create-rstack 1.7.10 → 1.7.12

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 CHANGED
@@ -12,6 +12,11 @@ export declare const BUILTIN_TOOLS: string[];
12
12
 
13
13
  export declare function checkCancel<T>(value: unknown): T;
14
14
 
15
+ /**
16
+ * Collect AGENTS.md files from template directories
17
+ */
18
+ export declare function collectAgentsFiles(agentsMdSearchDirs: string[]): string[];
19
+
15
20
  /**
16
21
  * Copy files from one folder to another.
17
22
  * @param from Source folder
@@ -31,21 +36,57 @@ export declare function copyFolder({ from, to, version, packageName, templatePar
31
36
  skipFiles?: string[];
32
37
  }): void;
33
38
 
34
- export declare function create({ name, root, templates, skipFiles, getTemplateName, mapESLintTemplate, version, noteInformation, }: {
39
+ export declare function create({ name, root, templates, skipFiles, getTemplateName, mapESLintTemplate, version, noteInformation, extraTools, argv: processArgv, }: {
35
40
  name: string;
36
41
  root: string;
37
42
  skipFiles?: string[];
38
43
  templates: string[];
39
44
  getTemplateName: (argv: Argv) => Promise<string>;
40
- mapESLintTemplate: (templateName: string, context: {
45
+ /**
46
+ * Map the template name to the ESLint template name.
47
+ * If not provided, defaults to 'vanilla-ts' for all templates.
48
+ */
49
+ mapESLintTemplate?: (templateName: string, context: {
41
50
  distFolder: string;
42
51
  }) => ESLintTemplateName | null;
43
52
  version?: Record<string, string> | string;
44
53
  noteInformation?: string[];
54
+ /**
55
+ * Specify additional tools.
56
+ */
57
+ extraTools?: ExtraTool[];
58
+ /**
59
+ * For test purpose, override the default argv (process.argv).
60
+ */
61
+ argv?: string[];
45
62
  }): Promise<void>;
46
63
 
47
64
  export declare type ESLintTemplateName = 'vanilla-js' | 'vanilla-ts' | 'react-js' | 'react-ts' | 'vue-ts' | 'vue-js' | 'svelte-js' | 'svelte-ts';
48
65
 
66
+ declare type ExtraTool = {
67
+ /**
68
+ * The value of the multiselect option.
69
+ */
70
+ value: string;
71
+ /**
72
+ * The label of the multiselect option.
73
+ */
74
+ label: string;
75
+ /**
76
+ * The action to perform when the tool is selected.
77
+ */
78
+ action?: () => unknown;
79
+ /**
80
+ * The custom command to run when the tool is selected.
81
+ */
82
+ command?: string;
83
+ };
84
+
85
+ /**
86
+ * Merge AGENTS.md files from multiple sources
87
+ */
88
+ export declare function mergeAgentsFiles(agentsFiles: string[]): string;
89
+
49
90
  /**
50
91
  * Merge two package.json files and keep the order of keys.
51
92
  * @param targetPackage Path to the base package.json file
package/dist/index.js CHANGED
@@ -1,5 +1,8 @@
1
1
  import 'module';
2
2
  /*#__PURE__*/ import.meta.url;
3
+ import * as __rspack_external_child_process from "child_process";
4
+ import * as __rspack_external_fs from "fs";
5
+ import * as __rspack_external_path from "path";
3
6
  import node_fs from "node:fs";
4
7
  import node_path, { dirname } from "node:path";
5
8
  import { fileURLToPath } from "node:url";
@@ -10,6 +13,192 @@ import { Writable } from "node:stream";
10
13
  import node_os from "node:os";
11
14
  import node_tty from "node:tty";
