create-rigg 0.1.3 → 1.0.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/dist/index.mjs +27 -1
- package/package.json +9 -9
package/dist/index.mjs
CHANGED
|
@@ -320,12 +320,20 @@ async function resolveOptions(argv) {
|
|
|
320
320
|
verbose: argv.verbose ?? false
|
|
321
321
|
};
|
|
322
322
|
}
|
|
323
|
+
/** Initializes a git repository in targetDir, unless git is missing or targetDir is already inside one. */
|
|
323
324
|
async function initializeGit(options, targetDir) {
|
|
324
325
|
const git = spawn.sync("git", ["--version"], { stdio: "ignore" });
|
|
325
326
|
if (git.error || git.status !== 0) {
|
|
326
327
|
p.log.info("Git not found. Skipping repository initialization.");
|
|
327
328
|
return;
|
|
328
329
|
}
|
|
330
|
+
if (spawn.sync("git", ["rev-parse", "--is-inside-work-tree"], {
|
|
331
|
+
cwd: targetDir,
|
|
332
|
+
stdio: "ignore"
|
|
333
|
+
}).status === 0) {
|
|
334
|
+
p.log.info("Already inside a git repository. Skipping git init.");
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
329
337
|
const spin = p.spinner();
|
|
330
338
|
spin.start("Initializing git repository...");
|
|
331
339
|
await run("git", [
|
|
@@ -338,6 +346,12 @@ async function initializeGit(options, targetDir) {
|
|
|
338
346
|
});
|
|
339
347
|
spin.stop("Git repository initialized");
|
|
340
348
|
}
|
|
349
|
+
/** Adds dist and node_modules to a generated oxlint/oxfmt config's ignorePatterns. */
|
|
350
|
+
function addIgnorePatterns(configPath) {
|
|
351
|
+
const config = JSON.parse(fs.readFileSync(configPath, "utf-8"));
|
|
352
|
+
config.ignorePatterns = ["dist", "node_modules"];
|
|
353
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n");
|
|
354
|
+
}
|
|
341
355
|
/**
|
|
342
356
|
* Creates oxlint+oxfmt configuration files and formats the code.
|
|
343
357
|
*/
|
|
@@ -366,6 +380,8 @@ async function formatCode(options, targetDir) {
|
|
|
366
380
|
cwd: targetDir,
|
|
367
381
|
stdio
|
|
368
382
|
});
|
|
383
|
+
addIgnorePatterns(path.join(targetDir, ".oxlintrc.json"));
|
|
384
|
+
addIgnorePatterns(path.join(targetDir, ".oxfmtrc.json"));
|
|
369
385
|
await run(pkgManager, [
|
|
370
386
|
execCmd,
|
|
371
387
|
"oxfmt",
|
|
@@ -377,15 +393,25 @@ async function formatCode(options, targetDir) {
|
|
|
377
393
|
});
|
|
378
394
|
spin.stop("Code formatted");
|
|
379
395
|
}
|
|
396
|
+
/** Reads the CLI's own version from its package.json. */
|
|
397
|
+
function getVersion() {
|
|
398
|
+
const directory = path.dirname(fileURLToPath(import.meta.url));
|
|
399
|
+
const pkgJsonPath = path.join(directory, "..", "package.json");
|
|
400
|
+
return JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8")).version;
|
|
401
|
+
}
|
|
380
402
|
async function main() {
|
|
381
403
|
const argv = mri(process.argv.slice(2), {
|
|
382
404
|
string: ["framework", "pm"],
|
|
383
|
-
boolean: ["verbose"],
|
|
405
|
+
boolean: ["verbose", "version"],
|
|
384
406
|
alias: {
|
|
385
407
|
f: "framework",
|
|
386
408
|
v: "verbose"
|
|
387
409
|
}
|
|
388
410
|
});
|
|
411
|
+
if (argv.version) {
|
|
412
|
+
console.log(getVersion());
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
389
415
|
showIntro();
|
|
390
416
|
const options = await resolveOptions(argv);
|
|
391
417
|
const targetDir = path.resolve(process.cwd(), options.projectName);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-rigg",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Create Node.js TypeScript projects using the Vite+ Toolchain - for everything outside the browser.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"backend",
|
|
@@ -51,20 +51,20 @@
|
|
|
51
51
|
"prepublishOnly": "git diff --exit-code && git diff --cached --exit-code && oxlint && oxfmt && tsc --noEmit && vitest run && pnpm build"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@clack/prompts": "^1.
|
|
54
|
+
"@clack/prompts": "^1.7.0",
|
|
55
55
|
"cross-spawn": "^7.0.6",
|
|
56
56
|
"mri": "^1.2.0",
|
|
57
57
|
"picocolors": "^1.1.1"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@types/cross-spawn": "^6.0.6",
|
|
61
|
-
"@types/node": "^
|
|
62
|
-
"oxfmt": "^0.
|
|
63
|
-
"oxlint": "^1.
|
|
64
|
-
"tsdown": "^0.
|
|
65
|
-
"tsx": "^4.
|
|
66
|
-
"typescript": "^
|
|
67
|
-
"vitest": "^4.1.
|
|
61
|
+
"@types/node": "^24.13.3",
|
|
62
|
+
"oxfmt": "^0.60.0",
|
|
63
|
+
"oxlint": "^1.75.0",
|
|
64
|
+
"tsdown": "^0.22.14",
|
|
65
|
+
"tsx": "^4.23.1",
|
|
66
|
+
"typescript": "^7.0.2",
|
|
67
|
+
"vitest": "^4.1.10"
|
|
68
68
|
},
|
|
69
69
|
"engines": {
|
|
70
70
|
"node": ">=22.12.0"
|