skuba 12.4.0-skuba-lib-api-20250925050503 → 12.4.1-add-ci-true-20250929053152

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 (35) hide show
  1. package/lib/cli/build/assets.js +3 -7
  2. package/lib/cli/build/assets.js.map +2 -2
  3. package/lib/cli/build/esbuild.d.ts +2 -1
  4. package/lib/cli/build/esbuild.js +4 -3
  5. package/lib/cli/build/esbuild.js.map +2 -2
  6. package/lib/cli/build/index.js +8 -4
  7. package/lib/cli/build/index.js.map +2 -2
  8. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.d.ts +2 -0
  9. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.js +40 -0
  10. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.js.map +7 -0
  11. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.d.ts +3 -0
  12. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js +100 -0
  13. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js.map +7 -0
  14. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.d.ts +3 -0
  15. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js +99 -0
  16. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js.map +7 -0
  17. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.d.ts +2 -0
  18. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.js +35 -0
  19. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.js.map +7 -0
  20. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.d.ts +3 -0
  21. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js +100 -0
  22. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js.map +7 -0
  23. package/lib/utils/manifest.d.ts +5 -1
  24. package/lib/utils/manifest.js +16 -7
  25. package/lib/utils/manifest.js.map +2 -2
  26. package/package.json +4 -4
  27. package/template/express-rest-api/Dockerfile.dev-deps +0 -2
  28. package/template/express-rest-api/package.json +1 -1
  29. package/template/greeter/Dockerfile +0 -2
  30. package/template/greeter/package.json +2 -2
  31. package/template/koa-rest-api/Dockerfile +2 -0
  32. package/template/koa-rest-api/Dockerfile.dev-deps +0 -2
  33. package/template/koa-rest-api/package.json +1 -1
  34. package/template/lambda-sqs-worker-cdk/Dockerfile +0 -2
  35. package/template/lambda-sqs-worker-cdk/package.json +2 -2
@@ -40,12 +40,8 @@ var import_dir = require("../../utils/dir.js");
40
40
  var import_logging = require("../../utils/logging.js");
41
41
  var import_manifest = require("../../utils/manifest.js");
