complete-cli 1.1.2 → 1.2.1
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/commands/UpdateCommand.js +2 -2
- package/dist/commands/init/createProject.js +24 -6
- package/dist/constants.js +2 -3
- package/package.json +8 -8
- package/src/commands/UpdateCommand.ts +2 -2
- package/src/commands/init/createProject.ts +27 -6
- package/src/commands/init/vsCodeInit.ts +1 -1
- package/src/constants.ts +2 -4
- package/src/main.ts +1 -1
|
@@ -8,8 +8,8 @@ export class UpdateCommand extends Command {
|
|
|
8
8
|
async execute() {
|
|
9
9
|
const hasNewDependencies = await updatePackageJSONDependencies();
|
|
10
10
|
const msg = hasNewDependencies
|
|
11
|
-
? "Successfully installed new
|
|
12
|
-
: "There were no new dependency updates
|
|
11
|
+
? "Successfully installed new dependencies."
|
|
12
|
+
: "There were no new dependency updates.";
|
|
13
13
|
console.log(msg);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -113,14 +113,30 @@ function copyDynamicFiles(projectName, authorName, projectPath, packageManager)
|
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
function copyPackageManagerSpecificFiles(projectPath, packageManager) {
|
|
116
|
-
|
|
116
|
+
switch (packageManager) {
|
|
117
|
+
case PackageManager.npm: {
|
|
118
|
+
const npmrc = "save-exact=true\n";
|
|
119
|
+
const npmrcPath = path.join(projectPath, ".npmrc");
|
|
120
|
+
writeFile(npmrcPath, npmrc);
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
117
123
|
// `pnpm` requires the `shamefully-hoist` option to be enabled for "complete-lint" to work
|
|
118
124
|
// correctly.
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
125
|
+
case PackageManager.pnpm: {
|
|
126
|
+
const npmrc = "save-exact=true\nshamefully-hoist=true\n";
|
|
127
|
+
const npmrcPath = path.join(projectPath, ".npmrc");
|
|
128
|
+
writeFile(npmrcPath, npmrc);
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
case PackageManager.yarn: {
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
case PackageManager.bun: {
|
|
135
|
+
const bunfig = "[install]\nexact = true\n";
|
|
136
|
+
const bunfigPath = path.join(projectPath, "bunfig.toml");
|
|
137
|
+
writeFile(bunfigPath, bunfig);
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
124
140
|
}
|
|
125
141
|
}
|
|
126
142
|
async function revertVersionsInPackageJSON(projectPath) {
|
|
@@ -169,6 +185,8 @@ async function installNodeModules(projectPath, skipInstall, packageManager) {
|
|
|
169
185
|
}
|
|
170
186
|
async function formatFiles(projectPath, packageManager) {
|
|
171
187
|
const $$q = $q({ cwd: projectPath });
|
|
188
|
+
// Execa does not work properly with Bun in this context. Invoking `bunx` directly fixes the
|
|
189
|
+
// problem.
|
|
172
190
|
await (packageManager === PackageManager.bun
|
|
173
191
|
? $$q `bunx prettier --write .`
|
|
174
192
|
: $$q `prettier --write .`);
|
package/dist/constants.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getPackageJSONFieldsMandatory, getPackageRoot, PackageManager, } from "complete-node";
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
export const CWD = process.cwd();
|
|
5
5
|
export const CURRENT_DIRECTORY_NAME = path.basename(CWD);
|
|
6
6
|
export const HOME_DIR = os.homedir();
|
|
7
|
-
const packageRoot =
|
|
7
|
+
const packageRoot = await getPackageRoot();
|
|
8
8
|
const { name, version } = await getPackageJSONFieldsMandatory(packageRoot, "name", "version");
|
|
9
9
|
export const PROJECT_NAME = name;
|
|
10
10
|
export const PROJECT_VERSION = version;
|
|
11
11
|
export const DEFAULT_PACKAGE_MANAGER = PackageManager.npm;
|
|
12
|
-
// ---------
|
|
13
12
|
const TEMPLATES_DIR = path.join(packageRoot, "file-templates");
|
|
14
13
|
export const TEMPLATES_STATIC_DIR = path.join(TEMPLATES_DIR, "static");
|
|
15
14
|
export const TEMPLATES_DYNAMIC_DIR = path.join(TEMPLATES_DIR, "dynamic");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "complete-cli",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "A command line tool for bootstrapping TypeScript projects.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript"
|
|
@@ -37,20 +37,20 @@
|
|
|
37
37
|
"@zamiell/clack-prompts": "0.10.2",
|
|
38
38
|
"chalk": "5.4.1",
|
|
39
39
|
"clipanion": "4.0.0-rc.4",
|
|
40
|
-
"complete-common": "2.
|
|
41
|
-
"complete-node": "
|
|
40
|
+
"complete-common": "2.3.0",
|
|
41
|
+
"complete-node": "7.0.2",
|
|
42
42
|
"klaw-sync": "7.0.0",
|
|
43
|
-
"yaml": "2.
|
|
43
|
+
"yaml": "2.8.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/klaw-sync": "6.0.5",
|
|
47
|
-
"@types/node": "
|
|
48
|
-
"glob": "11.0.
|
|
47
|
+
"@types/node": "24.0.3",
|
|
48
|
+
"glob": "11.0.3",
|
|
49
49
|
"ts-loader": "9.5.2",
|
|
50
50
|
"tsconfig-paths-webpack-plugin": "4.2.0",
|
|
51
51
|
"typescript": "5.8.3",
|
|
52
|
-
"typescript-eslint": "8.
|
|
53
|
-
"webpack": "5.99.
|
|
52
|
+
"typescript-eslint": "8.34.1",
|
|
53
|
+
"webpack": "5.99.9",
|
|
54
54
|
"webpack-cli": "6.0.1",
|
|
55
55
|
"webpack-shebang-plugin": "1.1.8"
|
|
56
56
|
},
|
|
@@ -12,8 +12,8 @@ export class UpdateCommand extends Command {
|
|
|
12
12
|
async execute(): Promise<void> {
|
|
13
13
|
const hasNewDependencies = await updatePackageJSONDependencies();
|
|
14
14
|
const msg = hasNewDependencies
|
|
15
|
-
? "Successfully installed new
|
|
16
|
-
: "There were no new dependency updates
|
|
15
|
+
? "Successfully installed new dependencies."
|
|
16
|
+
: "There were no new dependency updates.";
|
|
17
17
|
console.log(msg);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -185,14 +185,33 @@ function copyPackageManagerSpecificFiles(
|
|
|
185
185
|
projectPath: string,
|
|
186
186
|
packageManager: PackageManager,
|
|
187
187
|
) {
|
|
188
|
-
|
|
188
|
+
switch (packageManager) {
|
|
189
|
+
case PackageManager.npm: {
|
|
190
|
+
const npmrc = "save-exact=true\n";
|
|
191
|
+
const npmrcPath = path.join(projectPath, ".npmrc");
|
|
192
|
+
writeFile(npmrcPath, npmrc);
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
|
|
189
196
|
// `pnpm` requires the `shamefully-hoist` option to be enabled for "complete-lint" to work
|
|
190
197
|
// correctly.
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
198
|
+
case PackageManager.pnpm: {
|
|
199
|
+
const npmrc = "save-exact=true\nshamefully-hoist=true\n";
|
|
200
|
+
const npmrcPath = path.join(projectPath, ".npmrc");
|
|
201
|
+
writeFile(npmrcPath, npmrc);
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
case PackageManager.yarn: {
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
case PackageManager.bun: {
|
|
210
|
+
const bunfig = "[install]\nexact = true\n";
|
|
211
|
+
const bunfigPath = path.join(projectPath, "bunfig.toml");
|
|
212
|
+
writeFile(bunfigPath, bunfig);
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
196
215
|
}
|
|
197
216
|
}
|
|
198
217
|
|
|
@@ -259,6 +278,8 @@ async function formatFiles(
|
|
|
259
278
|
) {
|
|
260
279
|
const $$q = $q({ cwd: projectPath });
|
|
261
280
|
|
|
281
|
+
// Execa does not work properly with Bun in this context. Invoking `bunx` directly fixes the
|
|
282
|
+
// problem.
|
|
262
283
|
await (packageManager === PackageManager.bun
|
|
263
284
|
? $$q`bunx prettier --write .`
|
|
264
285
|
: $$q`prettier --write .`);
|
|
@@ -106,7 +106,7 @@ async function promptVSCode(
|
|
|
106
106
|
VSCodeCommand: string,
|
|
107
107
|
vscode: boolean,
|
|
108
108
|
yes: boolean,
|
|
109
|
-
)
|
|
109
|
+
) {
|
|
110
110
|
if (vscode) {
|
|
111
111
|
// They supplied the "--vscode" command-line flag, so there is no need to prompt the user.
|
|
112
112
|
await openVSCode(projectPath, VSCodeCommand);
|
package/src/constants.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
findPackageRoot,
|
|
3
2
|
getPackageJSONFieldsMandatory,
|
|
3
|
+
getPackageRoot,
|
|
4
4
|
PackageManager,
|
|
5
5
|
} from "complete-node";
|
|
6
6
|
import os from "node:os";
|
|
@@ -11,7 +11,7 @@ export const CURRENT_DIRECTORY_NAME = path.basename(CWD);
|
|
|
11
11
|
|
|
12
12
|
export const HOME_DIR = os.homedir();
|
|
13
13
|
|
|
14
|
-
const packageRoot =
|
|
14
|
+
const packageRoot = await getPackageRoot();
|
|
15
15
|
const { name, version } = await getPackageJSONFieldsMandatory(
|
|
16
16
|
packageRoot,
|
|
17
17
|
"name",
|
|
@@ -23,8 +23,6 @@ export const PROJECT_VERSION = version;
|
|
|
23
23
|
|
|
24
24
|
export const DEFAULT_PACKAGE_MANAGER = PackageManager.npm;
|
|
25
25
|
|
|
26
|
-
// ---------
|
|
27
|
-
|
|
28
26
|
const TEMPLATES_DIR = path.join(packageRoot, "file-templates");
|
|
29
27
|
export const TEMPLATES_STATIC_DIR = path.join(TEMPLATES_DIR, "static");
|
|
30
28
|
export const TEMPLATES_DYNAMIC_DIR = path.join(TEMPLATES_DIR, "dynamic");
|