Skip to content

Commit 31116b0

Browse files
authored
Merge pull request #26 from python-project-templates/copier-update-2026-04-10T03-21-54
Update from copier (2026-04-10T03:21:54)
2 parents 30107b5 + 6b3b4e8 commit 31116b0

File tree

9 files changed

+151
-180
lines changed

9 files changed

+151
-180
lines changed

.copier-answers.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier
2-
_commit: 9b579a3
2+
_commit: 9498b78
33
_src_path: https://github.com/python-project-templates/base.git
44
add_docs: true
55
add_extension: cppjswasm

js/build.mjs

Lines changed: 16 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,42 @@
1-
import { NodeModulesExternal } from "@finos/perspective-esbuild-plugin/external.js";
2-
import { build } from "@finos/perspective-esbuild-plugin/build.js";
3-
import { transform } from "lightningcss";
1+
import { bundle } from "./tools/bundle.mjs";
2+
import { bundle_css } from "./tools/css.mjs";
3+
import { node_modules_external } from "./tools/externals.mjs";
44
import { getarg } from "./tools/getarg.mjs";
5+
6+
import { transform } from "lightningcss";
57
import fs from "fs";
68
import cpy from "cpy";
79

8-
const DEBUG = getarg("--debug");
9-
10-
const COMMON_DEFINE = {
11-
global: "window",
12-
"process.env.DEBUG": `${DEBUG}`,
13-
};
14-
15-
const BUILD = [
10+
const BUNDLES = [
1611
{
17-
define: COMMON_DEFINE,
1812
entryPoints: ["src/ts/index.ts"],
19-
plugins: [NodeModulesExternal()],
20-
format: "esm",
21-
loader: {
22-
".css": "text",
23-
".html": "text",
24-
},
13+
plugins: [node_modules_external()],
2514
outfile: "dist/esm/index.js",
2615
},
2716
{
28-
define: COMMON_DEFINE,
2917
entryPoints: ["src/ts/index.ts"],
30-
plugins: [],
31-
format: "esm",
32-
loader: {
33-
".css": "text",
34-
".html": "text",
35-
},
3618
outfile: "dist/cdn/index.js",
3719
},
3820
];
3921

40-
async function compile_css() {
41-
const process_path = (path) => {
42-
const outpath = path.replace("src/css", "dist/css");
43-
fs.mkdirSync(outpath, { recursive: true });
44-
45-
fs.readdirSync(path, { withFileTypes: true }).forEach((entry) => {
46-
const input = `${path}/${entry.name}`;
47-
const output = `${outpath}/${entry.name}`;
48-
49-
if (entry.isDirectory()) {
50-
process_path(input);
51-
} else if (entry.isFile() && entry.name.endsWith(".css")) {
52-
const source = fs.readFileSync(input);
53-
const { code } = transform({
54-
filename: entry.name,
55-
code: source,
56-
minify: !DEBUG,
57-
sourceMap: false,
58-
});
59-
fs.writeFileSync(output, code);
60-
}
61-
});
62-
};
22+
async function build() {
23+
// Bundle css
24+
await bundle_css();
6325

64-
process_path("src/css");
65-
}
66-
67-
async function copy_html() {
26+
// Copy HTML
6827
fs.mkdirSync("dist/html", { recursive: true });
6928
cpy("src/html/*", "dist/html");
70-
// also copy to top level
7129
cpy("src/html/*", "dist/");
72-
}
7330

74-
async function copy_img() {
31+
// Copy images
7532
fs.mkdirSync("dist/img", { recursive: true });
7633
cpy("src/img/*", "dist/img");
77-
}
7834

79-
async function copy_to_python() {
35+
await Promise.all(BUNDLES.map(bundle)).catch(() => process.exit(1));
36+
37+
// Copy from dist to python
8038
fs.mkdirSync("../python_template_cppjswasm/extension", { recursive: true });
8139
cpy("dist/**/*", "../python_template_cppjswasm/extension");
8240
}
8341

84-
async function build_all() {
85-
await compile_css();
86-
await copy_html();
87-
await copy_img();
88-
await Promise.all(BUILD.map(build)).catch(() => process.exit(1));
89-
await copy_to_python();
90-
}
91-
92-
build_all();
42+
build();

js/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,9 @@
4848
},
4949
"dependencies": {},
5050
"devDependencies": {
51-
"@finos/perspective-esbuild-plugin": "^3.2.1",
52-
"@playwright/test": "^1.59.0",
51+
"@playwright/test": "^1.59.1",
5352
"cpy": "^13.2.1",
54-
"esbuild": "^0.27.2",
53+
"esbuild": "^0.27.3",
5554
"lightningcss": "^1.29.3",
5655
"http-server": "^14.1.1",
5756
"nodemon": "^3.1.10",

js/pnpm-lock.yaml

Lines changed: 2 additions & 109 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)