create-rstack 1.7.16 → 1.7.18
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 -1
- package/dist/index.js +21 -6
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -75,7 +75,11 @@ declare type ExtraTool = {
|
|
|
75
75
|
/**
|
|
76
76
|
* The action to perform when the tool is selected.
|
|
77
77
|
*/
|
|
78
|
-
action?: (
|
|
78
|
+
action?: (context: {
|
|
79
|
+
templateName: string;
|
|
80
|
+
distFolder: string;
|
|
81
|
+
addAgentsMdSearchDirs: (dir: string) => void;
|
|
82
|
+
}) => unknown;
|
|
79
83
|
/**
|
|
80
84
|
* The custom command to run when the tool is selected.
|
|
81
85
|
*/
|
package/dist/index.js
CHANGED
|
@@ -2144,15 +2144,15 @@ 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
2158
|
if (extraTools) options.push(...extraTools.map((tool)=>({
|
|
@@ -2183,7 +2183,18 @@ const parseArgv = (processArgv)=>{
|
|
|
2183
2183
|
if (argv['package-name']) argv.packageName = argv['package-name'];
|
|
2184
2184
|
return argv;
|
|
2185
2185
|
};
|
|
2186
|
-
function runCommand(command, cwd) {
|
|
2186
|
+
function runCommand(command, cwd, packageManager) {
|
|
2187
|
+
if (command.startsWith('npm create ')) {
|
|
2188
|
+
const createReplacements = {
|
|
2189
|
+
bun: 'bun create ',
|
|
2190
|
+
pnpm: 'pnpm create ',
|
|
2191
|
+
yarn: 'yarn create ',
|
|
2192
|
+
deno: 'deno run -A npm:create-'
|
|
2193
|
+
};
|
|
2194
|
+
const replacement = createReplacements[packageManager];
|
|
2195
|
+
if (replacement) command = command.replace(/^npm create /, replacement).replace(/ -- --/, ' --');
|
|
2196
|
+
if ('yarn' === packageManager) command = command.replace('@latest', '');
|
|
2197
|
+
}
|
|
2187
2198
|
const [bin, ...args] = command.split(' ');
|
|
2188
2199
|
cross_spawn_default().sync(bin, args, {
|
|
2189
2200
|
stdio: 'inherit',
|
|
@@ -2263,8 +2274,12 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
|
|
|
2263
2274
|
if (extraTools) {
|
|
2264
2275
|
const matchedTool = extraTools.find((extraTool)=>extraTool.value === tool);
|
|
2265
2276
|
if (matchedTool) {
|
|
2266
|
-
if (matchedTool.action) await matchedTool.action(
|
|
2267
|
-
|
|
2277
|
+
if (matchedTool.action) await matchedTool.action({
|
|
2278
|
+
templateName,
|
|
2279
|
+
distFolder,
|
|
2280
|
+
addAgentsMdSearchDirs: (dir)=>agentsMdSearchDirs.push(dir)
|
|
2281
|
+
});
|
|
2282
|
+
if (matchedTool.command) runCommand(matchedTool.command, distFolder, packageManager);
|
|
2268
2283
|
continue;
|
|
2269
2284
|
}
|
|
2270
2285
|
}
|