complete-cli 1.0.1-dev.7 → 1.0.1-dev.8
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/PublishCommand.js +1 -1
- package/dist/commands/UpdateCommand.js +1 -2
- package/dist/commands/init/createProject.js +4 -3
- package/dist/prompt.js +6 -1
- package/package.json +3 -3
- package/src/commands/PublishCommand.ts +1 -1
- package/src/commands/UpdateCommand.ts +1 -2
- package/src/commands/init/createProject.ts +4 -3
- package/src/prompt.ts +7 -0
|
@@ -82,7 +82,7 @@ async function updateDependencies(skipUpdate, dryRun, packageManager) {
|
|
|
82
82
|
return;
|
|
83
83
|
}
|
|
84
84
|
console.log('Updating dependencies in the "package.json" file...');
|
|
85
|
-
const hasNewDependencies = updatePackageJSONDependencies(undefined);
|
|
85
|
+
const hasNewDependencies = await updatePackageJSONDependencies(undefined);
|
|
86
86
|
if (hasNewDependencies) {
|
|
87
87
|
const command = getPackageManagerInstallCommand(packageManager);
|
|
88
88
|
const commandParts = command.split(" ");
|
|
@@ -5,9 +5,8 @@ export class UpdateCommand extends Command {
|
|
|
5
5
|
static usage = Command.Usage({
|
|
6
6
|
description: 'Invoke "npm-check-updates" to update the dependencies inside of the "package.json" file and then install them.',
|
|
7
7
|
});
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/require-await
|
|
9
8
|
async execute() {
|
|
10
|
-
const hasNewDependencies = updatePackageJSONDependencies();
|
|
9
|
+
const hasNewDependencies = await updatePackageJSONDependencies();
|
|
11
10
|
const msg = hasNewDependencies
|
|
12
11
|
? "Successfully installed new Node.js dependencies."
|
|
13
12
|
: "There were no new dependency updates from npm.";
|
|
@@ -5,7 +5,7 @@ import { $ } from "execa";
|
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { ACTION_YML, ACTION_YML_TEMPLATE_PATH, TEMPLATES_DYNAMIC_DIR, TEMPLATES_STATIC_DIR, } from "../../constants.js";
|
|
7
7
|
import { initGitRepository } from "../../git.js";
|
|
8
|
-
import { promptError, promptLog } from "../../prompt.js";
|
|
8
|
+
import { promptError, promptLog, promptSpinnerStart } from "../../prompt.js";
|
|
9
9
|
export async function createProject(projectName, authorName, projectPath, createNewDir, gitRemoteURL, skipInstall, packageManager) {
|
|
10
10
|
if (createNewDir) {
|
|
11
11
|
makeDirectory(projectPath);
|
|
@@ -13,7 +13,7 @@ export async function createProject(projectName, authorName, projectPath, create
|
|
|
13
13
|
copyStaticFiles(projectPath);
|
|
14
14
|
copyDynamicFiles(projectName, authorName, projectPath, packageManager);
|
|
15
15
|
// There is no package manager lock files yet, so we have to pass "false" to this function.
|
|
16
|
-
const updated = updatePackageJSONDependencies(projectPath, false, true);
|
|
16
|
+
const updated = await updatePackageJSONDependencies(projectPath, false, true);
|
|
17
17
|
if (!updated) {
|
|
18
18
|
promptError('Failed to update the dependencies in the "package.json" file.');
|
|
19
19
|
}
|
|
@@ -113,10 +113,11 @@ async function installNodeModules(projectPath, skipInstall, packageManager) {
|
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
115
|
const command = getPackageManagerInstallCommand(packageManager);
|
|
116
|
-
|
|
116
|
+
const s = promptSpinnerStart(`Installing node modules with "${command}"... (This can take a long time.)`);
|
|
117
117
|
const $$ = $({ cwd: projectPath });
|
|
118
118
|
const commandParts = command.split(" ");
|
|
119
119
|
await $$ `${commandParts}`;
|
|
120
|
+
s.stop("Installed.");
|
|
120
121
|
}
|
|
121
122
|
async function formatFiles(projectPath) {
|
|
122
123
|
const $$ = $({ cwd: projectPath });
|
package/dist/prompt.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Both the Inquirer.js library and the Prompts library have a bug where text is duplicated in a Git
|
|
2
2
|
// Bash terminal. Thus, we revert to using the simpler Prompt library.
|
|
3
|
-
import { cancel, confirm, intro, isCancel, log, outro, text, } from "@clack/prompts";
|
|
3
|
+
import { cancel, confirm, intro, isCancel, log, outro, spinner, text, } from "@clack/prompts";
|
|
4
4
|
import chalk from "chalk";
|
|
5
5
|
import { PROJECT_NAME } from "./constants.js";
|
|
6
6
|
export function promptStart() {
|
|
@@ -40,6 +40,11 @@ export async function getInputString(msg, defaultValue) {
|
|
|
40
40
|
export function promptLog(msg) {
|
|
41
41
|
log.step(msg); // Step is a hollow green diamond.
|
|
42
42
|
}
|
|
43
|
+
export function promptSpinnerStart(msg) {
|
|
44
|
+
const s = spinner();
|
|
45
|
+
s.start(msg);
|
|
46
|
+
return s;
|
|
47
|
+
}
|
|
43
48
|
export function promptError(msg) {
|
|
44
49
|
cancel(msg);
|
|
45
50
|
process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "complete-cli",
|
|
3
|
-
"version": "1.0.1-dev.
|
|
3
|
+
"version": "1.0.1-dev.8",
|
|
4
4
|
"description": "A command line tool for bootstrapping TypeScript projects.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript"
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"chalk": "^5.4.1",
|
|
39
39
|
"clipanion": "^4.0.0-rc.4",
|
|
40
40
|
"complete-common": "^1.1.0",
|
|
41
|
-
"complete-node": "^2.
|
|
41
|
+
"complete-node": "^2.1.0",
|
|
42
42
|
"execa": "^9.5.2",
|
|
43
43
|
"klaw-sync": "^6.0.0",
|
|
44
44
|
"yaml": "^2.7.0"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@types/klaw-sync": "^6.0.5",
|
|
48
48
|
"@types/node": "^22.13.4",
|
|
49
49
|
"@types/prompt": "^1.1.9",
|
|
50
|
-
"complete-node": "^2.
|
|
50
|
+
"complete-node": "^2.1.0",
|
|
51
51
|
"eslint-plugin-sort-exports": "^0.9.1",
|
|
52
52
|
"glob": "^11.0.1",
|
|
53
53
|
"typescript": "^5.7.3",
|
|
@@ -140,7 +140,7 @@ async function updateDependencies(
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
console.log('Updating dependencies in the "package.json" file...');
|
|
143
|
-
const hasNewDependencies = updatePackageJSONDependencies(undefined);
|
|
143
|
+
const hasNewDependencies = await updatePackageJSONDependencies(undefined);
|
|
144
144
|
if (hasNewDependencies) {
|
|
145
145
|
const command = getPackageManagerInstallCommand(packageManager);
|
|
146
146
|
const commandParts = command.split(" ");
|
|
@@ -9,9 +9,8 @@ export class UpdateCommand extends Command {
|
|
|
9
9
|
'Invoke "npm-check-updates" to update the dependencies inside of the "package.json" file and then install them.',
|
|
10
10
|
});
|
|
11
11
|
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/require-await
|
|
13
12
|
async execute(): Promise<void> {
|
|
14
|
-
const hasNewDependencies = updatePackageJSONDependencies();
|
|
13
|
+
const hasNewDependencies = await updatePackageJSONDependencies();
|
|
15
14
|
const msg = hasNewDependencies
|
|
16
15
|
? "Successfully installed new Node.js dependencies."
|
|
17
16
|
: "There were no new dependency updates from npm.";
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
TEMPLATES_STATIC_DIR,
|
|
23
23
|
} from "../../constants.js";
|
|
24
24
|
import { initGitRepository } from "../../git.js";
|
|
25
|
-
import { promptError, promptLog } from "../../prompt.js";
|
|
25
|
+
import { promptError, promptLog, promptSpinnerStart } from "../../prompt.js";
|
|
26
26
|
|
|
27
27
|
export async function createProject(
|
|
28
28
|
projectName: string,
|
|
@@ -41,7 +41,7 @@ export async function createProject(
|
|
|
41
41
|
copyDynamicFiles(projectName, authorName, projectPath, packageManager);
|
|
42
42
|
|
|
43
43
|
// There is no package manager lock files yet, so we have to pass "false" to this function.
|
|
44
|
-
const updated = updatePackageJSONDependencies(projectPath, false, true);
|
|
44
|
+
const updated = await updatePackageJSONDependencies(projectPath, false, true);
|
|
45
45
|
if (!updated) {
|
|
46
46
|
promptError(
|
|
47
47
|
'Failed to update the dependencies in the "package.json" file.',
|
|
@@ -183,12 +183,13 @@ async function installNodeModules(
|
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
const command = getPackageManagerInstallCommand(packageManager);
|
|
186
|
-
|
|
186
|
+
const s = promptSpinnerStart(
|
|
187
187
|
`Installing node modules with "${command}"... (This can take a long time.)`,
|
|
188
188
|
);
|
|
189
189
|
const $$ = $({ cwd: projectPath });
|
|
190
190
|
const commandParts = command.split(" ");
|
|
191
191
|
await $$`${commandParts}`;
|
|
192
|
+
s.stop("Installed.");
|
|
192
193
|
}
|
|
193
194
|
|
|
194
195
|
async function formatFiles(projectPath: string) {
|
package/src/prompt.ts
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
isCancel,
|
|
9
9
|
log,
|
|
10
10
|
outro,
|
|
11
|
+
spinner,
|
|
11
12
|
text,
|
|
12
13
|
} from "@clack/prompts";
|
|
13
14
|
import chalk from "chalk";
|
|
@@ -66,6 +67,12 @@ export function promptLog(msg: string): void {
|
|
|
66
67
|
log.step(msg); // Step is a hollow green diamond.
|
|
67
68
|
}
|
|
68
69
|
|
|
70
|
+
export function promptSpinnerStart(msg: string): ReturnType<typeof spinner> {
|
|
71
|
+
const s = spinner();
|
|
72
|
+
s.start(msg);
|
|
73
|
+
return s;
|
|
74
|
+
}
|
|
75
|
+
|
|
69
76
|
export function promptError(msg: string): never {
|
|
70
77
|
cancel(msg);
|
|
71
78
|
process.exit(1);
|