complete-cli 1.3.10 → 1.3.11-dev.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/init/checkIfProjectPathExists.js +6 -2
- package/dist/commands/init/checkIfProjectPathExists.js.map +1 -1
- package/dist/constants.js +3 -2
- package/dist/constants.js.map +1 -1
- package/package.json +2 -2
- package/src/commands/init/checkIfProjectPathExists.ts +12 -2
- package/src/constants.ts +3 -6
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
|
-
import { deleteFileOrDirectory, isDirectory, isFile } from "complete-node";
|
|
2
|
+
import { deleteFileOrDirectory, exists, isDirectory, isFile, } from "complete-node";
|
|
3
3
|
import { CWD } from "../../constants.js";
|
|
4
4
|
import { getInputYesNo, promptEnd, promptLog } from "../../prompt.js";
|
|
5
|
-
/** @throws If the project path is not a file or a directory. */
|
|
5
|
+
/** @throws If the project path exists and is not a file or a directory. */
|
|
6
6
|
export async function checkIfProjectPathExists(projectPath, yes) {
|
|
7
7
|
if (projectPath === CWD) {
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
10
|
+
const projectPathExists = await exists(projectPath);
|
|
11
|
+
if (!projectPathExists) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
10
14
|
const file = await isFile(projectPath);
|
|
11
15
|
const directory = await isDirectory(projectPath);
|
|
12
16
|
if (!file && !directory) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkIfProjectPathExists.js","sourceRoot":"","sources":["../../../../../src/commands/init/checkIfProjectPathExists.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,
|
|
1
|
+
{"version":3,"file":"checkIfProjectPathExists.js","sourceRoot":"","sources":["../../../../../src/commands/init/checkIfProjectPathExists.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,qBAAqB,EAC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CAAC,WAAW,CAAC,CAAC;AAC3C,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PackageManager } from "complete-node";
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
|
+
import packageJSON from "../package.json" with { type: "json" };
|
|
4
5
|
export const CWD = process.cwd();
|
|
5
6
|
export const CURRENT_DIRECTORY_NAME = path.basename(CWD);
|
|
6
7
|
export const HOME_DIR = os.homedir();
|
|
7
8
|
const PACKAGE_ROOT = path.resolve(import.meta.dirname, "..");
|
|
8
|
-
const { name, version } =
|
|
9
|
+
const { name, version } = packageJSON;
|
|
9
10
|
export const PROJECT_NAME = name;
|
|
10
11
|
export const PROJECT_VERSION = version;
|
|
11
12
|
export const DEFAULT_PACKAGE_MANAGER = PackageManager.npm;
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,WAAW,MAAM,iBAAiB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAEhE,MAAM,CAAC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;AACjC,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AAEzD,MAAM,CAAC,MAAM,QAAQ,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;AAErC,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AAC7D,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,WAAW,CAAC;AAEtC,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC;AACjC,MAAM,CAAC,MAAM,eAAe,GAAG,OAAO,CAAC;AAEvC,MAAM,CAAC,MAAM,uBAAuB,GAAG,cAAc,CAAC,GAAG,CAAC;AAE1D,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;AAChE,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;AACvE,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;AAEzE,MAAM,CAAC,MAAM,UAAU,GAAG,YAAY,CAAC;AACvC,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,CAAC,IAAI,CAC/C,qBAAqB,EACrB,SAAS,EACT,WAAW,EACX,OAAO,EACP,UAAU,CACX,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "complete-cli",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.11-dev.1",
|
|
4
4
|
"description": "A command line tool for bootstrapping TypeScript projects.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript"
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/klaw-sync": "6.0.5",
|
|
45
|
-
"@types/node": "24.
|
|
45
|
+
"@types/node": "24.4.0",
|
|
46
46
|
"@types/source-map-support": "0.5.10",
|
|
47
47
|
"ts-loader": "9.5.4",
|
|
48
48
|
"tsconfig-paths-webpack-plugin": "4.2.0",
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
deleteFileOrDirectory,
|
|
4
|
+
exists,
|
|
5
|
+
isDirectory,
|
|
6
|
+
isFile,
|
|
7
|
+
} from "complete-node";
|
|
3
8
|
import { CWD } from "../../constants.js";
|
|
4
9
|
import { getInputYesNo, promptEnd, promptLog } from "../../prompt.js";
|
|
5
10
|
|
|
6
|
-
/** @throws If the project path is not a file or a directory. */
|
|
11
|
+
/** @throws If the project path exists and is not a file or a directory. */
|
|
7
12
|
export async function checkIfProjectPathExists(
|
|
8
13
|
projectPath: string,
|
|
9
14
|
yes: boolean,
|
|
@@ -12,6 +17,11 @@ export async function checkIfProjectPathExists(
|
|
|
12
17
|
return;
|
|
13
18
|
}
|
|
14
19
|
|
|
20
|
+
const projectPathExists = await exists(projectPath);
|
|
21
|
+
if (!projectPathExists) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
15
25
|
const file = await isFile(projectPath);
|
|
16
26
|
const directory = await isDirectory(projectPath);
|
|
17
27
|
if (!file && !directory) {
|
package/src/constants.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PackageManager } from "complete-node";
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
|
+
import packageJSON from "../package.json" with { type: "json" };
|
|
4
5
|
|
|
5
6
|
export const CWD = process.cwd();
|
|
6
7
|
export const CURRENT_DIRECTORY_NAME = path.basename(CWD);
|
|
@@ -8,11 +9,7 @@ export const CURRENT_DIRECTORY_NAME = path.basename(CWD);
|
|
|
8
9
|
export const HOME_DIR = os.homedir();
|
|
9
10
|
|
|
10
11
|
const PACKAGE_ROOT = path.resolve(import.meta.dirname, "..");
|
|
11
|
-
const { name, version } =
|
|
12
|
-
PACKAGE_ROOT,
|
|
13
|
-
"name",
|
|
14
|
-
"version",
|
|
15
|
-
);
|
|
12
|
+
const { name, version } = packageJSON;
|
|
16
13
|
|
|
17
14
|
export const PROJECT_NAME = name;
|
|
18
15
|
export const PROJECT_VERSION = version;
|