create-rstack 1.9.2 → 2.0.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.
- package/dist/index.d.ts +12 -2
- package/dist/index.js +23 -14
- package/package.json +7 -4
- package/template-biome/package.json +1 -1
- package/template-eslint/react-js/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 +1 -1
- package/template-eslint/vanilla-js/package.json +1 -1
- package/template-eslint/vanilla-ts/package.json +1 -1
- package/template-eslint/vue-js/package.json +1 -1
- package/template-eslint/vue-ts/package.json +1 -1
- package/template-prettier/package.json +1 -1
- package/template-rslint/AGENTS.md +5 -0
- package/template-rslint/package.json +11 -0
- package/template-rslint/rslint.config.ts +3 -0
package/dist/index.d.ts
CHANGED
|
@@ -122,7 +122,15 @@ declare type ExtraSkill = {
|
|
|
122
122
|
label: string;
|
|
123
123
|
source: string;
|
|
124
124
|
skill?: string;
|
|
125
|
-
|
|
125
|
+
/**
|
|
126
|
+
* Controls whether the skill is shown in the interactive prompt for the
|
|
127
|
+
* selected template/tools. Explicit `--skill` values and `--help` remain
|
|
128
|
+
* unfiltered so CLI input stays authoritative and help stays discoverable.
|
|
129
|
+
*/
|
|
130
|
+
when?: (context: {
|
|
131
|
+
templateName: string;
|
|
132
|
+
tools: string[];
|
|
133
|
+
}) => boolean;
|
|
126
134
|
order?: 'pre' | 'post';
|
|
127
135
|
};
|
|
128
136
|
|
|
@@ -157,7 +165,9 @@ declare type ExtraTool = {
|
|
|
157
165
|
* If returns false, the tool will not be shown in the selection.
|
|
158
166
|
* @default () => true
|
|
159
167
|
*/
|
|
160
|
-
when?: (
|
|
168
|
+
when?: (context: {
|
|
169
|
+
templateName: string;
|
|
170
|
+
}) => boolean;
|
|
161
171
|
};
|
|
162
172
|
|
|
163
173
|
export declare const groupMultiselect: <Value>(opts: GroupMultiSelectOptions<Value>) => Promise<Value[] | symbol>;
|
package/dist/index.js
CHANGED
|
@@ -2982,8 +2982,9 @@ function parseSkillsOption(skills) {
|
|
|
2982
2982
|
return skillsArr.flatMap((skill)=>skill.split(',')).map((skill)=>skill.trim()).filter(Boolean);
|
|
2983
2983
|
}
|
|
2984
2984
|
const BUILTIN_TOOLS = [
|
|
2985
|
-
'biome',
|
|
2986
2985
|
'eslint',
|
|
2986
|
+
'rslint',
|
|
2987
|
+
'biome',
|
|
2987
2988
|
'prettier'
|
|
2988
2989
|
];
|
|
2989
2990
|
function logHelpMessage(name, templates, extraTools, extraSkills) {
|
|
@@ -3023,7 +3024,9 @@ async function getTools({ tools, dir, template }, extraTools, templateName) {
|
|
|
3023
3024
|
const parsedTools = parseToolsOption(tools);
|
|
3024
3025
|
const filteredExtraTools = extraTools?.filter((tool)=>{
|
|
3025
3026
|
const when = tool.when ?? (()=>true);
|
|
3026
|
-
return templateName ? when(
|
|
3027
|
+
return templateName ? when({
|
|
3028
|
+
templateName
|
|
3029
|
+
}) : true;
|
|
3027
3030
|
});
|
|
3028
3031
|
if (null !== parsedTools) {
|
|
3029
3032
|
const toolsArr = parsedTools.filter((tool)=>BUILTIN_TOOLS.includes(tool) || filteredExtraTools?.some((extraTool)=>extraTool.value === tool));
|
|
@@ -3031,17 +3034,21 @@ async function getTools({ tools, dir, template }, extraTools, templateName) {
|
|
|
3031
3034
|
}
|
|
3032
3035
|
if (dir && template) return [];
|
|
3033
3036
|
const options = [
|
|
3034
|
-
{
|
|
3035
|
-
value: 'biome',
|
|
3036
|
-
label: 'Biome - linting & formatting'
|
|
3037
|
-
},
|
|
3038
3037
|
{
|
|
3039
3038
|
value: 'eslint',
|
|
3040
3039
|
label: 'ESLint - linting'
|
|
3041
3040
|
},
|
|
3041
|
+
{
|
|
3042
|
+
value: 'rslint',
|
|
3043
|
+
label: 'Rslint - linting (experimental)'
|
|
3044
|
+
},
|
|
3042
3045
|
{
|
|
3043
3046
|
value: 'prettier',
|
|
3044
3047
|
label: 'Prettier - formatting'
|
|
3048
|
+
},
|
|
3049
|
+
{
|
|
3050
|
+
value: 'biome',
|
|
3051
|
+
label: 'Biome - linting & formatting'
|
|
3045
3052
|
}
|
|
3046
3053
|
];
|
|
3047
3054
|
if (filteredExtraTools) {
|
|
@@ -3059,10 +3066,13 @@ async function getTools({ tools, dir, template }, extraTools, templateName) {
|
|
|
3059
3066
|
required: false
|
|
3060
3067
|
}));
|
|
3061
3068
|
}
|
|
3062
|
-
function filterExtraSkills(extraSkills, templateName) {
|
|
3069
|
+
function filterExtraSkills(extraSkills, templateName, tools = []) {
|
|
3063
3070
|
return extraSkills?.filter((extraSkill)=>{
|
|
3064
3071
|
const when = extraSkill.when ?? (()=>true);
|
|
3065
|
-
return templateName ? when(
|
|
3072
|
+
return templateName ? when({
|
|
3073
|
+
templateName,
|
|
3074
|
+
tools
|
|
3075
|
+
}) : true;
|
|
3066
3076
|
});
|
|
3067
3077
|
}
|
|
3068
3078
|
function orderExtraSkills(extraSkills) {
|
|
@@ -3073,10 +3083,10 @@ function orderExtraSkills(extraSkills) {
|
|
|
3073
3083
|
...extraSkills.filter((extraSkill)=>'post' === extraSkill.order)
|
|
3074
3084
|
];
|
|
3075
3085
|
}
|
|
3076
|
-
async function getSkills({ skill, dir, template }, extraSkills, templateName, promptMultiselect = yt) {
|
|
3086
|
+
async function getSkills({ skill, dir, template }, extraSkills, templateName, tools = [], promptMultiselect = yt) {
|
|
3077
3087
|
const parsedSkills = parseSkillsOption(skill);
|
|
3078
|
-
const filteredExtraSkills = filterExtraSkills(extraSkills, templateName);
|
|
3079
|
-
if (null !== parsedSkills) return parsedSkills.filter((value)=>
|
|
3088
|
+
const filteredExtraSkills = filterExtraSkills(extraSkills, templateName, tools);
|
|
3089
|
+
if (null !== parsedSkills) return parsedSkills.filter((value)=>extraSkills?.some((extraSkill)=>extraSkill.value === value));
|
|
3080
3090
|
if (dir && template) return [];
|
|
3081
3091
|
if (!filteredExtraSkills?.length) return [];
|
|
3082
3092
|
const orderedExtraSkills = orderExtraSkills(filteredExtraSkills);
|
|
@@ -3220,8 +3230,7 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
|
|
|
3220
3230
|
}
|
|
3221
3231
|
const templateName = await getTemplateName(argv);
|
|
3222
3232
|
const tools = await getTools(argv, extraTools, templateName);
|
|
3223
|
-
const
|
|
3224
|
-
const skills = await getSkills(argv, filteredExtraSkills, templateName, yt);
|
|
3233
|
+
const skills = await getSkills(argv, extraSkills, templateName, tools, yt);
|
|
3225
3234
|
const srcFolder = node_path.join(root, `template-${templateName}`);
|
|
3226
3235
|
const commonFolder = node_path.join(root, 'template-common');
|
|
3227
3236
|
if (!node_fs.existsSync(srcFolder)) throw new Error(`Invalid input: template "${templateName}" not found.`);
|
|
@@ -3240,7 +3249,7 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
|
|
|
3240
3249
|
templateParameters,
|
|
3241
3250
|
skipFiles
|
|
3242
3251
|
});
|
|
3243
|
-
const skillsByValue = new Map((
|
|
3252
|
+
const skillsByValue = new Map((extraSkills ?? []).map((extraSkill)=>[
|
|
3244
3253
|
extraSkill.value,
|
|
3245
3254
|
extraSkill
|
|
3246
3255
|
]));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-rstack",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Create a new Rstack project",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -19,13 +19,15 @@
|
|
|
19
19
|
"files": [
|
|
20
20
|
"template-biome",
|
|
21
21
|
"template-eslint",
|
|
22
|
+
"template-rslint",
|
|
22
23
|
"template-prettier",
|
|
23
24
|
"dist"
|
|
24
25
|
],
|
|
25
26
|
"scripts": {
|
|
26
27
|
"build": "rslib",
|
|
27
28
|
"dev": "rslib --watch",
|
|
28
|
-
"lint": "rslint",
|
|
29
|
+
"lint": "rslint && prettier . --check",
|
|
30
|
+
"lint:fix": "rslint --fix && prettier . --write",
|
|
29
31
|
"prepare": "simple-git-hooks && rslib",
|
|
30
32
|
"test": "rstest",
|
|
31
33
|
"bump": "npx bumpp"
|
|
@@ -35,14 +37,15 @@
|
|
|
35
37
|
},
|
|
36
38
|
"nano-staged": {
|
|
37
39
|
"*.{js,jsx,ts,tsx,mjs,cjs}": [
|
|
38
|
-
"rslint
|
|
40
|
+
"rslint",
|
|
41
|
+
"prettier --write"
|
|
39
42
|
]
|
|
40
43
|
},
|
|
41
44
|
"devDependencies": {
|
|
42
45
|
"@clack/prompts": "^1.2.0",
|
|
43
46
|
"@microsoft/api-extractor": "^7.58.2",
|
|
44
47
|
"@rslib/core": "0.21.0",
|
|
45
|
-
"@rslint/core": "^0.4.
|
|
48
|
+
"@rslint/core": "^0.4.2",
|
|
46
49
|
"@rstest/core": "0.9.7",
|
|
47
50
|
"@types/fs-extra": "^11.0.4",
|
|
48
51
|
"@types/minimist": "^1.2.5",
|