12
15
  var __webpack_modules__ = {
16
+ "./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
17
+ const cp = __webpack_require__("child_process");
18
+ const parse = __webpack_require__("./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js");
19
+ const enoent = __webpack_require__("./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js");
20
+ function spawn(command, args, options) {
21
+ const parsed = parse(command, args, options);
22
+ const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
23
+ enoent.hookChildProcess(spawned, parsed);
24
+ return spawned;
25
+ }
26
+ function spawnSync(command, args, options) {
27
+ const parsed = parse(command, args, options);
28
+ const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
29
+ result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
30
+ return result;
31
+ }
32
+ module.exports = spawn;
33
+ module.exports.spawn = spawn;
34
+ module.exports.sync = spawnSync;
35
+ module.exports._parse = parse;
36
+ module.exports._enoent = enoent;
37
+ },
38
+ "./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js": function(module) {
39
+ const isWin = 'win32' === process.platform;
40
+ function notFoundError(original, syscall) {
41
+ return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
42
+ code: 'ENOENT',
43
+ errno: 'ENOENT',
44
+ syscall: `${syscall} ${original.command}`,
45
+ path: original.command,
46
+ spawnargs: original.args
47
+ });
48
+ }
49
+ function hookChildProcess(cp, parsed) {
50
+ if (!isWin) return;
51
+ const originalEmit = cp.emit;
52
+ cp.emit = function(name, arg1) {
53
+ if ('exit' === name) {
54
+ const err = verifyENOENT(arg1, parsed);
55
+ if (err) return originalEmit.call(cp, 'error', err);
56
+ }
57
+ return originalEmit.apply(cp, arguments);
58
+ };
59
+ }
60
+ function verifyENOENT(status, parsed) {
61
+ if (isWin && 1 === status && !parsed.file) return notFoundError(parsed.original, 'spawn');
62
+ return null;
63
+ }
64
+ function verifyENOENTSync(status, parsed) {
65
+ if (isWin && 1 === status && !parsed.file) return notFoundError(parsed.original, 'spawnSync');
66
+ return null;
67
+ }
68
+ module.exports = {
69
+ hookChildProcess,
70
+ verifyENOENT,
71
+ verifyENOENTSync,
72
+ notFoundError
73
+ };
74
+ },
75
+ "./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js": function(module, __unused_webpack_exports, __webpack_require__) {
76
+ const path = __webpack_require__("path");
77
+ const resolveCommand = __webpack_require__("./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js");
78
+ const escape = __webpack_require__("./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js");
79
+ const readShebang = __webpack_require__("./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js");
80
+ const isWin = 'win32' === process.platform;
81
+ const isExecutableRegExp = /\.(?:com|exe)$/i;
82
+ const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
83
+ function detectShebang(parsed) {
84
+ parsed.file = resolveCommand(parsed);
85
+ const shebang = parsed.file && readShebang(parsed.file);
86
+ if (shebang) {
87
+ parsed.args.unshift(parsed.file);
88
+ parsed.command = shebang;
89
+ return resolveCommand(parsed);
90
+ }
91
+ return parsed.file;
92
+ }
93
+ function parseNonShell(parsed) {
94
+ if (!isWin) return parsed;
95
+ const commandFile = detectShebang(parsed);
96
+ const needsShell = !isExecutableRegExp.test(commandFile);
97
+ if (parsed.options.forceShell || needsShell) {
98
+ const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
99
+ parsed.command = path.normalize(parsed.command);
100
+ parsed.command = escape.command(parsed.command);
101
+ parsed.args = parsed.args.map((arg)=>escape.argument(arg, needsDoubleEscapeMetaChars));
102
+ const shellCommand = [
103
+ parsed.command
104
+ ].concat(parsed.args).join(' ');
105
+ parsed.args = [
106
+ '/d',
107
+ '/s',
108
+ '/c',
109
+ `"${shellCommand}"`
110
+ ];
111
+ parsed.command = process.env.comspec || 'cmd.exe';
112
+ parsed.options.windowsVerbatimArguments = true;
113
+ }
114
+ return parsed;
115
+ }
116
+ function parse(command, args, options) {
117
+ if (args && !Array.isArray(args)) {
118
+ options = args;
119
+ args = null;
120
+ }
121
+ args = args ? args.slice(0) : [];
122
+ options = Object.assign({}, options);
123
+ const parsed = {
124
+ command,
125
+ args,
126
+ options,
127
+ file: void 0,
128
+ original: {
129
+ command,
130
+ args
131
+ }
132
+ };
133
+ return options.shell ? parsed : parseNonShell(parsed);
134
+ }
135
+ module.exports = parse;
136
+ },
137
+ "./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js": function(module) {
138
+ const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
139
+ function escapeCommand(arg) {
140
+ arg = arg.replace(metaCharsRegExp, '^$1');
141
+ return arg;
142
+ }
143
+ function escapeArgument(arg, doubleEscapeMetaChars) {
144
+ arg = `${arg}`;
145
+ arg = arg.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"');
146
+ arg = arg.replace(/(?=(\\+?)?)\1$/, '$1$1');
147
+ arg = `"${arg}"`;
148
+ arg = arg.replace(metaCharsRegExp, '^$1');
149
+ if (doubleEscapeMetaChars) arg = arg.replace(metaCharsRegExp, '^$1');
150
+ return arg;
151
+ }
152
+ module.exports.command = escapeCommand;
153
+ module.exports.argument = escapeArgument;
154
+ },
155
+ "./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js": function(module, __unused_webpack_exports, __webpack_require__) {
156
+ const fs = __webpack_require__("fs");
157
+ const shebangCommand = __webpack_require__("./node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js");
158
+ function readShebang(command) {
159
+ const size = 150;
160
+ const buffer = Buffer.alloc(size);
161
+ let fd;
162
+ try {
163
+ fd = fs.openSync(command, 'r');
164
+ fs.readSync(fd, buffer, 0, size, 0);
165
+ fs.closeSync(fd);
166
+ } catch (e) {}
167
+ return shebangCommand(buffer.toString());
168
+ }
169
+ module.exports = readShebang;
170
+ },
171
+ "./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js": function(module, __unused_webpack_exports, __webpack_require__) {
172
+ const path = __webpack_require__("path");
173
+ const which = __webpack_require__("./node_modules/.pnpm/which@2.0.2/node_modules/which/which.js");
174
+ const getPathKey = __webpack_require__("./node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js");
175
+ function resolveCommandAttempt(parsed, withoutPathExt) {
176
+ const env = parsed.options.env || process.env;
177
+ const cwd = process.cwd();
178
+ const hasCustomCwd = null != parsed.options.cwd;
179
+ const shouldSwitchCwd = hasCustomCwd && void 0 !== process.chdir && !process.chdir.disabled;
180
+ if (shouldSwitchCwd) try {
181
+ process.chdir(parsed.options.cwd);
182
+ } catch (err) {}
183
+ let resolved;
184
+ try {
185
+ resolved = which.sync(parsed.command, {
186
+ path: env[getPathKey({
187
+ env
188
+ })],
189
+ pathExt: withoutPathExt ? path.delimiter : void 0
190
+ });
191
+ } catch (e) {} finally{
192
+ if (shouldSwitchCwd) process.chdir(cwd);
193
+ }
194
+ if (resolved) resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : '', resolved);
195
+ return resolved;
196
+ }
197
+ function resolveCommand(parsed) {
198
+ return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
199
+ }
200
+ module.exports = resolveCommand;
201
+ },
13
202
  "./node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js": function(module) {
14
203
  var isMergeableObject = function(value) {
15
204
  return isNonNullObject(value) && !isSpecial(value);
@@ -93,6 +282,102 @@ var __webpack_modules__ = {
93
282
  var deepmerge_1 = deepmerge;
94
283
  module.exports = deepmerge_1;
95
284
  },
285
+ "./node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
286
+ __webpack_require__("fs");
287
+ var core;
288
+ core = 'win32' === process.platform || global.TESTING_WINDOWS ? __webpack_require__("./node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js") : __webpack_require__("./node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js");
289
+ module.exports = isexe;
290
+ isexe.sync = sync;
291
+ function isexe(path, options, cb) {
292
+ if ('function' == typeof options) {
293
+ cb = options;
294
+ options = {};
295
+ }
296
+ if (!cb) {
297
+ if ('function' != typeof Promise) throw new TypeError('callback not provided');
298
+ return new Promise(function(resolve, reject) {
299
+ isexe(path, options || {}, function(er, is) {
300
+ if (er) reject(er);
301
+ else resolve(is);
302
+ });
303
+ });
304
+ }
305
+ core(path, options || {}, function(er, is) {
306
+ if (er) {
307
+ if ('EACCES' === er.code || options && options.ignoreErrors) {
308
+ er = null;
309
+ is = false;
310
+ }
311
+ }
312
+ cb(er, is);
313
+ });
314
+ }
315
+ function sync(path, options) {
316
+ try {
317
+ return core.sync(path, options || {});
318
+ } catch (er) {
319
+ if (options && options.ignoreErrors || 'EACCES' === er.code) return false;
320
+ throw er;
321
+ }
322
+ }
323
+ },
324
+ "./node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js": function(module, __unused_webpack_exports, __webpack_require__) {
325
+ module.exports = isexe;
326
+ isexe.sync = sync;
327
+ var fs = __webpack_require__("fs");
328
+ function isexe(path, options, cb) {
329
+ fs.stat(path, function(er, stat) {
330
+ cb(er, er ? false : checkStat(stat, options));
331
+ });
332
+ }
333
+ function sync(path, options) {
334
+ return checkStat(fs.statSync(path), options);
335
+ }
336
+ function checkStat(stat, options) {
337
+ return stat.isFile() && checkMode(stat, options);
338
+ }
339
+ function checkMode(stat, options) {
340
+ var mod = stat.mode;
341
+ var uid = stat.uid;
342
+ var gid = stat.gid;
343
+ var myUid = void 0 !== options.uid ? options.uid : process.getuid && process.getuid();
344
+ var myGid = void 0 !== options.gid ? options.gid : process.getgid && process.getgid();
345
+ var u = parseInt('100', 8);
346
+ var g = parseInt('010', 8);
347
+ var o = parseInt('001', 8);
348
+ var ug = u | g;
349
+ var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && 0 === myUid;
350
+ return ret;
351
+ }
352
+ },
353
+ "./node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js": function(module, __unused_webpack_exports, __webpack_require__) {
354
+ module.exports = isexe;
355
+ isexe.sync = sync;
356
+ var fs = __webpack_require__("fs");
357
+ function checkPathExt(path, options) {
358
+ var pathext = void 0 !== options.pathExt ? options.pathExt : process.env.PATHEXT;
359
+ if (!pathext) return true;
360
+ pathext = pathext.split(';');
361
+ if (-1 !== pathext.indexOf('')) return true;
362
+ for(var i = 0; i < pathext.length; i++){
363
+ var p = pathext[i].toLowerCase();
364
+ if (p && path.substr(-p.length).toLowerCase() === p) return true;
365
+ }
366
+ return false;
367
+ }
368
+ function checkStat(stat, path, options) {
369
+ if (!stat.isSymbolicLink() && !stat.isFile()) return false;
370
+ return checkPathExt(path, options);
371
+ }
372
+ function isexe(path, options, cb) {
373
+ fs.stat(path, function(er, stat) {
374
+ cb(er, er ? false : checkStat(stat, path, options));
375
+ });
376
+ }
377
+ function sync(path, options) {
378
+ return checkStat(fs.statSync(path), path, options);
379
+ }
380
+ },
96
381
  "./node_modules/.pnpm/minimist@1.2.8/node_modules/minimist/index.js": function(module) {
97
382
  function hasKey(obj, keys) {
98
383
  var o = obj;
@@ -272,6 +557,16 @@ var __webpack_modules__ = {
272
557
  return argv;
273
558
  };
274
559
  },
560
+ "./node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js": function(module) {
561
+ const pathKey = (options = {})=>{
562
+ const environment = options.env || process.env;
563
+ const platform = options.platform || process.platform;
564
+ if ('win32' !== platform) return 'PATH';
565
+ return Object.keys(environment).reverse().find((key)=>'PATH' === key.toUpperCase()) || 'Path';
566
+ };
567
+ module.exports = pathKey;
568
+ module.exports["default"] = pathKey;
569
+ },
275
570
  "./node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js": function(module) {
276
571
  let p = process || {}, argv = p.argv || [], env = p.env || {};
277
572
  let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || "win32" === p.platform || (p.stdout || {}).isTTY && "dumb" !== env.TERM || !!env.CI);
@@ -338,6 +633,20 @@ var __webpack_modules__ = {
338
633
  module.exports = createColors();
339
634
  module.exports.createColors = createColors;
340
635
  },
636
+ "./node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
637
+ const shebangRegex = __webpack_require__("./node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js");
638
+ module.exports = (string = '')=>{
639
+ const match = string.match(shebangRegex);
640
+ if (!match) return null;
641
+ const [path, argument] = match[0].replace(/#! ?/, '').split(' ');
642
+ const binary = path.split('/').pop();
643
+ if ('env' === binary) return argument;
644
+ return argument ? `${binary} ${argument}` : binary;
645
+ };
646
+ },
647
+ "./node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js": function(module) {
648
+ module.exports = /^#!(.*)/;
649
+ },
341
650
  "./node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js": function(module) {
342
651
  const ESC = '\x1B';
343
652
  const CSI = `${ESC}[`;
@@ -391,6 +700,102 @@ var __webpack_modules__ = {
391
700
  erase,
392
701
  beep
393
702
  };
703
+ },
704
+ "./node_modules/.pnpm/which@2.0.2/node_modules/which/which.js": function(module, __unused_webpack_exports, __webpack_require__) {
705
+ const isWindows = 'win32' === process.platform || 'cygwin' === process.env.OSTYPE || 'msys' === process.env.OSTYPE;
706
+ const path = __webpack_require__("path");
707
+ const COLON = isWindows ? ';' : ':';
708
+ const isexe = __webpack_require__("./node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js");
709
+ const getNotFoundError = (cmd)=>Object.assign(new Error(`not found: ${cmd}`), {
710
+ code: 'ENOENT'
711
+ });
712
+ const getPathInfo = (cmd, opt)=>{
713
+ const colon = opt.colon || COLON;
714
+ const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [
715
+ ''
716
+ ] : [
717
+ ...isWindows ? [
718
+ process.cwd()
719
+ ] : [],
720
+ ...(opt.path || process.env.PATH || '').split(colon)
721
+ ];
722
+ const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM' : '';
723
+ const pathExt = isWindows ? pathExtExe.split(colon) : [
724
+ ''
725
+ ];
726
+ if (isWindows) {
727
+ if (-1 !== cmd.indexOf('.') && '' !== pathExt[0]) pathExt.unshift('');
728
+ }
729
+ return {
730
+ pathEnv,
731
+ pathExt,
732
+ pathExtExe
733
+ };
734
+ };
735
+ const which = (cmd, opt, cb)=>{
736
+ if ('function' == typeof opt) {
737
+ cb = opt;
738
+ opt = {};
739
+ }
740
+ if (!opt) opt = {};
741
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
742
+ const found = [];
743
+ const step = (i)=>new Promise((resolve, reject)=>{
744
+ if (i === pathEnv.length) return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
745
+ const ppRaw = pathEnv[i];
746
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
747
+ const pCmd = path.join(pathPart, cmd);
748
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
749
+ resolve(subStep(p, i, 0));
750
+ });
751
+ const subStep = (p, i, ii)=>new Promise((resolve, reject)=>{
752
+ if (ii === pathExt.length) return resolve(step(i + 1));
753
+ const ext = pathExt[ii];
754
+ isexe(p + ext, {
755
+ pathExt: pathExtExe
756
+ }, (er, is)=>{
757
+ if (!er && is) if (!opt.all) return resolve(p + ext);
758
+ else found.push(p + ext);
759
+ return resolve(subStep(p, i, ii + 1));
760
+ });
761
+ });
762
+ return cb ? step(0).then((res)=>cb(null, res), cb) : step(0);
763
+ };
764
+ const whichSync = (cmd, opt)=>{
765
+ opt = opt || {};
766
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
767
+ const found = [];
768
+ for(let i = 0; i < pathEnv.length; i++){
769
+ const ppRaw = pathEnv[i];
770
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
771
+ const pCmd = path.join(pathPart, cmd);
772
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
773
+ for(let j = 0; j < pathExt.length; j++){
774
+ const cur = p + pathExt[j];
775
+ try {
776
+ const is = isexe.sync(cur, {
777
+ pathExt: pathExtExe
778
+ });
779
+ if (is) if (!opt.all) return cur;
780
+ else found.push(cur);
781
+ } catch (ex) {}
782
+ }
783
+ }
784
+ if (opt.all && found.length) return found;
785
+ if (opt.nothrow) return null;
786
+ throw getNotFoundError(cmd);
787
+ };
788
+ module.exports = which;
789
+ which.sync = whichSync;
790
+ },
791
+ child_process: function(module) {
792
+ module.exports = __rspack_external_child_process;
793
+ },
794
+ fs: function(module) {
795
+ module.exports = __rspack_external_fs;
796
+ },
797
+ path: function(module) {
798
+ module.exports = __rspack_external_path;
394
799
  }
395
800
  };
396
801
  var __webpack_module_cache__ = {};
@@ -1281,6 +1686,8 @@ ${picocolors.gray(dist_d)} ${t}
1281
1686
  `);
1282
1687
  };
1283
1688
  picocolors.gray(dist_o);
1689
+ var cross_spawn = __webpack_require__("./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js");
1690
+ var cross_spawn_default = /*#__PURE__*/ __webpack_require__.n(cross_spawn);
1284
1691
  var cjs = __webpack_require__("./node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js");
1285
1692
  var cjs_default = /*#__PURE__*/ __webpack_require__.n(cjs);
1286
1693
  var minimist = __webpack_require__("./node_modules/.pnpm/minimist@1.2.8/node_modules/minimist/index.js");
@@ -1387,9 +1794,10 @@ const supportsColor = {
1387
1794
  };
1388
1795
  const supports_color = supportsColor;
1389
1796
  const colorLevel = supports_color.stdout ? supports_color.stdout.level : 0;
1390
- let errorStackRegExp = /at\s.*:\d+:\d+[\s\)]*$/;
1391
- let anonymousErrorStackRegExp = /at\s.*\(<anonymous>\)$/;
1392
- let isErrorStackMessage = (message)=>errorStackRegExp.test(message) || anonymousErrorStackRegExp.test(message);
1797
+ let errorStackRegExp = /at [^\r\n]{0,200}:\d+:\d+[\s\)]*$/;
1798
+ let anonymousErrorStackRegExp = /at [^\r\n]{0,200}\(<anonymous>\)$/;
1799
+ let indexErrorStackRegExp = /at [^\r\n]{0,200}\(index\s\d+\)$/;
1800
+ let isErrorStackMessage = (message)=>errorStackRegExp.test(message) || anonymousErrorStackRegExp.test(message) || indexErrorStackRegExp.test(message);
1393
1801
  let formatter = (open, close, replace = open)=>colorLevel >= 2 ? (input)=>{
1394
1802
  let string = '' + input;
1395
1803
  let index = string.indexOf(close, open.length);
@@ -1501,9 +1909,10 @@ const normalizeErrorMessage = (err)=>{
1501
1909
  let createLogger = (options = {})=>{
1502
1910
  let maxLevel = options.level || 'info';
1503
1911
  let log = (type, message, ...args)=>{
1504
- if (LOG_LEVEL[LOG_TYPES[type].level] > LOG_LEVEL[maxLevel]) return;
1505
- if (null == message) return console.log();
1506
1912
  let logType = LOG_TYPES[type];
1913
+ const { level } = logType;
1914
+ if (LOG_LEVEL[level] > LOG_LEVEL[maxLevel]) return;
1915
+ if (null == message) return console.log();
1507
1916
  let label = '';
1508
1917
  let text = '';
1509
1918
  if ('label' in logType) {
@@ -1517,11 +1926,12 @@ let createLogger = (options = {})=>{
1517
1926
  text += yellow('\n [cause]: ');
1518
1927
  text += cause instanceof Error ? normalizeErrorMessage(cause) : String(cause);
1519
1928
  }
1520
- } else if ('error' === logType.level && 'string' == typeof message) {
1929
+ } else if ('error' === level && 'string' == typeof message) {
1521
1930
  let lines = message.split('\n');
1522
1931
  text = lines.map((line)=>isErrorStackMessage(line) ? gray(line) : line).join('\n');
1523
1932
  } else text = `${message}`;
1524
- console.log(label.length ? `${label} ${text}` : text, ...args);
1933
+ const method = 'error' === level || 'warn' === level ? level : 'log';
1934
+ console[method](label.length ? `${label} ${text}` : text, ...args);
1525
1935
  };
1526
1936
  let logger = {
1527
1937
  greet: (message)=>log('log', gradient(message))
@@ -1594,32 +2004,38 @@ function logHelpMessage(name, templates) {
1594
2004
  ${templates.join(', ')}
1595
2005
  `);
