create-rstack 1.8.1 → 1.8.2
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.js +134 -127
- package/package.json +19 -17
- package/template-biome/package.json +1 -1
- package/template-eslint/react-ts/package.json +1 -1
- package/template-eslint/svelte-js/package.json +1 -1
- package/template-eslint/svelte-ts/package.json +2 -2
- package/template-eslint/vanilla-ts/package.json +1 -1
- package/template-eslint/vue-ts/package.json +1 -1
- package/dist/rslib-runtime.js +0 -39
package/dist/index.js
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import
|
|
3
|
-
import * as __rspack_external_fs from "fs";
|
|
4
|
-
import * as __rspack_external_node_fs_5ea92f0c from "node:fs";
|
|
5
|
-
import * as __rspack_external_node_fs_promises_153e37e0 from "node:fs/promises";
|
|
6
|
-
import * as __rspack_external_path from "path";
|
|
7
|
-
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
2
|
+
import node_fs from "node:fs";
|
|
8
3
|
import node_path, { dirname } from "node:path";
|
|
9
4
|
import { fileURLToPath } from "node:url";
|
|
10
5
|
import node_util, { styleText } from "node:util";
|
|
@@ -12,8 +7,47 @@ import node_process, { stdin, stdout } from "node:process";
|
|
|
12
7
|
import node_readline from "node:readline";
|
|
13
8
|
import node_tty from "node:tty";
|
|
14
9
|
import node_os from "node:os";
|
|
10
|
+
import { createRequire as __rspack_createRequire } from "node:module";
|
|
11
|
+
const __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
|
|
12
|
+
var __webpack_modules__ = {};
|
|
13
|
+
var __webpack_module_cache__ = {};
|
|
14
|
+
function __webpack_require__(moduleId) {
|
|
15
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
16
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
17
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
18
|
+
exports: {}
|
|
19
|
+
};
|
|
20
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
21
|
+
return module.exports;
|
|
22
|
+
}
|
|
23
|
+
__webpack_require__.m = __webpack_modules__;
|
|
24
|
+
(()=>{
|
|
25
|
+
__webpack_require__.n = (module)=>{
|
|
26
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
27
|
+
__webpack_require__.d(getter, {
|
|
28
|
+
a: getter
|
|
29
|
+
});
|
|
30
|
+
return getter;
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
(()=>{
|
|
34
|
+
__webpack_require__.d = (exports, definition)=>{
|
|
35
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
get: definition[key]
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
(()=>{
|
|
42
|
+
__webpack_require__.add = function(modules) {
|
|
43
|
+
Object.assign(__webpack_require__.m, modules);
|
|
44
|
+
};
|
|
45
|
+
})();
|
|
46
|
+
(()=>{
|
|
47
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
48
|
+
})();
|
|
15
49
|
__webpack_require__.add({
|
|
16
|
-
"./node_modules/.pnpm/@vercel+detect-agent@1.1
|
|
50
|
+
"./node_modules/.pnpm/@vercel+detect-agent@1.2.1/node_modules/@vercel/detect-agent/dist/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
17
51
|
var __defProp = Object.defineProperty;
|
|
18
52
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
19
53
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -43,37 +77,52 @@ __webpack_require__.add({
|
|
|
43
77
|
});
|
|
44
78
|
module.exports = __toCommonJS(src_exports);
|
|
45
79
|
var import_promises = __webpack_require__("node:fs/promises");
|
|
46
|
-
var import_node_fs = __webpack_require__("node:fs");
|
|
80
|
+
var import_node_fs = __webpack_require__("node:fs?31c0");
|
|
47
81
|
const DEVIN_LOCAL_PATH = "/opt/.devin";
|
|
48
82
|
const CURSOR = "cursor";
|
|
49
83
|
const CURSOR_CLI = "cursor-cli";
|
|
50
84
|
const CLAUDE = "claude";
|
|
85
|
+
const COWORK = "cowork";
|
|
51
86
|
const DEVIN = "devin";
|
|
52
87
|
const REPLIT = "replit";
|
|
53
88
|
const GEMINI = "gemini";
|
|
54
89
|
const CODEX = "codex";
|
|
90
|
+
const ANTIGRAVITY = "antigravity";
|
|
55
91
|
const AUGMENT_CLI = "augment-cli";
|
|
56
92
|
const OPENCODE = "opencode";
|
|
93
|
+
const GITHUB_COPILOT = "github-copilot";
|
|
94
|
+
const GITHUB_COPILOT_CLI = "github-copilot-cli";
|
|
57
95
|
const KNOWN_AGENTS = {
|
|
58
96
|
CURSOR,
|
|
59
97
|
CURSOR_CLI,
|
|
60
98
|
CLAUDE,
|
|
99
|
+
COWORK,
|
|
61
100
|
DEVIN,
|
|
62
101
|
REPLIT,
|
|
63
102
|
GEMINI,
|
|
64
103
|
CODEX,
|
|
104
|
+
ANTIGRAVITY,
|
|
65
105
|
AUGMENT_CLI,
|
|
66
|
-
OPENCODE
|
|
106
|
+
OPENCODE,
|
|
107
|
+
GITHUB_COPILOT
|
|
67
108
|
};
|
|
68
109
|
async function determineAgent() {
|
|
69
110
|
if (process.env.AI_AGENT) {
|
|
70
111
|
const name = process.env.AI_AGENT.trim();
|
|
71
|
-
if (name)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
112
|
+
if (name) {
|
|
113
|
+
if (name === GITHUB_COPILOT || name === GITHUB_COPILOT_CLI) return {
|
|
114
|
+
isAgent: true,
|
|
115
|
+
agent: {
|
|
116
|
+
name: GITHUB_COPILOT
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
return {
|
|
120
|
+
isAgent: true,
|
|
121
|
+
agent: {
|
|
122
|
+
name
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}
|
|
77
126
|
}
|
|
78
127
|
if (process.env.CURSOR_TRACE_ID) return {
|
|
79
128
|
isAgent: true,
|
|
@@ -93,12 +142,18 @@ __webpack_require__.add({
|
|
|
93
142
|
name: GEMINI
|
|
94
143
|
}
|
|
95
144
|
};
|
|
96
|
-
if (process.env.CODEX_SANDBOX) return {
|
|
145
|
+
if (process.env.CODEX_SANDBOX || process.env.CODEX_CI || process.env.CODEX_THREAD_ID) return {
|
|
97
146
|
isAgent: true,
|
|
98
147
|
agent: {
|
|
99
148
|
name: CODEX
|
|
100
149
|
}
|
|
101
150
|
};
|
|
151
|
+
if (process.env.ANTIGRAVITY_AGENT) return {
|
|
152
|
+
isAgent: true,
|
|
153
|
+
agent: {
|
|
154
|
+
name: ANTIGRAVITY
|
|
155
|
+
}
|
|
156
|
+
};
|
|
102
157
|
if (process.env.AUGMENT_AGENT) return {
|
|
103
158
|
isAgent: true,
|
|
104
159
|
agent: {
|
|
@@ -111,16 +166,30 @@ __webpack_require__.add({
|
|
|
111
166
|
name: OPENCODE
|
|
112
167
|
}
|
|
113
168
|
};
|
|
114
|
-
if (process.env.CLAUDECODE || process.env.CLAUDE_CODE)
|
|
169
|
+
if (process.env.CLAUDECODE || process.env.CLAUDE_CODE) {
|
|
170
|
+
if (process.env.CLAUDE_CODE_IS_COWORK) return {
|
|
171
|
+
isAgent: true,
|
|
172
|
+
agent: {
|
|
173
|
+
name: COWORK
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
return {
|
|
177
|
+
isAgent: true,
|
|
178
|
+
agent: {
|
|
179
|
+
name: CLAUDE
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
if (process.env.REPL_ID) return {
|
|
115
184
|
isAgent: true,
|
|
116
185
|
agent: {
|
|
117
|
-
name:
|
|
186
|
+
name: REPLIT
|
|
118
187
|
}
|
|
119
188
|
};
|
|
120
|
-
if (process.env.
|
|
189
|
+
if (process.env.COPILOT_MODEL || process.env.COPILOT_ALLOW_ALL || process.env.COPILOT_GITHUB_TOKEN) return {
|
|
121
190
|
isAgent: true,
|
|
122
191
|
agent: {
|
|
123
|
-
name:
|
|
192
|
+
name: GITHUB_COPILOT
|
|
124
193
|
}
|
|
125
194
|
};
|
|
126
195
|
try {
|
|
@@ -131,7 +200,7 @@ __webpack_require__.add({
|
|
|
131
200
|
name: DEVIN
|
|
132
201
|
}
|
|
133
202
|
};
|
|
134
|
-
} catch (
|
|
203
|
+
} catch (_error) {}
|
|
135
204
|
return {
|
|
136
205
|
isAgent: false,
|
|
137
206
|
agent: void 0
|
|
@@ -692,72 +761,6 @@ __webpack_require__.add({
|
|
|
692
761
|
module.exports = pathKey;
|
|
693
762
|
module.exports["default"] = pathKey;
|
|
694
763
|
},
|
|
695
|
-
"./node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js" (module) {
|
|
696
|
-
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
697
|
-
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);
|
|
698
|
-
let formatter = (open, close, replace = open)=>(input)=>{
|
|
699
|
-
let string = "" + input, index = string.indexOf(close, open.length);
|
|
700
|
-
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
701
|
-
};
|
|
702
|
-
let replaceClose = (string, close, replace, index)=>{
|
|
703
|
-
let result = "", cursor = 0;
|
|
704
|
-
do {
|
|
705
|
-
result += string.substring(cursor, index) + replace;
|
|
706
|
-
cursor = index + close.length;
|
|
707
|
-
index = string.indexOf(close, cursor);
|
|
708
|
-
}while (~index);
|
|
709
|
-
return result + string.substring(cursor);
|
|
710
|
-
};
|
|
711
|
-
let createColors = (enabled = isColorSupported)=>{
|
|
712
|
-
let f = enabled ? formatter : ()=>String;
|
|
713
|
-
return {
|
|
714
|
-
isColorSupported: enabled,
|
|
715
|
-
reset: f("\x1b[0m", "\x1b[0m"),
|
|
716
|
-
bold: f("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m"),
|
|
717
|
-
dim: f("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m"),
|
|
718
|
-
italic: f("\x1b[3m", "\x1b[23m"),
|
|
719
|
-
underline: f("\x1b[4m", "\x1b[24m"),
|
|
720
|
-
inverse: f("\x1b[7m", "\x1b[27m"),
|
|
721
|
-
hidden: f("\x1b[8m", "\x1b[28m"),
|
|
722
|
-
strikethrough: f("\x1b[9m", "\x1b[29m"),
|
|
723
|
-
black: f("\x1b[30m", "\x1b[39m"),
|
|
724
|
-
red: f("\x1b[31m", "\x1b[39m"),
|
|
725
|
-
green: f("\x1b[32m", "\x1b[39m"),
|
|
726
|
-
yellow: f("\x1b[33m", "\x1b[39m"),
|
|
727
|
-
blue: f("\x1b[34m", "\x1b[39m"),
|
|
728
|
-
magenta: f("\x1b[35m", "\x1b[39m"),
|
|
729
|
-
cyan: f("\x1b[36m", "\x1b[39m"),
|
|
730
|
-
white: f("\x1b[37m", "\x1b[39m"),
|
|
731
|
-
gray: f("\x1b[90m", "\x1b[39m"),
|
|
732
|
-
bgBlack: f("\x1b[40m", "\x1b[49m"),
|
|
733
|
-
bgRed: f("\x1b[41m", "\x1b[49m"),
|
|
734
|
-
bgGreen: f("\x1b[42m", "\x1b[49m"),
|
|
735
|
-
bgYellow: f("\x1b[43m", "\x1b[49m"),
|
|
736
|
-
bgBlue: f("\x1b[44m", "\x1b[49m"),
|
|
737
|
-
bgMagenta: f("\x1b[45m", "\x1b[49m"),
|
|
738
|
-
bgCyan: f("\x1b[46m", "\x1b[49m"),
|
|
739
|
-
bgWhite: f("\x1b[47m", "\x1b[49m"),
|
|
740
|
-
blackBright: f("\x1b[90m", "\x1b[39m"),
|
|
741
|
-
redBright: f("\x1b[91m", "\x1b[39m"),
|
|
742
|
-
greenBright: f("\x1b[92m", "\x1b[39m"),
|
|
743
|
-
yellowBright: f("\x1b[93m", "\x1b[39m"),
|
|
744
|
-
blueBright: f("\x1b[94m", "\x1b[39m"),
|
|
745
|
-
magentaBright: f("\x1b[95m", "\x1b[39m"),
|
|
746
|
-
cyanBright: f("\x1b[96m", "\x1b[39m"),
|
|
747
|
-
whiteBright: f("\x1b[97m", "\x1b[39m"),
|
|
748
|
-
bgBlackBright: f("\x1b[100m", "\x1b[49m"),
|
|
749
|
-
bgRedBright: f("\x1b[101m", "\x1b[49m"),
|
|
750
|
-
bgGreenBright: f("\x1b[102m", "\x1b[49m"),
|
|
751
|
-
bgYellowBright: f("\x1b[103m", "\x1b[49m"),
|
|
752
|
-
bgBlueBright: f("\x1b[104m", "\x1b[49m"),
|
|
753
|
-
bgMagentaBright: f("\x1b[105m", "\x1b[49m"),
|
|
754
|
-
bgCyanBright: f("\x1b[106m", "\x1b[49m"),
|
|
755
|
-
bgWhiteBright: f("\x1b[107m", "\x1b[49m")
|
|
756
|
-
};
|
|
757
|
-
};
|
|
758
|
-
module.exports = createColors();
|
|
759
|
-
module.exports.createColors = createColors;
|
|
760
|
-
},
|
|
761
764
|
"./node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
762
765
|
const shebangRegex = __webpack_require__("./node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js");
|
|
763
766
|
module.exports = (string = '')=>{
|
|
@@ -914,19 +917,19 @@ __webpack_require__.add({
|
|
|
914
917
|
which.sync = whichSync;
|
|
915
918
|
},
|
|
916
919
|
child_process (module) {
|
|
917
|
-
module.exports =
|
|
920
|
+
module.exports = __rspack_createRequire_require("child_process");
|
|
918
921
|
},
|
|
919
922
|
fs (module) {
|
|
920
|
-
module.exports =
|
|
923
|
+
module.exports = __rspack_createRequire_require("fs");
|
|
921
924
|
},
|
|
922
|
-
"node:fs" (module) {
|
|
923
|
-
module.exports =
|
|
925
|
+
"node:fs?31c0" (module) {
|
|
926
|
+
module.exports = __rspack_createRequire_require("node:fs");
|
|
924
927
|
},
|
|
925
928
|
"node:fs/promises" (module) {
|
|
926
|
-
module.exports =
|
|
929
|
+
module.exports = __rspack_createRequire_require("node:fs/promises");
|
|
927
930
|
},
|
|
928
931
|
path (module) {
|
|
929
|
-
module.exports =
|
|
932
|
+
module.exports = __rspack_createRequire_require("path");
|
|
930
933
|
}
|
|
931
934
|
});
|
|
932
935
|
const src = __webpack_require__("./node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js");
|
|
@@ -1418,7 +1421,6 @@ class dist_$t extends dist_B {
|
|
|
1418
1421
|
});
|
|
1419
1422
|
}
|
|
1420
1423
|
}
|
|
1421
|
-
const external_node_fs_ = __webpack_require__("node:fs");
|
|
1422
1424
|
function dist_pt() {
|
|
1423
1425
|
return "win32" !== node_process.platform ? "linux" !== node_process.env.TERM : !!node_process.env.CI || !!node_process.env.WT_SESSION || !!node_process.env.TERMINUS_SUBLIME || "{cmd::Cmder}" === node_process.env.ConEmuTask || "Terminus-Sublime" === node_process.env.TERM_PROGRAM || "vscode" === node_process.env.TERM_PROGRAM || "xterm-256color" === node_process.env.TERM || "alacritty" === node_process.env.TERM || "JetBrains-JediTerm" === node_process.env.TERMINAL_EMULATOR;
|
|
1424
1426
|
}
|
|
@@ -2094,12 +2096,13 @@ const normalizeErrorMessage = (err)=>{
|
|
|
2094
2096
|
return err.message;
|
|
2095
2097
|
};
|
|
2096
2098
|
let createLogger = (options = {})=>{
|
|
2097
|
-
|
|
2099
|
+
const { level = 'info', prefix, console: console1 = globalThis.console } = options;
|
|
2100
|
+
let maxLevel = level;
|
|
2098
2101
|
let log = (type, message, ...args)=>{
|
|
2099
2102
|
let logType = LOG_TYPES[type];
|
|
2100
2103
|
const { level } = logType;
|
|
2101
2104
|
if (LOG_LEVEL[level] > LOG_LEVEL[maxLevel]) return;
|
|
2102
|
-
if (null == message) return
|
|
2105
|
+
if (null == message) return console1.log();
|
|
2103
2106
|
let label = '';
|
|
2104
2107
|
let text = '';
|
|
2105
2108
|
if ('label' in logType) {
|
|
@@ -2117,8 +2120,9 @@ let createLogger = (options = {})=>{
|
|
|
2117
2120
|
let lines = message.split('\n');
|
|
2118
2121
|
text = lines.map((line)=>isErrorStackMessage(line) ? color.gray(line) : line).join('\n');
|
|
2119
2122
|
} else text = `${message}`;
|
|
2123
|
+
if (prefix) text = `${prefix} ${text}`;
|
|
2120
2124
|
const method = 'error' === level || 'warn' === level ? level : 'log';
|
|
2121
|
-
|
|
2125
|
+
console1[method](label.length ? `${label} ${text}` : text, ...args);
|
|
2122
2126
|
};
|
|
2123
2127
|
let logger = {
|
|
2124
2128
|
greet: (message)=>log('log', gradient(message))
|
|
@@ -2132,21 +2136,24 @@ let createLogger = (options = {})=>{
|
|
|
2132
2136
|
maxLevel = val;
|
|
2133
2137
|
}
|
|
2134
2138
|
});
|
|
2139
|
+
Object.defineProperty(logger, 'options', {
|
|
2140
|
+
get: ()=>({
|
|
2141
|
+
...options
|
|
2142
|
+
})
|
|
2143
|
+
});
|
|
2135
2144
|
logger.override = (customLogger)=>{
|
|
2136
2145
|
Object.assign(logger, customLogger);
|
|
2137
2146
|
};
|
|
2138
2147
|
return logger;
|
|
2139
2148
|
};
|
|
2140
2149
|
let src_logger = createLogger();
|
|
2141
|
-
const dist = __webpack_require__("./node_modules/.pnpm/@vercel+detect-agent@1.1
|
|
2150
|
+
const dist = __webpack_require__("./node_modules/.pnpm/@vercel+detect-agent@1.2.1/node_modules/@vercel/detect-agent/dist/index.js");
|
|
2142
2151
|
const cross_spawn = __webpack_require__("./node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js");
|
|
2143
2152
|
var cross_spawn_default = /*#__PURE__*/ __webpack_require__.n(cross_spawn);
|
|
2144
2153
|
const cjs = __webpack_require__("./node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js");
|
|
2145
2154
|
var cjs_default = /*#__PURE__*/ __webpack_require__.n(cjs);
|
|
2146
2155
|
const minimist = __webpack_require__("./node_modules/.pnpm/minimist@1.2.8/node_modules/minimist/index.js");
|
|
2147
2156
|
var minimist_default = /*#__PURE__*/ __webpack_require__.n(minimist);
|
|
2148
|
-
const picocolors = __webpack_require__("./node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
2149
|
-
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
2150
2157
|
const src_filename = fileURLToPath(import.meta.url);
|
|
2151
2158
|
const src_dirname = dirname(src_filename);
|
|
2152
2159
|
function cancelAndExit() {
|
|
@@ -2174,7 +2181,7 @@ function pkgFromUserAgent(userAgent) {
|
|
|
2174
2181
|
};
|
|
2175
2182
|
}
|
|
2176
2183
|
function isEmptyDir(path) {
|
|
2177
|
-
const files =
|
|
2184
|
+
const files = node_fs.readdirSync(path);
|
|
2178
2185
|
return 0 === files.length || 1 === files.length && '.git' === files[0];
|
|
2179
2186
|
}
|
|
2180
2187
|
function parseToolsOption(tools) {
|
|
@@ -2259,7 +2266,7 @@ async function getTools({ tools, dir, template }, extraTools, templateName) {
|
|
|
2259
2266
|
function upperFirst(str) {
|
|
2260
2267
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
2261
2268
|
}
|
|
2262
|
-
const readJSON = async (path)=>JSON.parse(await
|
|
2269
|
+
const readJSON = async (path)=>JSON.parse(await node_fs.promises.readFile(path, 'utf-8'));
|
|
2263
2270
|
const readPackageJson = async (filePath)=>readJSON(node_path.join(filePath, 'package.json'));
|
|
2264
2271
|
const parseArgv = (processArgv)=>{
|
|
2265
2272
|
const argv = minimist_default()(processArgv.slice(2), {
|
|
@@ -2319,7 +2326,7 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
|
|
|
2319
2326
|
const { targetDir } = formatted;
|
|
2320
2327
|
const packageName = argv.packageName || formatted.packageName;
|
|
2321
2328
|
const distFolder = node_path.isAbsolute(targetDir) ? targetDir : node_path.join(cwd, targetDir);
|
|
2322
|
-
if (!argv.override &&
|
|
2329
|
+
if (!argv.override && node_fs.existsSync(distFolder) && !isEmptyDir(distFolder)) {
|
|
2323
2330
|
const option = checkCancel(await Jt({
|
|
2324
2331
|
message: `"${targetDir}" is not empty, please choose:`,
|
|
2325
2332
|
options: [
|
|
@@ -2339,7 +2346,7 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
|
|
|
2339
2346
|
const tools = await getTools(argv, extraTools, templateName);
|
|
2340
2347
|
const srcFolder = node_path.join(root, `template-${templateName}`);
|
|
2341
2348
|
const commonFolder = node_path.join(root, 'template-common');
|
|
2342
|
-
if (!
|
|
2349
|
+
if (!node_fs.existsSync(srcFolder)) throw new Error(`Invalid input: template "${templateName}" not found.`);
|
|
2343
2350
|
copyFolder({
|
|
2344
2351
|
from: commonFolder,
|
|
2345
2352
|
to: distFolder,
|
|
@@ -2401,21 +2408,21 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
|
|
|
2401
2408
|
isMergePackageJson: true
|
|
2402
2409
|
});
|
|
2403
2410
|
agentsMdSearchDirs.push(toolFolder);
|
|
2404
|
-
if ('biome' === tool) await
|
|
2411
|
+
if ('biome' === tool) await node_fs.promises.rename(node_path.join(distFolder, 'biome.json.template'), node_path.join(distFolder, 'biome.json'));
|
|
2405
2412
|
}
|
|
2406
2413
|
const agentsFiles = collectAgentsFiles(agentsMdSearchDirs);
|
|
2407
2414
|
if (agentsFiles.length > 0) {
|
|
2408
2415
|
const mergedAgents = mergeAgentsFiles(agentsFiles);
|
|
2409
2416
|
const agentsPath = node_path.join(distFolder, 'AGENTS.md');
|
|
2410
|
-
|
|
2417
|
+
node_fs.writeFileSync(agentsPath, `${replacePlaceholder(mergedAgents, templateParameters)}\n`);
|
|
2411
2418
|
}
|
|
2412
2419
|
const nextSteps = noteInformation ? noteInformation : [
|
|
2413
|
-
`1. ${
|
|
2414
|
-
`2. ${
|
|
2415
|
-
`3. ${
|
|
2416
|
-
`4. ${
|
|
2420
|
+
`1. ${color.cyan(`cd ${targetDir}`)}`,
|
|
2421
|
+
`2. ${color.cyan('git init')} ${color.dim('(optional)')}`,
|
|
2422
|
+
`3. ${color.cyan(`${packageManager} install`)}`,
|
|
2423
|
+
`4. ${color.cyan(`${packageManager} run dev`)}`
|
|
2417
2424
|
];
|
|
2418
|
-
if (nextSteps.length) dist_Vt(nextSteps.map((step)=>
|
|
2425
|
+
if (nextSteps.length) dist_Vt(nextSteps.map((step)=>color.reset(step)).join('\n'), 'Next steps');
|
|
2419
2426
|
Gt('All set, happy coding!');
|
|
2420
2427
|
}
|
|
2421
2428
|
function sortObjectKeys(obj) {
|
|
@@ -2425,9 +2432,9 @@ function sortObjectKeys(obj) {
|
|
|
2425
2432
|
return sortedObj;
|
|
2426
2433
|
}
|
|
2427
2434
|
function mergePackageJson(targetPackage, extraPackage) {
|
|
2428
|
-
if (!
|
|
2429
|
-
const targetJson = JSON.parse(
|
|
2430
|
-
const extraJson = JSON.parse(
|
|
2435
|
+
if (!node_fs.existsSync(targetPackage)) return;
|
|
2436
|
+
const targetJson = JSON.parse(node_fs.readFileSync(targetPackage, 'utf-8'));
|
|
2437
|
+
const extraJson = JSON.parse(node_fs.readFileSync(extraPackage, 'utf-8'));
|
|
2431
2438
|
const mergedJson = cjs_default()(targetJson, extraJson);
|
|
2432
2439
|
mergedJson.name = targetJson.name || extraJson.name;
|
|
2433
2440
|
for (const key of [
|
|
@@ -2435,7 +2442,7 @@ function mergePackageJson(targetPackage, extraPackage) {
|
|
|
2435
2442
|
'dependencies',
|
|
2436
2443
|
'devDependencies'
|
|
2437
2444
|
])if (key in mergedJson) mergedJson[key] = sortObjectKeys(mergedJson[key]);
|
|
2438
|
-
|
|
2445
|
+
node_fs.writeFileSync(targetPackage, `${JSON.stringify(mergedJson, null, 2)}\n`);
|
|
2439
2446
|
}
|
|
2440
2447
|
const isMarkdown = (file)=>file.endsWith('.md') || file.endsWith('.mdx');
|
|
2441
2448
|
const replacePlaceholder = (content, templateParameters)=>{
|
|
@@ -2452,14 +2459,14 @@ function copyFolder({ from, to, version, packageName, templateParameters, isMerg
|
|
|
2452
2459
|
'dist',
|
|
2453
2460
|
...skipFiles
|
|
2454
2461
|
];
|
|
2455
|
-
|
|
2462
|
+
node_fs.mkdirSync(to, {
|
|
2456
2463
|
recursive: true
|
|
2457
2464
|
});
|
|
2458
|
-
for (const file of
|
|
2465
|
+
for (const file of node_fs.readdirSync(from)){
|
|
2459
2466
|
if (allSkipFiles.includes(file)) continue;
|
|
2460
2467
|
const srcFile = node_path.resolve(from, file);
|
|
2461
2468
|
const distFile = renameFiles[file] ? node_path.resolve(to, renameFiles[file]) : node_path.resolve(to, file);
|
|
2462
|
-
const stat =
|
|
2469
|
+
const stat = node_fs.statSync(srcFile);
|
|
2463
2470
|
if (stat.isDirectory()) copyFolder({
|
|
2464
2471
|
from: srcFile,
|
|
2465
2472
|
to: distFile,
|
|
@@ -2469,14 +2476,14 @@ function copyFolder({ from, to, version, packageName, templateParameters, isMerg
|
|
|
2469
2476
|
});
|
|
2470
2477
|
else if ('package.json' === file) {
|
|
2471
2478
|
const targetPackage = node_path.resolve(to, 'package.json');
|
|
2472
|
-
if (isMergePackageJson &&
|
|
2473
|
-
else
|
|
2479
|
+
if (isMergePackageJson && node_fs.existsSync(targetPackage)) mergePackageJson(targetPackage, srcFile);
|
|
2480
|
+
else node_fs.copyFileSync(srcFile, distFile);
|
|
2474
2481
|
updatePackageJson(distFile, version, packageName);
|
|
2475
2482
|
} else {
|
|
2476
|
-
|
|
2483
|
+
node_fs.copyFileSync(srcFile, distFile);
|
|
2477
2484
|
if (templateParameters && isMarkdown(distFile)) {
|
|
2478
|
-
const content =
|
|
2479
|
-
|
|
2485
|
+
const content = node_fs.readFileSync(distFile, 'utf-8');
|
|
2486
|
+
node_fs.writeFileSync(distFile, replacePlaceholder(content, templateParameters));
|
|
2480
2487
|
}
|
|
2481
2488
|
}
|
|
2482
2489
|
}
|
|
@@ -2489,7 +2496,7 @@ const isStableVersion = (version)=>[
|
|
|
2489
2496
|
'nightly'
|
|
2490
2497
|
].every((tag)=>!version.includes(tag));
|
|
2491
2498
|
const updatePackageJson = (pkgJsonPath, version, name)=>{
|
|
2492
|
-
let content =
|
|
2499
|
+
let content = node_fs.readFileSync(pkgJsonPath, 'utf-8');
|
|
2493
2500
|
if ('string' == typeof version) {
|
|
2494
2501
|
const targetVersion = isStableVersion(version) ? `^${version}` : version;
|
|
2495
2502
|
content = content.replace(/workspace:\*/g, targetVersion);
|
|
@@ -2503,11 +2510,11 @@ const updatePackageJson = (pkgJsonPath, version, name)=>{
|
|
|
2503
2510
|
const projectName = node_path.basename(node_path.dirname(pkgJsonPath));
|
|
2504
2511
|
if (projectName.length) pkg.name = projectName;
|
|
2505
2512
|
} else if (name) pkg.name = name;
|
|
2506
|
-
|
|
2513
|
+
node_fs.writeFileSync(pkgJsonPath, `${JSON.stringify(pkg, null, 2)}\n`);
|
|
2507
2514
|
};
|
|
2508
2515
|
function readAgentsFile(filePath) {
|
|
2509
|
-
if (!
|
|
2510
|
-
return
|
|
2516
|
+
if (!node_fs.existsSync(filePath)) return null;
|
|
2517
|
+
return node_fs.readFileSync(filePath, 'utf-8');
|
|
2511
2518
|
}
|
|
2512
2519
|
function parseAgentsContent(content) {
|
|
2513
2520
|
const sections = {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-rstack",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.2",
|
|
4
4
|
"description": "Create a new Rstack project",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,12 +23,11 @@
|
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
25
25
|
"scripts": {
|
|
26
|
-
"build": "rslib
|
|
27
|
-
"dev": "rslib
|
|
28
|
-
"lint": "
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"test": "rstest run",
|
|
26
|
+
"build": "rslib",
|
|
27
|
+
"dev": "rslib --watch",
|
|
28
|
+
"lint": "rslint",
|
|
29
|
+
"prepare": "simple-git-hooks && rslib",
|
|
30
|
+
"test": "rstest",
|
|
32
31
|
"bump": "npx bumpp"
|
|
33
32
|
},
|
|
34
33
|
"simple-git-hooks": {
|
|
@@ -36,31 +35,34 @@
|
|
|
36
35
|
},
|
|
37
36
|
"nano-staged": {
|
|
38
37
|
"*.{js,jsx,ts,tsx,mjs,cjs}": [
|
|
39
|
-
"
|
|
38
|
+
"rslint && prettier --write"
|
|
40
39
|
]
|
|
41
40
|
},
|
|
42
41
|
"devDependencies": {
|
|
43
|
-
"@biomejs/biome": "2.4.6",
|
|
44
42
|
"@clack/prompts": "^1.1.0",
|
|
45
|
-
"@microsoft/api-extractor": "^7.57.
|
|
46
|
-
"@rslib/core": "0.
|
|
47
|
-
"@
|
|
43
|
+
"@microsoft/api-extractor": "^7.57.7",
|
|
44
|
+
"@rslib/core": "0.20.1",
|
|
45
|
+
"@rslint/core": "^0.3.3",
|
|
46
|
+
"@rstest/core": "0.9.5",
|
|
48
47
|
"@types/cross-spawn": "^6.0.6",
|
|
49
48
|
"@types/fs-extra": "^11.0.4",
|
|
50
49
|
"@types/minimist": "^1.2.5",
|
|
51
50
|
"@types/node": "24.12.0",
|
|
52
|
-
"@vercel/detect-agent": "^1.1
|
|
51
|
+
"@vercel/detect-agent": "^1.2.1",
|
|
53
52
|
"cross-spawn": "^7.0.6",
|
|
54
53
|
"deepmerge": "^4.3.1",
|
|
55
54
|
"fs-extra": "^11.3.4",
|
|
56
55
|
"minimist": "^1.2.8",
|
|
57
|
-
"
|
|
56
|
+
"prettier": "^3.8.1",
|
|
58
57
|
"rimraf": "^6.1.3",
|
|
59
|
-
"rslog": "^2.0
|
|
58
|
+
"rslog": "^2.1.0",
|
|
60
59
|
"simple-git-hooks": "^2.13.1",
|
|
61
|
-
"typescript": "^
|
|
60
|
+
"typescript": "^6.0.2"
|
|
62
61
|
},
|
|
63
|
-
"
|
|
62
|
+
"engines": {
|
|
63
|
+
"node": "^20.19.0 || >=22.12.0"
|
|
64
|
+
},
|
|
65
|
+
"packageManager": "pnpm@10.33.0",
|
|
64
66
|
"publishConfig": {
|
|
65
67
|
"access": "public",
|
|
66
68
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
"devDependencies": {
|
|
9
9
|
"@eslint/js": "^9.39.4",
|
|
10
10
|
"eslint": "^9.39.4",
|
|
11
|
-
"eslint-plugin-svelte": "^3.
|
|
11
|
+
"eslint-plugin-svelte": "^3.16.0",
|
|
12
12
|
"globals": "^17.4.0",
|
|
13
|
-
"typescript-eslint": "^8.
|
|
13
|
+
"typescript-eslint": "^8.57.2"
|
|
14
14
|
},
|
|
15
15
|
"type": "module"
|
|
16
16
|
}
|
package/dist/rslib-runtime.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import "node:module";
|
|
2
|
-
var __webpack_modules__ = {};
|
|
3
|
-
var __webpack_module_cache__ = {};
|
|
4
|
-
function __webpack_require__(moduleId) {
|
|
5
|
-
var cachedModule = __webpack_module_cache__[moduleId];
|
|
6
|
-
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
7
|
-
var module = __webpack_module_cache__[moduleId] = {
|
|
8
|
-
exports: {}
|
|
9
|
-
};
|
|
10
|
-
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
11
|
-
return module.exports;
|
|
12
|
-
}
|
|
13
|
-
__webpack_require__.m = __webpack_modules__;
|
|
14
|
-
(()=>{
|
|
15
|
-
__webpack_require__.add = function(modules) {
|
|
16
|
-
Object.assign(__webpack_require__.m, modules);
|
|
17
|
-
};
|
|
18
|
-
})();
|
|
19
|
-
(()=>{
|
|
20
|
-
__webpack_require__.n = (module)=>{
|
|
21
|
-
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
22
|
-
__webpack_require__.d(getter, {
|
|
23
|
-
a: getter
|
|
24
|
-
});
|
|
25
|
-
return getter;
|
|
26
|
-
};
|
|
27
|
-
})();
|
|
28
|
-
(()=>{
|
|
29
|
-
__webpack_require__.d = (exports, definition)=>{
|
|
30
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: definition[key]
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
})();
|
|
36
|
-
(()=>{
|
|
37
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
38
|
-
})();
|
|
39
|
-
export { __webpack_require__ };
|