skuba 13.0.3 → 13.1.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.
Files changed (109) hide show
  1. package/lib/cli/adapter/eslint.js +3 -3
  2. package/lib/cli/adapter/eslint.js.map +3 -3
  3. package/lib/cli/build/assets.d.ts +3 -2
  4. package/lib/cli/build/assets.js +2 -2
  5. package/lib/cli/build/assets.js.map +3 -3
  6. package/lib/cli/build/esbuild.js +3 -12
  7. package/lib/cli/build/esbuild.js.map +3 -3
  8. package/lib/cli/build/index.js +3 -13
  9. package/lib/cli/build/index.js.map +3 -3
  10. package/lib/cli/build/tsc.js +1 -2
  11. package/lib/cli/build/tsc.js.map +2 -2
  12. package/lib/cli/configure/analysis/diff.js +3 -13
  13. package/lib/cli/configure/analysis/diff.js.map +3 -3
  14. package/lib/cli/configure/ensureTemplateCompletion.js +5 -2
  15. package/lib/cli/configure/ensureTemplateCompletion.js.map +3 -3
  16. package/lib/cli/configure/getEntryPoint.d.ts +1 -1
  17. package/lib/cli/configure/getEntryPoint.js +8 -10
  18. package/lib/cli/configure/getEntryPoint.js.map +3 -3
  19. package/lib/cli/configure/getProjectType.js +4 -6
  20. package/lib/cli/configure/getProjectType.js.map +2 -2
  21. package/lib/cli/configure/index.js +12 -11
  22. package/lib/cli/configure/index.js.map +2 -2
  23. package/lib/cli/format/index.js +4 -14
  24. package/lib/cli/format/index.js.map +3 -3
  25. package/lib/cli/init/getConfig.d.ts +1 -1
  26. package/lib/cli/init/getConfig.js +35 -42
  27. package/lib/cli/init/getConfig.js.map +3 -3
  28. package/lib/cli/init/git.js +2 -2
  29. package/lib/cli/init/git.js.map +3 -3
  30. package/lib/cli/init/prompts.d.ts +13 -10
  31. package/lib/cli/init/prompts.js +26 -36
  32. package/lib/cli/init/prompts.js.map +3 -3
  33. package/lib/cli/init/types.d.ts +1 -1
  34. package/lib/cli/lint/autofix.js +2 -2
  35. package/lib/cli/lint/autofix.js.map +3 -3
  36. package/lib/cli/lint/eslint.js +2 -2
  37. package/lib/cli/lint/eslint.js.map +3 -3
  38. package/lib/cli/lint/index.js +1 -3
  39. package/lib/cli/lint/index.js.map +2 -2
  40. package/lib/cli/lint/internal.js +6 -14
  41. package/lib/cli/lint/internal.js.map +3 -3
  42. package/lib/cli/lint/internalLints/noSkubaTemplateJs.js +3 -5
  43. package/lib/cli/lint/internalLints/noSkubaTemplateJs.js.map +3 -3
  44. package/lib/cli/lint/internalLints/refreshConfigFiles.js +1 -3
  45. package/lib/cli/lint/internalLints/refreshConfigFiles.js.map +2 -2
  46. package/lib/cli/lint/internalLints/upgrade/index.js +1 -3
  47. package/lib/cli/lint/internalLints/upgrade/index.js.map +2 -2
  48. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js +17 -21
  49. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js.map +2 -2
  50. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js +0 -5
  51. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js.map +2 -2
  52. package/lib/cli/lint/prettier.js +2 -2
  53. package/lib/cli/lint/prettier.js.map +3 -3
  54. package/lib/utils/dir.js +3 -2
  55. package/lib/utils/dir.js.map +2 -2
  56. package/lib/utils/exec.d.ts +3 -2
  57. package/lib/utils/exec.js +1 -1
  58. package/lib/utils/exec.js.map +2 -2
  59. package/lib/utils/fs.d.ts +1 -0
  60. package/lib/utils/fs.js +51 -0
  61. package/lib/utils/fs.js.map +7 -0
  62. package/lib/utils/logging.d.ts +9 -10
  63. package/lib/utils/logging.js +9 -19
  64. package/lib/utils/logging.js.map +3 -3
  65. package/lib/utils/logo.js +11 -18
  66. package/lib/utils/logo.js.map +3 -3
  67. package/lib/utils/sleep.d.ts +5 -0
  68. package/lib/utils/sleep.js +35 -0
  69. package/lib/utils/sleep.js.map +7 -0
  70. package/lib/utils/wait.d.ts +0 -4
  71. package/lib/utils/wait.js +2 -10
  72. package/lib/utils/wait.js.map +2 -2
  73. package/lib/utils/worker.d.ts +3 -3
  74. package/lib/wrapper/http.d.ts +0 -6
  75. package/lib/wrapper/http.js +4 -12
  76. package/lib/wrapper/http.js.map +2 -2
  77. package/lib/wrapper/requestListener.js +3 -2
  78. package/lib/wrapper/requestListener.js.map +2 -2
  79. package/lib/wrapper/server.d.ts +7 -0
  80. package/lib/wrapper/server.js +35 -0
  81. package/lib/wrapper/server.js.map +7 -0
  82. package/package.json +16 -18
  83. package/template/base/_pnpm-workspace.yaml +1 -0
  84. package/template/express-rest-api/.buildkite/pipeline.yml +1 -1
  85. package/template/express-rest-api/.gantry/dev.yml +2 -2
  86. package/template/express-rest-api/.gantry/prod.yml +2 -2
  87. package/template/express-rest-api/package.json +5 -5
  88. package/template/greeter/.buildkite/pipeline.yml +1 -1
  89. package/template/greeter/package.json +2 -2
  90. package/template/koa-rest-api/.buildkite/pipeline.yml +1 -1
  91. package/template/koa-rest-api/.gantry/dev.yml +2 -2
  92. package/template/koa-rest-api/.gantry/prod.yml +2 -2
  93. package/template/koa-rest-api/package.json +5 -5
  94. package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +2 -2
  95. package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +2 -4
  96. package/template/lambda-sqs-worker-cdk/infra/appStack.ts +1 -1
  97. package/template/lambda-sqs-worker-cdk/infra/config.ts +2 -4
  98. package/template/lambda-sqs-worker-cdk/package.json +3 -2
  99. package/template/lambda-sqs-worker-cdk/skuba.template.js +12 -0
  100. package/template/oss-npm-package/.github/workflows/release.yml +2 -2
  101. package/template/oss-npm-package/.github/workflows/validate.yml +2 -2
  102. package/template/private-npm-package/skuba.template.js +1 -1
  103. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.d.ts +0 -2
  104. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.js +0 -144
  105. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.js.map +0 -7
  106. package/lib/enquirer.d.js +0 -2
  107. package/lib/enquirer.d.js.map +0 -7
  108. package/lib/eslint.d.js +0 -2
  109. package/lib/eslint.d.js.map +0 -7
@@ -31,15 +31,15 @@ __export(eslint_exports, {
31
31
  runESLint: () => runESLint
32
32
  });
33
33
  module.exports = __toCommonJS(eslint_exports);
34
+ var import_node_util = require("node:util");
34
35
  var import_path = __toESM(require("path"));
35
- var import_chalk = __toESM(require("chalk"));
36
36
  var import_eslint = require("eslint");
37
37
  var import_logging = require("../../utils/logging.js");
38
38
  const symbolForResult = (result) => {
39
39
  if (result.errorCount) {
40
- return import_chalk.default.red("\u25CB");
40
+ return (0, import_node_util.styleText)("red", "\u25CB");
41
41
  }
42
- return result.warningCount ? import_chalk.default.yellow("\u25CD") : import_chalk.default.green("\u25CB");
42
+ return result.warningCount ? (0, import_node_util.styleText)("yellow", "\u25CD") : (0, import_node_util.styleText)("green", "\u25CB");
43
43
  };