1596
2006
  }
1597
- async function getTools({ tools, dir, template }) {
2007
+ async function getTools({ tools, dir, template }, extraTools) {
1598
2008
  if (tools) {
1599
2009
  let toolsArr = Array.isArray(tools) ? tools : [
1600
2010
  tools
1601
2011
  ];
1602
- toolsArr = toolsArr.filter((tool)=>BUILTIN_TOOLS.includes(tool));
2012
+ toolsArr = toolsArr.filter((tool)=>BUILTIN_TOOLS.includes(tool) || extraTools?.some((extraTool)=>extraTool.value === tool));
1603
2013
  return toolsArr;
1604
2014
  }
1605
2015
  if (dir && template) return [];
1606
2016
  if ('' === tools) return [];
2017
+ const options = [
2018
+ {
2019
+ value: 'biome',
2020
+ label: 'Add Biome for code linting and formatting'
2021
+ },
2022
+ {
2023
+ value: 'eslint',
2024
+ label: 'Add ESLint for code linting'
2025
+ },
2026
+ {
2027
+ value: 'prettier',
2028
+ label: 'Add Prettier for code formatting'
2029
+ }
2030
+ ];
2031
+ if (extraTools) options.push(...extraTools.map((tool)=>({
2032
+ value: tool.value,
2033
+ label: tool.label,
2034
+ hint: tool.command
2035
+ })));
1607
2036
  return checkCancel(await fe({
1608
2037
  message: 'Select additional tools (Use <space> to select, <enter> to continue)',
1609
- options: [
1610
- {
1611
- value: 'biome',
1612
- label: 'Add Biome for code linting and formatting'
1613
- },
1614
- {
1615
- value: 'eslint',
1616
- label: 'Add ESLint for code linting'
1617
- },
1618
- {
1619
- value: 'prettier',
1620
- label: 'Add Prettier for code formatting'
1621
- }
1622
- ],
2038
+ options,
1623
2039
  required: false
1624
2040
  }));
1625
2041
  }
@@ -1628,8 +2044,8 @@ function upperFirst(str) {
1628
2044
  }
1629
2045
  const readJSON = async (path)=>JSON.parse(await node_fs.promises.readFile(path, 'utf-8'));
1630
2046
  const readPackageJson = async (filePath)=>readJSON(node_path.join(filePath, 'package.json'));
1631
- const parseArgv = ()=>{
1632
- const argv = minimist_default()(process.argv.slice(2), {
2047
+ const parseArgv = (processArgv)=>{
2048
+ const argv = minimist_default()(processArgv.slice(2), {
1633
2049
  alias: {
1634
2050
  h: 'help',
1635
2051
  d: 'dir',
@@ -1640,10 +2056,17 @@ const parseArgv = ()=>{
1640
2056
  if (argv['package-name']) argv.packageName = argv['package-name'];
1641
2057
  return argv;
1642
2058
  };
1643
- async function create({ name, root, templates, skipFiles, getTemplateName, mapESLintTemplate, version, noteInformation }) {
2059
+ function runCommand(command, cwd) {
2060
+ const [bin, ...args] = command.split(' ');
2061
+ cross_spawn_default().sync(bin, args, {
2062
+ stdio: 'inherit',
2063
+ cwd
2064
+ });
2065
+ }
2066
+ async function create({ name, root, templates, skipFiles, getTemplateName, mapESLintTemplate, version, noteInformation, extraTools, argv: processArgv = process.argv }) {
1644
2067
  console.log('');
1645
2068
  src_logger.greet(`◆ Create ${upperFirst(name)} Project`);
1646
- const argv = parseArgv();
2069
+ const argv = parseArgv(processArgv);
1647
2070
  if (argv.help) return void logHelpMessage(name, templates);
1648
2071
  const cwd = process.cwd();
1649
2072
  const pkgInfo = pkgFromUserAgent(process.env.npm_config_user_agent);
@@ -1681,7 +2104,7 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
1681
2104
  if ('no' === option) cancelAndExit();
1682
2105
  }
1683
2106
  const templateName = await getTemplateName(argv);
1684
- const tools = await getTools(argv);
2107
+ const tools = await getTools(argv, extraTools);
1685
2108
  const srcFolder = node_path.join(root, `template-${templateName}`);
1686
2109
  const commonFolder = node_path.join(root, 'template-common');
1687
2110
  if (!node_fs.existsSync(srcFolder)) throw new Error(`Invalid input: template "${templateName}" not found.`);
@@ -1706,11 +2129,17 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
1706
2129
  srcFolder
1707
2130
  ];
1708
2131
  for (const tool of tools){
2132
+ if (extraTools) {
2133
+ const matchedTool = extraTools.find((extraTool)=>extraTool.value === tool);
2134
+ if (matchedTool?.action) await matchedTool.action();
2135
+ if (matchedTool?.command) runCommand(matchedTool.command, distFolder);
2136
+ continue;
2137
+ }
1709
2138
  const toolFolder = node_path.join(packageRoot, `template-${tool}`);
1710
2139
  if ('eslint' === tool) {
1711
- const eslintTemplateName = mapESLintTemplate(templateName, {
2140
+ const eslintTemplateName = mapESLintTemplate ? mapESLintTemplate(templateName, {
1712
2141
  distFolder
1713
- });
2142
+ }) : 'vanilla-ts';
1714
2143
  if (!eslintTemplateName) continue;
1715
2144
  const subFolder = node_path.join(toolFolder, eslintTemplateName);
1716
2145
  copyFolder({
@@ -1903,4 +2332,4 @@ function collectAgentsFiles(agentsMdSearchDirs) {
1903
2332
  }
1904
2333
  return agentsFiles;
1905
2334
  }
1906
- export { BUILTIN_TOOLS, checkCancel, copyFolder, create, mergePackageJson, fe as multiselect, ve as select, he as text };
2335
+ export { BUILTIN_TOOLS, checkCancel, collectAgentsFiles, copyFolder, create, mergeAgentsFiles, mergePackageJson, fe as multiselect, ve as select, he as text };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-rstack",
3
- "version": "1.7.10",
3
+ "version": "1.7.12",
4
4
  "description": "Create a new Rstack project",
5
5
  "repository": {
6
6
  "type": "git",
@@ -40,21 +40,26 @@
40
40
  ]
41
41
  },
42
42
  "devDependencies": {
43
- "@biomejs/biome": "2.3.2",
43
+ "@biomejs/biome": "2.3.8",
44
44
  "@clack/prompts": "^0.11.0",
45
- "@microsoft/api-extractor": "^7.53.3",
46
- "@rslib/core": "0.17.0",
47
- "@rstest/core": "0.6.1",
45
+ "@microsoft/api-extractor": "^7.55.1",
46
+ "@rslib/core": "0.18.2",
47
+ "@rstest/core": "0.6.8",
48
+ "@types/cross-spawn": "^6.0.6",
49
+ "@types/fs-extra": "^11.0.4",
48
50
  "@types/minimist": "^1.2.5",
49
- "@types/node": "24.9.2",
51
+ "@types/node": "24.10.1",
52
+ "cross-spawn": "^7.0.6",
50
53
  "deepmerge": "^4.3.1",
54
+ "fs-extra": "^11.3.2",
51
55
  "minimist": "^1.2.8",
52
56
  "picocolors": "^1.1.1",
53
- "rslog": "^1.3.0",
57
+ "rimraf": "^6.1.2",
58
+ "rslog": "^1.3.2",
54
59
  "simple-git-hooks": "^2.13.1",
55
60
  "typescript": "^5.9.3"
56
61
  },
57
- "packageManager": "pnpm@10.20.0",
62
+ "packageManager": "pnpm@10.24.0",
58
63
  "publishConfig": {
59
64
  "access": "public",
60
65
  "registry": "https://registry.npmjs.org/"
@@ -7,6 +7,6 @@
7
7
  "format": "biome format --write"
8
8
  },
9
9
  "devDependencies": {
10
- "@biomejs/biome": "2.3.2"
10
+ "@biomejs/biome": "2.3.8"
11
11
  }
12
12
  }
@@ -6,10 +6,10 @@
6
6
  "lint": "eslint ."
7
7
  },
8
8
  "devDependencies": {
9
- "@eslint/js": "^9.39.0",
10
- "eslint": "^9.39.0",
9
+ "@eslint/js": "^9.39.1",
10
+ "eslint": "^9.39.1",
11
11
  "eslint-plugin-react-hooks": "^7.0.1",
12
12
  "eslint-plugin-react-refresh": "^0.4.24",
13
- "globals": "^16.4.0"
13
+ "globals": "^16.5.0"
14
14
  }
15
15
  }
@@ -6,11 +6,11 @@
6
6
  "lint": "eslint ."
7
7
  },
8
8
  "devDependencies": {
9
- "@eslint/js": "^9.39.0",
10
- "eslint": "^9.39.0",
9
+ "@eslint/js": "^9.39.1",
10
+ "eslint": "^9.39.1",
11
11
  "eslint-plugin-react-hooks": "^7.0.1",
12
12
  "eslint-plugin-react-refresh": "^0.4.24",
13
- "globals": "^16.4.0",
14
- "typescript-eslint": "^8.46.2"
13
+ "globals": "^16.5.0",
14
+ "typescript-eslint": "^8.48.0"
15
15
  }
16
16
  }
@@ -6,9 +6,9 @@
6
6
  "lint": "eslint ."
7
7
  },
8
8
  "devDependencies": {
9
- "@eslint/js": "^9.39.0",
10
- "eslint": "^9.39.0",
9
+ "@eslint/js": "^9.39.1",
10
+ "eslint": "^9.39.1",
11
11
  "eslint-plugin-svelte": "^3.13.0",
12
- "globals": "^16.4.0"
12
+ "globals": "^16.5.0"
13
13
  }
14
14
  }
@@ -6,11 +6,11 @@
6
6
  "lint": "eslint ."
7
7
  },
8
8
  "devDependencies": {
9
- "@eslint/js": "^9.39.0",
10
- "eslint": "^9.39.0",
9
+ "@eslint/js": "^9.39.1",
10
+ "eslint": "^9.39.1",
11
11
  "eslint-plugin-svelte": "^3.13.0",
12
- "globals": "^16.4.0",
13
- "typescript-eslint": "^8.46.2"
12
+ "globals": "^16.5.0",
13
+ "typescript-eslint": "^8.48.0"
14
14
  },
15
15
  "type": "module"
16
16
  }
@@ -6,8 +6,8 @@
6
6
  "lint": "eslint ."
7
7
  },
