create-alistt69-kit 0.1.1 → 0.1.2
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/README.md
CHANGED
|
@@ -90,7 +90,7 @@ npm create alistt69-kit@latest my-app --features=all
|
|
|
90
90
|
npm create alistt69-kit@latest my-app --pm pnpm
|
|
91
91
|
|
|
92
92
|
# Overwrite existing directory
|
|
93
|
-
npm create alistt69-kit@latest my-app --yes --
|
|
93
|
+
npm create alistt69-kit@latest my-app --yes --overwrite
|
|
94
94
|
```
|
|
95
95
|
|
|
96
96
|
## ⚙️ CLI options
|
|
@@ -98,7 +98,7 @@ npm create alistt69-kit@latest my-app --yes --force
|
|
|
98
98
|
| Option | Alias | Description |
|
|
99
99
|
|--------|-------|-------------|
|
|
100
100
|
| `--yes` | `-y` | Skip prompts, use defaults |
|
|
101
|
-
| `--
|
|
101
|
+
| `--overwrite` | — | Overwrite target directory if it exists |
|
|
102
102
|
| `--no-install` | — | Skip dependency installation |
|
|
103
103
|
| `--features <list>` | — | Enable specific features (`eslint`, `react-router`, `all`) |
|
|
104
104
|
| `--pm <name>` | — | Choose package manager (`npm`, `pnpm`, `yarn`) |
|
package/package.json
CHANGED
|
@@ -29,7 +29,7 @@ export function formatHelpMessage() {
|
|
|
29
29
|
'',
|
|
30
30
|
'Options:',
|
|
31
31
|
' -y, --yes Skip prompts and use defaults',
|
|
32
|
-
' --
|
|
32
|
+
' --overwrite Overwrite target directory if it exists',
|
|
33
33
|
' --no-install Do not install dependencies',
|
|
34
34
|
' --features <comma-list> Example: eslint,stylelint,react-router',
|
|
35
35
|
' --features all Enable all features',
|
|
@@ -46,7 +46,7 @@ export function formatHelpMessage() {
|
|
|
46
46
|
' create-alistt69-kit my-app --features=all',
|
|
47
47
|
' create-alistt69-kit my-app --pm pnpm --no-install',
|
|
48
48
|
' create-alistt69-kit my-app --yes',
|
|
49
|
-
' create-alistt69-kit my-app --yes --
|
|
49
|
+
' create-alistt69-kit my-app --yes --overwrite',
|
|
50
50
|
].join('\n');
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -57,7 +57,7 @@ export function parseCliArgs(argv) {
|
|
|
57
57
|
shouldInstallDependencies: undefined,
|
|
58
58
|
packageManager: undefined,
|
|
59
59
|
yes: false,
|
|
60
|
-
|
|
60
|
+
overwrite: false,
|
|
61
61
|
showHelp: false,
|
|
62
62
|
};
|
|
63
63
|
|
|
@@ -74,8 +74,8 @@ export function parseCliArgs(argv) {
|
|
|
74
74
|
continue;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
if (arg === '--
|
|
78
|
-
result.
|
|
77
|
+
if (arg === '--overwrite') {
|
|
78
|
+
result.overwrite = true;
|
|
79
79
|
continue;
|
|
80
80
|
}
|
|
81
81
|
|
|
@@ -14,7 +14,7 @@ async function pathExists(targetDirPath) {
|
|
|
14
14
|
|
|
15
15
|
export async function prepareTargetDirectory({
|
|
16
16
|
projectName,
|
|
17
|
-
|
|
17
|
+
overwrite = false,
|
|
18
18
|
yes = false,
|
|
19
19
|
}) {
|
|
20
20
|
const targetDirPath = resolve(process.cwd(), projectName);
|
|
@@ -37,8 +37,8 @@ export async function prepareTargetDirectory({
|
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
if (
|
|
41
|
-
await rm(targetDirPath, { recursive: true,
|
|
40
|
+
if (overwrite) {
|
|
41
|
+
await rm(targetDirPath, { recursive: true, overwrite: true });
|
|
42
42
|
|
|
43
43
|
return {
|
|
44
44
|
targetDirPath,
|
|
@@ -48,7 +48,7 @@ export async function prepareTargetDirectory({
|
|
|
48
48
|
|
|
49
49
|
if (yes) {
|
|
50
50
|
throw new Error(
|
|
51
|
-
`Directory already exists and is not empty: ${targetDirPath}. Use --
|
|
51
|
+
`Directory already exists and is not empty: ${targetDirPath}. Use --overwrite to overwrite it.`,
|
|
52
52
|
);
|
|
53
53
|
}
|
|
54
54
|
|
|
@@ -61,7 +61,7 @@ export async function prepareTargetDirectory({
|
|
|
61
61
|
process.exit(0);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
await rm(targetDirPath, { recursive: true,
|
|
64
|
+
await rm(targetDirPath, { recursive: true, overwrite: true });
|
|
65
65
|
|
|
66
66
|
return {
|
|
67
67
|
targetDirPath,
|