create-rstack 1.7.17 → 1.7.19
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/index.d.ts +5 -0
- package/dist/index.js +25 -10
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -84,6 +84,11 @@ declare type ExtraTool = {
|
|
|
84
84
|
* The custom command to run when the tool is selected.
|
|
85
85
|
*/
|
|
86
86
|
command?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Specify where to display this tool.
|
|
89
|
+
* If undefined, the tool will be displayed after built-in tools.
|
|
90
|
+
*/
|
|
91
|
+
order?: 'pre' | 'post';
|
|
87
92
|
};
|
|
88
93
|
|
|
89
94
|
/**
|
package/dist/index.js
CHANGED
|
@@ -2144,22 +2144,26 @@ async function getTools({ tools, dir, template }, extraTools) {
|
|
|
2144
2144
|
const options = [
|
|
2145
2145
|
{
|
|
2146
2146
|
value: 'biome',
|
|
2147
|
-
label: '
|
|
2147
|
+
label: 'Biome - linting & formatting'
|
|
2148
2148
|
},
|
|
2149
2149
|
{
|
|
2150
2150
|
value: 'eslint',
|
|
2151
|
-
label: '
|
|
2151
|
+
label: 'ESLint - linting'
|
|
2152
2152
|
},
|
|
2153
2153
|
{
|
|
2154
2154
|
value: 'prettier',
|
|
2155
|
-
label: '
|
|
2155
|
+
label: 'Prettier - formatting'
|
|
2156
2156
|
}
|
|
2157
2157
|
];
|
|
2158
|
-
if (extraTools)
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2158
|
+
if (extraTools) {
|
|
2159
|
+
const normalize = (tool)=>({
|
|
2160
|
+
value: tool.value,
|
|
2161
|
+
label: tool.label,
|
|
2162
|
+
hint: tool.command
|
|
2163
|
+
});
|
|
2164
|
+
options.unshift(...extraTools.filter((tool)=>'pre' === tool.order).map(normalize));
|
|
2165
|
+
options.push(...extraTools.filter((tool)=>'pre' !== tool.order).map(normalize));
|
|
2166
|
+
}
|
|
2163
2167
|
return checkCancel(await fe({
|
|
2164
2168
|
message: 'Select additional tools (Use <space> to select, <enter> to continue)',
|
|
2165
2169
|
options,
|
|
@@ -2183,7 +2187,18 @@ const parseArgv = (processArgv)=>{
|
|
|
2183
2187
|
if (argv['package-name']) argv.packageName = argv['package-name'];
|
|
2184
2188
|
return argv;
|
|
2185
2189
|
};
|
|
2186
|
-
function runCommand(command, cwd) {
|
|
2190
|
+
function runCommand(command, cwd, packageManager) {
|
|
2191
|
+
if (command.startsWith('npm create ')) {
|
|
2192
|
+
const createReplacements = {
|
|
2193
|
+
bun: 'bun create ',
|
|
2194
|
+
pnpm: 'pnpm create ',
|
|
2195
|
+
yarn: 'yarn create ',
|
|
2196
|
+
deno: 'deno run -A npm:create-'
|
|
2197
|
+
};
|
|
2198
|
+
const replacement = createReplacements[packageManager];
|
|
2199
|
+
if (replacement) command = command.replace('npm create ', replacement).replace(' -- --', ' --');
|
|
2200
|
+
if ('yarn' === packageManager) command = command.replace('@latest', '');
|
|
2201
|
+
}
|
|
2187
2202
|
const [bin, ...args] = command.split(' ');
|
|
2188
2203
|
cross_spawn_default().sync(bin, args, {
|
|
2189
2204
|
stdio: 'inherit',
|
|
@@ -2268,7 +2283,7 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
|
|
|
2268
2283
|
distFolder,
|
|
2269
2284
|
addAgentsMdSearchDirs: (dir)=>agentsMdSearchDirs.push(dir)
|
|
2270
2285
|
});
|
|
2271
|
-
if (matchedTool.command) runCommand(matchedTool.command, distFolder);
|
|
2286
|
+
if (matchedTool.command) runCommand(matchedTool.command, distFolder, packageManager);
|
|
2272
2287
|
continue;
|
|
2273
2288
|
}
|
|
2274
2289
|
}
|