@contentful/experience-design-system-cli 2.34.4 → 2.34.5-dev-build-a88e62a.0
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/bin/cli.js +13 -5
- package/dist/package.json +1 -1
- package/dist/src/index.js +267 -200
- package/package.json +6 -6
package/bin/cli.js
CHANGED
|
@@ -11,6 +11,7 @@ process.on("warning", (w) => {
|
|
|
11
11
|
// Skipped when src/ doesn't exist (e.g. npm-installed users).
|
|
12
12
|
import { existsSync, statSync, readdirSync } from "node:fs";
|
|
13
13
|
import { execFileSync } from "node:child_process";
|
|
14
|
+
import { createRequire } from "node:module";
|
|
14
15
|
import { fileURLToPath } from "node:url";
|
|
15
16
|
import { dirname, resolve, join } from "node:path";
|
|
16
17
|
|
|
@@ -42,12 +43,19 @@ if (
|
|
|
42
43
|
const distMtime = statSync(distEntry).mtimeMs;
|
|
43
44
|
if (newestMtime(srcDir) > distMtime) {
|
|
44
45
|
process.stderr.write("⚙ Source changed — rebuilding...\n");
|
|
45
|
-
|
|
46
|
+
// Run the compiler's own entry script with this Node rather than the
|
|
47
|
+
// node_modules/.bin/tsc shim: on Windows the extensionless shim is a POSIX
|
|
48
|
+
// sh script (the runnable one is tsc.CMD), so exec'ing it fails there.
|
|
49
|
+
const tsc = createRequire(import.meta.url).resolve("typescript/bin/tsc");
|
|
46
50
|
try {
|
|
47
|
-
execFileSync(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
execFileSync(
|
|
52
|
+
process.execPath,
|
|
53
|
+
[tsc, "-p", join(pkgRoot, "tsconfig.build.json")],
|
|
54
|
+
{
|
|
55
|
+
stdio: ["ignore", "ignore", "inherit"],
|
|
56
|
+
cwd: pkgRoot,
|
|
57
|
+
},
|
|
58
|
+
);
|
|
51
59
|
process.stderr.write("✓ Build complete\n");
|
|
52
60
|
} catch {
|
|
53
61
|
process.stderr.write("✗ Build failed — running with existing dist\n");
|