44
44
  const runESLint = async (mode, logger, overrideConfigFile) => {
45
45
  logger.debug("Initialising ESLint...");
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/adapter/eslint.ts"],
4
- "sourcesContent": ["import path from 'path';\n\nimport chalk from 'chalk';\nimport { type ESLint, type Linter, loadESLint } from 'eslint';\n\nimport { type Logger, pluralise } from '../../utils/logging.js';\n\nconst symbolForResult = (result: ESLint.LintResult) => {\n if (result.errorCount) {\n return chalk.red('\u25CB');\n }\n\n return result.warningCount ? chalk.yellow('\u25CD') : chalk.green('\u25CB');\n};\n\nexport interface ESLintResult {\n messages: Linter.LintMessage[];\n filePath: string;\n}\n\nexport interface ESLintOutput {\n errors: ESLintResult[];\n fixable: boolean;\n ok: boolean;\n output: string;\n warnings: ESLintResult[];\n}\n\nexport const runESLint = async (\n mode: 'format' | 'lint',\n logger: Logger,\n overrideConfigFile?: string,\n): Promise<ESLintOutput> => {\n logger.debug('Initialising ESLint...');\n\n const cwd = process.cwd();\n\n const ESLint = await loadESLint({ useFlatConfig: true });\n const engine = new ESLint({\n cache: true,\n fix: mode === 'format',\n overrideConfigFile,\n overrideConfig: {\n linterOptions: {\n reportUnusedDisableDirectives: true,\n },\n },\n });\n\n logger.debug('Processing files...');\n\n const start = process.hrtime.bigint();\n\n const [formatter, { type, results }] = await Promise.all([\n engine.loadFormatter(),\n lintFiles(engine),\n ]);\n\n if (type === 'no-config') {\n logger.plain(\n 'skuba could not find an eslint config file. Do you need to run format or configure?',\n );\n return { ok: false, fixable: false, errors: [], warnings: [], output: '' };\n }\n\n const end = process.hrtime.bigint();\n\n logger.plain(\n `Processed ${pluralise(results.length, 'file')} in ${logger.timing(\n start,\n end,\n )}.`,\n );\n\n const errors: ESLintResult[] = [];\n const warnings: ESLintResult[] = [];\n let fixable = false;\n\n for (const result of results) {\n const relativePath = path.relative(cwd, result.filePath);\n if (result.fixableErrorCount + result.fixableWarningCount) {\n fixable = true;\n }\n\n if (result.errorCount) {\n errors.push({\n filePath: relativePath,\n messages: result.messages,\n });\n }\n\n if (result.warningCount) {\n warnings.push({\n filePath: relativePath,\n messages: result.messages,\n });\n }\n\n logger.debug(symbolForResult(result), relativePath);\n }\n\n const ok = errors.length === 0;\n\n await ESLint.outputFixes(results);\n\n const output = await formatter.format(\n results,\n engine.getRulesMetaForResults(results),\n );\n\n if (output) {\n logger.plain(output);\n }\n\n return { errors, fixable, ok, output, warnings };\n};\n\nconst lintFiles = async (engine: ESLint) => {\n try {\n const result = await engine.lintFiles([]);\n return { type: 'results', results: result } as const;\n } catch (error) {\n if (\n error instanceof Error &&\n error.message === 'Could not find config file.'\n ) {\n return { type: 'no-config', results: undefined } as const;\n }\n throw error;\n }\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,mBAAkB;AAClB,oBAAqD;AAErD,qBAAuC;AAEvC,MAAM,kBAAkB,CA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,gBAAU;AAAA,IACZ;AAEA,QAAI,OAAO,YAAY;AACrB,aAAO,KAAK;AAAA,QACV,UAAU;AAAA,QACV,UAAU,OAAO;AAAA,MACnB,CAAC;AAAA,IACH;AAEA,QAAI,OAAO,cAAc;AACvB,eAAS,KAAK;AAAA,QACZ,UAAU;AAAA,QACV,UAAU,OAAO;AAAA,MACnB,CAAC;AAAA,IACH;AAEA,WAAO,MAAM,gBAAgB,MAAM,GAAG,YAAY;AAAA,EACpD;AAEA,QAAM,KAAK,OAAO,WAAW;AAE7B,QAAM,OAAO,YAAY,OAAO;AAEhC,QAAM,SAAS,MAAM,UAAU;AAAA,IAC7B;AAAA,IACA,OAAO,uBAAuB,OAAO;AAAA,EACvC;AAEA,MAAI,QAAQ;AACV,WAAO,MAAM,MAAM;AAAA,EACrB;AAEA,SAAO,EAAE,QAAQ,SAAS,IAAI,QAAQ,SAAS;AACjD;AAEA,MAAM,YAAY,OAAO,WAAmB;AAC1C,MAAI;AACF,UAAM,SAAS,MAAM,OAAO,UAAU,CAAC,CAAC;AACxC,WAAO,EAAE,MAAM,WAAW,SAAS,OAAO;AAAA,EAC5C,SAAS,OAAO;AACd,QACE,iBAAiB,SACjB,MAAM,YAAY,+BAClB;AACA,aAAO,EAAE,MAAM,aAAa,SAAS,OAAU;AAAA,IACjD;AACA,UAAM;AAAA,EACR;AACF;",
6
- "names": ["chalk", "path"]
4
+ "sourcesContent": ["import { styleText } from 'node:util';\nimport path from 'path';\n\nimport { type ESLint, type Linter, loadESLint } from 'eslint';\n\nimport { type Logger, pluralise } from '../../utils/logging.js';\n\nconst symbolForResult = (result: ESLint.LintResult) => {\n if (result.errorCount) {\n return styleText('red', '\u25CB');\n }\n\n return result.warningCount\n ? styleText('yellow', '\u25CD')\n : styleText('green', '\u25CB');\n};\n\nexport interface ESLintResult {\n messages: Linter.LintMessage[];\n filePath: string;\n}\n\nexport interface ESLintOutput {\n errors: ESLintResult[];\n fixable: boolean;\n ok: boolean;\n output: string;\n warnings: ESLintResult[];\n}\n\nexport const runESLint = async (\n mode: 'format' | 'lint',\n logger: Logger,\n overrideConfigFile?: string,\n): Promise<ESLintOutput> => {\n logger.debug('Initialising ESLint...');\n\n const cwd = process.cwd();\n\n const ESLint = await loadESLint({ useFlatConfig: true });\n const engine = new ESLint({\n cache: true,\n fix: mode === 'format',\n overrideConfigFile,\n overrideConfig: {\n linterOptions: {\n reportUnusedDisableDirectives: true,\n },\n },\n });\n\n logger.debug('Processing files...');\n\n const start = process.hrtime.bigint();\n\n const [formatter, { type, results }] = await Promise.all([\n engine.loadFormatter(),\n lintFiles(engine),\n ]);\n\n if (type === 'no-config') {\n logger.plain(\n 'skuba could not find an eslint config file. Do you need to run format or configure?',\n );\n return { ok: false, fixable: false, errors: [], warnings: [], output: '' };\n }\n\n const end = process.hrtime.bigint();\n\n logger.plain(\n `Processed ${pluralise(results.length, 'file')} in ${logger.timing(\n start,\n end,\n )}.`,\n );\n\n const errors: ESLintResult[] = [];\n const warnings: ESLintResult[] = [];\n let fixable = false;\n\n for (const result of results) {\n const relativePath = path.relative(cwd, result.filePath);\n if (result.fixableErrorCount + result.fixableWarningCount) {\n fixable = true;\n }\n\n if (result.errorCount) {\n errors.push({\n filePath: relativePath,\n messages: result.messages,\n });\n }\n\n if (result.warningCount) {\n warnings.push({\n filePath: relativePath,\n messages: result.messages,\n });\n }\n\n logger.debug(symbolForResult(result), relativePath);\n }\n\n const ok = errors.length === 0;\n\n await ESLint.outputFixes(results);\n\n const output = await formatter.format(\n results,\n engine.getRulesMetaForResults(results),\n );\n\n if (output) {\n logger.plain(output);\n }\n\n return { errors, fixable, ok, output, warnings };\n};\n\nconst lintFiles = async (engine: ESLint) => {\n try {\n const result = await engine.lintFiles([]);\n return { type: 'results', results: result } as const;\n } catch (error) {\n if (\n error instanceof Error &&\n error.message === 'Could not find config file.'\n ) {\n return { type: 'no-config', results: undefined } as const;\n }\n throw error;\n }\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;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AAS;AAC5B,UAAM,eAAe,YAAAA,QAAK,SAAS,KAAK,OAAO,QAAQ;AACvD,QAAI,OAAO,oBAAoB,OAAO,qBAAqB;AACzD,gBAAU;AAAA,IACZ;AAEA,QAAI,OAAO,YAAY;AACrB,aAAO,KAAK;AAAA,QACV,UAAU;AAAA,QACV,UAAU,OAAO;AAAA,MACnB,CAAC;AAAA,IACH;AAEA,QAAI,OAAO,cAAc;AACvB,eAAS,KAAK;AAAA,QACZ,UAAU;AAAA,QACV,UAAU,OAAO;AAAA,MACnB,CAAC;AAAA,IACH;AAEA,WAAO,MAAM,gBAAgB,MAAM,GAAG,YAAY;AAAA,EACpD;AAEA,QAAM,KAAK,OAAO,WAAW;AAE7B,QAAM,OAAO,YAAY,OAAO;AAEhC,QAAM,SAAS,MAAM,UAAU;AAAA,IAC7B;AAAA,IACA,OAAO,uBAAuB,OAAO;AAAA,EACvC;AAEA,MAAI,QAAQ;AACV,WAAO,MAAM,MAAM;AAAA,EACrB;AAEA,SAAO,EAAE,QAAQ,SAAS,IAAI,QAAQ,SAAS;AACjD;AAEA,MAAM,YAAY,OAAO,WAAmB;AAC1C,MAAI;AACF,UAAM,SAAS,MAAM,OAAO,UAAU,CAAC,CAAC;AACxC,WAAO,EAAE,MAAM,WAAW,SAAS,OAAO;AAAA,EAC5C,SAAS,OAAO;AACd,QACE,iBAAiB,SACjB,MAAM,YAAY,+BAClB;AACA,aAAO,EAAE,MAAM,aAAa,SAAS,OAAU;AAAA,IACjD;AACA,UAAM;AAAA,EACR;AACF;",
6
+ "names": ["path"]
7
7
  }
@@ -1,10 +1,11 @@
1
- import { type Color } from 'chalk';
1
+ import { styleText } from 'node:util';
2
2
  import { type Logger } from '../../utils/logging.js';
3
+ type StyleColor = Parameters<typeof styleText>[0];
3
4
  export declare const copyAssets: (destinationDir: string, logger?: Logger) => Promise<void>;
4
5
  interface CopyAssetsConfig {
5
6
  outDir: string;
6
7
  name: string;
7
- prefixColor: typeof Color;
8
+ prefixColor: StyleColor;
8
9
  }
9
10
  export declare const copyAssetsConcurrently: (configs: CopyAssetsConfig[]) => Promise<void>;
10
11
  export {};
@@ -32,8 +32,8 @@ __export(assets_exports, {
32
32
  copyAssetsConcurrently: () => copyAssetsConcurrently
33
33
  });
34
34
  module.exports = __toCommonJS(assets_exports);
35
+ var import_node_util = require("node:util");
35
36
  var import_path = __toESM(require("path"));
36
- var import_chalk = __toESM(require("chalk"));
37
37
  var import_fs_extra = __toESM(require("fs-extra"));
38
38
  var import_copy = require("../../utils/copy.js");
39
39
  var import_dir = require("../../utils/dir.js");
@@ -89,7 +89,7 @@ const copyAssetsConcurrently = async (configs) => {
89
89
  outDir,
90
90
  (0, import_logging.createLogger)({
91
91
  debug: false,
92
- prefixes: [import_chalk.default[prefixColor](`${name.padEnd(maxNameLength)} \u2502`)]
92
+ prefixes: [(0, import_node_util.styleText)(prefixColor, `${name.padEnd(maxNameLength)} \u2502`)]
93
93
  })
94
94
  )
95
95
  )
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/build/assets.ts"],
4
- "sourcesContent": ["import path from 'path';\n\nimport chalk, { type Color } from 'chalk';\nimport fs from 'fs-extra';\n\nimport { copyFile } from '../../utils/copy.js';\nimport { buildPatternToFilepathMap, crawlDirectory } from '../../utils/dir.js';\nimport { type Logger, createLogger, log } from '../../utils/logging.js';\nimport {\n getEntryPointFromManifest,\n getManifestProperties,\n} from '../../utils/manifest.js';\n\nexport const copyAssets = async (\n destinationDir: string,\n logger: Logger = log,\n) => {\n const manifest = await getManifestProperties<string, string[]>('assets');\n\n if (!manifest?.value) {\n return;\n }\n\n const entryPoint = await getEntryPointFromManifest();\n if (!entryPoint) {\n return;\n }\n\n const pathSegments = entryPoint.split(path.sep);\n const srcDir = (pathSegments.length > 1 && pathSegments[0]) || '';\n const resolvedSrcDir = path.resolve(path.dirname(manifest.path), srcDir);\n const resolvedDestinationDir = path.resolve(\n path.dirname(manifest.path),\n destinationDir,\n );\n\n const allFiles = await crawlDirectory(resolvedSrcDir);\n const filesByPattern = buildPatternToFilepathMap(manifest.value, allFiles, {\n cwd: resolvedSrcDir,\n dot: true,\n });\n const matchedFiles = Array.from(\n new Set(Object.values(filesByPattern).flat()),\n );\n\n await Promise.all(\n matchedFiles.map(async (filename) => {\n logger.subtle(`Copying ${filename}`);\n\n await fs.promises.mkdir(\n path.dirname(path.join(resolvedDestinationDir, filename)),\n { recursive: true },\n );\n await copyFile(\n path.join(resolvedSrcDir, filename),\n path.join(resolvedDestinationDir, filename),\n { processors: [] },\n );\n }),\n );\n};\n\ninterface CopyAssetsConfig {\n outDir: string;\n name: string;\n prefixColor: typeof Color;\n}\n\nexport const copyAssetsConcurrently = async (configs: CopyAssetsConfig[]) => {\n const maxNameLength = configs.reduce(\n (length, command) => Math.max(length, command.name.length),\n 0,\n );\n\n await Promise.all(\n configs.map(async ({ outDir, name, prefixColor }) =>\n copyAssets(\n outDir,\n createLogger({\n debug: false,\n prefixes: [chalk[prefixColor](`${name.padEnd(maxNameLength)} \u2502`)],\n }),\n ),\n ),\n );\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,mBAAkC;AAClC,sBAAe;AAEf,kBAAyB;AACzB,iBAA0D;AAC1D,qBAA+C;AAC/C,sBAGO;AAEA,MAAM,aAAa,OACxB,gBACA,SAAiB,uBACd;AACH,QAAM,WAAW,UAAM,uCAAwC,QAAQ;AAEvE,MAAI,CAAC,UAAU,OAAO;AACpB;AAAA,EACF;AAEA,QAAM,aAAa,UAAM,2CAA0B;AACnD,MAAI,CAAC,YAAY;AACf;AAAA,EACF;AAEA,QAAM,eAAe,WAAW,MAAM,YAAAA,QAAK,GAAG;AAC9C,QAAM,SAAU,aAAa,SAAS,KAAK,aAAa,CAAC,KAAM;AAC/D,QAAM,iBAAiB,YAAAA,QAAK,QAAQ,YAAAA,QAAK,QA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6
- "names": ["path", "fs", "chalk"]
4
+ "sourcesContent": ["import { styleText } from 'node:util';\nimport path from 'path';\n\nimport fs from 'fs-extra';\n\nimport { copyFile } from '../../utils/copy.js';\nimport { buildPatternToFilepathMap, crawlDirectory } from '../../utils/dir.js';\nimport { type Logger, createLogger, log } from '../../utils/logging.js';\nimport {\n getEntryPointFromManifest,\n getManifestProperties,\n} from '../../utils/manifest.js';\n\ntype StyleColor = Parameters<typeof styleText>[0];\n\nexport const copyAssets = async (\n destinationDir: string,\n logger: Logger = log,\n) => {\n const manifest = await getManifestProperties<string, string[]>('assets');\n\n if (!manifest?.value) {\n return;\n }\n\n const entryPoint = await getEntryPointFromManifest();\n if (!entryPoint) {\n return;\n }\n\n const pathSegments = entryPoint.split(path.sep);\n const srcDir = (pathSegments.length > 1 && pathSegments[0]) || '';\n const resolvedSrcDir = path.resolve(path.dirname(manifest.path), srcDir);\n const resolvedDestinationDir = path.resolve(\n path.dirname(manifest.path),\n destinationDir,\n );\n\n const allFiles = await crawlDirectory(resolvedSrcDir);\n const filesByPattern = buildPatternToFilepathMap(manifest.value, allFiles, {\n cwd: resolvedSrcDir,\n dot: true,\n });\n const matchedFiles = Array.from(\n new Set(Object.values(filesByPattern).flat()),\n );\n\n await Promise.all(\n matchedFiles.map(async (filename) => {\n logger.subtle(`Copying ${filename}`);\n\n await fs.promises.mkdir(\n path.dirname(path.join(resolvedDestinationDir, filename)),\n { recursive: true },\n );\n await copyFile(\n path.join(resolvedSrcDir, filename),\n path.join(resolvedDestinationDir, filename),\n { processors: [] },\n );\n }),\n );\n};\n\ninterface CopyAssetsConfig {\n outDir: string;\n name: string;\n prefixColor: StyleColor;\n}\n\nexport const copyAssetsConcurrently = async (configs: CopyAssetsConfig[]) => {\n const maxNameLength = configs.reduce(\n (length, command) => Math.max(length, command.name.length),\n 0,\n );\n\n await Promise.all(\n configs.map(async ({ outDir, name, prefixColor }) =>\n copyAssets(\n outDir,\n createLogger({\n debug: false,\n prefixes: [styleText(pref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A,QACJ,YAAAA,QAAK,KAAK,gBAAgB,QAAQ;AAAA,QAClC,YAAAA,QAAK,KAAK,wBAAwB,QAAQ;AAAA,QAC1C,EAAE,YAAY,CAAC,EAAE;AAAA,MACnB;AAAA,IACF,CAAC;AAAA,EACH;AACF;AAQO,MAAM,yBAAyB,OAAO,YAAgC;AAC3E,QAAM,gBAAgB,QAAQ;AAAA,IAC5B,CAAC,QAAQ,YAAY,KAAK,IAAI,QAAQ,QAAQ,KAAK,MAAM;AAAA,IACzD;AAAA,EACF;AAEA,QAAM,QAAQ;AAAA,IACZ,QAAQ;AAAA,MAAI,OAAO,EAAE,QAAQ,MAAM,YAAY,MAC7C;AAAA,QACE;AAAA,YACA,6BAAa;AAAA,UACX,OAAO;AAAA,UACP,UAAU,KAAC,4BAAU,aAAa,GAAG,KAAK,OAAO,aAAa,CAAC,SAAI,CAAC;AAAA,QACtE,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;",
6
+ "names": ["path", "fs"]
7
7
  }
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
  var esbuild_exports = {};
30
20
  __export(esbuild_exports, {
@@ -32,7 +22,7 @@ __export(esbuild_exports, {
32
22
  });
33
23
  module.exports = __toCommonJS(esbuild_exports);
34
24
  var import_util = require("util");
35
- var import_tsconfig_paths = __toESM(require("@esbuild-plugins/tsconfig-paths"));
25
+ var import_tsconfig_paths = require("@esbuild-plugins/tsconfig-paths");
36
26
  var import_esbuild = require("esbuild");
37
27
  var import_typescript = require("typescript");
38
28
  var import_logging = require("../../utils/logging.js");
@@ -71,7 +61,8 @@ const esbuild = async ({ debug, type }, args = process.argv.slice(2)) => {
71
61
  platform: compilerOptions.moduleResolution === import_typescript.ModuleResolutionKind.NodeJs || compilerOptions.moduleResolution === import_typescript.ModuleResolutionKind.Node16 ? "node" : void 0,
72
62
  plugins: bundle ? [] : [
73
63
  // evanw/esbuild#394
74
- (0, import_tsconfig_paths.default)({
64
+ // eslint-disable-next-line new-cap
65
+ (0, import_tsconfig_paths.TsconfigPathsPlugin)({
75
66
  tsconfig: { baseUrl: compilerOptions.baseUrl, compilerOptions }
76
67
  })
77
68
  ],
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/build/esbuild.ts"],
4
- "sourcesContent": ["import { inspect } from 'util';\n\nimport tsconfigPaths from '@esbuild-plugins/tsconfig-paths';\nimport { build } from 'esbuild';\nimport { ModuleKind, ModuleResolutionKind, ScriptTarget } from 'typescript';\n\nimport { createLogger } from '../../utils/logging.js';\n\nimport { parseTscArgs } from './args.js';\nimport { getCustomConditions, readTsBuildConfig, tsc } from './tsc.js';\n\ninterface EsbuildParameters {\n debug: boolean;\n type: string | undefined;\n}\n\nexport const esbuild = async (\n { debug, type }: EsbuildParameters,\n args = process.argv.slice(2),\n) => {\n const log = createLogger({ debug });\n\n const tscArgs = parseTscArgs(args);\n\n const customConditions = getCustomConditions();\n\n if (tscArgs.build) {\n log.err(\n 'skuba does not currently support the tsc --build flag with esbuild',\n );\n process.exitCode = 1;\n return;\n }\n\n const parsedCommandLine = readTsBuildConfig(args, log);\n\n if (!parsedCommandLine || process.exitCode) {\n return;\n }\n\n const { fileNames: entryPoints, options: compilerOptions } =\n parsedCommandLine;\n\n log.debug(log.bold('Files'));\n entryPoints.forEach((filepath) => log.debug(filepath));\n\n log.debug(log.bold('Compiler options'));\n log.debug(inspect(compilerOptions));\n\n const start = process.hrtime.bigint();\n\n // TODO: support `bundle`, `minify`, `splitting`, `treeShaking`\n const bundle = false;\n\n const isEsm =\n compilerOptions.module !== ModuleKind.CommonJS && type === 'module';\n\n await build({\n bundle,\n entryPoints,\n format: !isEsm ? 'cjs' : undefined,\n outdir: compilerOptions.outDir,\n logLevel: debug ? 'debug' : 'info',\n logLimit: 0,\n platform:\n compilerOptions.moduleResolution === ModuleResolutionKind.NodeJs ||\n compilerOptions.moduleResolution === ModuleResolutionKind.Node16\n ? 'node'\n : undefined,\n plugins: bundle\n ? []\n : [\n // evanw/esbuild#394\n tsconfigPaths({\n tsconfig: { baseUrl: compilerOptions.baseUrl, compilerOptions },\n }),\n ],\n sourcemap: compilerOptions.sourceMap,\n // TODO: as of 0.18, the esbuild CLI no longer infers the target property to\n // avoid ambiguity where multiple `tsconfig.json`s are involved in a build.\n // This would be unusual for a typical SEEK project but we can still explore\n // an explicit setting once we implement `skuba.config.ts` (#1167).\n target: compilerOptions.target\n ? ScriptTarget[compilerOptions.target].toLocaleLowerCase()\n : undefined,\n tsconfig: tscArgs.pathname,\n conditions: customConditions?.length ? customConditions : undefined,\n });\n\n const end = process.hrtime.bigint();\n\n log.plain(`Built in ${log.timing(start, end)}.`);\n\n if (compilerOptions.declaration) {\n await tsc([\n '--declaration',\n '--emitDeclarationOnly',\n ...(tscArgs.project ? ['--project', tscArgs.project] : []),\n ]);\n }\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA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A,IACJ,WAAW,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA,IAK3B,QAAQ,gBAAgB,SACpB,+BAAa,gBAAgB,MAAM,EAAE,kBAAkB,IACvD;AAAA,IACJ,UAAU,QAAQ;AAAA,IAClB,YAAY,kBAAkB,SAAS,mBAAmB;AAAA,EAC5D,CAAC;AAED,QAAM,MAAM,QAAQ,OAAO,OAAO;AAElC,MAAI,MAAM,YAAY,IAAI,OAAO,OAAO,GAAG,CAAC,GAAG;AAE/C,MAAI,gBAAgB,aAAa;AAC/B,cAAM,gBAAI;AAAA,MACR;AAAA,MACA;AAAA,MACA,GAAI,QAAQ,UAAU,CAAC,aAAa,QAAQ,OAAO,IAAI,CAAC;AAAA,IAC1D,CAAC;AAAA,EACH;AACF;",
6
- "names": ["tsconfigPaths"]
4
+ "sourcesContent": ["import { inspect } from 'util';\n\nimport { TsconfigPathsPlugin } from '@esbuild-plugins/tsconfig-paths';\nimport { build } from 'esbuild';\nimport { ModuleKind, ModuleResolutionKind, ScriptTarget } from 'typescript';\n\nimport { createLogger } from '../../utils/logging.js';\n\nimport { parseTscArgs } from './args.js';\nimport { getCustomConditions, readTsBuildConfig, tsc } from './tsc.js';\n\ninterface EsbuildParameters {\n debug: boolean;\n type: string | undefined;\n}\n\nexport const esbuild = async (\n { debug, type }: EsbuildParameters,\n args = process.argv.slice(2),\n) => {\n const log = createLogger({ debug });\n\n const tscArgs = parseTscArgs(args);\n\n const customConditions = getCustomConditions();\n\n if (tscArgs.build) {\n log.err(\n 'skuba does not currently support the tsc --build flag with esbuild',\n );\n process.exitCode = 1;\n return;\n }\n\n const parsedCommandLine = readTsBuildConfig(args, log);\n\n if (!parsedCommandLine || process.exitCode) {\n return;\n }\n\n const { fileNames: entryPoints, options: compilerOptions } =\n parsedCommandLine;\n\n log.debug(log.bold('Files'));\n entryPoints.forEach((filepath) => log.debug(filepath));\n\n log.debug(log.bold('Compiler options'));\n log.debug(inspect(compilerOptions));\n\n const start = process.hrtime.bigint();\n\n // TODO: support `bundle`, `minify`, `splitting`, `treeShaking`\n const bundle = false;\n\n const isEsm =\n compilerOptions.module !== ModuleKind.CommonJS && type === 'module';\n\n await build({\n bundle,\n entryPoints,\n format: !isEsm ? 'cjs' : undefined,\n outdir: compilerOptions.outDir,\n logLevel: debug ? 'debug' : 'info',\n logLimit: 0,\n platform:\n compilerOptions.moduleResolution === ModuleResolutionKind.NodeJs ||\n compilerOptions.moduleResolution === ModuleResolutionKind.Node16\n ? 'node'\n : undefined,\n plugins: bundle\n ? []\n : [\n // evanw/esbuild#394\n // eslint-disable-next-line new-cap\n TsconfigPathsPlugin({\n tsconfig: { baseUrl: compilerOptions.baseUrl, compilerOptions },\n }),\n ],\n sourcemap: compilerOptions.sourceMap,\n // TODO: as of 0.18, the esbuild CLI no longer infers the target property to\n // avoid ambiguity where multiple `tsconfig.json`s are involved in a build.\n // This would be unusual for a typical SEEK project but we can still explore\n // an explicit setting once we implement `skuba.config.ts` (#1167).\n target: compilerOptions.target\n ? ScriptTarget[compilerOptions.target].toLocaleLowerCase()\n : undefined,\n tsconfig: tscArgs.pathname,\n conditions: customConditions?.length ? customConditions : undefined,\n });\n\n const end = process.hrtime.bigint();\n\n log.plain(`Built in ${log.timing(start, end)}.`);\n\n if (compilerOptions.declaration) {\n await tsc([\n '--declaration',\n '--emitDeclarationOnly',\n ...(tscArgs.project ? ['--project', tscArgs.project] : []),\n ]);\n }\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAExB,4BAAoC;AACpC,qBAAsB;AACtB,wBAA+D;AAE/D,qBAA6B;AAE7B,kBAA6B;AAC7B,iBAA4D;AAOrD,MAAM,UAAU,OACrB,EAAE,OAAO,KAAK,GACd,OAAO,QAAQ,KAAK,MAAM,CAAC,MACxB;AACH,QAAM,UAAM,6BAAa,EAAE,MAAM,CAAC;AAElC,QAAM,cAAU,0BAAa,IAAI;AAEjC,QAAM,uB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GAAG,CAAC,GAAG;AAE/C,MAAI,gBAAgB,aAAa;AAC/B,cAAM,gBAAI;AAAA,MACR;AAAA,MACA;AAAA,MACA,GAAI,QAAQ,UAAU,CAAC,aAAa,QAAQ,OAAO,IAAI,CAAC;AAAA,IAC1D,CAAC;AAAA,EACH;AACF;",
6
+ "names": []
7
7
  }
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,21 +15,13 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
  var build_exports = {};
30
20
  __export(build_exports, {
31
21
  build: () => build
32
22
  });
33
23
  module.exports = __toCommonJS(build_exports);
34
- var import_chalk = __toESM(require("chalk"));
24
+ var import_node_util = require("node:util");
35
25
  var import_args = require("../../utils/args.js");
36
26
  var import_logging = require("../../utils/logging.js");
37
27
  var import_manifest = require("../../utils/manifest.js");
@@ -43,14 +33,14 @@ const build = async (args = process.argv.slice(2)) => {
43
33
  switch (manifest?.value) {
44
34
  case "esbuild": {
45
35
  const debug = (0, import_args.hasDebugFlag)(args);
46
- import_logging.log.plain(import_chalk.default.yellow("esbuild"));
36
+ import_logging.log.plain((0, import_node_util.styleText)("yellow", "esbuild"));
47
37
  await (0, import_esbuild.esbuild)({ debug, type: manifest.type }, args);
48
38
  break;
49
39
  }
50
40
  // TODO: flip the default case over to `esbuild` in skuba vNext.
51
41
  case void 0:
52
42
  case "tsc": {
53
- import_logging.log.plain(import_chalk.default.blue("tsc"));
43
+ import_logging.log.plain((0, import_node_util.styleText)("blue", "tsc"));
54
44
  await (0, import_tsc.tsc)(args);
55
45
  break;
56
46
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/build/index.ts"],
4
- "sourcesContent": ["import chalk from 'chalk';\n\nimport { hasDebugFlag } from '../../utils/args.js';\nimport { log } from '../../utils/logging.js';\nimport { getManifestProperties } from '../../utils/manifest.js';\n\nimport { copyAssets } from './assets.js';\nimport { esbuild } from './esbuild.js';\nimport { readTsBuildConfig, tsc } from './tsc.js';\n\nexport const build = async (args = process.argv.slice(2)) => {\n // TODO: define a unified `package.json#/skuba` schema and parser so we don't\n // need all these messy lookups.\n const manifest = await getManifestProperties('build');\n\n switch (manifest?.value) {\n case 'esbuild': {\n const debug = hasDebugFlag(args);\n\n log.plain(chalk.yellow('esbuild'));\n await esbuild({ debug, type: manifest.type }, args);\n break;\n }\n\n // TODO: flip the default case over to `esbuild` in skuba vNext.\n case undefined:\n case 'tsc': {\n log.plain(chalk.blue('tsc'));\n await tsc(args);\n break;\n }\n\n default: {\n log.err(\n 'We don\u2019t support the build tool specified in your',\n log.bold('package.json'),\n 'yet:',\n );\n log.err(\n log.subtle(\n JSON.stringify({ skuba: { build: manifest?.value } }, null, 2),\n ),\n );\n process.exitCode = 1;\n return;\n }\n }\n\n const parsedCommandLine = readTsBuildConfig(args, log);\n\n if (!parsedCommandLine || process.exitCode) {\n return;\n }\n\n const { options: compilerOptions } = parsedCommandLine;\n\n if (!compilerOptions.outDir) {\n return;\n }\n\n await copyAssets(compilerOptions.outDir);\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,kBAA6B;AAC7B,qBAAoB;AACpB,sBAAsC;AAEtC,oBAA2B;AAC3B,qBAAwB;AACxB,iBAAuC;AAEhC,MAAM,QAAQ,OAAO,OAAO,QAAQ,KAAK,MAAM,CAAC,MAAM;AAG3D,QAAM,WAAW,UAAM,uCAAsB,OAAO;AAEpD,UAAQ,UAAU,OAAO;AAAA,IACvB,KAAK,WAAW;AACd,YAAM,YAAQ,0BAAa,IAAI;AAE/B,yBAAI,MAAM,aAAAA,QAAM,OAAO,SAAS,CAAC;AACjC,gBAAM,wBAAQ,EAAE,OAAO,MAAM,SAAS,KAAK,GAAG,IAAI;AAClD;AAAA,IACF;AAAA;AAAA,IAGA,KAAK;AAAA,IACL,KAAK,OAAO;AACV,yBAAI,MAAM,aAAAA,QAAM,KAAK,KAAK,CAAC;AAC3B,gBAAM,gBAAI,IAAI;AACd;AAAA,IACF;AAAA,IAEA,SAAS;AACP,yBAAI;AAAA,QACF;AAAA,QACA,mBAAI,KAAK,cAAc;AAAA,QACvB;AAAA,MACF;AACA,yBAAI;AAAA,QACF,mBAAI;AAAA,UACF,KAAK,UAAU,EAAE,OAAO,EAAE,OAAO,UAAU,MAAM,EAAE,GAAG,MAAM,CAAC;AAAA,QAC/D;AAAA,MACF;AACA,cAAQ,WAAW;AACnB;AAAA,IACF;AAAA,EACF;AAEA,QAAM,wBAAoB,8BAAkB,MAAM,kBAAG;AAErD,MAAI,CAAC,qBAAqB,QAAQ,UAAU;AAC1C;AAAA,EACF;AAEA,QAAM,EAAE,SAAS,gBAAgB,IAAI;AAErC,MAAI,CAAC,gBAAgB,QAAQ;AAC3B;AAAA,EACF;AAEA,YAAM,0BAAW,gBAAgB,MAAM;AACzC;",
6
- "names": ["chalk"]
4
+ "sourcesContent": ["import { styleText } from 'node:util';\n\nimport { hasDebugFlag } from '../../utils/args.js';\nimport { log } from '../../utils/logging.js';\nimport { getManifestProperties } from '../../utils/manifest.js';\n\nimport { copyAssets } from './assets.js';\nimport { esbuild } from './esbuild.js';\nimport { readTsBuildConfig, tsc } from './tsc.js';\n\nexport const build = async (args = process.argv.slice(2)) => {\n // TODO: define a unified `package.json#/skuba` schema and parser so we don't\n // need all these messy lookups.\n const manifest = await getManifestProperties('build');\n\n switch (manifest?.value) {\n case 'esbuild': {\n const debug = hasDebugFlag(args);\n\n log.plain(styleText('yellow', 'esbuild'));\n await esbuild({ debug, type: manifest.type }, args);\n break;\n }\n\n // TODO: flip the default case over to `esbuild` in skuba vNext.\n case undefined:\n case 'tsc': {\n log.plain(styleText('blue', 'tsc'));\n await tsc(args);\n break;\n }\n\n default: {\n log.err(\n 'We don\u2019t support the build tool specified in your',\n log.bold('package.json'),\n 'yet:',\n );\n log.err(\n log.subtle(\n JSON.stringify({ skuba: { build: manifest?.value } }, null, 2),\n ),\n );\n process.exitCode = 1;\n return;\n }\n }\n\n const parsedCommandLine = readTsBuildConfig(args, log);\n\n if (!parsedCommandLine || process.exitCode) {\n return;\n }\n\n const { options: compilerOptions } = parsedCommandLine;\n\n if (!compilerOptions.outDir) {\n return;\n }\n\n await copyAssets(compilerOptions.outDir);\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA0B;AAE1B,kBAA6B;AAC7B,qBAAoB;AACpB,sBAAsC;AAEtC,oBAA2B;AAC3B,qBAAwB;AACxB,iBAAuC;AAEhC,MAAM,QAAQ,OAAO,OAAO,QAAQ,KAAK,MAAM,CAAC,MAAM;AAG3D,QAAM,WAAW,UAAM,uCAAsB,OAAO;AAEpD,UAAQ,UAAU,OAAO;AAAA,IACvB,KAAK,WAAW;AACd,YAAM,YAAQ,0BAAa,IAAI;AAE/B,yBAAI,UAAM,4BAAU,UAAU,SAAS,CAAC;AACxC,gBAAM,wBAAQ,EAAE,OAAO,MAAM,SAAS,KAAK,GAAG,IAAI;AAClD;AAAA,IACF;AAAA;AAAA,IAGA,KAAK;AAAA,IACL,KAAK,OAAO;AACV,yBAAI,UAAM,4BAAU,QAAQ,KAAK,CAAC;AAClC,gBAAM,gBAAI,IAAI;AACd;AAAA,IACF;AAAA,IAEA,SAAS;AACP,yBAAI;AAAA,QACF;AAAA,QACA,mBAAI,KAAK,cAAc;AAAA,QACvB;AAAA,MACF;AACA,yBAAI;AAAA,QACF,mBAAI;AAAA,UACF,KAAK,UAAU,EAAE,OAAO,EAAE,OAAO,UAAU,MAAM,EAAE,GAAG,MAAM,CAAC;AAAA,QAC/D;AAAA,MACF;AACA,cAAQ,WAAW;AACnB;AAAA,IACF;AAAA,EACF;AAEA,QAAM,wBAAoB,8BAAkB,MAAM,kBAAG;AAErD,MAAI,CAAC,qBAAqB,QAAQ,UAAU;AAC1C;AAAA,EACF;AAEA,QAAM,EAAE,SAAS,gBAAgB,IAAI;AAErC,MAAI,CAAC,gBAAgB,QAAQ;AAC3B;AAAA,EACF;AAEA,YAAM,0BAAW,gBAAgB,MAAM;AACzC;",
6
+ "names": []
7
7
  }
@@ -55,8 +55,7 @@ const readTsBuildConfig = (args = process.argv.slice(2), log) => {
55
55
  const tscArgs = (0, import_args.parseTscArgs)(args);
56
56
  log.debug(
57
57
  log.bold(
58
- "tsconfig",
59
- ...tscArgs.project ? ["--project", tscArgs.project] : []
58
+ `tsconfig${tscArgs.project ? ` --project ${tscArgs.project}` : ""}`
60
59
  )
61
60
  );
62
61
  log.debug(tscArgs.pathname);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/build/tsc.ts"],
4
- "sourcesContent": ["import path from 'path';\n\nimport ts from 'typescript';\n\nimport { exec } from '../../utils/exec.js';\nimport { type Logger, log as logger } from '../../utils/logging.js';\n\nimport { parseTscArgs } from './args.js';\n\nconst DEFAULT_ARGS = ['--project', 'tsconfig.build.json'] as const;\n\nconst formatHost: ts.FormatDiagnosticsHost = {\n getCanonicalFileName: (fileName) => fileName,\n getCurrentDirectory: ts.sys.getCurrentDirectory.bind(undefined),\n getNewLine: () => ts.sys.newLine,\n};\n\nconst tsconfigCache = new Map<string, ts.ParsedCommandLine>();\n\nexport const tsc = async (args = process.argv.slice(2)) => {\n const tscArgs = parseTscArgs(args);\n\n // Build flag is incompatible with project flag.\n const defaultArgs = tscArgs.build || tscArgs.project ? [] : DEFAULT_ARGS;\n\n return exec('tsc', ...defaultArgs, ...args);\n};\n\nexport const readTsBuildConfig = (\n args = process.argv.slice(2),\n log: Logger,\n) => {\n const tscArgs = parseTscArgs(args);\n\n log.debug(\n log.bold(\n 'tsconfig',\n ...(tscArgs.project ? ['--project', tscArgs.project] : []),\n ),\n );\n log.debug(tscArgs.pathname);\n\n const parsedConfig = readTsConfig({\n dir: tscArgs.dirname,\n fileName: tscArgs.basename,\n log,\n });\n\n if (parsedConfig?.errors.length) {\n log.err(`Could not parse ${tscArgs.basename}.`);\n log.subtle(ts.formatDiagnostics(parsedConfig.errors, formatHost));\n process.exitCode = 1;\n return;\n }\n\n return parsedConfig;\n};\n\nexport const readTsConfig = ({\n dir,\n fileName,\n log,\n silentlyFail = false,\n}: {\n dir: string;\n fileName: string;\n log: Logger;\n silentlyFail?: boolean;\n}) => {\n const pathName = path.join(dir, fileName);\n\n const cachedConfig = tsconfigCache.get(pathName);\n\n if (cachedConfig) {\n return cachedConfig;\n }\n\n const tsconfigFile = ts.findConfigFile(\n dir,\n ts.sys.fileExists.bind(undefined),\n fileName,\n );\n if (!tsconfigFile) {\n if (!silentlyFail) {\n log.err(`Could not find ${pathName}.`);\n process.exitCode = 1;\n }\n return;\n }\n\n const readConfigFile = ts.readConfigFile(\n tsconfigFile,\n ts.sys.readFile.bind(undefined),\n );\n if (readConfigFile.error) {\n if (!silentlyFail) {\n log.err(`Could not read ${pathName}.`);\n log.subtle(ts.formatDiagnostic(readConfigFile.error, formatHost));\n process.exitCode = 1;\n }\n return;\n }\n\n const parsedConfig = ts.parseJsonConfigFileContent(\n readConfigFile.config,\n ts.sys,\n dir,\n );\n\n tsconfigCache.set(pathName, parsedConfig);\n\n return parsedConfig;\n};\n\nexport const getCustomConditions = () => {\n const parsedConfig = readTsConfig({\n dir: process.cwd(),\n fileName: 'tsconfig.json',\n log: logger,\n silentlyFail: true,\n });\n\n if (!parsedConfig) {\n return [];\n }\n\n return parsedConfig.options.customConditions ?? [];\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,wBAAe;AAEf,kBAAqB;AACrB,qBAA2C;AAE3C,kBAA6B;AAE7B,MAAM,eAAe,CAAC,aAAa,qBAAqB;AAExD,MAAM,aAAuC;AAAA,EAC3C,sBAAsB,CAAC,aAAa;AAAA,EACpC,qBAAqB,kBAAAA,QAAG,IAAI,oBAAoB,KAAK,MAAS;AAAA,EAC9D,YAAY,MAAM,kBAAAA,QAAG,IAAI;AAC3B;AAEA,MAAM,gBAAgB,oBAAI,IAAkC;AAErD,MAAM,MAAM,OAAO,OAAO,QAAQ,KAAK,MAAM,CAAC,MAAM;AACzD,QAAM,cAAU,0BAAa,IAAI;AAGjC,QAAM,cAAc,QAAQ,SAAS,QAAQ,UAAU,CAAC,IAAI;AAE5D,aAAO,kBAAK,OAAO,GAAG,aAAa,GAAG,IAAI;AAC5C;AAEO,MAAM,oBAAoB,CAC/B,OAAO,QAAQ,KAAK,MAAM,CAAC,GAC3B,QACG;AACH,QAAM,cAAU,0BAAa,IAAI;AAEjC,MAAI;AAAA,IACF,IAAI;AAAA,MACF;AAAA,MACA,GAAI,QAAQ,UAAU,CAAC,aAAa,QAAQ,OAAO,IAAI,CAAC;AAAA,IAC1D;AAAA,EACF;AACA,MAAI,MAAM,QAAQ,QAAQ;AAE1B,QAAM,eAAe,aAAa;AAAA,IAChC,KAAK,QAAQ;AAAA,IACb,UAAU,QAAQ;AAAA,I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B,UAAU;AAAA,IACV,KAAK,eAAAE;AAAA,IACL,cAAc;AAAA,EAChB,CAAC;AAED,MAAI,CAAC,cAAc;AACjB,WAAO,CAAC;AAAA,EACV;AAEA,SAAO,aAAa,QAAQ,oBAAoB,CAAC;AACnD;",
4
+ "sourcesContent": ["import path from 'path';\n\nimport ts from 'typescript';\n\nimport { exec } from '../../utils/exec.js';\nimport { type Logger, log as logger } from '../../utils/logging.js';\n\nimport { parseTscArgs } from './args.js';\n\nconst DEFAULT_ARGS = ['--project', 'tsconfig.build.json'] as const;\n\nconst formatHost: ts.FormatDiagnosticsHost = {\n getCanonicalFileName: (fileName) => fileName,\n getCurrentDirectory: ts.sys.getCurrentDirectory.bind(undefined),\n getNewLine: () => ts.sys.newLine,\n};\n\nconst tsconfigCache = new Map<string, ts.ParsedCommandLine>();\n\nexport const tsc = async (args = process.argv.slice(2)) => {\n const tscArgs = parseTscArgs(args);\n\n // Build flag is incompatible with project flag.\n const defaultArgs = tscArgs.build || tscArgs.project ? [] : DEFAULT_ARGS;\n\n return exec('tsc', ...defaultArgs, ...args);\n};\n\nexport const readTsBuildConfig = (\n args = process.argv.slice(2),\n log: Logger,\n) => {\n const tscArgs = parseTscArgs(args);\n\n log.debug(\n log.bold(\n `tsconfig${tscArgs.project ? ` --project ${tscArgs.project}` : ''}`,\n ),\n );\n log.debug(tscArgs.pathname);\n\n const parsedConfig = readTsConfig({\n dir: tscArgs.dirname,\n fileName: tscArgs.basename,\n log,\n });\n\n if (parsedConfig?.errors.length) {\n log.err(`Could not parse ${tscArgs.basename}.`);\n log.subtle(ts.formatDiagnostics(parsedConfig.errors, formatHost));\n process.exitCode = 1;\n return;\n }\n\n return parsedConfig;\n};\n\nexport const readTsConfig = ({\n dir,\n fileName,\n log,\n silentlyFail = false,\n}: {\n dir: string;\n fileName: string;\n log: Logger;\n silentlyFail?: boolean;\n}) => {\n const pathName = path.join(dir, fileName);\n\n const cachedConfig = tsconfigCache.get(pathName);\n\n if (cachedConfig) {\n return cachedConfig;\n }\n\n const tsconfigFile = ts.findConfigFile(\n dir,\n ts.sys.fileExists.bind(undefined),\n fileName,\n );\n if (!tsconfigFile) {\n if (!silentlyFail) {\n log.err(`Could not find ${pathName}.`);\n process.exitCode = 1;\n }\n return;\n }\n\n const readConfigFile = ts.readConfigFile(\n tsconfigFile,\n ts.sys.readFile.bind(undefined),\n );\n if (readConfigFile.error) {\n if (!silentlyFail) {\n log.err(`Could not read ${pathName}.`);\n log.subtle(ts.formatDiagnostic(readConfigFile.error, formatHost));\n process.exitCode = 1;\n }\n return;\n }\n\n const parsedConfig = ts.parseJsonConfigFileContent(\n readConfigFile.config,\n ts.sys,\n dir,\n );\n\n tsconfigCache.set(pathName, parsedConfig);\n\n return parsedConfig;\n};\n\nexport const getCustomConditions = () => {\n const parsedConfig = readTsConfig({\n dir: process.cwd(),\n fileName: 'tsconfig.json',\n log: logger,\n silentlyFail: true,\n });\n\n if (!parsedConfig) {\n return [];\n }\n\n return parsedConfig.options.customConditions ?? [];\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,wBAAe;AAEf,kBAAqB;AACrB,qBAA2C;AAE3C,kBAA6B;AAE7B,MAAM,eAAe,CAAC,aAAa,qBAAqB;AAExD,MAAM,aAAuC;AAAA,EAC3C,sBAAsB,CAAC,aAAa;AAAA,EACpC,qBAAqB,kBAAAA,QAAG,IAAI,oBAAoB,KAAK,MAAS;AAAA,EAC9D,YAAY,MAAM,kBAAAA,QAAG,IAAI;AAC3B;AAEA,MAAM,gBAAgB,oBAAI,IAAkC;AAErD,MAAM,MAAM,OAAO,OAAO,QAAQ,KAAK,MAAM,CAAC,MAAM;AACzD,QAAM,cAAU,0BAAa,IAAI;AAGjC,QAAM,cAAc,QAAQ,SAAS,QAAQ,UAAU,CAAC,IAAI;AAE5D,aAAO,kBAAK,OAAO,GAAG,aAA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;AACrC,UAAI,OAAO,kBAAAA,QAAG,iBAAiB,eAAe,OAAO,UAAU,CAAC;AAChE,cAAQ,WAAW;AAAA,IACrB;AACA;AAAA,EACF;AAEA,QAAM,eAAe,kBAAAA,QAAG;AAAA,IACtB,eAAe;AAAA,IACf,kBAAAA,QAAG;AAAA,IACH;AAAA,EACF;AAEA,gBAAc,IAAI,UAAU,YAAY;AAExC,SAAO;AACT;AAEO,MAAM,sBAAsB,MAAM;AACvC,QAAM,eAAe,aAAa;AAAA,IAChC,KAAK,QAAQ,IAAI;AAAA,IACjB,UAAU;AAAA,IACV,KAAK,eAAAE;AAAA,IACL,cAAc;AAAA,EAChB,CAAC;AAED,MAAI,CAAC,cAAc;AACjB,WAAO,CAAC;AAAA,EACV;AAEA,SAAO,aAAa,QAAQ,oBAAoB,CAAC;AACnD;",
6
6
  "names": ["ts", "path", "logger"]
7
7
  }
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,26 +15,18 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
  var diff_exports = {};
30
20
  __export(diff_exports, {
31
21
  determineOperation: () => determineOperation
32
22
  });
33
23
  module.exports = __toCommonJS(diff_exports);
34
- var import_chalk = __toESM(require("chalk"));
24
+ var import_node_util = require("node:util");
35
25
  const determineOperation = (oldData, newData) => {
36
26
  if (oldData === void 0) {
37
- return import_chalk.default.green("A");
27
+ return (0, import_node_util.styleText)("green", "A");
38
28
  }
39
- return newData === void 0 ? import_chalk.default.red("D") : import_chalk.default.yellow("M");
29
+ return newData === void 0 ? (0, import_node_util.styleText)("red", "D") : (0, import_node_util.styleText)("yellow", "M");
40
30
  };
41
31
  // Annotate the CommonJS export names for ESM import in node:
42
32
  0 && (module.exports = {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/cli/configure/analysis/diff.ts"],
4
- "sourcesContent": ["import chalk from 'chalk';\n\nexport const determineOperation = (\n oldData?: string,\n newData?: string,\n): string => {\n if (oldData === undefined) {\n return chalk.green('A');\n }\n\n return newData === undefined ? chalk.red('D') : chalk.yellow('M');\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAEX,MAAM,qBAAqB,CAChC,SACA,YACW;AACX,MAAI,YAAY,QAAW;AACzB,WAAO,aAAAA,QAAM,MAAM,GAAG;AAAA,EACxB;AAEA,SAAO,YAAY,SAAY,aAAAA,QAAM,IAAI,GAAG,IAAI,aAAAA,QAAM,OAAO,GAAG;AAClE;",
6
- "names": ["chalk"]
4
+ "sourcesContent": ["import { styleText } from 'node:util';\n\nexport const determineOperation = (\n oldData?: string,\n newData?: string,\n): string => {\n if (oldData === undefined) {\n return styleText('green', 'A');\n }\n\n return newData === undefined\n ? styleText('red', 'D')\n : styleText('yellow', 'M');\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA0B;AAEnB,MAAM,qBAAqB,CAChC,SACA,YACW;AACX,MAAI,YAAY,QAAW;AACzB,eAAO,4BAAU,SAAS,GAAG;AAAA,EAC/B;AAEA,SAAO,YAAY,aACf,4BAAU,OAAO,GAAG,QACpB,4BAAU,UAAU,GAAG;AAC7B;",
6
+ "names": []
7
7
  }
@@ -31,8 +31,8 @@ __export(ensureTemplateCompletion_exports, {
31
31
  ensureTemplateCompletion: () => ensureTemplateCompletion
32
32
  });
33
33
  module.exports = __toCommonJS(ensureTemplateCompletion_exports);
34
+ var import_node_util = require("node:util");
34
35
  var import_path = __toESM(require("path"));
35
- var import_chalk = __toESM(require("chalk"));
36
36
  var import_fs_extra = __toESM(require("fs-extra"));
37
37
  var z = __toESM(require("zod/v4"));
38
38
  var import_copy = require("../../utils/copy.js");
@@ -71,7 +71,10 @@ const ensureTemplateCompletion = async ({
71
71
  import_logging.log.newline();
72
72
  const templateData = process.stdin.isTTY ? await (0, import_getConfig.runForm)({
73
73
  choices: templateConfig.fields,
74
- message: import_chalk.default.bold(`Complete ${import_chalk.default.cyan(templateName)}:`),
74
+ message: (0, import_node_util.styleText)(
75
+ "bold",
76
+ `Complete ${(0, import_node_util.styleText)("cyan", templateName)}:`
77
+ ),
75
78
  name: "customAnswers"
76
79
  }) : await getTemplateDataFromStdIn(templateConfig);
77
80
  const updatedPackageJson = await (0, import_package.formatPackage)(manifest.packageJson);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/configure/ensureTemplateCompletion.ts"],
4
- "sourcesContent": ["import path from 'path';\n\nimport chalk from 'chalk';\nimport fs from 'fs-extra';\nimport type { ReadResult } from 'read-pkg-up';\nimport * as z from 'zod/v4';\n\nimport { copyFiles, createEjsRenderer } from '../../utils/copy.js';\nimport { log } from '../../utils/logging.js';\nimport {\n type TemplateConfig,\n ensureTemplateConfigDeletion,\n} from '../../utils/template.js';\nimport { hasStringProp } from '../../utils/validation.js';\nimport {\n getTemplateConfig,\n readJSONFromStdIn,\n runForm,\n} from '../init/getConfig.js';\n\nimport { formatPackage } from './processing/package.js';\n\ninterface Props {\n destinationRoot: string;\n include: (pathname: string) => boolean;\n manifest: ReadResult;\n}\n\nconst templateDataSchema = z.object({\n templateData: z.record(z.string(), z.string()),\n});\n\nconst getTemplateDataFromStdIn = async (\n templateConfig: TemplateConfig,\n): Promise<Record<string, string>> => {\n const config = await readJSONFromStdIn();\n const data = templateDataSchema.parse(config);\n\n templateConfig.fields.forEach((field) => {\n const value = data.templateData[field.name];\n if (value === undefined) {\n throw new Error(`Missing field: ${field.name}`);\n }\n\n if (field.validate && !field.validate(value)) {\n throw new Error(`Invalid value for field: ${field.name}`);\n }\n });\n\n return data.templateData;\n};\n\nexport const ensureTemplateCompletion = async ({\n destinationRoot,\n include,\n manifest,\n}: Props): Promise<TemplateConfig> => {\n const templateConfig = getTemplateConfig(destinationRoot);\n\n if (templateConfig.fields.length === 0) {\n return templateConfig;\n }\n\n const templateName = hasStringProp(manifest.packageJson.skuba, 'template')\n ? manifest.packageJson.skuba.template\n : 'template';\n\n log.newline();\n const templateData = process.stdin.isTTY\n ? await runForm({\n choices: templateConfig.fields,\n message: chalk.bold(`Complete ${chalk.cyan(templateName)}:`),\n name: 'customAnswers',\n })\n : await getTemplateDataFromStdIn(templateConfig);\n\n const updatedPackageJson = await formatPackage(manifest.packageJson);\n const packageJsonFilepath = path.join(destinationRoot, 'package.json');\n await fs.promises.writeFile(packageJsonFilepath, updatedPackageJson);\n\n await copyFiles({\n sourceRoot: destinationRoot,\n destinationRoot,\n include,\n processors: [createEjsRenderer(templateData)],\n });\n\n await ensureTemplateConfigDeletion(destinationRoot);\n\n log.newline();\n log.ok('Templating complete!');\n\n return templateConfig;\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,mBAAkB;AAClB,sBAAe;AAEf,QAAmB;AAEnB,kBAA6C;AAC7C,qBAAoB;AACpB,sBAGO;A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B;AAEnE,YAAM,uBAAU;AAAA,IACd,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA,YAAY,KAAC,+BAAkB,YAAY,CAAC;AAAA,EAC9C,CAAC;AAED,YAAM,8CAA6B,eAAe;AAElD,qBAAI,QAAQ;AACZ,qBAAI,GAAG,sBAAsB;AAE7B,SAAO;AACT;",
6
- "names": ["chalk", "path", "fs"]
4
+ "sourcesContent": ["import { styleText } from 'node:util';\nimport path from 'path';\n\nimport fs from 'fs-extra';\nimport type { ReadResult } from 'read-pkg-up';\nimport * as z from 'zod/v4';\n\nimport { copyFiles, createEjsRenderer } from '../../utils/copy.js';\nimport { log } from '../../utils/logging.js';\nimport {\n type TemplateConfig,\n ensureTemplateConfigDeletion,\n} from '../../utils/template.js';\nimport { hasStringProp } from '../../utils/validation.js';\nimport {\n getTemplateConfig,\n readJSONFromStdIn,\n runForm,\n} from '../init/getConfig.js';\n\nimport { formatPackage } from './processing/package.js';\n\ninterface Props {\n destinationRoot: string;\n include: (pathname: string) => boolean;\n manifest: ReadResult;\n}\n\nconst templateDataSchema = z.object({\n templateData: z.record(z.string(), z.string()),\n});\n\nconst getTemplateDataFromStdIn = async (\n templateConfig: TemplateConfig,\n): Promise<Record<string, string>> => {\n const config = await readJSONFromStdIn();\n const data = templateDataSchema.parse(config);\n\n templateConfig.fields.forEach((field) => {\n const value = data.templateData[field.name];\n if (value === undefined) {\n throw new Error(`Missing field: ${field.name}`);\n }\n\n if (field.validate && !field.validate(value)) {\n throw new Error(`Invalid value for field: ${field.name}`);\n }\n });\n\n return data.templateData;\n};\n\nexport const ensureTemplateCompletion = async ({\n destinationRoot,\n include,\n manifest,\n}: Props): Promise<TemplateConfig> => {\n const templateConfig = getTemplateConfig(destinationRoot);\n\n if (templateConfig.fields.length === 0) {\n return templateConfig;\n }\n\n const templateName = hasStringProp(manifest.packageJson.skuba, 'template')\n ? manifest.packageJson.skuba.template\n : 'template';\n\n log.newline();\n const templateData = process.stdin.isTTY\n ? await runForm({\n choices: templateConfig.fields,\n message: styleText(\n 'bold',\n `Complete ${styleText('cyan', templateName)}:`,\n ),\n name: 'customAnswers',\n })\n : await getTemplateDataFromStdIn(templateConfig);\n\n const updatedPackageJson = await formatPackage(manifest.packageJson);\n const packageJsonFilepath = path.join(destinationRoot, 'package.json');\n await fs.promises.writeFile(packageJsonFilepath, updatedPackageJson);\n\n await copyFiles({\n sourceRoot: destinationRoot,\n destinationRoot,\n include,\n processors: [createEjsRenderer(templateData)],\n });\n\n await ensureTemplateConfigDeletion(destinationRoot);\n\n log.newline();\n log.ok('Templating complete!');\n\n return templateConfig;\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA0B;AAC1B,kBAAiB;AAEjB,sBAAe;AAEf,QAAmB;AAEnB,kBAA6C;AAC7C,qBAAoB;AACpB,sBAGO;AACP,wBAA8B;AAC9B,uBAIO;AAEP,qBAA8B;AAQ9B,MAAM,qBAAqB,EAAE,OAAO;AAAA,EAClC,cAAc,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC;AAC/C,CAAC;AAED,MAAM,2BAA2B,OAC/B,mBACoC;AACpC,QAAM,SAAS,UAAM,oCAAkB;AACvC,QAAM,OAAO,mBAAmB,MAAM,MAAM;AAE5C,iBAAe,OAAO,QAAQ,CAAC,UAAU;AACvC,UAAM,QAAQ,KAAK,aAAa,MAAM,IAAI;AAC1C,QAAI,UAAU,QAAW;AACvB,YAAM,IAAI,MAAM,kBAAkB,MAAM,IAAI,EAAE;AAAA,IAChD;AAEA,QAAI,MAAM,YAAY,CAAC,MAAM,SAAS,KAAK,GAAG;AAC5C,YAAM,IAAI,MAAM,4BAA4B,MAAM,IAAI,EAAE;AAAA,IAC1D;AAAA,EACF,CAAC;AAED,SAAO,KAAK;AACd;AAEO,MAAM,2BAA2B,OAAO;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AACF,MAAsC;AACpC,QAAM,qBAAiB,oCAAkB,eAAe;AAExD,MAAI,eAAe,OAAO,WAAW,GAAG;AACtC,WAAO;AAAA,EACT;AAEA,QAAM,mBAAe,iCAAc,SAAS,YAAY,OAAO,UAAU,IACrE,SAAS,YAAY,MAAM,WAC3B;AAEJ,qBAAI,QAAQ;AACZ,QAAM,eAAe,QAAQ,MAAM,QAC/B,UAAM,0BAAQ;AAAA,IACZ,SAAS,eAAe;AAAA,IACxB,aAAS;AAAA,MACP;AAAA,MACA,gBAAY,4BAAU,QAAQ,YAAY,CAAC;AAAA,IAC7C;AAAA,IACA,MAAM;AAAA,EACR,CAAC,IACD,MAAM,yBAAyB,cAAc;AAEjD,QAAM,qBAAqB,UAAM,8BAAc,SAAS,WAAW;AACnE,QAAM,sBAAsB,YAAAA,QAAK,KAAK,iBAAiB,cAAc;AACrE,QAAM,gBAAAC,QAAG,SAAS,UAAU,qBAAqB,kBAAkB;AAEnE,YAAM,uBAAU;AAAA,IACd,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA,YAAY,KAAC,+BAAkB,YAAY,CAAC;AAAA,EAC9C,CAAC;AAED,YAAM,8CAA6B,eAAe;AAElD,qBAAI,QAAQ;AACZ,qBAAI,GAAG,sBAAsB;AAE7B,SAAO;AACT;",
6
+ "names": ["path", "fs"]
7
7
  }
@@ -7,5 +7,5 @@ interface Props {
7
7
  templateConfig: TemplateConfig;
8
8
  type: ProjectType;
9
9
  }
10
- export declare const getEntryPoint: ({ destinationRoot, manifest, templateConfig, type, }: Props) => string | Promise<string>;
10
+ export declare const getEntryPoint: ({ destinationRoot, manifest, templateConfig, type, }: Props) => Promise<string>;
11
11
  export {};
@@ -31,13 +31,13 @@ __export(getEntryPoint_exports, {
31
31
  getEntryPoint: () => getEntryPoint
32
32
  });
33
33
  module.exports = __toCommonJS(getEntryPoint_exports);
34
+ var import_node_util = require("node:util");
34
35
  var import_path = __toESM(require("path"));
35
- var import_chalk = __toESM(require("chalk"));
36
- var import_enquirer = require("enquirer");
36
+ var import_prompts = require("@inquirer/prompts");
37
37
  var import_logging = require("../../utils/logging.js");
38
38
  var import_validation = require("../../utils/validation.js");
39
39
  var import_files = require("./analysis/files.js");
40
- const getEntryPoint = ({
40
+ const getEntryPoint = async ({
41
41
  destinationRoot,
42
42
  manifest,
43
43
  templateConfig,
@@ -50,21 +50,19 @@ const getEntryPoint = ({
50
50
  return templateConfig.entryPoint;
51
51
  }
52
52
  import_logging.log.newline();
53
- const entryPointPrompt = new import_enquirer.Input({
54
- initial: type === "package" ? "src/index.ts" : "src/app.ts",
53
+ const result = await (0, import_prompts.input)({
55
54
  message: "Entry point:",
56
- name: "entryPoint",
57
- result: (value) => value.endsWith(".ts") ? value : `${value}.ts`,
55
+ default: type === "package" ? "src/index.ts" : "src/app.ts",
58
56
  validate: async (value) => {
59
57
  const [modulePath] = value.split("#", 2);
60
58
  if (!modulePath) {
61
- return `${import_chalk.default.bold(value)} is an invalid module path`;
59
+ return `${(0, import_node_util.styleText)("bold", value)} is an invalid module path`;
62
60
  }
63
61
  const exists = await (0, import_files.tsFileExists)(import_path.default.join(destinationRoot, modulePath));
64
- return exists || `${import_chalk.default.bold(value)} is not a TypeScript file.`;
62
+ return exists || `${(0, import_node_util.styleText)("bold", value)} is not a TypeScript file.`;
65
63
  }
66
64
  });
67
- return entryPointPrompt.run();
65
+ return result.endsWith(".ts") ? result : `${result}.ts`;
68
66
  };
69
67
  // Annotate the CommonJS export names for ESM import in node:
70
68
  0 && (module.exports = {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/configure/getEntryPoint.ts"],
4
- "sourcesContent": ["import path from 'path';\n\nimport chalk from 'chalk';\nimport { Input } from 'enquirer';\nimport type { ReadResult } from 'read-pkg-up';\n\nimport { log } from '../../utils/logging.js';\nimport type { ProjectType } from '../../utils/manifest.js';\nimport type { TemplateConfig } from '../../utils/template.js';\nimport { hasStringProp } from '../../utils/validation.js';\n\nimport { tsFileExists } from './analysis/files.js';\n\ninterface Props {\n destinationRoot: string;\n manifest: ReadResult;\n templateConfig: TemplateConfig;\n type: ProjectType;\n}\nexport const getEntryPoint = ({\n destinationRoot,\n manifest,\n templateConfig,\n type,\n}: Props) => {\n if (hasStringProp(manifest.packageJson.skuba, 'entryPoint')) {\n return manifest.packageJson.skuba.entryPoint;\n }\n\n if (templateConfig.entryPoint !== undefined) {\n return templateConfig.entryPoint;\n }\n\n log.newline();\n const entryPointPrompt = new Input({\n initial: type === 'package' ? 'src/index.ts' : 'src/app.ts',\n message: 'Entry point:',\n name: 'entryPoint',\n result: (value) => (value.endsWith('.ts') ? value : `${value}.ts`),\n validate: async (value) => {\n // Support exported function targeting, e.g. `src/module.ts#callMeMaybe`\n const [modulePath] = value.split('#', 2);\n\n if (!modulePath) {\n return `${chalk.bold(value)} is an invalid module path`;\n }\n\n const exists = await tsFileExists(path.join(destinationRoot, modulePath));\n\n return exists || `${chalk.bold(value)} is not a TypeScript file.`;\n },\n });\n\n return entryPointPrompt.run();\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,mBAAkB;AAClB,sBAAsB;AAGtB,qBAAoB;AAGpB,wBAA8B;AAE9B,mBAA6B;AAQtB,MAAM,gBAAgB,CAAC;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAa;AACX,UAAI,iCAAc,SAAS,YAAY,OAAO,YAAY,GAAG;AAC3D,WAAO,SAAS,YAAY,MAAM;AAAA,EACpC;AAEA,MAAI,eAAe,eAAe,QAAW;AAC3C,WAAO,eAAe;AAAA,EACxB;AAEA,qBAAI,QAAQ;AACZ,QAAM,mBAAmB,IAAI,sBAAM;AAAA,IACjC,SAAS,SAAS,YAAY,iBAAiB;AAAA,IAC/C,SAAS;AAAA,IACT,MAAM;AAAA,IACN,QAAQ,CAAC,UAAW,MAAM,SAAS,KAAK,IAAI,QAAQ,GAAG,KAAK;AAAA,IAC5D,UAAU,OAAO,UAAU;AAEzB,YAAM,CAAC,UAAU,IAAI,MAAM,MAAM,KAAK,CAAC;AAEvC,UAAI,CAAC,YAAY;AACf,eAAO,GAAG,aAAAA,QAAM,KAAK,KAAK,CAAC;AAAA,MAC7B;AAEA,YAAM,SAAS,UAAM,2BAAa,YAAAC,QAAK,KAAK,iBAAiB,UAAU,CAAC;AAExE,aAAO,UAAU,GAAG,aAAAD,QAAM,KAAK,KAAK,CAAC;AAAA,IACvC;AAAA,EACF,CAAC;AAED,SAAO,iBAAiB,IAAI;AAC9B;",
6
- "names": ["chalk", "path"]
4
+ "sourcesContent": ["import { styleText } from 'node:util';\nimport path from 'path';\n\nimport { input } from '@inquirer/prompts';\nimport type { ReadResult } from 'read-pkg-up';\n\nimport { log } from '../../utils/logging.js';\nimport type { ProjectType } from '../../utils/manifest.js';\nimport type { TemplateConfig } from '../../utils/template.js';\nimport { hasStringProp } from '../../utils/validation.js';\n\nimport { tsFileExists } from './analysis/files.js';\n\ninterface Props {\n destinationRoot: string;\n manifest: ReadResult;\n templateConfig: TemplateConfig;\n type: ProjectType;\n}\nexport const getEntryPoint = async ({\n destinationRoot,\n manifest,\n templateConfig,\n type,\n}: Props) => {\n if (hasStringProp(manifest.packageJson.skuba, 'entryPoint')) {\n return manifest.packageJson.skuba.entryPoint;\n }\n\n if (templateConfig.entryPoint !== undefined) {\n return templateConfig.entryPoint;\n }\n\n log.newline();\n\n const result = await input({\n message: 'Entry point:',\n default: type === 'package' ? 'src/index.ts' : 'src/app.ts',\n validate: async (value) => {\n // Support exported function targeting, e.g. `src/module.ts#callMeMaybe`\n const [modulePath] = value.split('#', 2);\n\n if (!modulePath) {\n return `${styleText('bold', value)} is an invalid module path`;\n }\n\n const exists = await tsFileExists(path.join(destinationRoot, modulePath));\n\n return exists || `${styleText('bold', value)} is not a TypeScript file.`;\n },\n });\n\n return result.endsWith('.ts') ? result : `${result}.ts`;\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA0B;AAC1B,kBAAiB;AAEjB,qBAAsB;AAGtB,qBAAoB;AAGpB,wBAA8B;AAE9B,mBAA6B;AAQtB,MAAM,gBAAgB,OAAO;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAa;AACX,UAAI,iCAAc,SAAS,YAAY,OAAO,YAAY,GAAG;AAC3D,WAAO,SAAS,YAAY,MAAM;AAAA,EACpC;AAEA,MAAI,eAAe,eAAe,QAAW;AAC3C,WAAO,eAAe;AAAA,EACxB;AAEA,qBAAI,QAAQ;AAEZ,QAAM,SAAS,UAAM,sBAAM;AAAA,IACzB,SAAS;AAAA,IACT,SAAS,SAAS,YAAY,iBAAiB;AAAA,IAC/C,UAAU,OAAO,UAAU;AAEzB,YAAM,CAAC,UAAU,IAAI,MAAM,MAAM,KAAK,CAAC;AAEvC,UAAI,CAAC,YAAY;AACf,eAAO,OAAG,4BAAU,QAAQ,KAAK,CAAC;AAAA,MACpC;AAEA,YAAM,SAAS,UAAM,2BAAa,YAAAA,QAAK,KAAK,iBAAiB,UAAU,CAAC;AAExE,aAAO,UAAU,OAAG,4BAAU,QAAQ,KAAK,CAAC;AAAA,IAC9C;AAAA,EACF,CAAC;AAED,SAAO,OAAO,SAAS,KAAK,IAAI,SAAS,GAAG,MAAM;AACpD;",
6
+ "names": ["path"]
7
7
  }
@@ -21,7 +21,7 @@ __export(getProjectType_exports, {
21
21
  getProjectType: () => getProjectType
22
22
  });
23
23
  module.exports = __toCommonJS(getProjectType_exports);
24
- var import_enquirer = require("enquirer");
24
+ var import_prompts = require("@inquirer/prompts");
25
25
  var import_logging = require("../../utils/logging.js");
26
26
  var import_manifest = require("../../utils/manifest.js");
27
27
  var import_validation = require("../../utils/validation.js");
@@ -40,13 +40,11 @@ const getProjectType = async ({
40
40
  }
41
41
  const initial = manifest.packageJson.devDependencies?.["@seek/seek-module-toolkit"] || manifest.packageJson.files ? "package" : "application";
42
42
  import_logging.log.newline();
43
- const projectTypePrompt = new import_enquirer.Select({
44
- choices: import_manifest.PROJECT_TYPES,
43
+ return (0, import_prompts.select)({
45
44
  message: "Project type:",
46
- name: "projectType",
47
- initial
45
+ choices: import_manifest.PROJECT_TYPES.map((type) => ({ name: type, value: type })),
46
+ default: initial
48
47
  });
49
- return projectTypePrompt.run();
50
48
  };
51
49
  // Annotate the CommonJS export names for ESM import in node:
52
50
  0 && (module.exports = {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/configure/getProjectType.ts"],
4
- "sourcesContent": ["import { Select } from 'enquirer';\nimport type { ReadResult } from 'read-pkg-up';\n\nimport { log } from '../../utils/logging.js';\nimport {\n PROJECT_TYPES,\n type ProjectType,\n projectTypeSchema,\n} from '../../utils/manifest.js';\nimport type { TemplateConfig } from '../../utils/template.js';\nimport { hasProp } from '../../utils/validation.js';\n\ninterface Props {\n manifest: ReadResult;\n templateConfig: TemplateConfig;\n}\n\nexport const getProjectType = async ({\n manifest,\n templateConfig,\n}: Props): Promise<ProjectType> => {\n const projectType = projectTypeSchema.safeParse(\n hasProp(manifest.packageJson.skuba, 'type')\n ? manifest.packageJson.skuba.type\n : null,\n );\n\n if (projectType.success) {\n return projectType.data;\n }\n\n if (templateConfig.type !== undefined) {\n return templateConfig.type;\n }\n\n const initial: ProjectType =\n manifest.packageJson.devDependencies?.['@seek/seek-module-toolkit'] ||\n manifest.packageJson.files\n ? 'package'\n : 'application';\n\n log.newline();\n const projectTypePrompt = new Select({\n choices: PROJECT_TYPES,\n message: 'Project type:',\n name: 'projectType',\n initial,\n });\n\n return projectTypePrompt.run();\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAuB;AAGvB,qBAAoB;AACpB,sBAIO;AAEP,wBAAwB;AAOjB,MAAM,iBAAiB,OAAO;AAAA,EACnC;AAAA,EACA;AACF,MAAmC;AACjC,QAAM,cAAc,kCAAkB;AAAA,QACpC,2BAAQ,SAAS,YAAY,OAAO,MAAM,IACtC,SAAS,YAAY,MAAM,OAC3B;AAAA,EACN;AAEA,MAAI,YAAY,SAAS;AACvB,WAAO,YAAY;AAAA,EACrB;AAEA,MAAI,eAAe,SAAS,QAAW;AACrC,WAAO,eAAe;AAAA,EACxB;AAEA,QAAM,UACJ,SAAS,YAAY,kBAAkB,2BAA2B,KAClE,SAAS,YAAY,QACjB,YACA;AAEN,qBAAI,QAAQ;AACZ,QAAM,oBAAoB,IAAI,uBAAO;AAAA,IACnC,SAAS;AAAA,IACT,SAAS;AAAA,IACT,MAAM;AAAA,IACN;AAAA,EACF,CAAC;AAED,SAAO,kBAAkB,IAAI;AAC/B;",
4
+ "sourcesContent": ["import { select } from '@inquirer/prompts';\nimport type { ReadResult } from 'read-pkg-up';\n\nimport { log } from '../../utils/logging.js';\nimport {\n PROJECT_TYPES,\n type ProjectType,\n projectTypeSchema,\n} from '../../utils/manifest.js';\nimport type { TemplateConfig } from '../../utils/template.js';\nimport { hasProp } from '../../utils/validation.js';\n\ninterface Props {\n manifest: ReadResult;\n templateConfig: TemplateConfig;\n}\n\nexport const getProjectType = async ({\n manifest,\n templateConfig,\n}: Props): Promise<ProjectType> => {\n const projectType = projectTypeSchema.safeParse(\n hasProp(manifest.packageJson.skuba, 'type')\n ? manifest.packageJson.skuba.type\n : null,\n );\n\n if (projectType.success) {\n return projectType.data;\n }\n\n if (templateConfig.type !== undefined) {\n return templateConfig.type;\n }\n\n const initial: ProjectType =\n manifest.packageJson.devDependencies?.['@seek/seek-module-toolkit'] ||\n manifest.packageJson.files\n ? 'package'\n : 'application';\n\n log.newline();\n\n return select({\n message: 'Project type:',\n choices: PROJECT_TYPES.map((type) => ({ name: type, value: type })),\n default: initial,\n });\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAuB;AAGvB,qBAAoB;AACpB,sBAIO;AAEP,wBAAwB;AAOjB,MAAM,iBAAiB,OAAO;AAAA,EACnC;AAAA,EACA;AACF,MAAmC;AACjC,QAAM,cAAc,kCAAkB;AAAA,QACpC,2BAAQ,SAAS,YAAY,OAAO,MAAM,IACtC,SAAS,YAAY,MAAM,OAC3B;AAAA,EACN;AAEA,MAAI,YAAY,SAAS;AACvB,WAAO,YAAY;AAAA,EACrB;AAEA,MAAI,eAAe,SAAS,QAAW;AACrC,WAAO,eAAe;AAAA,EACxB;AAEA,QAAM,UACJ,SAAS,YAAY,kBAAkB,2BAA2B,KAClE,SAAS,YAAY,QACjB,YACA;AAEN,qBAAI,QAAQ;AAEZ,aAAO,uBAAO;AAAA,IACZ,SAAS;AAAA,IACT,SAAS,8BAAc,IAAI,CAAC,UAAU,EAAE,MAAM,MAAM,OAAO,KAAK,EAAE;AAAA,IAClE,SAAS;AAAA,EACX,CAAC;AACH;",
6
6
  "names": []
7
7
  }
@@ -32,7 +32,7 @@ __export(configure_exports, {
32
32
  });
33
33
  module.exports = __toCommonJS(configure_exports);
34
34
  var import_path = __toESM(require("path"));
35
- var import_enquirer = require("enquirer");
35
+ var import_prompts = require("@inquirer/prompts");
36
36
  var import_dir = require("../../utils/dir.js");
37
37
  var import_exec = require("../../utils/exec.js");
38
38
  var import_logging = require("../../utils/logging.js");
@@ -47,16 +47,17 @@ var import_package = require("./analysis/package.js");
47
47
  var import_ensureTemplateCompletion = require("./ensureTemplateCompletion.js");
48
48
  var import_getEntryPoint = require("./getEntryPoint.js");
49
49
  var import_getProjectType = require("./getProjectType.js");
50
- const shouldApply = async (name) => {
50
+ const shouldApply = async () => {
51
51
  if (!process.stdin.isTTY) {
52
52
  return "yes";
53
53
  }
54
- const prompt = new import_enquirer.Select({
55
- choices: ["yes", "no"],
54
+ const result = await (0, import_prompts.select)({
56
55
  message: "Apply changes?",
57
- name
56
+ choices: [
57
+ { name: "Yes", value: "yes" },
58
+ { name: "No", value: "no" }
59
+ ]
58
60
  });
59
- const result = await prompt.run();
60
61
  return result === "yes";
61
62
  };
62
63
  const configure = async () => {
@@ -98,7 +99,7 @@ const configure = async () => {
98
99
  });
99
100
  if (fixDependencies) {
100
101
  import_logging.log.newline();
101
- if (await shouldApply("fixDependencies")) {
102
+ if (await shouldApply()) {
102
103
  await fixDependencies();
103
104
  }
104
105
  }
@@ -112,7 +113,7 @@ const configure = async () => {
112
113
  });
113
114
  if (fixConfiguration) {
114
115
  import_logging.log.newline();
115
- if (await shouldApply("fixConfiguration")) {
116
+ if (await shouldApply()) {
116
117
  await fixConfiguration();
117
118
  }
118
119
  }
@@ -128,8 +129,8 @@ const configure = async () => {
128
129
  import_logging.log.newline();
129
130
  import_logging.log.warn(import_logging.log.bold("\u2717 Failed to install dependencies. Resume with:"));
130
131
  import_logging.log.newline();
131
- import_logging.log.plain(import_logging.log.bold(packageManager.command, "install"));
132
- import_logging.log.plain(import_logging.log.bold(packageManager.command, "format"));
132
+ import_logging.log.plain(import_logging.log.bold(`${packageManager.command} install`));
133
+ import_logging.log.plain(import_logging.log.bold(`${packageManager.command} format`));
133
134
  import_logging.log.newline();
134
135
  process.exitCode = 1;
135
136
  return;
@@ -139,7 +140,7 @@ const configure = async () => {
139
140
  import_logging.log.newline();
140
141
  import_logging.log.ok(import_logging.log.bold("\u2714 All done! Try running:"));
141
142
  import_logging.log.newline();
142
- import_logging.log.plain(import_logging.log.bold(packageManager.command, "format"));
143
+ import_logging.log.plain(import_logging.log.bold(`${packageManager.command} format`));
143
144
  }
144
145
  import_logging.log.newline();
145
146
  };