nestia 12.0.0 → 12.1.0
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.
|
@@ -6,10 +6,10 @@ export declare namespace NestiaProjectTemplate {
|
|
|
6
6
|
* the network, the file system, or a real package manager.
|
|
7
7
|
*/
|
|
8
8
|
interface IContext {
|
|
9
|
-
/** Runs
|
|
10
|
-
execute: (
|
|
11
|
-
/** Silently checks whether
|
|
12
|
-
probe: (
|
|
9
|
+
/** Runs an executable with explicit arguments, inheriting stdio. */
|
|
10
|
+
execute: (executable: string, args: readonly string[]) => void;
|
|
11
|
+
/** Silently checks whether an executable accepts the supplied arguments. */
|
|
12
|
+
probe: (executable: string, args: readonly string[]) => boolean;
|
|
13
13
|
/** Changes the working directory. */
|
|
14
14
|
chdir: (directory: string) => void;
|
|
15
15
|
/** Checks whether a path exists. */
|
|
@@ -28,7 +28,7 @@ var NestiaProjectTemplate;
|
|
|
28
28
|
console.log(` ${props.title}`);
|
|
29
29
|
console.log("-----------------------------------------");
|
|
30
30
|
// COPY PROJECTS
|
|
31
|
-
context.execute(
|
|
31
|
+
context.execute("git", ["clone", repository !== null && repository !== void 0 ? repository : props.repository, dest]);
|
|
32
32
|
console.log(`cd "${dest}"`);
|
|
33
33
|
context.chdir(dest);
|
|
34
34
|
// TEMPLATE REPOSITORIES ARE PNPM MONOREPOS.
|
|
@@ -38,12 +38,12 @@ var NestiaProjectTemplate;
|
|
|
38
38
|
// through corepack) can set them up.
|
|
39
39
|
const pm = getPackageManager(halter, context);
|
|
40
40
|
// INSTALL DEPENDENCIES
|
|
41
|
-
context.execute(
|
|
41
|
+
context.execute(pm.executable, [...pm.args, "install"]);
|
|
42
42
|
// BUILD TYPESCRIPT
|
|
43
|
-
context.execute(
|
|
43
|
+
context.execute(pm.executable, [...pm.args, "run", "build"]);
|
|
44
44
|
// DO TEST
|
|
45
45
|
if (props.test === true)
|
|
46
|
-
context.execute(
|
|
46
|
+
context.execute(pm.executable, [...pm.args, "run", "test"]);
|
|
47
47
|
// REMOVE REPOSITORY ONLY FILES
|
|
48
48
|
context.remove(".git");
|
|
49
49
|
context.remove(".github/dependabot.yml");
|
|
@@ -65,11 +65,11 @@ var NestiaProjectTemplate;
|
|
|
65
65
|
return output;
|
|
66
66
|
}
|
|
67
67
|
function getPackageManager(halter, context) {
|
|
68
|
-
if (context.probe("pnpm --version") === true)
|
|
69
|
-
return "pnpm";
|
|
70
|
-
else if (context.probe("corepack --version") === true) {
|
|
68
|
+
if (context.probe("pnpm", ["--version"]) === true)
|
|
69
|
+
return { executable: "pnpm", args: [] };
|
|
70
|
+
else if (context.probe("corepack", ["--version"]) === true) {
|
|
71
71
|
process.env.COREPACK_ENABLE_DOWNLOAD_PROMPT = "0";
|
|
72
|
-
return "corepack pnpm";
|
|
72
|
+
return { executable: "corepack", args: ["pnpm"] };
|
|
73
73
|
}
|
|
74
74
|
return halter([
|
|
75
75
|
"The template project is a pnpm monorepo, but neither pnpm nor",
|
|
@@ -83,13 +83,15 @@ var NestiaProjectTemplate;
|
|
|
83
83
|
].join("\n"));
|
|
84
84
|
}
|
|
85
85
|
const CONTEXT = {
|
|
86
|
-
execute: (
|
|
87
|
-
console.log(`\n$ ${
|
|
88
|
-
|
|
86
|
+
execute: (executable, args) => {
|
|
87
|
+
console.log(`\n$ ${[executable, ...args].join(" ")}`);
|
|
88
|
+
const command = commandOf(executable, args);
|
|
89
|
+
child_process_1.default.execFileSync(command.executable, command.args, { stdio: "inherit" });
|
|
89
90
|
},
|
|
90
|
-
probe: (
|
|
91
|
+
probe: (executable, args) => {
|
|
91
92
|
try {
|
|
92
|
-
|
|
93
|
+
const command = commandOf(executable, args);
|
|
94
|
+
child_process_1.default.execFileSync(command.executable, command.args, { stdio: "ignore" });
|
|
93
95
|
return true;
|
|
94
96
|
}
|
|
95
97
|
catch (_a) {
|
|
@@ -100,5 +102,15 @@ var NestiaProjectTemplate;
|
|
|
100
102
|
exists: (path) => fs_1.default.existsSync(path),
|
|
101
103
|
remove: (path) => fs_1.default.rmSync(path, { recursive: true, force: true }),
|
|
102
104
|
};
|
|
105
|
+
const commandOf = (executable, args) => process.platform === "win32" &&
|
|
106
|
+
(executable === "pnpm" || executable === "corepack")
|
|
107
|
+
? {
|
|
108
|
+
executable: "cmd.exe",
|
|
109
|
+
args: ["/d", "/s", "/c", executable, ...args],
|
|
110
|
+
}
|
|
111
|
+
: {
|
|
112
|
+
executable,
|
|
113
|
+
args: [...args],
|
|
114
|
+
};
|
|
103
115
|
})(NestiaProjectTemplate || (exports.NestiaProjectTemplate = NestiaProjectTemplate = {}));
|
|
104
116
|
//# sourceMappingURL=NestiaProjectTemplate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NestiaProjectTemplate.js","sourceRoot":"","sources":["../src/NestiaProjectTemplate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kEAA+B;AAC/B,4CAAoB;AAEpB,IAAiB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"NestiaProjectTemplate.js","sourceRoot":"","sources":["../src/NestiaProjectTemplate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kEAA+B;AAC/B,4CAAoB;AAEpB,IAAiB,qBAAqB,CAwJrC;AAxJD,WAAiB,qBAAqB;IA6BvB,2BAAK,GAChB,CAAC,KAAa,EAAE,EAAE,CAClB,CAAC,MAA+B,EAAE,OAAO,GAAa,OAAO,EAAE,EAAE,CACjE,CAAO,IAAc,EAAiB,EAAE;QACtC,aAAa;QACb,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACjD,IAAI,IAAI,KAAK,SAAS;YAAE,MAAM,EAAE,CAAC;aAC5B,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,IAAI;YACpC,MAAM,CAAC,sCAAsC,CAAC,CAAC;QAEjD,OAAO,CAAC,GAAG,CAAC,2CAA2C,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,UAAU,KAAK,UAAU,CAAC;QAClD,CAAC,CAAC;YACE,UAAU,EAAE,SAAS;YACrB,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;SAC9C;QACH,CAAC,CAAC;YACE,UAAU;YACV,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;SAChB,CAAC;AACV,CAAC,EAxJgB,qBAAqB,aAArB,qBAAqB,GAArB,qBAAqB,QAwJrC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nestia",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.1.0",
|
|
4
4
|
"description": "Nestia CLI tool",
|
|
5
5
|
"main": "bin/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "^25.3.3",
|
|
37
37
|
"rimraf": "^6.1.3",
|
|
38
|
-
"@nestia/core": "^12.
|
|
39
|
-
"@nestia/sdk": "^12.
|
|
38
|
+
"@nestia/core": "^12.1.0",
|
|
39
|
+
"@nestia/sdk": "^12.1.0"
|
|
40
40
|
},
|
|
41
41
|
"files": [
|
|
42
42
|
"bin",
|
|
@@ -9,10 +9,10 @@ export namespace NestiaProjectTemplate {
|
|
|
9
9
|
* the network, the file system, or a real package manager.
|
|
10
10
|
*/
|
|
11
11
|
export interface IContext {
|
|
12
|
-
/** Runs
|
|
13
|
-
execute: (
|
|
14
|
-
/** Silently checks whether
|
|
15
|
-
probe: (
|
|
12
|
+
/** Runs an executable with explicit arguments, inheriting stdio. */
|
|
13
|
+
execute: (executable: string, args: readonly string[]) => void;
|
|
14
|
+
/** Silently checks whether an executable accepts the supplied arguments. */
|
|
15
|
+
probe: (executable: string, args: readonly string[]) => boolean;
|
|
16
16
|
/** Changes the working directory. */
|
|
17
17
|
chdir: (directory: string) => void;
|
|
18
18
|
/** Checks whether a path exists. */
|
|
@@ -45,9 +45,7 @@ export namespace NestiaProjectTemplate {
|
|
|
45
45
|
console.log("-----------------------------------------");
|
|
46
46
|
|
|
47
47
|
// COPY PROJECTS
|
|
48
|
-
context.execute(
|
|
49
|
-
`git clone "${repository ?? props.repository}" "${dest}"`,
|
|
50
|
-
);
|
|
48
|
+
context.execute("git", ["clone", repository ?? props.repository, dest]);
|
|
51
49
|
console.log(`cd "${dest}"`);
|
|
52
50
|
context.chdir(dest);
|
|
53
51
|
|
|
@@ -56,16 +54,17 @@ export namespace NestiaProjectTemplate {
|
|
|
56
54
|
// Their workspace manifests use the `catalog:` dependency protocol,
|
|
57
55
|
// which npm cannot resolve. Only pnpm (directly installed, or served
|
|
58
56
|
// through corepack) can set them up.
|
|
59
|
-
const pm:
|
|
57
|
+
const pm: ICommand = getPackageManager(halter, context);
|
|
60
58
|
|
|
61
59
|
// INSTALL DEPENDENCIES
|
|
62
|
-
context.execute(
|
|
60
|
+
context.execute(pm.executable, [...pm.args, "install"]);
|
|
63
61
|
|
|
64
62
|
// BUILD TYPESCRIPT
|
|
65
|
-
context.execute(
|
|
63
|
+
context.execute(pm.executable, [...pm.args, "run", "build"]);
|
|
66
64
|
|
|
67
65
|
// DO TEST
|
|
68
|
-
if (props.test === true)
|
|
66
|
+
if (props.test === true)
|
|
67
|
+
context.execute(pm.executable, [...pm.args, "run", "test"]);
|
|
69
68
|
|
|
70
69
|
// REMOVE REPOSITORY ONLY FILES
|
|
71
70
|
context.remove(".git");
|
|
@@ -93,14 +92,20 @@ export namespace NestiaProjectTemplate {
|
|
|
93
92
|
return output;
|
|
94
93
|
}
|
|
95
94
|
|
|
95
|
+
interface ICommand {
|
|
96
|
+
executable: string;
|
|
97
|
+
args: string[];
|
|
98
|
+
}
|
|
99
|
+
|
|
96
100
|
function getPackageManager(
|
|
97
101
|
halter: (msg?: string) => never,
|
|
98
102
|
context: IContext,
|
|
99
|
-
):
|
|
100
|
-
if (context.probe("pnpm --version") === true)
|
|
101
|
-
|
|
103
|
+
): ICommand {
|
|
104
|
+
if (context.probe("pnpm", ["--version"]) === true)
|
|
105
|
+
return { executable: "pnpm", args: [] };
|
|
106
|
+
else if (context.probe("corepack", ["--version"]) === true) {
|
|
102
107
|
process.env.COREPACK_ENABLE_DOWNLOAD_PROMPT = "0";
|
|
103
|
-
return "corepack pnpm";
|
|
108
|
+
return { executable: "corepack", args: ["pnpm"] };
|
|
104
109
|
}
|
|
105
110
|
return halter(
|
|
106
111
|
[
|
|
@@ -117,13 +122,15 @@ export namespace NestiaProjectTemplate {
|
|
|
117
122
|
}
|
|
118
123
|
|
|
119
124
|
const CONTEXT: IContext = {
|
|
120
|
-
execute: (
|
|
121
|
-
console.log(`\n$ ${
|
|
122
|
-
|
|
125
|
+
execute: (executable, args): void => {
|
|
126
|
+
console.log(`\n$ ${[executable, ...args].join(" ")}`);
|
|
127
|
+
const command: ICommand = commandOf(executable, args);
|
|
128
|
+
cp.execFileSync(command.executable, command.args, { stdio: "inherit" });
|
|
123
129
|
},
|
|
124
|
-
probe: (
|
|
130
|
+
probe: (executable, args): boolean => {
|
|
125
131
|
try {
|
|
126
|
-
|
|
132
|
+
const command: ICommand = commandOf(executable, args);
|
|
133
|
+
cp.execFileSync(command.executable, command.args, { stdio: "ignore" });
|
|
127
134
|
return true;
|
|
128
135
|
} catch {
|
|
129
136
|
return false;
|
|
@@ -134,4 +141,16 @@ export namespace NestiaProjectTemplate {
|
|
|
134
141
|
remove: (path: string): void =>
|
|
135
142
|
fs.rmSync(path, { recursive: true, force: true }),
|
|
136
143
|
};
|
|
144
|
+
|
|
145
|
+
const commandOf = (executable: string, args: readonly string[]): ICommand =>
|
|
146
|
+
process.platform === "win32" &&
|
|
147
|
+
(executable === "pnpm" || executable === "corepack")
|
|
148
|
+
? {
|
|
149
|
+
executable: "cmd.exe",
|
|
150
|
+
args: ["/d", "/s", "/c", executable, ...args],
|
|
151
|
+
}
|
|
152
|
+
: {
|
|
153
|
+
executable,
|
|
154
|
+
args: [...args],
|
|
155
|
+
};
|
|
137
156
|
}
|