diff --git a/src/index.ts b/src/index.ts index a537d50..0286ad7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -105,8 +105,19 @@ function logHelpMessage( templates: string[], extraTools?: ExtraTool[], ) { - const extraToolNames = extraTools?.map((tool) => tool.value) ?? []; - const toolsList = [...BUILTIN_TOOLS, ...extraToolNames].join(', '); + const toolsList = [...BUILTIN_TOOLS]; + if (extraTools) { + for (const tool of extraTools) { + if (!tool.value) { + continue; + } + if (tool.order === 'pre') { + toolsList.unshift(tool.value); + } else { + toolsList.push(tool.value); + } + } + } logger.log(` Usage: create-${name} [dir] [options] @@ -116,13 +127,15 @@ function logHelpMessage( -h, --help display help for command -d, --dir create project in specified directory -t, --template specify the template to use - --tools select additional tools (${toolsList}) + --tools add additional tools, comma separated --override override files in target directory --packageName specify the package name - Templates: - + Available templates: ${templates.join(', ')} + + Optional tools: + ${toolsList.join(', ')} `); } diff --git a/test/help.test.ts b/test/help.test.ts index 86b7a6e..96a417f 100644 --- a/test/help.test.ts +++ b/test/help.test.ts @@ -28,7 +28,5 @@ test('help message includes extra tools', async () => { } const logOutput = logs.join('\n'); - expect(logOutput).toContain( - '--tools select additional tools (biome, eslint, prettier, custom-tool)', - ); + expect(logOutput).toContain('biome, eslint, prettier, custom-tool'); });