8
8
  "devDependencies": {
9
- "@eslint/js": "^9.39.0",
10
- "eslint": "^9.39.0",
11
- "globals": "^16.4.0"
9
+ "@eslint/js": "^9.39.1",
10
+ "eslint": "^9.39.1",
11
+ "globals": "^16.5.0"
12
12
  }
13
13
  }
@@ -6,9 +6,9 @@
6
6
  "lint": "eslint ."
7
7
  },
8
8
  "devDependencies": {
9
- "@eslint/js": "^9.39.0",
10
- "eslint": "^9.39.0",
11
- "globals": "^16.4.0",
12
- "typescript-eslint": "^8.46.2"
9
+ "@eslint/js": "^9.39.1",
10
+ "eslint": "^9.39.1",
11
+ "globals": "^16.5.0",
12
+ "typescript-eslint": "^8.48.0"
13
13
  }
14
14
  }
@@ -6,9 +6,9 @@
6
6
  "lint": "eslint ."
7
7
  },
8
8
  "devDependencies": {
9
- "@eslint/js": "^9.39.0",
10
- "eslint": "^9.39.0",
11
- "eslint-plugin-vue": "^10.5.1",
12
- "globals": "^16.4.0"
9
+ "@eslint/js": "^9.39.1",
10
+ "eslint": "^9.39.1",
11
+ "eslint-plugin-vue": "^10.6.2",
12
+ "globals": "^16.5.0"
13
13
  }
14
14
  }
@@ -7,9 +7,9 @@
7
7
  },
8
8
  "devDependencies": {
9
9
  "@vue/eslint-config-typescript": "^14.6.0",
10
- "eslint": "^9.39.0",
11
- "eslint-plugin-vue": "^10.5.1",
12
- "globals": "^16.4.0",
13
- "typescript-eslint": "^8.46.2"
10
+ "eslint": "^9.39.1",
11
+ "eslint-plugin-vue": "^10.6.2",
12
+ "globals": "^16.5.0",
13
+ "typescript-eslint": "^8.48.0"
14
14
  }
15
15
  }
@@ -6,6 +6,6 @@
6
6
  "format": "prettier --write ."
7
7
  },
8
8
  "devDependencies": {
9
- "prettier": "^3.6.2"
9
+ "prettier": "^3.7.3"
10
10
  }
11
11
  }