42
42
  const copyAssets = async (destinationDir, logger = import_logging.log) => {
43
- const manifest = await (0, import_manifest.getConsumerManifest)();
44
- if (!manifest) {
45
- return;
46
- }
47
- const assets = await (0, import_manifest.getPropFromConsumerManifest)("assets");
48
- if (!assets) {
43
+ const manifest = await (0, import_manifest.getManifestProperties)("assets");
44
+ if (!manifest?.value) {
49
45
  return;
50
46
  }
51
47
  const entryPoint = await (0, import_manifest.getEntryPointFromManifest)();
@@ -60,7 +56,7 @@ const copyAssets = async (destinationDir, logger = import_logging.log) => {
60
56
  destinationDir
61
57
  );
62
58
  const allFiles = await (0, import_dir.crawlDirectory)(resolvedSrcDir);
63
- const filesByPattern = (0, import_dir.buildPatternToFilepathMap)(assets, allFiles, {
59
+ const filesByPattern = (0, import_dir.buildPatternToFilepathMap)(manifest.value, allFiles, {
64
60
  cwd: resolvedSrcDir,
65
61
  dot: true
66
62
  });
@@ -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 getConsumerManifest,\n getEntryPointFromManifest,\n getPropFromConsumerManifest,\n} from '../../utils/manifest.js';\n\nexport const copyAssets = async (\n destinationDir: string,\n logger: Logger = log,\n) => {\n const manifest = await getConsumerManifest();\n if (!manifest) {\n return;\n }\n\n const assets = await getPropFromConsumerManifest<string, string[]>('assets');\n if (!assets) {\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(assets, 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 ),\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AACA,gBAAM;AAAA,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,CAAC,aAAAE,QAAM,WAAW,EAAE,GAAG,KAAK,OAAO,aAAa,CAAC,SAAI,CAAC;AAAA,QAClE,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;",
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,QAAQ,SAAS,IAAI,GAAG,MAAM;AACvE,QAAM,yBAAyB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,6 @@
1
1
  interface EsbuildParameters {
2
2
  debug: boolean;
3
+ type: string | undefined;
3
4
  }
4
- export declare const esbuild: ({ debug }: EsbuildParameters, args?: string[]) => Promise<void>;
5
+ export declare const esbuild: ({ debug, type }: EsbuildParameters, args?: string[]) => Promise<void>;
5
6
  export {};
@@ -38,7 +38,7 @@ var import_typescript = require("typescript");
38
38
  var import_logging = require("../../utils/logging.js");
39
39
  var import_args = require("./args.js");
40
40
  var import_tsc = require("./tsc.js");
41
- const esbuild = async ({ debug }, args = process.argv.slice(2)) => {
41
+ const esbuild = async ({ debug, type }, args = process.argv.slice(2)) => {
42
42
  const log = (0, import_logging.createLogger)({ debug });
43
43
  const tscArgs = (0, import_args.parseTscArgs)(args);
44
44
  if (tscArgs.build) {
@@ -59,14 +59,15 @@ const esbuild = async ({ debug }, args = process.argv.slice(2)) => {
59
59
  log.debug((0, import_util.inspect)(compilerOptions));
60
60
  const start = process.hrtime.bigint();
61
61
  const bundle = false;
62
+ const isEsm = compilerOptions.module !== import_typescript.ModuleKind.CommonJS && type === "module";
62
63
  await (0, import_esbuild.build)({
63
64
  bundle,
64
65
  entryPoints,
65
- format: compilerOptions.module === import_typescript.ModuleKind.CommonJS ? "cjs" : void 0,
66
+ format: !isEsm ? "cjs" : void 0,
66
67
  outdir: compilerOptions.outDir,
67
68
  logLevel: debug ? "debug" : "info",
68
69
  logLimit: 0,
69
- platform: compilerOptions.moduleResolution === import_typescript.ModuleResolutionKind.NodeJs ? "node" : void 0,
70
+ platform: compilerOptions.moduleResolution === import_typescript.ModuleResolutionKind.NodeJs || compilerOptions.moduleResolution === import_typescript.ModuleResolutionKind.Node16 ? "node" : void 0,
70
71
  plugins: bundle ? [] : [
71
72
  // evanw/esbuild#394
72
73
  (0, import_tsconfig_paths.default)({
@@ -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 { readTsBuildConfig, tsc } from './tsc.js';\n\ninterface EsbuildParameters {\n debug: boolean;\n}\n\nexport const esbuild = async (\n { debug }: EsbuildParameters,\n args = process.argv.slice(2),\n) => {\n const log = createLogger({ debug });\n\n const tscArgs = parseTscArgs(args);\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 await build({\n bundle,\n entryPoints,\n format: compilerOptions.module === ModuleKind.CommonJS ? 'cjs' : undefined,\n outdir: compilerOptions.outDir,\n logLevel: debug ? 'debug' : 'info',\n logLimit: 0,\n platform:\n compilerOptions.moduleResolution === ModuleResolutionKind.NodeJs\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 });\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,4BAA0B;AAC1B,qBAAsB;AACtB,wBAA+D;AAE/D,qBAA6B;AAE7B,kBAA6B;AAC7B,iBAAuC;AAMhC,MAAM,UAAU,OACrB,EAAE,MAAM,GACR,OAAO,QAAQ,KAAK,MAAM,CAAC,MACxB;AACH,QAAM,UAAM,6BAAa,EAAE,MAAM,CAAC;AAElC,QAAM,cAAU,0BAAa,IAAI;AAEjC,MAAI,QAAQ,OAAO;AACjB,QAAI;AAAA,MACF;AAAA,IACF;AACA,YAAQ,WAAW;AACnB;AAAA,EACF;AAEA,QAAM,wBAAoB,8BAAkB,MAAM,GAAG;AAErD,MAAI,CAAC,qBAAqB,QAAQ,UAAU;AAC1C;AAAA,EACF;AAEA,QAAM,EAAE,WAAW,aAAa,SAAS,gBAAgB,IACvD;AAEF,MAAI,MAAM,IAAI,KAAK,OAAO,CAAC;AAC3B,cAAY,QAAQ,CAAC,aAAa,IAAI,MAAM,QAAQ,CAAC;AAErD,MAAI,MAAM,IAAI,KAAK,kBAAkB,CAAC;AACtC,MAAI,UAAM,qBAAQ,eAAe,CAAC;AAElC,QAAM,QAAQ,QAAQ,OAAO,OAAO;AAGpC,QAAM,SAAS;AAEf,YAAM,sBAAM;AAAA,IACV;AAAA,IACA;AAAA,IACA,QAAQ,gBAAgB,WAAW,6BAAW,WAAW,QAAQ;AAAA,IACjE,QAAQ,gBAAgB;AAAA,IACxB,UAAU,QAAQ,UAAU;AAAA,IAC5B,UAAU;AAAA,IACV,UACE,gBAAgB,qBAAqB,uCAAqB,SACtD,SACA;AAAA,IACN,SAAS,SACL,CAAC,IACD;AAAA;AAAA,UAEE,sBAAAA,SAAc;AAAA,QACZ,UAAU,EAAE,SAAS,gBAAgB,SAAS,gBAAgB;AAAA,MAChE,CAAC;AAAA,IACH;AAAA,IACJ,WAAW,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA,IAK3B,QAAQ,gBAAgB,SACpB,+BAAa,gBAAgB,MAAM,EAAE,kBAAkB,IACvD;AAAA,IACJ,UAAU,QAAQ;AAAA,EACpB,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;",
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 { 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 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 });\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,4BAA0B;AAC1B,qBAAsB;AACtB,wBAA+D;AAE/D,qBAA6B;AAE7B,kBAA6B;AAC7B,iBAAuC;AAOhC,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,MAAI,QAAQ,OAAO;AACjB,QAAI;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ACA,GAAI,QAAQ,UAAU,CAAC,aAAa,QAAQ,OAAO,IAAI,CAAC;AAAA,IAC1D,CAAC;AAAA,EACH;AACF;",
6
6
  "names": ["tsconfigPaths"]
7
7
  }
@@ -39,12 +39,12 @@ var import_assets = require("./assets.js");
39
39
  var import_esbuild = require("./esbuild.js");
40
40
  var import_tsc = require("./tsc.js");
41
41
  const build = async (args = process.argv.slice(2)) => {
42
- const tool = await (0, import_manifest.getStringPropFromConsumerManifest)("build");
43
- switch (tool) {
42
+ const manifest = await (0, import_manifest.getManifestProperties)("build");
43
+ switch (manifest?.value) {
44
44
  case "esbuild": {
45
45
  const debug = (0, import_args.hasDebugFlag)(args);
46
46
  import_logging.log.plain(import_chalk.default.yellow("esbuild"));
47
- await (0, import_esbuild.esbuild)({ debug }, args);
47
+ await (0, import_esbuild.esbuild)({ debug, type: manifest.type }, args);
48
48
  break;
49
49
  }
50
50
  // TODO: flip the default case over to `esbuild` in skuba vNext.
@@ -60,7 +60,11 @@ const build = async (args = process.argv.slice(2)) => {
60
60
  import_logging.log.bold("package.json"),
61
61
  "yet:"
62
62
  );
63
- import_logging.log.err(import_logging.log.subtle(JSON.stringify({ skuba: { build: tool } }, null, 2)));
63
+ import_logging.log.err(
64
+ import_logging.log.subtle(
65
+ JSON.stringify({ skuba: { build: manifest?.value } }, null, 2)
66
+ )
67
+ );
64
68
  process.exitCode = 1;
65
69
  return;
66
70
  }
@@ -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 { getStringPropFromConsumerManifest } 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 tool = await getStringPropFromConsumerManifest('build');\n\n switch (tool) {\n case 'esbuild': {\n const debug = hasDebugFlag(args);\n\n log.plain(chalk.yellow('esbuild'));\n await esbuild({ debug }, 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(log.subtle(JSON.stringify({ skuba: { build: tool } }, null, 2)));\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,sBAAkD;AAElD,oBAA2B;AAC3B,qBAAwB;AACxB,iBAAuC;AAEhC,MAAM,QAAQ,OAAO,OAAO,QAAQ,KAAK,MAAM,CAAC,MAAM;AAG3D,QAAM,OAAO,UAAM,mDAAkC,OAAO;AAE5D,UAAQ,MAAM;AAAA,IACZ,KAAK,WAAW;AACd,YAAM,YAAQ,0BAAa,IAAI;AAE/B,yBAAI,MAAM,aAAAA,QAAM,OAAO,SAAS,CAAC;AACjC,gBAAM,wBAAQ,EAAE,MAAM,GAAG,IAAI;AAC7B;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,IAAI,mBAAI,OAAO,KAAK,UAAU,EAAE,OAAO,EAAE,OAAO,KAAK,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC;AACvE,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;",
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(compilerO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js';
2
+ export declare const patches: Patches;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var __exports = {};
20
+ __export(__exports, {
21
+ patches: () => patches
22
+ });
23
+ module.exports = __toCommonJS(__exports);
24
+ var import_patchApiTokenFromEnvironment = require("./patchApiTokenFromEnvironment.js");
25
+ var import_patchDockerfileSyntaxDirective = require("./patchDockerfileSyntaxDirective.js");
26
+ const patches = [
27
+ {
28
+ apply: import_patchDockerfileSyntaxDirective.tryPatchDockerfileSyntaxDirective,
29
+ description: "Remove Dockerfile syntax directives"
30
+ },
31
+ {
32
+ apply: import_patchApiTokenFromEnvironment.tryPatchApiTokenFromEnvironment,
33
+ description: "Update import for `apiTokenFromEnvironment`"
34
+ }
35
+ ];
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ patches
39
+ });
40
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/12.3.0/index.ts"],
4
+ "sourcesContent": ["import type { Patches } from '../../index.js';\n\nimport { tryPatchApiTokenFromEnvironment } from './patchApiTokenFromEnvironment.js';\nimport { tryPatchDockerfileSyntaxDirective } from './patchDockerfileSyntaxDirective.js';\n\nexport const patches: Patches = [\n {\n apply: tryPatchDockerfileSyntaxDirective,\n description: 'Remove Dockerfile syntax directives',\n },\n {\n apply: tryPatchApiTokenFromEnvironment,\n description: 'Update import for `apiTokenFromEnvironment`',\n },\n];\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,0CAAgD;AAChD,4CAAkD;AAE3C,MAAM,UAAmB;AAAA,EAC9B;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,3 @@
1
+ import type { PatchFunction, PatchReturnType } from '../../index.js';
2
+ export declare const patchApiTokenFromEnvironment: (mode: "lint" | "format") => Promise<PatchReturnType>;
3
+ export declare const tryPatchApiTokenFromEnvironment: PatchFunction;
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
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
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var patchApiTokenFromEnvironment_exports = {};
30
+ __export(patchApiTokenFromEnvironment_exports, {
31
+ patchApiTokenFromEnvironment: () => patchApiTokenFromEnvironment,
32
+ tryPatchApiTokenFromEnvironment: () => tryPatchApiTokenFromEnvironment
33
+ });
34
+ module.exports = __toCommonJS(patchApiTokenFromEnvironment_exports);
35
+ var import_util = require("util");
36
+ var import_fast_glob = __toESM(require("fast-glob"));
37
+ var import_fs_extra = __toESM(require("fs-extra"));
38
+ var import_logging = require("../../../../../../utils/logging.js");
39
+ const importRegex = /import { apiTokenFromEnvironment } from 'skuba\/lib\/api\/github\/environment';\n/;
40
+ const usageRegex = /apiTokenFromEnvironment\(\)/;
41
+ const patchApiTokenFromEnvironment = async (mode) => {
42
+ const scriptPaths = await (0, import_fast_glob.default)(["scripts/**/*.ts"], {
43
+ ignore: ["**/.git", "**/node_modules"]
44
+ });
45
+ if (scriptPaths.length === 0) {
46
+ return {
47
+ result: "skip",
48
+ reason: "no scripts found"
49
+ };
50
+ }
51
+ const scripts = await Promise.all(
52
+ scriptPaths.map(async (file) => {
53
+ const contents = await import_fs_extra.default.readFile(file, "utf8");
54
+ return {
55
+ file,
56
+ contents
57
+ };
58
+ })
59
+ );
60
+ const scriptsToPatch = scripts.filter(
61
+ ({ contents }) => importRegex.exec(contents) ?? usageRegex.exec(contents)
62
+ );
63
+ if (scriptsToPatch.length === 0) {
64
+ return {
65
+ result: "skip",
66
+ reason: "no scripts to patch"
67
+ };
68
+ }
69
+ if (mode === "lint") {
70
+ return {
71
+ result: "apply"
72
+ };
73
+ }
74
+ await Promise.all(
75
+ scriptsToPatch.map(async ({ file, contents }) => {
76
+ const updatedContents = contents.replace(importRegex, "import { GitHub } from 'skuba';\n").replace(usageRegex, "GitHub.apiTokenFromEnvironment()");
77
+ await import_fs_extra.default.writeFile(file, updatedContents, "utf8");
78
+ })
79
+ );
80
+ return {
81
+ result: "apply"
82
+ };
83
+ };
84
+ const tryPatchApiTokenFromEnvironment = async ({
85
+ mode
86
+ }) => {
87
+ try {
88
+ return await patchApiTokenFromEnvironment(mode);
89
+ } catch (err) {
90
+ import_logging.log.warn("Failed to apply apiTokenFromEnvironment patch.");
91
+ import_logging.log.subtle((0, import_util.inspect)(err));
92
+ return { result: "skip", reason: "due to an error" };
93
+ }
94
+ };
95
+ // Annotate the CommonJS export names for ESM import in node:
96
+ 0 && (module.exports = {
97
+ patchApiTokenFromEnvironment,
98
+ tryPatchApiTokenFromEnvironment
99
+ });
100
+ //# sourceMappingURL=patchApiTokenFromEnvironment.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.ts"],
4
+ "sourcesContent": ["import { inspect } from 'util';\n\nimport fg from 'fast-glob';\nimport fs from 'fs-extra';\n\nimport { log } from '../../../../../../utils/logging.js';\nimport type { PatchFunction, PatchReturnType } from '../../index.js';\n\nconst importRegex =\n /import { apiTokenFromEnvironment } from 'skuba\\/lib\\/api\\/github\\/environment';\\n/;\nconst usageRegex = /apiTokenFromEnvironment\\(\\)/;\n\nexport const patchApiTokenFromEnvironment = async (\n mode: 'lint' | 'format',\n): Promise<PatchReturnType> => {\n const scriptPaths = await fg(['scripts/**/*.ts'], {\n ignore: ['**/.git', '**/node_modules'],\n });\n\n if (scriptPaths.length === 0) {\n return {\n result: 'skip',\n reason: 'no scripts found',\n };\n }\n\n const scripts = await Promise.all(\n scriptPaths.map(async (file) => {\n const contents = await fs.readFile(file, 'utf8');\n\n return {\n file,\n contents,\n };\n }),\n );\n\n const scriptsToPatch = scripts.filter(\n ({ contents }) => importRegex.exec(contents) ?? usageRegex.exec(contents),\n );\n\n if (scriptsToPatch.length === 0) {\n return {\n result: 'skip',\n reason: 'no scripts to patch',\n };\n }\n\n if (mode === 'lint') {\n return {\n result: 'apply',\n };\n }\n\n await Promise.all(\n scriptsToPatch.map(async ({ file, contents }) => {\n const updatedContents = contents\n .replace(importRegex, \"import { GitHub } from 'skuba';\\n\")\n .replace(usageRegex, 'GitHub.apiTokenFromEnvironment()');\n await fs.writeFile(file, updatedContents, 'utf8');\n }),\n );\n\n return {\n result: 'apply',\n };\n};\n\nexport const tryPatchApiTokenFromEnvironment: PatchFunction = async ({\n mode,\n}) => {\n try {\n return await patchApiTokenFromEnvironment(mode);\n } catch (err) {\n log.warn('Failed to apply apiTokenFromEnvironment patch.');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAExB,uBAAe;AACf,sBAAe;AAEf,qBAAoB;AAGpB,MAAM,cACJ;AACF,MAAM,aAAa;AAEZ,MAAM,+BAA+B,OAC1C,SAC6B;AAC7B,QAAM,cAAc,UAAM,iBAAAA,SAAG,CAAC,iBAAiB,GAAG;AAAA,IAChD,QAAQ,CAAC,WAAW,iBAAiB;AAAA,EACvC,CAAC;AAED,MAAI,YAAY,WAAW,GAAG;AAC5B,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV;AAAA,EACF;AAEA,QAAM,UAAU,MAAM,QAAQ;AAAA,IAC5B,YAAY,IAAI,OAAO,SAAS;AAC9B,YAAM,WAAW,MAAM,gBAAAC,QAAG,SAAS,MAAM,MAAM;AAE/C,aAAO;AAAA,QACL;AAAA,QACA;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AAEA,QAAM,iBAAiB,QAAQ;AAAA,IAC7B,CAAC,EAAE,SAAS,MAAM,YAAY,KAAK,QAAQ,KAAK,WAAW,KAAK,QAAQ;AAAA,EAC1E;AAEA,MAAI,eAAe,WAAW,GAAG;AAC/B,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV;AAAA,EACF;AAEA,MAAI,SAAS,QAAQ;AACnB,WAAO;AAAA,MACL,QAAQ;AAAA,IACV;AAAA,EACF;AAEA,QAAM,QAAQ;AAAA,IACZ,eAAe,IAAI,OAAO,EAAE,MAAM,SAAS,MAAM;AAC/C,YAAM,kBAAkB,SACrB,QAAQ,aAAa,mCAAmC,EACxD,QAAQ,YAAY,kCAAkC;AACzD,YAAM,gBAAAA,QAAG,UAAU,MAAM,iBAAiB,MAAM;AAAA,IAClD,CAAC;AAAA,EACH;AAEA,SAAO;AAAA,IACL,QAAQ;AAAA,EACV;AACF;AAEO,MAAM,kCAAiD,OAAO;AAAA,EACnE;AACF,MAAM;AACJ,MAAI;AACF,WAAO,MAAM,6BAA6B,IAAI;AAAA,EAChD,SAAS,KAAK;AACZ,uBAAI,KAAK,gDAAgD;AACzD,uBAAI,WAAO,qBAAQ,GAAG,CAAC;AACvB,WAAO,EAAE,QAAQ,QAAQ,QAAQ,kBAAkB;AAAA,EACrD;AACF;",
6
+ "names": ["fg", "fs"]
7
+ }
@@ -0,0 +1,3 @@
1
+ import type { PatchFunction, PatchReturnType } from '../../index.js';
2
+ export declare const patchDockerfileSyntaxDirective: (mode: "lint" | "format") => Promise<PatchReturnType>;
3
+ export declare const tryPatchDockerfileSyntaxDirective: PatchFunction;
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
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
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var patchDockerfileSyntaxDirective_exports = {};
30
+ __export(patchDockerfileSyntaxDirective_exports, {
31
+ patchDockerfileSyntaxDirective: () => patchDockerfileSyntaxDirective,
32
+ tryPatchDockerfileSyntaxDirective: () => tryPatchDockerfileSyntaxDirective
33
+ });
34
+ module.exports = __toCommonJS(patchDockerfileSyntaxDirective_exports);
35
+ var import_util = require("util");
36
+ var import_fast_glob = __toESM(require("fast-glob"));
37
+ var import_fs_extra = __toESM(require("fs-extra"));
38
+ var import_logging = require("../../../../../../utils/logging.js");
39
+ const dockerSyntaxRegex = /^#\s*syntax=\s*docker\/dockerfile:\S+\n+/;
40
+ const patchDockerfileSyntaxDirective = async (mode) => {
41
+ const dockerfilePaths = await (0, import_fast_glob.default)(["**/Dockerfile*"], {
42
+ ignore: ["**/.git", "**/node_modules"]
43
+ });
44
+ if (dockerfilePaths.length === 0) {
45
+ return {
46
+ result: "skip",
47
+ reason: "no dockerfiles found"
48
+ };
49
+ }
50
+ const dockerfiles = await Promise.all(
51
+ dockerfilePaths.map(async (file) => {
52
+ const contents = await import_fs_extra.default.readFile(file, "utf8");
53
+ return {
54
+ file,
55
+ contents
56
+ };
57
+ })
58
+ );
59
+ const dockerfilesToPatch = dockerfiles.filter(
60
+ ({ contents }) => dockerSyntaxRegex.test(contents)
61
+ );
62
+ if (dockerfilesToPatch.length === 0) {
63
+ return {
64
+ result: "skip",
65
+ reason: "no dockerfiles to patch"
66
+ };
67
+ }
68
+ if (mode === "lint") {
69
+ return {
70
+ result: "apply"
71
+ };
72
+ }
73
+ await Promise.all(
74
+ dockerfilesToPatch.map(async ({ file, contents }) => {
75
+ const updatedContents = contents.replace(dockerSyntaxRegex, "");
76
+ await import_fs_extra.default.writeFile(file, updatedContents, "utf8");
77
+ })
78
+ );
79
+ return {
80
+ result: "apply"
81
+ };
82
+ };
83
+ const tryPatchDockerfileSyntaxDirective = async ({
84
+ mode
85
+ }) => {
86
+ try {
87
+ return await patchDockerfileSyntaxDirective(mode);
88
+ } catch (err) {
89
+ import_logging.log.warn("Failed to apply Dockerfile syntax directive patch.");
90
+ import_logging.log.subtle((0, import_util.inspect)(err));
91
+ return { result: "skip", reason: "due to an error" };
92
+ }
93
+ };
94
+ // Annotate the CommonJS export names for ESM import in node:
95
+ 0 && (module.exports = {
96
+ patchDockerfileSyntaxDirective,
97
+ tryPatchDockerfileSyntaxDirective
98
+ });
99
+ //# sourceMappingURL=patchDockerfileSyntaxDirective.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.ts"],
4
+ "sourcesContent": ["import { inspect } from 'util';\n\nimport fg from 'fast-glob';\nimport fs from 'fs-extra';\n\nimport { log } from '../../../../../../utils/logging.js';\nimport type { PatchFunction, PatchReturnType } from '../../index.js';\n\nconst dockerSyntaxRegex = /^#\\s*syntax=\\s*docker\\/dockerfile:\\S+\\n+/;\n\nexport const patchDockerfileSyntaxDirective = async (\n mode: 'lint' | 'format',\n): Promise<PatchReturnType> => {\n const dockerfilePaths = await fg(['**/Dockerfile*'], {\n ignore: ['**/.git', '**/node_modules'],\n });\n\n if (dockerfilePaths.length === 0) {\n return {\n result: 'skip',\n reason: 'no dockerfiles found',\n };\n }\n\n const dockerfiles = await Promise.all(\n dockerfilePaths.map(async (file) => {\n const contents = await fs.readFile(file, 'utf8');\n\n return {\n file,\n contents,\n };\n }),\n );\n\n const dockerfilesToPatch = dockerfiles.filter(({ contents }) =>\n dockerSyntaxRegex.test(contents),\n );\n\n if (dockerfilesToPatch.length === 0) {\n return {\n result: 'skip',\n reason: 'no dockerfiles to patch',\n };\n }\n\n if (mode === 'lint') {\n return {\n result: 'apply',\n };\n }\n\n await Promise.all(\n dockerfilesToPatch.map(async ({ file, contents }) => {\n const updatedContents = contents.replace(dockerSyntaxRegex, '');\n await fs.writeFile(file, updatedContents, 'utf8');\n }),\n );\n\n return {\n result: 'apply',\n };\n};\n\nexport const tryPatchDockerfileSyntaxDirective: PatchFunction = async ({\n mode,\n}) => {\n try {\n return await patchDockerfileSyntaxDirective(mode);\n } catch (err) {\n log.warn('Failed to apply Dockerfile syntax directive patch.');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAExB,uBAAe;AACf,sBAAe;AAEf,qBAAoB;AAGpB,MAAM,oBAAoB;AAEnB,MAAM,iCAAiC,OAC5C,SAC6B;AAC7B,QAAM,kBAAkB,UAAM,iBAAAA,SAAG,CAAC,gBAAgB,GAAG;AAAA,IACnD,QAAQ,CAAC,WAAW,iBAAiB;AAAA,EACvC,CAAC;AAED,MAAI,gBAAgB,WAAW,GAAG;AAChC,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV;AAAA,EACF;AAEA,QAAM,cAAc,MAAM,QAAQ;AAAA,IAChC,gBAAgB,IAAI,OAAO,SAAS;AAClC,YAAM,WAAW,MAAM,gBAAAC,QAAG,SAAS,MAAM,MAAM;AAE/C,aAAO;AAAA,QACL;AAAA,QACA;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AAEA,QAAM,qBAAqB,YAAY;AAAA,IAAO,CAAC,EAAE,SAAS,MACxD,kBAAkB,KAAK,QAAQ;AAAA,EACjC;AAEA,MAAI,mBAAmB,WAAW,GAAG;AACnC,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV;AAAA,EACF;AAEA,MAAI,SAAS,QAAQ;AACnB,WAAO;AAAA,MACL,QAAQ;AAAA,IACV;AAAA,EACF;AAEA,QAAM,QAAQ;AAAA,IACZ,mBAAmB,IAAI,OAAO,EAAE,MAAM,SAAS,MAAM;AACnD,YAAM,kBAAkB,SAAS,QAAQ,mBAAmB,EAAE;AAC9D,YAAM,gBAAAA,QAAG,UAAU,MAAM,iBAAiB,MAAM;AAAA,IAClD,CAAC;AAAA,EACH;AAEA,SAAO;AAAA,IACL,QAAQ;AAAA,EACV;AACF;AAEO,MAAM,oCAAmD,OAAO;AAAA,EACrE;AACF,MAAM;AACJ,MAAI;AACF,WAAO,MAAM,+BAA+B,IAAI;AAAA,EAClD,SAAS,KAAK;AACZ,uBAAI,KAAK,oDAAoD;AAC7D,uBAAI,WAAO,qBAAQ,GAAG,CAAC;AACvB,WAAO,EAAE,QAAQ,QAAQ,QAAQ,kBAAkB;AAAA,EACrD;AACF;",
6
+ "names": ["fg", "fs"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import type { Patches } from '../../index.js';
2
+ export declare const patches: Patches;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var __exports = {};
20
+ __export(__exports, {
21
+ patches: () => patches
22
+ });
23
+ module.exports = __toCommonJS(__exports);
24
+ var import_patchDockerfileCIVariable = require("./patchDockerfileCIVariable.js");
25
+ const patches = [
26
+ {
27
+ apply: import_patchDockerfileCIVariable.tryPatchDockerfileCIVariable,
28
+ description: "Remove Dockerfile syntax directives"
29
+ }
30
+ ];
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
33
+ patches
34
+ });
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/12.4.0/index.ts"],
4
+ "sourcesContent": ["import type { Patches } from '../../index.js';\n\nimport { tryPatchDockerfileCIVariable } from './patchDockerfileCIVariable.js';\n\nexport const patches: Patches = [\n {\n apply: tryPatchDockerfileCIVariable,\n description: 'Remove Dockerfile syntax directives',\n },\n];\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,uCAA6C;AAEtC,MAAM,UAAmB;AAAA,EAC9B;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,3 @@
1
+ import type { PatchFunction, PatchReturnType } from '../../index.js';
2
+ export declare const patchDockerfileCIVariable: (mode: "lint" | "format") => Promise<PatchReturnType>;
3
+ export declare const tryPatchDockerfileCIVariable: PatchFunction;
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
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
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var patchDockerfileCIVariable_exports = {};
30
+ __export(patchDockerfileCIVariable_exports, {
31
+ patchDockerfileCIVariable: () => patchDockerfileCIVariable,
32
+ tryPatchDockerfileCIVariable: () => tryPatchDockerfileCIVariable
33
+ });
34
+ module.exports = __toCommonJS(patchDockerfileCIVariable_exports);
35
+ var import_util = require("util");
36
+ var import_fast_glob = __toESM(require("fast-glob"));
37
+ var import_fs_extra = __toESM(require("fs-extra"));
38
+ var import_logging = require("../../../../../../utils/logging.js");
39
+ const dockerRegex = /FROM \$\{BASE_IMAGE\} AS build/;
40
+ const patchDockerfileCIVariable = async (mode) => {
41
+ const dockerfilePaths = await (0, import_fast_glob.default)(["**/Dockerfile*"], {
42
+ ignore: ["**/.git", "**/node_modules"]
43
+ });
44
+ if (dockerfilePaths.length === 0) {
45
+ return {
46
+ result: "skip",
47
+ reason: "no dockerfiles found"
48
+ };
49
+ }
50
+ const dockerfiles = await Promise.all(
51
+ dockerfilePaths.map(async (file) => {
52
+ const contents = await import_fs_extra.default.readFile(file, "utf8");
53
+ return {
54
+ file,
55
+ contents
56
+ };
57
+ })
58
+ );
59
+ const dockerfilesToPatch = dockerfiles.filter(
60
+ ({ contents }) => contents.includes("FROM ${BASE_IMAGE} AS build")
61
+ );
62
+ if (dockerfilesToPatch.length === 0) {
63
+ return {
64
+ result: "skip",
65
+ reason: "no dockerfiles to patch"
66
+ };
67
+ }
68
+ if (mode === "lint") {
69
+ return {
70
+ result: "apply"
71
+ };
72
+ }
73
+ await Promise.all(
74
+ dockerfilesToPatch.map(async ({ file, contents }) => {
75
+ const updatedContents = contents.replace(
76
+ dockerRegex,
77
+ "FROM ${BASE_IMAGE} AS build\n\nENV CI=true\n"
78
+ );
79
+ await import_fs_extra.default.writeFile(file, updatedContents, "utf8");
80
+ })
81
+ );
82
+ return {
83
+ result: "apply"
84
+ };
85
+ };
86
+ const tryPatchDockerfileCIVariable = async ({ mode }) => {
87
+ try {
88
+ return await patchDockerfileCIVariable(mode);
89
+ } catch (err) {
90
+ import_logging.log.warn("Failed to apply Dockerfile CI variable patch.");
91
+ import_logging.log.subtle((0, import_util.inspect)(err));
92
+ return { result: "skip", reason: "due to an error" };
93
+ }
94
+ };
95
+ // Annotate the CommonJS export names for ESM import in node:
96
+ 0 && (module.exports = {
97
+ patchDockerfileCIVariable,
98
+ tryPatchDockerfileCIVariable
99
+ });
100
+ //# sourceMappingURL=patchDockerfileCIVariable.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.ts"],
4
+ "sourcesContent": ["import { inspect } from 'util';\n\nimport fg from 'fast-glob';\nimport fs from 'fs-extra';\n\nimport { log } from '../../../../../../utils/logging.js';\nimport type { PatchFunction, PatchReturnType } from '../../index.js';\n\nconst dockerRegex = /FROM \\$\\{BASE_IMAGE\\} AS build/;\n\nexport const patchDockerfileCIVariable = async (\n mode: 'lint' | 'format',\n): Promise<PatchReturnType> => {\n const dockerfilePaths = await fg(['**/Dockerfile*'], {\n ignore: ['**/.git', '**/node_modules'],\n });\n\n if (dockerfilePaths.length === 0) {\n return {\n result: 'skip',\n reason: 'no dockerfiles found',\n };\n }\n\n const dockerfiles = await Promise.all(\n dockerfilePaths.map(async (file) => {\n const contents = await fs.readFile(file, 'utf8');\n\n return {\n file,\n contents,\n };\n }),\n );\n\n const dockerfilesToPatch = dockerfiles.filter(({ contents }) =>\n contents.includes('FROM ${BASE_IMAGE} AS build'),\n );\n\n if (dockerfilesToPatch.length === 0) {\n return {\n result: 'skip',\n reason: 'no dockerfiles to patch',\n };\n }\n\n if (mode === 'lint') {\n return {\n result: 'apply',\n };\n }\n\n await Promise.all(\n dockerfilesToPatch.map(async ({ file, contents }) => {\n const updatedContents = contents.replace(\n dockerRegex,\n 'FROM ${BASE_IMAGE} AS build\\n\\nENV CI=true\\n',\n );\n await fs.writeFile(file, updatedContents, 'utf8');\n }),\n );\n\n return {\n result: 'apply',\n };\n};\n\nexport const tryPatchDockerfileCIVariable: PatchFunction = async ({ mode }) => {\n try {\n return await patchDockerfileCIVariable(mode);\n } catch (err) {\n log.warn('Failed to apply Dockerfile CI variable patch.');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAExB,uBAAe;AACf,sBAAe;AAEf,qBAAoB;AAGpB,MAAM,cAAc;AAEb,MAAM,4BAA4B,OACvC,SAC6B;AAC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
@@ -5,6 +5,10 @@ export declare const projectTypeSchema: z.ZodUnion<readonly [z.ZodLiteral<"appli
5
5
  export declare const PROJECT_TYPES: readonly ["application", "package"];
6
6
  export declare const getSkubaManifest: () => Promise<NormalizedPackageJson>;
7
7
  export declare const getConsumerManifest: (cwd?: string) => Promise<readPkgUp.ReadResult | undefined>;
8
- export declare const getPropFromConsumerManifest: <T extends string, V = unknown>(prop: T) => Promise<V | undefined>;
8
+ export declare const getManifestProperties: <T extends string, V = unknown>(prop: T) => Promise<{
9
+ value: V | undefined;
10
+ type: string | undefined;
11
+ path: string;
12
+ } | undefined>;
9
13
  export declare const getStringPropFromConsumerManifest: <T extends string>(prop: T) => Promise<string | undefined>;
10
14
  export declare const getEntryPointFromManifest: () => Promise<string>;
@@ -31,7 +31,7 @@ __export(manifest_exports, {
31
31
  PROJECT_TYPES: () => PROJECT_TYPES,
32
32
  getConsumerManifest: () => getConsumerManifest,
33
33
  getEntryPointFromManifest: () => getEntryPointFromManifest,
34
- getPropFromConsumerManifest: () => getPropFromConsumerManifest,
34
+ getManifestProperties: () => getManifestProperties,
35
35
  getSkubaManifest: () => getSkubaManifest,
36
36
  getStringPropFromConsumerManifest: () => getStringPropFromConsumerManifest,
37
37
  projectTypeSchema: () => projectTypeSchema
@@ -58,13 +58,22 @@ const getSkubaManifest = async () => {
58
58
  return skubaManifest = result.packageJson;
59
59
  };
60
60
  const getConsumerManifest = (cwd) => (0, import_read_pkg_up.default)({ cwd, normalize: false });
61
- const getPropFromConsumerManifest = async (prop) => {
62
- const result = await getConsumerManifest();
63
- return result !== void 0 && (0, import_validation.hasProp)(result.packageJson.skuba, prop) ? result.packageJson.skuba[prop] : void 0;
61
+ const getManifestProperties = async (prop) => {
62
+ const manifest = await getConsumerManifest();
63
+ if (!manifest) {
64
+ return void 0;
65
+ }
66
+ const value = (0, import_validation.hasProp)(manifest.packageJson.skuba, prop) ? manifest.packageJson.skuba[prop] : void 0;
67
+ const type = typeof manifest.packageJson.type === "string" ? manifest.packageJson.type : void 0;
68
+ return {
69
+ value,
70
+ type,
71
+ path: manifest.path
72
+ };
64
73
  };
65
74
  const getStringPropFromConsumerManifest = async (prop) => {
66
- const result = await getPropFromConsumerManifest(prop);
67
- return typeof result === "string" ? result : void 0;
75
+ const manifest = await getManifestProperties(prop);
76
+ return typeof manifest?.value === "string" ? manifest.value : void 0;
68
77
  };
69
78
  const getEntryPointFromManifest = async () => {
70
79
  const entryPoint = await getStringPropFromConsumerManifest("entryPoint");
@@ -75,7 +84,7 @@ const getEntryPointFromManifest = async () => {
75
84
  PROJECT_TYPES,
76
85
  getConsumerManifest,
77
86
  getEntryPointFromManifest,
78
- getPropFromConsumerManifest,
87
+ getManifestProperties,
79
88
  getSkubaManifest,
80
89
  getStringPropFromConsumerManifest,
81
90
  projectTypeSchema
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/manifest.ts"],
4
- "sourcesContent": ["import readPkgUp, { type NormalizedPackageJson } from 'read-pkg-up';\nimport * as z from 'zod/v4';\n\nimport { hasProp } from './validation.js';\n\nexport type ProjectType = z.infer<typeof projectTypeSchema>;\n\nexport const projectTypeSchema = z.union([\n z.literal('application'),\n z.literal('package'),\n]);\n\nexport const PROJECT_TYPES = ['application', 'package'] as const;\n\nconst DEFAULT_ENTRY_POINT = 'src/app.ts';\n\nlet skubaManifest: NormalizedPackageJson | undefined;\n\nexport const getSkubaManifest = async (): Promise<NormalizedPackageJson> => {\n if (skubaManifest !== undefined) {\n return skubaManifest;\n }\n\n const result = await readPkgUp({ cwd: __dirname });\n\n if (result === undefined) {\n throw Error('skuba could not find its own manifest');\n }\n\n return (skubaManifest = result.packageJson);\n};\n\nexport const getConsumerManifest = (cwd?: string) =>\n readPkgUp({ cwd, normalize: false });\n\nexport const getPropFromConsumerManifest = async <\n T extends string,\n V = unknown,\n>(\n prop: T,\n): Promise<V | undefined> => {\n const result = await getConsumerManifest();\n\n return result !== undefined && hasProp<T, V>(result.packageJson.skuba, prop)\n ? result.packageJson.skuba[prop]\n : undefined;\n};\n\nexport const getStringPropFromConsumerManifest = async <T extends string>(\n prop: T,\n): Promise<string | undefined> => {\n const result = await getPropFromConsumerManifest(prop);\n\n return typeof result === 'string' ? result : undefined;\n};\n\nexport const getEntryPointFromManifest = async (): Promise<string> => {\n const entryPoint = await getStringPropFromConsumerManifest('entryPoint');\n\n return entryPoint ?? DEFAULT_ENTRY_POINT;\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAsD;AACtD,QAAmB;AAEnB,wBAAwB;AAIjB,MAAM,oBAAoB,EAAE,MAAM;AAAA,EACvC,EAAE,QAAQ,aAAa;AAAA,EACvB,EAAE,QAAQ,SAAS;AACrB,CAAC;AAEM,MAAM,gBAAgB,CAAC,eAAe,SAAS;AAEtD,MAAM,sBAAsB;AAE5B,IAAI;AAEG,MAAM,mBAAmB,YAA4C;AAC1E,MAAI,kBAAkB,QAAW;AAC/B,WAAO;AAAA,EACT;AAEA,QAAM,SAAS,UAAM,mBAAAA,SAAU,EAAE,KAAK,UAAU,CAAC;AAEjD,MAAI,WAAW,QAAW;AACxB,UAAM,MAAM,uCAAuC;AAAA,EACrD;AAEA,SAAQ,gBAAgB,OAAO;AACjC;AAEO,MAAM,sBAAsB,CAAC,YAClC,mBAAAA,SAAU,EAAE,KAAK,WAAW,MAAM,CAAC;AAE9B,MAAM,8BAA8B,OAIzC,SAC2B;AAC3B,QAAM,SAAS,MAAM,oBAAoB;AAEzC,SAAO,WAAW,cAAa,2BAAc,OAAO,YAAY,OAAO,IAAI,IACvE,OAAO,YAAY,MAAM,IAAI,IAC7B;AACN;AAEO,MAAM,oCAAoC,OAC/C,SACgC;AAChC,QAAM,SAAS,MAAM,4BAA4B,IAAI;AAErD,SAAO,OAAO,WAAW,WAAW,SAAS;AAC/C;AAEO,MAAM,4BAA4B,YAA6B;AACpE,QAAM,aAAa,MAAM,kCAAkC,YAAY;AAEvE,SAAO,cAAc;AACvB;",
4
+ "sourcesContent": ["import readPkgUp, { type NormalizedPackageJson } from 'read-pkg-up';\nimport * as z from 'zod/v4';\n\nimport { hasProp } from './validation.js';\n\nexport type ProjectType = z.infer<typeof projectTypeSchema>;\n\nexport const projectTypeSchema = z.union([\n z.literal('application'),\n z.literal('package'),\n]);\n\nexport const PROJECT_TYPES = ['application', 'package'] as const;\n\nconst DEFAULT_ENTRY_POINT = 'src/app.ts';\n\nlet skubaManifest: NormalizedPackageJson | undefined;\n\nexport const getSkubaManifest = async (): Promise<NormalizedPackageJson> => {\n if (skubaManifest !== undefined) {\n return skubaManifest;\n }\n\n const result = await readPkgUp({ cwd: __dirname });\n\n if (result === undefined) {\n throw Error('skuba could not find its own manifest');\n }\n\n return (skubaManifest = result.packageJson);\n};\n\nexport const getConsumerManifest = (cwd?: string) =>\n readPkgUp({ cwd, normalize: false });\n\nexport const getManifestProperties = async <T extends string, V = unknown>(\n prop: T,\n): Promise<\n | {\n value: V | undefined;\n type: string | undefined;\n path: string;\n }\n | undefined\n> => {\n const manifest = await getConsumerManifest();\n\n if (!manifest) {\n return undefined;\n }\n\n const value = hasProp<T, V>(manifest.packageJson.skuba, prop)\n ? manifest.packageJson.skuba[prop]\n : undefined;\n\n const type =\n typeof manifest.packageJson.type === 'string'\n ? manifest.packageJson.type\n : undefined;\n\n return {\n value,\n type,\n path: manifest.path,\n };\n};\n\nexport const getStringPropFromConsumerManifest = async <T extends string>(\n prop: T,\n): Promise<string | undefined> => {\n const manifest = await getManifestProperties(prop);\n\n return typeof manifest?.value === 'string' ? manifest.value : undefined;\n};\n\nexport const getEntryPointFromManifest = async (): Promise<string> => {\n const entryPoint = await getStringPropFromConsumerManifest('entryPoint');\n\n return entryPoint ?? DEFAULT_ENTRY_POINT;\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA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2
2
  "name": "skuba",
3
- "version": "12.4.0-skuba-lib-api-20250925050503",
3
+ "version": "12.4.1-add-ci-true-20250929053152",
4
4
  "private": false,
5
5
  "description": "SEEK development toolkit for backend applications and packages",
6
6
  "homepage": "https://github.com/seek-oss/skuba#readme",
@@ -97,8 +97,8 @@
97
97
  "tsx": "^4.16.2",
98
98
  "typescript": "~5.9.0",
99
99
  "zod": "^4.0.0",
100
- "eslint-config-skuba": "7.1.2",
101
- "@skuba-lib/api": "^0.1.0-skuba-lib-api-20250925050503"
100
+ "@skuba-lib/api": "^1.0.0",
101
+ "eslint-config-skuba": "7.1.2"
102
102
  },
103
103
  "devDependencies": {
104
104
  "@changesets/cli": "2.29.7",
@@ -146,7 +146,7 @@
146
146
  "entryPoint": "src/index.ts",
147
147
  "template": null,
148
148
  "type": "package",
149
- "version": "12.2.0"
149
+ "version": "12.4.0"
150
150
  },
151
151
  "scripts": {
152
152
  "build": "scripts/build.sh",
@@ -1,5 +1,3 @@
1
- # syntax=docker/dockerfile:1.18
2
-
3
1
  FROM public.ecr.aws/docker/library/node:22-alpine AS dev-deps
4
2
 
5
3
  RUN --mount=type=bind,source=package.json,target=package.json \
@@ -34,7 +34,7 @@
34
34
  "skuba": "*",
35
35
  "supertest": "^7.0.0"
36
36
  },
37
- "packageManager": "pnpm@10.17.0",
37
+ "packageManager": "pnpm@10.17.1",
38
38
  "engines": {
39
39
  "node": ">=22"
40
40
  }
@@ -1,5 +1,3 @@
1
- # syntax=docker/dockerfile:1.18
2
-
3
1
  FROM public.ecr.aws/docker/library/node:22-alpine AS dev-deps
4
2
 
5
3
  RUN --mount=type=bind,source=package.json,target=package.json \
@@ -17,9 +17,9 @@
17
17
  },
18
18
  "devDependencies": {
19
19
  "@types/node": "^22.13.10",
20
- "skuba": "12.4.0-skuba-lib-api-20250925050503"
20
+ "skuba": "12.4.1-add-ci-true-20250929053152"
21
21
  },
22
- "packageManager": "pnpm@10.17.0",
22
+ "packageManager": "pnpm@10.17.1",
23
23
  "engines": {
24
24
  "node": ">=22"
25
25
  }
@@ -4,6 +4,8 @@ ARG BASE_IMAGE
4
4
 
5
5
  FROM ${BASE_IMAGE} AS build
6
6
 
7
+ ENV CI=true
8
+
7
9
  COPY . .
8
10
 
9
11
  RUN pnpm install --offline
@@ -1,5 +1,3 @@
1
- # syntax=docker/dockerfile:1.18
2
-
3
1
  FROM public.ecr.aws/docker/library/node:22-alpine AS dev-deps
4
2
 
5
3
  RUN --mount=type=bind,source=package.json,target=package.json \
@@ -43,7 +43,7 @@
43
43
  "skuba": "*",
44
44
  "supertest": "^7.0.0"
45
45
  },
46
- "packageManager": "pnpm@10.17.0",
46
+ "packageManager": "pnpm@10.17.1",
47
47
  "engines": {
48
48
  "node": ">=22"
49
49
  }
@@ -1,5 +1,3 @@
1
- # syntax=docker/dockerfile:1.18
2
-
3
1
  FROM public.ecr.aws/docker/library/node:22-alpine AS dev-deps
4
2
 
5
3
  # Needed for cdk
@@ -35,9 +35,9 @@
35
35
  "datadog-lambda-js": "^12.0.0",
36
36
  "dd-trace": "^5.0.0",
37
37
  "pino-pretty": "^13.0.0",
38
- "skuba": "12.4.0-skuba-lib-api-20250925050503"
38
+ "skuba": "12.4.1-add-ci-true-20250929053152"
39
39
  },
40
- "packageManager": "pnpm@10.17.0",
40
+ "packageManager": "pnpm@10.17.1",
41
41
  "engines": {
42
42
  "node": ">=22"
43
43
  }