@nocobase/build 0.21.0-alpha.6 → 0.21.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/buildEsm.js +10 -3
- package/package.json +2 -2
package/lib/buildEsm.js
CHANGED
|
@@ -33,21 +33,28 @@ module.exports = __toCommonJS(buildEsm_exports);
|
|
|
33
33
|
var import_path = __toESM(require("path"));
|
|
34
34
|
var import_vite = require("vite");
|
|
35
35
|
var import_fast_glob = __toESM(require("fast-glob"));
|
|
36
|
+
const clientExt = ".{ts,tsx,js,jsx}";
|
|
37
|
+
function getSingleEntry(file, cwd) {
|
|
38
|
+
return import_fast_glob.default.sync([`${file}${clientExt}`], { cwd, absolute: true, onlyFiles: true })?.[0]?.replaceAll(/\\/g, "/");
|
|
39
|
+
}
|
|
36
40
|
async function buildEsm(cwd, userConfig, sourcemap = false, log) {
|
|
37
41
|
log("build esm");
|
|
38
|
-
const indexEntry =
|
|
42
|
+
const indexEntry = getSingleEntry("src/index", cwd);
|
|
39
43
|
const outDir = import_path.default.resolve(cwd, "es");
|
|
40
44
|
await build(cwd, indexEntry, outDir, userConfig, sourcemap, log);
|
|
41
|
-
const clientEntry =
|
|
45
|
+
const clientEntry = getSingleEntry("src/client/index", cwd) || getSingleEntry("src/client", cwd);
|
|
42
46
|
const clientOutDir = import_path.default.resolve(cwd, "es/client");
|
|
43
47
|
if (clientEntry) {
|
|
44
48
|
await build(cwd, clientEntry, clientOutDir, userConfig, sourcemap, log);
|
|
45
49
|
}
|
|
46
50
|
const pkg = require(import_path.default.join(cwd, "package.json"));
|
|
47
51
|
if (pkg.name === "@nocobase/test") {
|
|
48
|
-
const e2eEntry =
|
|
52
|
+
const e2eEntry = getSingleEntry("src/e2e/index", cwd);
|
|
49
53
|
const e2eOutDir = import_path.default.resolve(cwd, "es/e2e");
|
|
50
54
|
await build(cwd, e2eEntry, e2eOutDir, userConfig, sourcemap, log);
|
|
55
|
+
const webEntry = getSingleEntry("src/web/index", cwd);
|
|
56
|
+
const webOutDir = import_path.default.resolve(cwd, "es/web");
|
|
57
|
+
await build(cwd, webEntry, webOutDir, userConfig, sourcemap, log);
|
|
51
58
|
}
|
|
52
59
|
}
|
|
53
60
|
function build(cwd, entry, outDir, userConfig, sourcemap = false, log) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/build",
|
|
3
|
-
"version": "0.21.0-alpha.
|
|
3
|
+
"version": "0.21.0-alpha.7",
|
|
4
4
|
"description": "Library build tool based on rollup.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "tsup"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "b1be3993f8aa81173d01bc390aa8e4c5adcc0e2d"
|
|
40
40
|
}
|