create-rstack 1.7.18 → 1.7.20

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
@@ -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
@@ -2112,11 +2112,13 @@ const BUILTIN_TOOLS = [
2112
2112
  'prettier'
2113
2113
  ];
2114
2114
  function logHelpMessage(name, templates, extraTools) {
2115
- const extraToolNames = extraTools?.map((tool)=>tool.value) ?? [];
2116
2115
  const toolsList = [
2117
- ...BUILTIN_TOOLS,
2118
- ...extraToolNames
2119
- ].join(', ');
2116
+ ...BUILTIN_TOOLS
2117
+ ];
2118
+ if (extraTools) {
2119
+ for (const tool of extraTools)if (tool.value) if ('pre' === tool.order) toolsList.unshift(tool.value);
2120
+ else toolsList.push(tool.value);
2121
+ }
2120
2122
  src_logger.log(`
2121
2123
  Usage: create-${name} [dir] [options]
2122
2124
 
@@ -2125,13 +2127,15 @@ function logHelpMessage(name, templates, extraTools) {
2125
2127
  -h, --help display help for command
2126
2128
  -d, --dir <dir> create project in specified directory
2127
2129
  -t, --template <tpl> specify the template to use
2128
- --tools <tool> select additional tools (${toolsList})
2130
+ --tools <tool> add additional tools, comma separated
2129
2131
  --override override files in target directory
2130
2132
  --packageName <name> specify the package name
2131
2133
 
2132
- Templates:
2133
-
2134
+ Available templates:
2134
2135
  ${templates.join(', ')}
2136
+
2137
+ Optional tools:
2138
+ ${toolsList.join(', ')}
2135
2139
  `);
2136
2140
  }
2137
2141
  async function getTools({ tools, dir, template }, extraTools) {
@@ -2144,22 +2148,26 @@ async function getTools({ tools, dir, template }, extraTools) {
2144
2148
  const options = [
2145
2149
  {
2146
2150
  value: 'biome',
2147
- label: 'Biome (linting & formatting)'
2151
+ label: 'Biome - linting & formatting'
2148
2152
  },
2149
2153
  {
2150
2154
  value: 'eslint',
2151
- label: 'ESLint (linting)'
2155
+ label: 'ESLint - linting'
2152
2156
  },
2153
2157
  {
2154
2158
  value: 'prettier',
2155
- label: 'Prettier (formatting)'
2159
+ label: 'Prettier - formatting'
2156
2160
  }
2157
2161
  ];
2158
- if (extraTools) options.push(...extraTools.map((tool)=>({
2159
- value: tool.value,
2160
- label: tool.label,
2161
- hint: tool.command
2162
- })));
2162
+ if (extraTools) {
2163
+ const normalize = (tool)=>({
2164
+ value: tool.value,
2165
+ label: tool.label,
2166
+ hint: tool.command
2167
+ });
2168
+ options.unshift(...extraTools.filter((tool)=>'pre' === tool.order).map(normalize));
2169
+ options.push(...extraTools.filter((tool)=>'pre' !== tool.order).map(normalize));
2170
+ }
2163
2171
  return checkCancel(await fe({
2164
2172
  message: 'Select additional tools (Use <space> to select, <enter> to continue)',
2165
2173
  options,
@@ -2192,7 +2200,7 @@ function runCommand(command, cwd, packageManager) {
2192
2200
  deno: 'deno run -A npm:create-'
2193
2201
  };
2194
2202
  const replacement = createReplacements[packageManager];
2195
- if (replacement) command = command.replace(/^npm create /, replacement).replace(/ -- --/, ' --');
2203
+ if (replacement) command = command.replace('npm create ', replacement).replace(' -- --', ' --');
2196
2204
  if ('yarn' === packageManager) command = command.replace('@latest', '');
2197
2205
  }
2198
2206
  const [bin, ...args] = command.split(' ');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-rstack",
3
- "version": "1.7.18",
3
+ "version": "1.7.20",
4
4
  "description": "Create a new Rstack project",
5
5
  "repository": {
6
6
  "type": "git",