create-mikstack 0.1.5 → 0.1.6
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/index.js +44 -47
- package/package.json +1 -1
- package/templates/supply-chain-bun/bunfig.toml +0 -4
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import * as p from "@clack/prompts";
|
|
3
|
+
import { execSync } from "node:child_process";
|
|
3
4
|
import path from "node:path";
|
|
4
5
|
import { parseArgs } from "node:util";
|
|
5
|
-
import { execSync } from "node:child_process";
|
|
6
6
|
import fs from "node:fs";
|
|
7
7
|
|
|
8
8
|
//#region src/config.ts
|
|
@@ -41,39 +41,6 @@ function pmLockfile(pm) {
|
|
|
41
41
|
return "bun.lock";
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
//#endregion
|
|
45
|
-
//#region src/post-scaffold.ts
|
|
46
|
-
function postScaffold(targetDir, packageManager, s) {
|
|
47
|
-
const cwd = path.resolve(process.cwd(), targetDir);
|
|
48
|
-
const run = (cmd) => execSync(cmd, {
|
|
49
|
-
cwd,
|
|
50
|
-
stdio: "pipe"
|
|
51
|
-
});
|
|
52
|
-
s.message("Installing dependencies...");
|
|
53
|
-
try {
|
|
54
|
-
run(`${packageManager} install`);
|
|
55
|
-
s.stop("Dependencies installed.");
|
|
56
|
-
} catch {
|
|
57
|
-
s.stop("Failed to install dependencies. You can run install manually.");
|
|
58
|
-
}
|
|
59
|
-
s.start("Formatting project...");
|
|
60
|
-
try {
|
|
61
|
-
run(`${packageManager} run format`);
|
|
62
|
-
s.stop("Project formatted.");
|
|
63
|
-
} catch {
|
|
64
|
-
s.stop("Formatting skipped.");
|
|
65
|
-
}
|
|
66
|
-
s.start("Initializing git repository...");
|
|
67
|
-
try {
|
|
68
|
-
run("git init");
|
|
69
|
-
run("git add .");
|
|
70
|
-
run("git commit -m \"the future is now\"");
|
|
71
|
-
s.stop("Git repository initialized.");
|
|
72
|
-
} catch {
|
|
73
|
-
s.stop("Failed to initialize git. You can run git init manually.");
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
44
|
//#endregion
|
|
78
45
|
//#region src/prompts.ts
|
|
79
46
|
function isCancel(value) {
|
|
@@ -384,21 +351,51 @@ async function cli() {
|
|
|
384
351
|
p.intro("create-mikstack");
|
|
385
352
|
p.log.info(`Scaffolding ${config.projectName} with recommended defaults (non-interactive)...`);
|
|
386
353
|
} else config = await runPrompts(projectName, packageManager);
|
|
387
|
-
const
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
354
|
+
const cwd = path.resolve(process.cwd(), config.targetDir);
|
|
355
|
+
const run = (cmd) => execSync(cmd, {
|
|
356
|
+
cwd,
|
|
357
|
+
stdio: "pipe"
|
|
358
|
+
});
|
|
359
|
+
await p.tasks([
|
|
360
|
+
{
|
|
361
|
+
title: "Scaffolding project",
|
|
362
|
+
task: async (message) => {
|
|
363
|
+
message("Running sv create...");
|
|
364
|
+
scaffold(config, message);
|
|
365
|
+
return "Project scaffolded";
|
|
366
|
+
}
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
title: "Installing dependencies",
|
|
370
|
+
task: async () => {
|
|
371
|
+
run(`${packageManager} install`);
|
|
372
|
+
return "Dependencies installed";
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
title: "Formatting project",
|
|
377
|
+
task: async () => {
|
|
378
|
+
try {
|
|
379
|
+
run(`${packageManager} run format`);
|
|
380
|
+
} catch {}
|
|
381
|
+
return "Project formatted";
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
title: "Initializing git repository",
|
|
386
|
+
task: async () => {
|
|
387
|
+
run("git init");
|
|
388
|
+
run("git add .");
|
|
389
|
+
run("git commit -m \"the future is now\"");
|
|
390
|
+
return "Git repository initialized";
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
]);
|
|
394
|
+
const pmrun = pmRun(config.packageManager);
|
|
398
395
|
p.note([
|
|
399
396
|
`cd ${config.targetDir}`,
|
|
400
|
-
`${
|
|
401
|
-
`${
|
|
397
|
+
`${pmrun} db:push`,
|
|
398
|
+
`${pmrun} dev`
|
|
402
399
|
].join("\n"), "Next steps");
|
|
403
400
|
}
|
|
404
401
|
function printHelp() {
|
package/package.json
CHANGED