sprint-es 0.0.94 → 0.0.97
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/dist/cjs/cli.cjs +18 -2
- package/dist/esm/cli.js +19 -3
- package/package.json +1 -1
package/dist/cjs/cli.cjs
CHANGED
|
@@ -307,8 +307,24 @@ switch (command) {
|
|
|
307
307
|
case "build": {
|
|
308
308
|
console.log("🚀 Building for production...");
|
|
309
309
|
const isTS = fs.existsSync(path.join(projectRoot, "sprint.config.ts"));
|
|
310
|
-
|
|
311
|
-
|
|
310
|
+
if (isTS) {
|
|
311
|
+
const tsconfigPath = path.join(projectRoot, "tsconfig.json");
|
|
312
|
+
const tsconfig = JSON.parse(fs.readFileSync(tsconfigPath, "utf-8"));
|
|
313
|
+
const originalInclude = tsconfig.include ?? [];
|
|
314
|
+
const patched = originalInclude.filter((p) => !p.includes("sprint.config"));
|
|
315
|
+
if (patched.length !== originalInclude.length) {
|
|
316
|
+
fs.writeFileSync(tsconfigPath, JSON.stringify({ ...tsconfig, include: patched }, null, 4));
|
|
317
|
+
try {
|
|
318
|
+
runCommand("tsc && tsc-alias", { NODE_ENV: "production" });
|
|
319
|
+
} finally {
|
|
320
|
+
fs.writeFileSync(tsconfigPath, JSON.stringify(tsconfig, null, 4));
|
|
321
|
+
}
|
|
322
|
+
} else runCommand("tsc && tsc-alias", { NODE_ENV: "production" });
|
|
323
|
+
runCommand(
|
|
324
|
+
"esbuild sprint.config.ts --outfile=dist/sprint.config.js --platform=node --format=cjs --bundle=false",
|
|
325
|
+
{ NODE_ENV: "production" }
|
|
326
|
+
);
|
|
327
|
+
} else runCommand("tsc && tsc-alias", { NODE_ENV: "production" });
|
|
312
328
|
break;
|
|
313
329
|
}
|
|
314
330
|
case "start": {
|
package/dist/esm/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { existsSync, readFileSync, readdirSync, statSync } from "fs";
|
|
2
|
+
import { existsSync, readFileSync, writeFileSync, readdirSync, statSync } from "fs";
|
|
3
3
|
import * as crypto from "crypto";
|
|
4
4
|
import { join, resolve } from "path";
|
|
5
5
|
import { spawn } from "child_process";
|
|
@@ -289,8 +289,24 @@ switch (command) {
|
|
|
289
289
|
case "build": {
|
|
290
290
|
console.log("🚀 Building for production...");
|
|
291
291
|
const isTS = existsSync(join(projectRoot, "sprint.config.ts"));
|
|
292
|
-
|
|
293
|
-
|
|
292
|
+
if (isTS) {
|
|
293
|
+
const tsconfigPath = join(projectRoot, "tsconfig.json");
|
|
294
|
+
const tsconfig = JSON.parse(readFileSync(tsconfigPath, "utf-8"));
|
|
295
|
+
const originalInclude = tsconfig.include ?? [];
|
|
296
|
+
const patched = originalInclude.filter((p) => !p.includes("sprint.config"));
|
|
297
|
+
if (patched.length !== originalInclude.length) {
|
|
298
|
+
writeFileSync(tsconfigPath, JSON.stringify({ ...tsconfig, include: patched }, null, 4));
|
|
299
|
+
try {
|
|
300
|
+
runCommand("tsc && tsc-alias", { NODE_ENV: "production" });
|
|
301
|
+
} finally {
|
|
302
|
+
writeFileSync(tsconfigPath, JSON.stringify(tsconfig, null, 4));
|
|
303
|
+
}
|
|
304
|
+
} else runCommand("tsc && tsc-alias", { NODE_ENV: "production" });
|
|
305
|
+
runCommand(
|
|
306
|
+
"esbuild sprint.config.ts --outfile=dist/sprint.config.js --platform=node --format=cjs --bundle=false",
|
|
307
|
+
{ NODE_ENV: "production" }
|
|
308
|
+
);
|
|
309
|
+
} else runCommand("tsc && tsc-alias", { NODE_ENV: "production" });
|
|
294
310
|
break;
|
|
295
311
|
}
|
|
296
312
|
case "start": {
|