skuba 14.0.0-tsdown-package-templates-20251225094805 → 14.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cli/build/assets.d.ts +9 -0
- package/lib/cli/build/assets.js +22 -2
- package/lib/cli/build/assets.js.map +2 -2
- package/lib/cli/build/esbuild.d.ts +4 -2
- package/lib/cli/build/esbuild.js +19 -2
- package/lib/cli/build/esbuild.js.map +2 -2
- package/lib/cli/build/index.js +9 -1
- package/lib/cli/build/index.js.map +2 -2
- package/lib/cli/buildPackage/index.d.ts +1 -0
- package/lib/cli/buildPackage/index.js +67 -0
- package/lib/cli/buildPackage/index.js.map +7 -0
- package/lib/cli/lint/autofix.d.ts +5 -0
- package/lib/cli/lint/autofix.js +8 -4
- package/lib/cli/lint/autofix.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/index.d.ts +6 -2
- package/lib/cli/lint/internalLints/upgrade/index.js +53 -17
- package/lib/cli/lint/internalLints/upgrade/index.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/index.js +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/index.js.map +1 -1
- package/lib/cli/migrate/index.js +1 -1
- package/lib/cli/migrate/index.js.map +1 -1
- package/lib/cli/migrate/nodeVersion/index.js +12 -0
- package/lib/cli/migrate/nodeVersion/index.js.map +2 -2
- package/lib/cli/migrate/nodeVersion/upgrade.js +28 -5
- package/lib/cli/migrate/nodeVersion/upgrade.js.map +3 -3
- package/lib/cli/test/index.js +21 -0
- package/lib/cli/test/index.js.map +2 -2
- package/package.json +10 -10
- package/template/express-rest-api/Dockerfile +1 -1
- package/template/express-rest-api/Dockerfile.dev-deps +1 -1
- package/template/express-rest-api/package.json +6 -6
- package/template/greeter/Dockerfile +1 -1
- package/template/greeter/package.json +3 -3
- package/template/koa-rest-api/Dockerfile +1 -1
- package/template/koa-rest-api/Dockerfile.dev-deps +1 -1
- package/template/koa-rest-api/package.json +7 -7
- package/template/lambda-sqs-worker-cdk/Dockerfile +1 -1
- package/template/lambda-sqs-worker-cdk/infra/appStack.ts +1 -1
- package/template/lambda-sqs-worker-cdk/package.json +3 -3
- package/template/oss-npm-package/_package.json +3 -11
- package/template/oss-npm-package/tsconfig.json +2 -3
- package/template/private-npm-package/_package.json +3 -11
- package/template/private-npm-package/tsconfig.json +2 -3
- package/template/oss-npm-package/tsdown.config.ts +0 -11
- package/template/private-npm-package/tsdown.config.ts +0 -11
|
@@ -1,2 +1,11 @@
|
|
|
1
|
+
import { styleText } from 'node:util';
|
|
1
2
|
import { type Logger } from '../../utils/logging.js';
|
|
3
|
+
type StyleColor = Parameters<typeof styleText>[0];
|
|
2
4
|
export declare const copyAssets: (destinationDir: string, logger?: Logger) => Promise<void>;
|
|
5
|
+
interface CopyAssetsConfig {
|
|
6
|
+
outDir: string;
|
|
7
|
+
name: string;
|
|
8
|
+
prefixColor: StyleColor;
|
|
9
|
+
}
|
|
10
|
+
export declare const copyAssetsConcurrently: (configs: CopyAssetsConfig[]) => Promise<void>;
|
|
11
|
+
export {};
|
package/lib/cli/build/assets.js
CHANGED
|
@@ -28,9 +28,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var assets_exports = {};
|
|
30
30
|
__export(assets_exports, {
|
|
31
|
-
copyAssets: () => copyAssets
|
|
31
|
+
copyAssets: () => copyAssets,
|
|
32
|
+
copyAssetsConcurrently: () => copyAssetsConcurrently
|
|
32
33
|
});
|
|
33
34
|
module.exports = __toCommonJS(assets_exports);
|
|
35
|
+
var import_node_util = require("node:util");
|
|
34
36
|
var import_path = __toESM(require("path"));
|
|
35
37
|
var import_fs_extra = __toESM(require("fs-extra"));
|
|
36
38
|
var import_copy = require("../../utils/copy.js");
|
|
@@ -76,8 +78,26 @@ const copyAssets = async (destinationDir, logger = import_logging.log) => {
|
|
|
76
78
|
})
|
|
77
79
|
);
|
|
78
80
|
};
|
|
81
|
+
const copyAssetsConcurrently = async (configs) => {
|
|
82
|
+
const maxNameLength = configs.reduce(
|
|
83
|
+
(length, command) => Math.max(length, command.name.length),
|
|
84
|
+
0
|
|
85
|
+
);
|
|
86
|
+
await Promise.all(
|
|
87
|
+
configs.map(
|
|
88
|
+
async ({ outDir, name, prefixColor }) => copyAssets(
|
|
89
|
+
outDir,
|
|
90
|
+
(0, import_logging.createLogger)({
|
|
91
|
+
debug: false,
|
|
92
|
+
prefixes: [(0, import_node_util.styleText)(prefixColor, `${name.padEnd(maxNameLength)} \u2502`)]
|
|
93
|
+
})
|
|
94
|
+
)
|
|
95
|
+
)
|
|
96
|
+
);
|
|
97
|
+
};
|
|
79
98
|
// Annotate the CommonJS export names for ESM import in node:
|
|
80
99
|
0 && (module.exports = {
|
|
81
|
-
copyAssets
|
|
100
|
+
copyAssets,
|
|
101
|
+
copyAssetsConcurrently
|
|
82
102
|
});
|
|
83
103
|
//# sourceMappingURL=assets.js.map
|
|
@@ -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 fs from 'fs-extra';\n\nimport { copyFile } from '../../utils/copy.js';\nimport { buildPatternToFilepathMap, crawlDirectory } from '../../utils/dir.js';\nimport { type Logger, 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"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,sBAAe;AAEf,kBAAyB;AACzB,iBAA0D;AAC1D,
|
|
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(prefixColor, `${name.padEnd(maxNameLength)} \u2502`)],\n }),\n ),\n ),\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA0B;AAC1B,kBAAiB;AAEjB,sBAAe;AAEf,kBAAyB;AACzB,iBAA0D;AAC1D,qBAA+C;AAC/C,sBAGO;AAIA,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,yBAA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1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { type BuildOptions } from 'esbuild';
|
|
2
|
+
export type EsbuildConfig = Pick<BuildOptions, 'external' | 'minify' | 'bundle' | 'splitting' | 'treeShaking'>;
|
|
3
|
+
interface EsbuildParameters extends EsbuildConfig {
|
|
2
4
|
debug: boolean;
|
|
3
5
|
type: string | undefined;
|
|
4
6
|
}
|
|
5
|
-
export declare const esbuild: ({ debug, type }: EsbuildParameters, args?: string[]) => Promise<void>;
|
|
7
|
+
export declare const esbuild: ({ debug, type, external, bundle, minify, splitting, treeShaking, }: EsbuildParameters, args?: string[]) => Promise<void>;
|
|
6
8
|
export {};
|
package/lib/cli/build/esbuild.js
CHANGED
|
@@ -28,7 +28,15 @@ var import_typescript = require("typescript");
|
|
|
28
28
|
var import_logging = require("../../utils/logging.js");
|
|
29
29
|
var import_args = require("./args.js");
|
|
30
30
|
var import_tsc = require("./tsc.js");
|
|
31
|
-
const esbuild = async ({
|
|
31
|
+
const esbuild = async ({
|
|
32
|
+
debug,
|
|
33
|
+
type,
|
|
34
|
+
external,
|
|
35
|
+
bundle,
|
|
36
|
+
minify,
|
|
37
|
+
splitting,
|
|
38
|
+
treeShaking
|
|
39
|
+
}, args = process.argv.slice(2)) => {
|
|
32
40
|
const log = (0, import_logging.createLogger)({ debug });
|
|
33
41
|
const tscArgs = (0, import_args.parseTscArgs)(args);
|
|
34
42
|
const customConditions = (0, import_tsc.getCustomConditions)();
|
|
@@ -49,10 +57,19 @@ const esbuild = async ({ debug, type }, args = process.argv.slice(2)) => {
|
|
|
49
57
|
log.debug(log.bold("Compiler options"));
|
|
50
58
|
log.debug((0, import_util.inspect)(compilerOptions));
|
|
51
59
|
const start = process.hrtime.bigint();
|
|
52
|
-
const bundle = false;
|
|
53
60
|
const isEsm = compilerOptions.module !== import_typescript.ModuleKind.CommonJS && type === "module";
|
|
61
|
+
const canSplit = bundle && isEsm && Boolean(compilerOptions.outDir);
|
|
62
|
+
if (splitting && !canSplit) {
|
|
63
|
+
throw new Error(
|
|
64
|
+
"Splitting requires bundling to be enabled, ESM output format, and outDir to be configured"
|
|
65
|
+
);
|
|
66
|
+
}
|
|
54
67
|
await (0, import_esbuild.build)({
|
|
55
68
|
bundle,
|
|
69
|
+
minify: bundle && minify,
|
|
70
|
+
splitting: canSplit && splitting,
|
|
71
|
+
treeShaking: bundle && treeShaking,
|
|
72
|
+
external,
|
|
56
73
|
entryPoints,
|
|
57
74
|
format: !isEsm ? "cjs" : void 0,
|
|
58
75
|
outdir: compilerOptions.outDir,
|
|
@@ -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 { 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 {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAExB,4BAAoC;AACpC,
|
|
4
|
+
"sourcesContent": ["import { inspect } from 'util';\n\nimport { TsconfigPathsPlugin } from '@esbuild-plugins/tsconfig-paths';\nimport { type BuildOptions, 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\nexport type EsbuildConfig = Pick<\n BuildOptions,\n 'external' | 'minify' | 'bundle' | 'splitting' | 'treeShaking'\n>;\n\ninterface EsbuildParameters extends EsbuildConfig {\n debug: boolean;\n type: string | undefined;\n}\n\nexport const esbuild = async (\n {\n debug,\n type,\n external,\n bundle,\n minify,\n splitting,\n treeShaking,\n }: 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 const isEsm =\n compilerOptions.module !== ModuleKind.CommonJS && type === 'module';\n\n const canSplit = bundle && isEsm && Boolean(compilerOptions.outDir);\n\n if (splitting && !canSplit) {\n throw new Error(\n 'Splitting requires bundling to be enabled, ESM output format, and outDir to be configured',\n );\n }\n\n await build({\n bundle,\n minify: bundle && minify,\n splitting: canSplit && splitting,\n treeShaking: bundle && treeShaking,\n external,\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,qBAAyC;AACzC,wBAA+D;AAE/D,qBAA6B;AAE7B,kBAA6B;AAC7B,iBAA4D;AAYrD,MAAM,UAAU,OACrB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GACA,OAAO,QAAQ,KAAK,MAAM,CAAC,MACxB;AACH,QAAM,UAAM,6BAAa,EAAE,MAAM,CAAC;AAElC,QAAM,cAAU,0BAAa,IAAI;AAEjC,QAAM,uBAAmB,gCAAoB;AAE7C,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;AAEpC,QAAM,QACJ,gBAAgB,WAAW,6BAAW,Y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value) {
|
|
34
34
|
case "esbuild": {
|
|
35
35
|
const debug = (0, import_args.hasDebugFlag)(args);
|
|
36
|
+
const esbuildConfig = await (0, import_manifest.getManifestProperties)("esbuildConfig");
|
|
36
37
|
import_logging.log.plain((0, import_node_util.styleText)("yellow", "esbuild"));
|
|
37
|
-
await (0, import_esbuild.esbuild)(
|
|
38
|
+
await (0, import_esbuild.esbuild)(
|
|
39
|
+
{
|
|
40
|
+
debug,
|
|
41
|
+
type: manifest.type,
|
|
42
|
+
...esbuildConfig?.value
|
|
43
|
+
},
|
|
44
|
+
args
|
|
45
|
+
);
|
|
38
46
|
break;
|
|
39
47
|
}
|
|
40
48
|
// TODO: flip the default case over to `esbuild` in skuba vNext.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/build/index.ts"],
|
|
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({
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA0B;AAE1B,kBAA6B;AAC7B,qBAAoB;AACpB,sBAAsC;AAEtC,oBAA2B;AAC3B,
|
|
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 { type EsbuildConfig, 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 const esbuildConfig = await getManifestProperties<\n 'esbuildConfig',\n EsbuildConfig\n >('esbuildConfig');\n\n log.plain(styleText('yellow', 'esbuild'));\n await esbuild(\n {\n debug,\n type: manifest.type,\n ...esbuildConfig?.value,\n },\n args,\n );\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,qBAA4C;AAC5C,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;AAC/B,YAAM,gBAAgB,UAAM,uCAG1B,eAAe;AAEjB,yBAAI,UAAM,4BAAU,UAAU,SAAS,CAAC;AACxC,gBAAM;AAAA,QACJ;AAAA,UACE;AAAA,UACA,MAAM,SAAS;AAAA,UACf,GAAG,eAAe;AAAA,QACpB;AAAA,QACA;AAAA,MACF;AACA;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
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const buildPackage: (args?: string[]) => Promise<void>;
|
|
@@ -0,0 +1,67 @@
|
|
|
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 buildPackage_exports = {};
|
|
20
|
+
__export(buildPackage_exports, {
|
|
21
|
+
buildPackage: () => buildPackage
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(buildPackage_exports);
|
|
24
|
+
var import_args = require("../../utils/args.js");
|
|
25
|
+
var import_exec = require("../../utils/exec.js");
|
|
26
|
+
var import_assets = require("../build/assets.js");
|
|
27
|
+
const buildPackage = async (args = process.argv.slice(2)) => {
|
|
28
|
+
await (0, import_exec.execConcurrently)(
|
|
29
|
+
[
|
|
30
|
+
{
|
|
31
|
+
command: "tsc --module CommonJS --outDir lib-commonjs --project tsconfig.build.json --moduleResolution node",
|
|
32
|
+
name: "commonjs",
|
|
33
|
+
prefixColor: "green"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
command: "tsc --module ES2015 --outDir lib-es2015 --project tsconfig.build.json --moduleResolution node",
|
|
37
|
+
name: "es2015",
|
|
38
|
+
prefixColor: "yellow"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
command: "tsc --allowJS false --declaration --emitDeclarationOnly --outDir lib-types --project tsconfig.build.json",
|
|
42
|
+
name: "types",
|
|
43
|
+
prefixColor: "blue"
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
{
|
|
47
|
+
maxProcesses: (0, import_args.hasSerialFlag)(args) ? 1 : void 0
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
await (0, import_assets.copyAssetsConcurrently)([
|
|
51
|
+
{
|
|
52
|
+
outDir: "lib-commonjs",
|
|
53
|
+
name: "commonjs",
|
|
54
|
+
prefixColor: "green"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
outDir: "lib-es2015",
|
|
58
|
+
name: "es2015",
|
|
59
|
+
prefixColor: "yellow"
|
|
60
|
+
}
|
|
61
|
+
]);
|
|
62
|
+
};
|
|
63
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
64
|
+
0 && (module.exports = {
|
|
65
|
+
buildPackage
|
|
66
|
+
});
|
|
67
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/cli/buildPackage/index.ts"],
|
|
4
|
+
"sourcesContent": ["import { hasSerialFlag } from '../../utils/args.js';\nimport { execConcurrently } from '../../utils/exec.js';\nimport { copyAssetsConcurrently } from '../build/assets.js';\n\nexport const buildPackage = async (args = process.argv.slice(2)) => {\n await execConcurrently(\n [\n {\n command:\n 'tsc --module CommonJS --outDir lib-commonjs --project tsconfig.build.json --moduleResolution node',\n name: 'commonjs',\n prefixColor: 'green',\n },\n {\n command:\n 'tsc --module ES2015 --outDir lib-es2015 --project tsconfig.build.json --moduleResolution node',\n name: 'es2015',\n prefixColor: 'yellow',\n },\n {\n command:\n 'tsc --allowJS false --declaration --emitDeclarationOnly --outDir lib-types --project tsconfig.build.json',\n name: 'types',\n prefixColor: 'blue',\n },\n ],\n {\n maxProcesses: hasSerialFlag(args) ? 1 : undefined,\n },\n );\n\n await copyAssetsConcurrently([\n {\n outDir: 'lib-commonjs',\n name: 'commonjs',\n prefixColor: 'green',\n },\n {\n outDir: 'lib-es2015',\n name: 'es2015',\n prefixColor: 'yellow',\n },\n ]);\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA8B;AAC9B,kBAAiC;AACjC,oBAAuC;AAEhC,MAAM,eAAe,OAAO,OAAO,QAAQ,KAAK,MAAM,CAAC,MAAM;AAClE,YAAM;AAAA,IACJ;AAAA,MACE;AAAA,QACE,SACE;AAAA,QACF,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,MACA;AAAA,QACE,SACE;AAAA,QACF,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,MACA;AAAA,QACE,SACE;AAAA,QACF,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,IACF;AAAA,IACA;AAAA,MACE,kBAAc,2BAAc,IAAI,IAAI,IAAI;AAAA,IAC1C;AAAA,EACF;AAEA,YAAM,sCAAuB;AAAA,IAC3B;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,aAAa;AAAA,IACf;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,aAAa;AAAA,IACf;AAAA,EACF,CAAC;AACH;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -2,6 +2,11 @@ import type { Input } from './types.js';
|
|
|
2
2
|
import * as Git from '@skuba-lib/api/git';
|
|
3
3
|
export declare const AUTOFIX_IGNORE_FILES_BASE: Git.ChangedFile[];
|
|
4
4
|
export declare const AUTOFIX_IGNORE_FILES_NPMRC: Git.ChangedFile[];
|
|
5
|
+
export declare const shouldCommit: ({ currentBranch, dir, }: {
|
|
6
|
+
currentBranch?: string;
|
|
7
|
+
dir: string;
|
|
8
|
+
}) => Promise<boolean>;
|
|
9
|
+
export declare const getIgnores: (dir: string) => Promise<Git.ChangedFile[]>;
|
|
5
10
|
interface AutofixParameters {
|
|
6
11
|
debug: Input['debug'];
|
|
7
12
|
eslint: boolean;
|
package/lib/cli/lint/autofix.js
CHANGED
|
@@ -30,7 +30,9 @@ var autofix_exports = {};
|
|
|
30
30
|
__export(autofix_exports, {
|
|
31
31
|
AUTOFIX_IGNORE_FILES_BASE: () => AUTOFIX_IGNORE_FILES_BASE,
|
|
32
32
|
AUTOFIX_IGNORE_FILES_NPMRC: () => AUTOFIX_IGNORE_FILES_NPMRC,
|
|
33
|
-
autofix: () => autofix
|
|
33
|
+
autofix: () => autofix,
|
|
34
|
+
getIgnores: () => getIgnores,
|
|
35
|
+
shouldCommit: () => shouldCommit
|
|
34
36
|
});
|
|
35
37
|
module.exports = __toCommonJS(autofix_exports);
|
|
36
38
|
var import_util = require("util");
|
|
@@ -64,7 +66,7 @@ const AUTOFIX_IGNORE_FILES_NPMRC = [
|
|
|
64
66
|
state: "modified"
|
|
65
67
|
}
|
|
66
68
|
];
|
|
67
|
-
const
|
|
69
|
+
const shouldCommit = async ({
|
|
68
70
|
currentBranch,
|
|
69
71
|
dir
|
|
70
72
|
}) => {
|
|
@@ -118,7 +120,7 @@ const autofix = async (params) => {
|
|
|
118
120
|
currentBranch = await Git.currentBranch({ dir });
|
|
119
121
|
} catch {
|
|
120
122
|
}
|
|
121
|
-
if (!await
|
|
123
|
+
if (!await shouldCommit({ currentBranch, dir })) {
|
|
122
124
|
return;
|
|
123
125
|
}
|
|
124
126
|
try {
|
|
@@ -186,6 +188,8 @@ const autofix = async (params) => {
|
|
|
186
188
|
0 && (module.exports = {
|
|
187
189
|
AUTOFIX_IGNORE_FILES_BASE,
|
|
188
190
|
AUTOFIX_IGNORE_FILES_NPMRC,
|
|
189
|
-
autofix
|
|
191
|
+
autofix,
|
|
192
|
+
getIgnores,
|
|
193
|
+
shouldCommit
|
|
190
194
|
});
|
|
191
195
|
//# sourceMappingURL=autofix.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/lint/autofix.ts"],
|
|
4
|
-
"sourcesContent": ["import { inspect } from 'util';\n\nimport { simpleGit } from 'simple-git';\n\nimport { isCiEnv } from '../../utils/env.js';\nimport { createLogger, log } from '../../utils/logging.js';\nimport { hasNpmrcSecret } from '../../utils/npmrc.js';\nimport { throwOnTimeout } from '../../utils/wait.js';\nimport { runESLint } from '../adapter/eslint.js';\nimport { runPrettier } from '../adapter/prettier.js';\nimport { createDestinationFileReader } from '../configure/analysis/project.js';\n\nimport { internalLint } from './internal.js';\nimport type { Input } from './types.js';\n\nimport * as Buildkite from '@skuba-lib/api/buildkite';\nimport * as Git from '@skuba-lib/api/git';\nimport * as GitHub from '@skuba-lib/api/github';\n\nconst RENOVATE_DEFAULT_PREFIX = 'renovate';\n\nconst AUTOFIX_COMMIT_MESSAGE = 'Run `skuba format`';\n\nexport const AUTOFIX_IGNORE_FILES_BASE: Git.ChangedFile[] = [\n {\n path: 'Dockerfile-incunabulum',\n state: 'added',\n },\n];\n\nexport const AUTOFIX_IGNORE_FILES_NPMRC: Git.ChangedFile[] = [\n {\n path: '.npmrc',\n state: 'added',\n },\n {\n path: '.npmrc',\n state: 'modified',\n },\n];\n\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAExB,wBAA0B;AAE1B,iBAAwB;AACxB,qBAAkC;AAClC,mBAA+B;AAC/B,kBAA+B;AAC/B,oBAA0B;AAC1B,sBAA4B;AAC5B,qBAA4C;AAE5C,sBAA6B;AAG7B,gBAA2B;AAC3B,UAAqB;AACrB,aAAwB;AAExB,MAAM,0BAA0B;AAEhC,MAAM,yBAAyB;AAExB,MAAM,4BAA+C;AAAA,EAC1D;AAAA,IACE,MAAM;AAAA,IACN,OAAO;AAAA,EACT;AACF;AAEO,MAAM,6BAAgD;AAAA,EAC3D;AAAA,IACE,MAAM;AAAA,IACN,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,OAAO;AAAA,EACT;AACF;
|
|
4
|
+
"sourcesContent": ["import { inspect } from 'util';\n\nimport { simpleGit } from 'simple-git';\n\nimport { isCiEnv } from '../../utils/env.js';\nimport { createLogger, log } from '../../utils/logging.js';\nimport { hasNpmrcSecret } from '../../utils/npmrc.js';\nimport { throwOnTimeout } from '../../utils/wait.js';\nimport { runESLint } from '../adapter/eslint.js';\nimport { runPrettier } from '../adapter/prettier.js';\nimport { createDestinationFileReader } from '../configure/analysis/project.js';\n\nimport { internalLint } from './internal.js';\nimport type { Input } from './types.js';\n\nimport * as Buildkite from '@skuba-lib/api/buildkite';\nimport * as Git from '@skuba-lib/api/git';\nimport * as GitHub from '@skuba-lib/api/github';\n\nconst RENOVATE_DEFAULT_PREFIX = 'renovate';\n\nconst AUTOFIX_COMMIT_MESSAGE = 'Run `skuba format`';\n\nexport const AUTOFIX_IGNORE_FILES_BASE: Git.ChangedFile[] = [\n {\n path: 'Dockerfile-incunabulum',\n state: 'added',\n },\n];\n\nexport const AUTOFIX_IGNORE_FILES_NPMRC: Git.ChangedFile[] = [\n {\n path: '.npmrc',\n state: 'added',\n },\n {\n path: '.npmrc',\n state: 'modified',\n },\n];\n\nexport const shouldCommit = async ({\n currentBranch,\n dir,\n}: {\n currentBranch?: string;\n dir: string;\n}) => {\n if (!isCiEnv()) {\n // We're not running in a CI environment so we don't need to push autofixes.\n // Ideally we'd drive this off of repository write permissions, but that is\n // non-trivial to infer without attempting an actual write.\n return false;\n }\n\n const isDefaultBuildkiteBranch =\n currentBranch &&\n [process.env.BUILDKITE_PIPELINE_DEFAULT_BRANCH, 'master', 'main'].includes(\n currentBranch,\n );\n\n const isProtectedGitHubBranch = process.env.GITHUB_REF_PROTECTED === 'true';\n\n if (isDefaultBuildkiteBranch || isProtectedGitHubBranch) {\n // The current branch is a protected branch.\n // We respect GitHub Flow; avoid pushing directly to the default branch.\n return false;\n }\n\n if (currentBranch?.startsWith(RENOVATE_DEFAULT_PREFIX)) {\n try {\n await GitHub.getPullRequestNumber();\n } catch {\n const warning =\n 'An autofix is available, but it was not pushed because an open pull request for this Renovate branch could not be found. If a pull request has since been created, retry the lint step to push the fix.';\n log.warn(warning);\n try {\n await Buildkite.annotate(Buildkite.md.terminal(warning));\n } catch {}\n\n return false;\n }\n }\n\n let headCommitMessage;\n try {\n headCommitMessage = await Git.getHeadCommitMessage({ dir });\n } catch {}\n\n if (headCommitMessage?.startsWith(AUTOFIX_COMMIT_MESSAGE)) {\n // Short circuit when the head commit appears to be one of our autofixes.\n // Repeating the same operation is unlikely to correct outstanding issues.\n return false;\n }\n\n // Allow the push attempt to go ahead if our guards have been cleared.\n return true;\n};\n\nexport const getIgnores = async (dir: string): Promise<Git.ChangedFile[]> => {\n const contents = await createDestinationFileReader(dir)('.npmrc');\n\n // If an .npmrc has secrets, we need to ignore it\n if (hasNpmrcSecret(contents ?? '')) {\n return [...AUTOFIX_IGNORE_FILES_BASE, ...AUTOFIX_IGNORE_FILES_NPMRC];\n }\n\n return AUTOFIX_IGNORE_FILES_BASE;\n};\n\ninterface AutofixParameters {\n debug: Input['debug'];\n\n eslint: boolean;\n prettier: boolean;\n internal: boolean;\n\n eslintConfigFile?: string;\n}\n\nexport const autofix = async (params: AutofixParameters): Promise<void> => {\n const dir = process.cwd();\n\n if (!params.eslint && !params.prettier && !params.internal) {\n return;\n }\n\n let currentBranch;\n try {\n currentBranch = await Git.currentBranch({ dir });\n } catch {}\n\n if (!(await shouldCommit({ currentBranch, dir }))) {\n return;\n }\n\n try {\n log.newline();\n\n log.warn(\n `Attempting to autofix issues (${[\n params.internal ? 'skuba' : undefined,\n params.internal || params.eslint ? 'ESLint' : undefined,\n 'Prettier', // Prettier is always run\n ]\n .filter((s) => s !== undefined)\n .join(', ')})...`,\n );\n\n const logger = createLogger({ debug: params.debug });\n\n if (params.internal) {\n await internalLint('format');\n }\n\n if (params.internal || params.eslint) {\n await runESLint('format', logger, params.eslintConfigFile);\n }\n\n // Unconditionally re-run Prettier; reaching here means we have pre-existing\n // format violations or may have created new ones through ESLint/internal fixes.\n await runPrettier('format', logger);\n\n if (process.env.GITHUB_ACTIONS) {\n // GitHub runners have Git installed locally\n const ref = await Git.commitAllChanges({\n dir,\n message: AUTOFIX_COMMIT_MESSAGE,\n\n ignore: await getIgnores(dir),\n });\n\n if (!ref) {\n return log.warn('No autofixes detected.');\n }\n\n await throwOnTimeout(simpleGit().push(), { s: 30 });\n log.warn(`Pushed fix commit ${ref}.`);\n return;\n }\n\n // Other CI Environments, use GitHub API\n if (!currentBranch) {\n log.warn('Could not determine the current branch.');\n log.warn(\n 'Please propagate BUILDKITE_BRANCH, GITHUB_HEAD_REF, GITHUB_REF_NAME, or the .git directory to your container.',\n );\n return;\n }\n\n const ref = await throwOnTimeout(\n GitHub.uploadAllFileChanges({\n branch: currentBranch,\n dir,\n messageHeadline: AUTOFIX_COMMIT_MESSAGE,\n\n ignore: await getIgnores(dir),\n }),\n { s: 30 },\n );\n\n if (!ref) {\n return log.warn('No autofixes detected.');\n }\n\n log.warn(`Pushed fix commit ${ref}.`);\n } catch (err) {\n log.warn(log.bold('Failed to push fix commit.'));\n log.warn(\n log.bold(\n 'Does your CI environment have write access to your Git repository?',\n ),\n );\n log.subtle(inspect(err));\n }\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAExB,wBAA0B;AAE1B,iBAAwB;AACxB,qBAAkC;AAClC,mBAA+B;AAC/B,kBAA+B;AAC/B,oBAA0B;AAC1B,sBAA4B;AAC5B,qBAA4C;AAE5C,sBAA6B;AAG7B,gBAA2B;AAC3B,UAAqB;AACrB,aAAwB;AAExB,MAAM,0BAA0B;AAEhC,MAAM,yBAAyB;AAExB,MAAM,4BAA+C;AAAA,EAC1D;AAAA,IACE,MAAM;AAAA,IACN,OAAO;AAAA,EACT;AACF;AAEO,MAAM,6BAAgD;AAAA,EAC3D;AAAA,IACE,MAAM;AAAA,IACN,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,OAAO;AAAA,EACT;AACF;AAEO,MAAM,eAAe,OAAO;AAAA,EACjC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AEA,uBAAI,KAAK,qBAAqB,GAAG,GAAG;AAAA,EACtC,SAAS,KAAK;AACZ,uBAAI,KAAK,mBAAI,KAAK,4BAA4B,CAAC;AAC/C,uBAAI;AAAA,MACF,mBAAI;AAAA,QACF;AAAA,MACF;AAAA,IACF;AACA,uBAAI,WAAO,qBAAQ,GAAG,CAAC;AAAA,EACzB;AACF;",
|
|
6
6
|
"names": ["ref"]
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReadResult } from 'read-pkg-up';
|
|
2
|
-
import type
|
|
2
|
+
import { type Logger } from '../../../../utils/logging.js';
|
|
3
3
|
import { type PackageManagerConfig } from '../../../../utils/packageManager.js';
|
|
4
4
|
import type { InternalLintResult } from '../../internal.js';
|
|
5
5
|
export type Patches = Patch[];
|
|
@@ -20,4 +20,8 @@ export type PatchConfig = {
|
|
|
20
20
|
dir?: string;
|
|
21
21
|
};
|
|
22
22
|
export type PatchFunction = (config: PatchConfig) => Promise<PatchReturnType>;
|
|
23
|
-
|
|
23
|
+
type UpgradeSkubaResult = InternalLintResult & {
|
|
24
|
+
upgraded?: boolean;
|
|
25
|
+
};
|
|
26
|
+
export declare const upgradeSkuba: (mode: "lint" | "format", logger: Logger, additionalFlags?: string[]) => Promise<UpgradeSkubaResult>;
|
|
27
|
+
export {};
|
|
@@ -34,10 +34,13 @@ module.exports = __toCommonJS(upgrade_exports);
|
|
|
34
34
|
var import_path = __toESM(require("path"));
|
|
35
35
|
var import_fs_extra = __toESM(require("fs-extra"));
|
|
36
36
|
var import_semver = require("semver");
|
|
37
|
+
var import_logging = require("../../../../utils/logging.js");
|
|
37
38
|
var import_manifest = require("../../../../utils/manifest.js");
|
|
38
39
|
var import_packageManager = require("../../../../utils/packageManager.js");
|
|
39
40
|
var import_version = require("../../../../utils/version.js");
|
|
40
41
|
var import_package = require("../../../configure/processing/package.js");
|
|
42
|
+
var import_autofix = require("../../autofix.js");
|
|
43
|
+
var import_api = require("@skuba-lib/api");
|
|
41
44
|
const getPatches = async (manifestVersion) => {
|
|
42
45
|
const patches = await import_fs_extra.default.readdir(import_path.default.join(__dirname, "patches"), {
|
|
43
46
|
withFileTypes: true
|
|
@@ -51,7 +54,14 @@ const getPatches = async (manifestVersion) => {
|
|
|
51
54
|
)
|
|
52
55
|
)
|
|
53
56
|
);
|
|
54
|
-
return
|
|
57
|
+
return new Map(
|
|
58
|
+
await Promise.all(
|
|
59
|
+
patchesForVersion.map(async (version) => {
|
|
60
|
+
const resolved = await resolvePatches(version);
|
|
61
|
+
return [version, resolved];
|
|
62
|
+
})
|
|
63
|
+
)
|
|
64
|
+
);
|
|
55
65
|
};
|
|
56
66
|
const fileExtensions = ["js", "ts"];
|
|
57
67
|
const resolvePatches = async (version) => {
|
|
@@ -78,12 +88,13 @@ const upgradeSkuba = async (mode, logger, additionalFlags = []) => {
|
|
|
78
88
|
return { ok: true, fixable: false };
|
|
79
89
|
}
|
|
80
90
|
const patches = await getPatches(manifestVersion);
|
|
81
|
-
if (patches.
|
|
91
|
+
if (patches.size === 0) {
|
|
82
92
|
return { ok: true, fixable: false };
|
|
83
93
|
}
|
|
84
94
|
if (mode === "lint") {
|
|
95
|
+
const allPatches = Array.from(patches.values()).flat();
|
|
85
96
|
const results = await Promise.all(
|
|
86
|
-
|
|
97
|
+
allPatches.map(
|
|
87
98
|
async ({ apply }) => await apply({
|
|
88
99
|
mode,
|
|
89
100
|
manifest,
|
|
@@ -113,19 +124,43 @@ const upgradeSkuba = async (mode, logger, additionalFlags = []) => {
|
|
|
113
124
|
};
|
|
114
125
|
}
|
|
115
126
|
logger.plain("Updating skuba...");
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
|
|
127
|
+
const dir = process.cwd();
|
|
128
|
+
let currentBranch;
|
|
129
|
+
try {
|
|
130
|
+
currentBranch = await import_api.Git.currentBranch({ dir });
|
|
131
|
+
} catch {
|
|
132
|
+
}
|
|
133
|
+
const shouldCommitChanges = await (0, import_autofix.shouldCommit)({ currentBranch, dir });
|
|
134
|
+
for (const version of patches.keys()) {
|
|
135
|
+
const patchesForVersion = patches.get(version);
|
|
136
|
+
if (!patchesForVersion) {
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
for (const { apply, description } of patchesForVersion) {
|
|
140
|
+
const result = await apply({
|
|
141
|
+
mode,
|
|
142
|
+
manifest,
|
|
143
|
+
packageManager
|
|
144
|
+
});
|
|
145
|
+
logger.newline();
|
|
146
|
+
if (result.result === "skip") {
|
|
147
|
+
logger.plain(
|
|
148
|
+
`Patch skipped: ${description}${result.reason ? ` - ${result.reason}` : ""}`
|
|
149
|
+
);
|
|
150
|
+
} else {
|
|
151
|
+
logger.plain(`Patch applied: ${description}`);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (shouldCommitChanges) {
|
|
155
|
+
const ref = await import_api.Git.commitAllChanges({
|
|
156
|
+
dir,
|
|
157
|
+
message: `Apply skuba ${version} patches`,
|
|
158
|
+
ignore: await (0, import_autofix.getIgnores)(dir)
|
|
159
|
+
});
|
|
160
|
+
if (!ref) {
|
|
161
|
+
import_logging.log.warn("No autofixes detected.");
|
|
162
|
+
return { ok: true, fixable: false };
|
|
163
|
+
}
|
|
129
164
|
}
|
|
130
165
|
}
|
|
131
166
|
const updatedManifest = await (0, import_manifest.getConsumerManifest)();
|
|
@@ -140,7 +175,8 @@ const upgradeSkuba = async (mode, logger, additionalFlags = []) => {
|
|
|
140
175
|
logger.newline();
|
|
141
176
|
return {
|
|
142
177
|
ok: true,
|
|
143
|
-
fixable: false
|
|
178
|
+
fixable: false,
|
|
179
|
+
upgraded: true
|
|
144
180
|
};
|
|
145
181
|
};
|
|
146
182
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/cli/lint/internalLints/upgrade/index.ts"],
|
|
4
|
-
"sourcesContent": ["import path from 'path';\n\nimport fs from 'fs-extra';\nimport type { ReadResult } from 'read-pkg-up';\nimport { gte, sort } from 'semver';\n\nimport type
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,sBAAe;AAEf,oBAA0B;
|
|
4
|
+
"sourcesContent": ["import path from 'path';\n\nimport fs from 'fs-extra';\nimport type { ReadResult } from 'read-pkg-up';\nimport { gte, sort } from 'semver';\n\nimport { type Logger, log } from '../../../../utils/logging.js';\nimport { getConsumerManifest } from '../../../../utils/manifest.js';\nimport {\n type PackageManagerConfig,\n detectPackageManager,\n} from '../../../../utils/packageManager.js';\nimport { getSkubaVersion } from '../../../../utils/version.js';\nimport { formatPackage } from '../../../configure/processing/package.js';\nimport type { SkubaPackageJson } from '../../../init/writePackageJson.js';\nimport { getIgnores, shouldCommit } from '../../autofix.js';\nimport type { InternalLintResult } from '../../internal.js';\n\nimport { Git } from '@skuba-lib/api';\n\nexport type Patches = Patch[];\nexport type Patch = {\n apply: PatchFunction;\n description: string;\n};\nexport type PatchReturnType =\n | { result: 'apply' }\n | { result: 'skip'; reason?: string };\n\nexport type PatchConfig = {\n mode: 'format' | 'lint';\n manifest: ReadResult;\n packageManager: PackageManagerConfig;\n dir?: string;\n};\n\nexport type PatchFunction = (config: PatchConfig) => Promise<PatchReturnType>;\n\nconst getPatches = async (\n manifestVersion: string,\n): Promise<Map<string, Patches>> => {\n const patches = await fs.readdir(path.join(__dirname, 'patches'), {\n withFileTypes: true,\n });\n\n // The patches are sorted by the version they were added from.\n // Only return patches that are newer or equal to the current version.\n const patchesForVersion = sort(\n patches.flatMap((patch) =>\n // Is a directory rather than a JavaScript source file\n patch.isDirectory() &&\n // Has been added since the last patch run on the project\n gte(patch.name, manifestVersion)\n ? patch.name\n : [],\n ),\n );\n\n return new Map<string, Patches>(\n await Promise.all(\n patchesForVersion.map(async (version) => {\n const resolved = await resolvePatches(version);\n return [version, resolved] as const;\n }),\n ),\n );\n};\n\nconst fileExtensions = ['js', 'ts'];\n\n// Hack to allow our Jest environment/transform to resolve the patches\n// In normal scenarios this will resolve immediately after the .js import\nconst resolvePatches = async (version: string): Promise<Patches> => {\n for (const extension of fileExtensions) {\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access\n return (await import(`./patches/${version}/index.${extension}`)).patches;\n } catch {\n // Ignore\n }\n }\n throw new Error(`Could not resolve patches for ${version}`);\n};\n\ntype UpgradeSkubaResult = InternalLintResult & {\n upgraded?: boolean;\n};\n\nexport const upgradeSkuba = async (\n mode: 'lint' | 'format',\n logger: Logger,\n additionalFlags: string[] = [],\n): Promise<UpgradeSkubaResult> => {\n const [currentVersion, manifest, packageManager] = await Promise.all([\n getSkubaVersion(),\n getConsumerManifest(),\n detectPackageManager(),\n ]);\n\n if (!manifest) {\n throw new Error('Could not find a package json for this project');\n }\n\n manifest.packageJson.skuba ??= { version: '1.0.0' };\n\n const manifestVersion = additionalFlags.includes('--force-apply-all-patches')\n ? '1.0.0'\n : (manifest.packageJson.skuba as SkubaPackageJson).version;\n\n // We are up to date, skip patches\n if (gte(manifestVersion, currentVersion)) {\n return { ok: true, fixable: false };\n }\n\n const patches = await getPatches(manifestVersion);\n // No patches to apply even if version out of date. Early exit to avoid unnecessary commits.\n if (patches.size === 0) {\n return { ok: true, fixable: false };\n }\n\n if (mode === 'lint') {\n const allPatches = Array.from(patches.values()).flat();\n const results = await Promise.all(\n allPatches.map(\n async ({ apply }) =>\n await apply({\n mode,\n manifest,\n packageManager,\n }),\n ),\n );\n\n // No patches are applicable. Early exit to avoid unnecessary commits.\n if (results.every(({ result }) => result === 'skip')) {\n return { ok: true, fixable: false };\n }\n\n logger.warn(\n `skuba has patches to apply. Run ${logger.bold(\n `${packageManager.print.exec} skuba format`,\n )} to run them.`,\n );\n\n return {\n ok: false,\n fixable: true,\n annotations: [\n {\n // package.json as likely skuba version has changed\n // TODO: locate the \"skuba\": {} config in the package.json and annotate on the version property\n path: manifest.path,\n message: `skuba has patches to apply. Run ${packageManager.print.exec} skuba format to run them.`,\n },\n ],\n };\n }\n\n logger.plain('Updating skuba...');\n\n const dir = process.cwd();\n let currentBranch;\n try {\n currentBranch = await Git.currentBranch({ dir });\n } catch {}\n\n const shouldCommitChanges = await shouldCommit({ currentBranch, dir });\n\n // Run these in series in case a subsequent patch relies on a previous patch\n for (const version of patches.keys()) {\n const patchesForVersion = patches.get(version);\n if (!patchesForVersion) {\n continue;\n }\n\n for (const { apply, description } of patchesForVersion) {\n const result = await apply({\n mode,\n manifest,\n packageManager,\n });\n logger.newline();\n if (result.result === 'skip') {\n logger.plain(\n `Patch skipped: ${description}${\n result.reason ? ` - ${result.reason}` : ''\n }`,\n );\n } else {\n logger.plain(`Patch applied: ${description}`);\n }\n }\n\n if (shouldCommitChanges) {\n // Only commit changes here, each version should have a separate commit and they should all be pushed together at the end\n const ref = await Git.commitAllChanges({\n dir,\n message: `Apply skuba ${version} patches`,\n\n ignore: await getIgnores(dir),\n });\n\n if (!ref) {\n log.warn('No autofixes detected.');\n return { ok: true, fixable: false };\n }\n }\n }\n\n const updatedManifest = await getConsumerManifest();\n if (!updatedManifest) {\n throw new Error('Could not find a package json for this project');\n }\n\n (updatedManifest.packageJson.skuba as SkubaPackageJson).version =\n currentVersion;\n\n const updatedPackageJson = await formatPackage(updatedManifest.packageJson);\n\n await fs.writeFile(updatedManifest.path, updatedPackageJson);\n logger.newline();\n logger.plain('skuba update complete.');\n logger.newline();\n\n return {\n ok: true,\n fixable: false,\n upgraded: true,\n };\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,sBAAe;AAEf,oBA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Node.tryUpgradeNode,
|
|
29
|
-
description: "Upgrade Node.js version to 24 and package targets to Node.js
|
|
29
|
+
description: "Upgrade Node.js version to 24 and package targets to Node.js 22.14.0+"
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
32
|
apply: import_patchRootTsconfig.tryPatchRootTsConfig,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/13.1.1/index.ts"],
|
|
4
|
-
"sourcesContent": ["import type { Patches } from '../../index.js';\n\nimport { tryPatchRootTsConfig } from './patchRootTsconfig.js';\nimport { tryUpgradeNode } from './upgradeNode.js';\n\nexport const patches: Patches = [\n {\n apply: tryUpgradeNode,\n description:\n 'Upgrade Node.js version to 24 and package targets to Node.js
|
|
4
|
+
"sourcesContent": ["import type { Patches } from '../../index.js';\n\nimport { tryPatchRootTsConfig } from './patchRootTsconfig.js';\nimport { tryUpgradeNode } from './upgradeNode.js';\n\nexport const patches: Patches = [\n {\n apply: tryUpgradeNode,\n description:\n 'Upgrade Node.js version to 24 and package targets to Node.js 22.14.0+',\n },\n {\n apply: tryPatchRootTsConfig,\n description: \"Add 'rootDir' to root tsconfig.json compilerOptions\",\n },\n];\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,+BAAqC;AACrC,yBAA+B;AAExB,MAAM,UAAmB;AAAA,EAC9B;AAAA,IACE,OAAO;AAAA,IACP,aACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/cli/migrate/index.js
CHANGED
|
@@ -42,7 +42,7 @@ const migrations = {
|
|
|
42
42
|
node24: () => (0, import_nodeVersion.nodeVersionMigration)({
|
|
43
43
|
nodeVersion: "24",
|
|
44
44
|
ECMAScriptVersion: "ES2024",
|
|
45
|
-
packageNodeVersion: "
|
|
45
|
+
packageNodeVersion: "22.14.0",
|
|
46
46
|
packageECMAScriptVersion: "ES2023",
|
|
47
47
|
infraPackages: [
|
|
48
48
|
{
|