create-avalon 0.1.8 → 0.1.9
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/cli.js +34 -40
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -76,11 +76,42 @@ var require_src = __commonJS((exports, module) => {
|
|
|
76
76
|
});
|
|
77
77
|
|
|
78
78
|
// src/cli.ts
|
|
79
|
-
import { parseArgs } from "node:util";
|
|
80
|
-
import { existsSync, readdirSync } from "node:fs";
|
|
81
79
|
import { basename, resolve } from "node:path";
|
|
82
80
|
import { createRequire } from "node:module";
|
|
83
81
|
|
|
82
|
+
// src/cli-utils.ts
|
|
83
|
+
import { parseArgs } from "node:util";
|
|
84
|
+
import { existsSync, readdirSync } from "node:fs";
|
|
85
|
+
function validateDirectory(dir) {
|
|
86
|
+
if (!existsSync(dir)) {
|
|
87
|
+
return { valid: true };
|
|
88
|
+
}
|
|
89
|
+
const entries = readdirSync(dir);
|
|
90
|
+
if (entries.length === 0) {
|
|
91
|
+
return { valid: true };
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
valid: false,
|
|
95
|
+
error: `Directory "${dir}" already exists and is not empty.`
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function parseCliArgs(argv) {
|
|
99
|
+
const { values, positionals } = parseArgs({
|
|
100
|
+
args: argv,
|
|
101
|
+
options: {
|
|
102
|
+
help: { type: "boolean", default: false, short: "h" },
|
|
103
|
+
version: { type: "boolean", default: false, short: "v" }
|
|
104
|
+
},
|
|
105
|
+
strict: true,
|
|
106
|
+
allowPositionals: true
|
|
107
|
+
});
|
|
108
|
+
return {
|
|
109
|
+
projectName: positionals[0] ?? undefined,
|
|
110
|
+
help: values.help ?? false,
|
|
111
|
+
version: values.version ?? false
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
84
115
|
// ../../node_modules/.bun/@clack+core@1.1.0/node_modules/@clack/core/dist/index.mjs
|
|
85
116
|
import { styleText as D } from "node:util";
|
|
86
117
|
import { stdout as R, stdin as q } from "node:process";
|
|
@@ -1719,35 +1750,6 @@ function printSummary(config, scaffoldedInPlace = false) {
|
|
|
1719
1750
|
}
|
|
1720
1751
|
|
|
1721
1752
|
// src/cli.ts
|
|
1722
|
-
function validateDirectory(dir) {
|
|
1723
|
-
if (!existsSync(dir)) {
|
|
1724
|
-
return { valid: true };
|
|
1725
|
-
}
|
|
1726
|
-
const entries = readdirSync(dir);
|
|
1727
|
-
if (entries.length === 0) {
|
|
1728
|
-
return { valid: true };
|
|
1729
|
-
}
|
|
1730
|
-
return {
|
|
1731
|
-
valid: false,
|
|
1732
|
-
error: `Directory "${dir}" already exists and is not empty.`
|
|
1733
|
-
};
|
|
1734
|
-
}
|
|
1735
|
-
function parseCliArgs(argv) {
|
|
1736
|
-
const { values, positionals } = parseArgs({
|
|
1737
|
-
args: argv,
|
|
1738
|
-
options: {
|
|
1739
|
-
help: { type: "boolean", default: false, short: "h" },
|
|
1740
|
-
version: { type: "boolean", default: false, short: "v" }
|
|
1741
|
-
},
|
|
1742
|
-
strict: true,
|
|
1743
|
-
allowPositionals: true
|
|
1744
|
-
});
|
|
1745
|
-
return {
|
|
1746
|
-
projectName: positionals[0] ?? undefined,
|
|
1747
|
-
help: values.help ?? false,
|
|
1748
|
-
version: values.version ?? false
|
|
1749
|
-
};
|
|
1750
|
-
}
|
|
1751
1753
|
async function main() {
|
|
1752
1754
|
const args = parseCliArgs(process.argv.slice(2));
|
|
1753
1755
|
if (args.version) {
|
|
@@ -1788,12 +1790,4 @@ Options:
|
|
|
1788
1790
|
printSummary(config, scaffoldedInPlace);
|
|
1789
1791
|
process.exit(0);
|
|
1790
1792
|
}
|
|
1791
|
-
|
|
1792
|
-
if (process.argv[1] && entryPath === process.argv[1]) {
|
|
1793
|
-
main();
|
|
1794
|
-
}
|
|
1795
|
-
export {
|
|
1796
|
-
validateDirectory,
|
|
1797
|
-
parseCliArgs,
|
|
1798
|
-
main
|
|
1799
|
-
};
|
|
1793
|
+
main();
|