create-mikstack 0.1.19 → 0.1.20
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 +13 -11
- package/package.json +1 -1
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
|
+
import { execFile, execSync } from "node:child_process";
|
|
4
4
|
import path from "node:path";
|
|
5
|
-
import { parseArgs } from "node:util";
|
|
5
|
+
import { parseArgs, promisify } from "node:util";
|
|
6
6
|
import fs from "node:fs";
|
|
7
7
|
|
|
8
8
|
//#region src/config.ts
|
|
@@ -322,6 +322,7 @@ function renderDir(dir, context) {
|
|
|
322
322
|
|
|
323
323
|
//#endregion
|
|
324
324
|
//#region src/cli.ts
|
|
325
|
+
promisify(execFile);
|
|
325
326
|
async function cli() {
|
|
326
327
|
const { values, positionals } = parseArgs({
|
|
327
328
|
allowPositionals: true,
|
|
@@ -358,10 +359,7 @@ async function cli() {
|
|
|
358
359
|
p.log.info(`Scaffolding ${config.projectName} with recommended defaults (non-interactive)...`);
|
|
359
360
|
} else config = await runPrompts(projectName, packageManager);
|
|
360
361
|
const cwd = path.resolve(process.cwd(), config.targetDir);
|
|
361
|
-
const run = (cmd) =>
|
|
362
|
-
cwd,
|
|
363
|
-
stdio: "pipe"
|
|
364
|
-
});
|
|
362
|
+
const run = (cmd, args) => execFileAsync(cmd, args, { cwd });
|
|
365
363
|
await p.tasks([
|
|
366
364
|
{
|
|
367
365
|
title: "Scaffolding project",
|
|
@@ -374,7 +372,7 @@ async function cli() {
|
|
|
374
372
|
{
|
|
375
373
|
title: "Installing dependencies",
|
|
376
374
|
task: async () => {
|
|
377
|
-
run(
|
|
375
|
+
await run(packageManager, ["install"]);
|
|
378
376
|
return "Dependencies installed";
|
|
379
377
|
}
|
|
380
378
|
},
|
|
@@ -382,7 +380,7 @@ async function cli() {
|
|
|
382
380
|
title: "Formatting project",
|
|
383
381
|
task: async () => {
|
|
384
382
|
try {
|
|
385
|
-
run(
|
|
383
|
+
await run(packageManager, ["run", "format"]);
|
|
386
384
|
} catch {}
|
|
387
385
|
return "Project formatted";
|
|
388
386
|
}
|
|
@@ -390,9 +388,13 @@ async function cli() {
|
|
|
390
388
|
{
|
|
391
389
|
title: "Initializing git repository",
|
|
392
390
|
task: async () => {
|
|
393
|
-
run("git init");
|
|
394
|
-
run("git add .");
|
|
395
|
-
run("git
|
|
391
|
+
await run("git", ["init"]);
|
|
392
|
+
await run("git", ["add", "."]);
|
|
393
|
+
await run("git", [
|
|
394
|
+
"commit",
|
|
395
|
+
"-m",
|
|
396
|
+
"the future is now"
|
|
397
|
+
]);
|
|
396
398
|
return "Git repository initialized";
|
|
397
399
|
}
|
|
398
400
|
}
|