skuba 0.0.0-master-20230319220011 → 0.0.0-preserve-assets-20230504055335
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/api/jest/index.d.ts +4 -1
- package/lib/cli/adapter/eslint.js +0 -24
- package/lib/cli/adapter/eslint.js.map +2 -2
- package/lib/cli/build/esbuild.js +3 -42
- package/lib/cli/build/esbuild.js.map +3 -3
- package/lib/cli/build/index.js +9 -2
- package/lib/cli/build/index.js.map +2 -2
- package/lib/cli/build/tsc.d.ts +3 -0
- package/lib/cli/build/tsc.js +60 -0
- package/lib/cli/build/tsc.js.map +3 -3
- package/lib/cli/buildPackage.js +17 -0
- package/lib/cli/buildPackage.js.map +3 -3
- package/lib/cli/configure/patchRenovateConfig.js +3 -1
- package/lib/cli/configure/patchRenovateConfig.js.map +2 -2
- package/lib/cli/lint/autofix.js +6 -0
- package/lib/cli/lint/autofix.js.map +2 -2
- package/lib/cli/test/reporters/github/index.js +0 -2
- package/lib/utils/copy.d.ts +2 -0
- package/lib/utils/copy.js +43 -1
- package/lib/utils/copy.js.map +2 -2
- package/lib/utils/dir.d.ts +2 -1
- package/lib/utils/dir.js +2 -2
- package/lib/utils/dir.js.map +2 -2
- package/lib/utils/manifest.d.ts +1 -0
- package/lib/utils/manifest.js +8 -2
- package/lib/utils/manifest.js.map +2 -2
- package/lib/wrapper/requestListener.js +3 -0
- package/lib/wrapper/requestListener.js.map +2 -2
- package/package.json +11 -11
- package/template/base/.github/CODEOWNERS +0 -4
- package/template/express-rest-api/.buildkite/pipeline.yml +1 -1
- package/template/express-rest-api/gantry.apply.yml +0 -2
- package/template/express-rest-api/package.json +1 -1
- package/template/express-rest-api/src/api/healthCheck.ts +1 -1
- package/template/express-rest-api/src/api/smokeTest.ts +1 -1
- package/template/greeter/.buildkite/pipeline.yml +1 -1
- package/template/koa-rest-api/.buildkite/pipeline.yml +1 -1
- package/template/koa-rest-api/gantry.apply.yml +0 -2
- package/template/koa-rest-api/package.json +5 -5
- package/template/koa-rest-api/src/api/healthCheck.ts +1 -1
- package/template/koa-rest-api/src/api/jobs/getJobs.ts +1 -1
- package/template/koa-rest-api/src/api/jobs/postJob.ts +1 -1
- package/template/koa-rest-api/src/api/smokeTest.ts +1 -1
- package/template/koa-rest-api/src/framework/server.test.ts +1 -1
- package/template/koa-rest-api/src/framework/validation.ts +2 -2
- package/template/koa-rest-api/src/storage/jobs.ts +1 -1
- package/template/koa-rest-api/src/testing/server.ts +2 -2
- package/template/koa-rest-api/src/testing/types.ts +1 -1
- package/template/lambda-sqs-worker/.buildkite/pipeline.yml +2 -2
- package/template/lambda-sqs-worker/package.json +2 -2
- package/template/lambda-sqs-worker/src/app.ts +1 -1
- package/template/lambda-sqs-worker/src/framework/validation.ts +1 -1
- package/template/lambda-sqs-worker/src/mapping/jobScorer.ts +5 -2
- package/template/lambda-sqs-worker/src/services/jobScorer.ts +6 -6
- package/template/lambda-sqs-worker/src/testing/handler.ts +1 -1
- package/template/lambda-sqs-worker/src/testing/types.ts +1 -1
- package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +2 -2
- package/template/lambda-sqs-worker-cdk/infra/appStack.ts +1 -1
- package/template/lambda-sqs-worker-cdk/package.json +1 -1
- package/template/lambda-sqs-worker-cdk/src/app.ts +1 -1
package/lib/api/jest/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ type DefaultOptions = 'collectCoverage' | 'collectCoverageFrom' | 'coveragePathI
|
|
|
11
11
|
*
|
|
12
12
|
* This concatenates array options like `testPathIgnorePatterns`.
|
|
13
13
|
*/
|
|
14
|
-
export declare const mergePreset: <AdditionalOptions extends "filter" | "json" | "silent" | "cache" | "runtime" | "watch" | "runner" | "projects" | "id" | "automock" | "cacheDirectory" | "clearMocks" | "coveragePathIgnorePatterns" | "dependencyExtractor" | "detectLeaks" | "detectOpenHandles" | "displayName" | "errorOnDeprecated" | "extensionsToTreatAsEsm" | "fakeTimers" | "forceCoverageMatch" | "globalSetup" | "globalTeardown" | "globals" | "haste" | "injectGlobals" | "moduleDirectories" | "moduleFileExtensions" | "moduleNameMapper" | "modulePathIgnorePatterns" | "modulePaths" | "preset" | "prettierPath" | "resetMocks" | "resetModules" | "resolver" | "restoreMocks" | "rootDir" | "roots" | "sandboxInjectedGlobals" | "setupFiles" | "setupFilesAfterEnv" | "skipFilter" | "skipNodeResolution" | "slowTestThreshold" | "snapshotResolver" | "snapshotSerializers" | "snapshotFormat" | "testEnvironment" | "testEnvironmentOptions" | "testMatch" | "testLocationInResults" | "testPathIgnorePatterns" | "testRegex" | "testRunner" | "transform" | "transformIgnorePatterns" | "watchPathIgnorePatterns" | "unmockedModulePathPatterns" | "workerIdleMemoryLimit" | "bail" | "ci" | "changedFilesWithAncestor" | "changedSince" | "collectCoverage" | "collectCoverageFrom" | "coverageDirectory" | "coverageProvider" | "coverageReporters" | "coverageThreshold" | "expand" | "findRelatedTests" | "forceExit" | "reporters" | "logHeapUsage" | "lastCommit" | "listTests" | "maxConcurrency" | "maxWorkers" | "noStackTrace" | "notify" | "notifyMode" | "onlyChanged" | "onlyFailures" | "outputFile" | "passWithNoTests" | "replname" | "runTestsByPath" | "showSeed" | "testFailureExitCode" | "testNamePattern" | "testResultsProcessor" | "testSequencer" | "testTimeout" | "updateSnapshot" | "useStderr" | "verbose" | "watchAll" | "watchman" | "watchPlugins">(options: Pick<Partial<{
|
|
14
|
+
export declare const mergePreset: <AdditionalOptions extends "filter" | "json" | "silent" | "cache" | "runtime" | "watch" | "runner" | "projects" | "id" | "automock" | "cacheDirectory" | "clearMocks" | "coveragePathIgnorePatterns" | "dependencyExtractor" | "detectLeaks" | "detectOpenHandles" | "displayName" | "errorOnDeprecated" | "extensionsToTreatAsEsm" | "fakeTimers" | "forceCoverageMatch" | "globalSetup" | "globalTeardown" | "globals" | "haste" | "injectGlobals" | "moduleDirectories" | "moduleFileExtensions" | "moduleNameMapper" | "modulePathIgnorePatterns" | "modulePaths" | "openHandlesTimeout" | "preset" | "prettierPath" | "resetMocks" | "resetModules" | "resolver" | "restoreMocks" | "rootDir" | "roots" | "sandboxInjectedGlobals" | "setupFiles" | "setupFilesAfterEnv" | "skipFilter" | "skipNodeResolution" | "slowTestThreshold" | "snapshotResolver" | "snapshotSerializers" | "snapshotFormat" | "testEnvironment" | "testEnvironmentOptions" | "testMatch" | "testLocationInResults" | "testPathIgnorePatterns" | "testRegex" | "testRunner" | "transform" | "transformIgnorePatterns" | "watchPathIgnorePatterns" | "unmockedModulePathPatterns" | "workerIdleMemoryLimit" | "bail" | "ci" | "changedFilesWithAncestor" | "changedSince" | "collectCoverage" | "collectCoverageFrom" | "coverageDirectory" | "coverageProvider" | "coverageReporters" | "coverageThreshold" | "expand" | "findRelatedTests" | "forceExit" | "reporters" | "logHeapUsage" | "lastCommit" | "listTests" | "maxConcurrency" | "maxWorkers" | "noStackTrace" | "notify" | "notifyMode" | "onlyChanged" | "onlyFailures" | "outputFile" | "passWithNoTests" | "randomize" | "replname" | "runTestsByPath" | "showSeed" | "testFailureExitCode" | "testNamePattern" | "testResultsProcessor" | "testSequencer" | "testTimeout" | "updateSnapshot" | "useStderr" | "verbose" | "watchAll" | "watchman" | "watchPlugins" | "workerThreads">(options: Pick<Partial<{
|
|
15
15
|
automock: boolean;
|
|
16
16
|
bail: number | boolean;
|
|
17
17
|
cache: boolean;
|
|
@@ -68,11 +68,13 @@ export declare const mergePreset: <AdditionalOptions extends "filter" | "json" |
|
|
|
68
68
|
notifyMode: string;
|
|
69
69
|
onlyChanged: boolean;
|
|
70
70
|
onlyFailures: boolean;
|
|
71
|
+
openHandlesTimeout: number;
|
|
71
72
|
outputFile: string;
|
|
72
73
|
passWithNoTests: boolean;
|
|
73
74
|
preset: string | null | undefined;
|
|
74
75
|
prettierPath: string | null | undefined;
|
|
75
76
|
projects: (string | Config.InitialProjectOptions)[];
|
|
77
|
+
randomize: boolean;
|
|
76
78
|
replname: string | null | undefined;
|
|
77
79
|
resetMocks: boolean;
|
|
78
80
|
resetModules: boolean;
|
|
@@ -140,5 +142,6 @@ export declare const mergePreset: <AdditionalOptions extends "filter" | "json" |
|
|
|
140
142
|
watchman: boolean;
|
|
141
143
|
watchPlugins: (string | [string, Record<string, unknown>])[];
|
|
142
144
|
workerIdleMemoryLimit: string | number;
|
|
145
|
+
workerThreads: boolean;
|
|
143
146
|
}>, DefaultOptions | AdditionalOptions>) => Config.InitialOptions;
|
|
144
147
|
export {};
|
|
@@ -45,40 +45,16 @@ const runESLint = async (mode, logger) => {
|
|
|
45
45
|
logger.debug("Initialising ESLint...");
|
|
46
46
|
const engine = new import_eslint.ESLint({
|
|
47
47
|
cache: true,
|
|
48
|
-
extensions: [
|
|
49
|
-
"cjs",
|
|
50
|
-
"cts",
|
|
51
|
-
"js",
|
|
52
|
-
"jsx",
|
|
53
|
-
"mjs",
|
|
54
|
-
"mts",
|
|
55
|
-
"ts",
|
|
56
|
-
"tsx",
|
|
57
|
-
"yaml",
|
|
58
|
-
"yml"
|
|
59
|
-
],
|
|
60
48
|
fix: mode === "format",
|
|
61
49
|
reportUnusedDisableDirectives: "error"
|
|
62
50
|
});
|
|
63
51
|
const cwd = process.cwd();
|
|
64
52
|
logger.debug("Processing files...");
|
|
65
53
|
const start = process.hrtime.bigint();
|
|
66
|
-
const ogConsoleError = console.error;
|
|
67
|
-
console.error = (...args) => {
|
|
68
|
-
if (args[0] !== // `eslint-plugin-react` prints this annoying error on non-React repos.
|
|
69
|
-
// We still want to support React linting for repos that have React code,
|
|
70
|
-
// so we have to manually suppress it.
|
|
71
|
-
//
|
|
72
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/7484acaca8351a8568fa99344bc811c5cd8396bd/lib/util/version.js#L61-L65
|
|
73
|
-
'Warning: React version was set to "detect" in eslint-plugin-react settings, but the "react" package is not installed. Assuming latest React version for linting.') {
|
|
74
|
-
ogConsoleError(...args);
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
54
|
const [formatter, results] = await Promise.all([
|
|
78
55
|
engine.loadFormatter(),
|
|
79
56
|
engine.lintFiles(".")
|
|
80
57
|
]);
|
|
81
|
-
console.error = ogConsoleError;
|
|
82
58
|
const end = process.hrtime.bigint();
|
|
83
59
|
logger.plain(
|
|
84
60
|
`Processed ${(0, import_logging.pluralise)(results.length, "file")} in ${logger.timing(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/adapter/eslint.ts"],
|
|
4
|
-
"sourcesContent": ["import path from 'path';\n\nimport chalk from 'chalk';\nimport type { Linter } from 'eslint';\nimport { ESLint } from 'eslint';\n\nimport type { Logger } from '../../utils/logging';\nimport { pluralise } from '../../utils/logging';\n\nconst symbolForResult = (result: ESLint.LintResult) => {\n if (result.errorCount) {\n return chalk.red('\u25CB');\n }\n\n return result.warningCount ? chalk.yellow('\u25CD') : chalk.green('\u25CB');\n};\n\nexport interface ESLintResult {\n messages: Linter.LintMessage[];\n filePath: string;\n}\n\nexport interface ESLintOutput {\n errors: ESLintResult[];\n fixable: boolean;\n ok: boolean;\n output: string;\n warnings: ESLintResult[];\n}\n\nexport const runESLint = async (\n mode: 'format' | 'lint',\n logger: Logger,\n): Promise<ESLintOutput> => {\n logger.debug('Initialising ESLint...');\n\n const engine = new ESLint({\n cache: true,\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,mBAAkB;AAElB,oBAAuB;AAGvB,qBAA0B;AAE1B,MAAM,kBAAkB,CAAC,WAA8B;AACrD,MAAI,OAAO,YAAY;AACrB,WAAO,aAAAA,QAAM,IAAI,QAAG;AAAA,EACtB;AAEA,SAAO,OAAO,eAAe,aAAAA,QAAM,OAAO,QAAG,IAAI,aAAAA,QAAM,MAAM,QAAG;AAClE;AAeO,MAAM,YAAY,OACvB,MACA,WAC0B;AAC1B,SAAO,MAAM,wBAAwB;AAErC,QAAM,SAAS,IAAI,qBAAO;AAAA,IACxB,OAAO;AAAA,IACP,
|
|
4
|
+
"sourcesContent": ["import path from 'path';\n\nimport chalk from 'chalk';\nimport type { Linter } from 'eslint';\nimport { ESLint } from 'eslint';\n\nimport type { Logger } from '../../utils/logging';\nimport { pluralise } from '../../utils/logging';\n\nconst symbolForResult = (result: ESLint.LintResult) => {\n if (result.errorCount) {\n return chalk.red('\u25CB');\n }\n\n return result.warningCount ? chalk.yellow('\u25CD') : chalk.green('\u25CB');\n};\n\nexport interface ESLintResult {\n messages: Linter.LintMessage[];\n filePath: string;\n}\n\nexport interface ESLintOutput {\n errors: ESLintResult[];\n fixable: boolean;\n ok: boolean;\n output: string;\n warnings: ESLintResult[];\n}\n\nexport const runESLint = async (\n mode: 'format' | 'lint',\n logger: Logger,\n): Promise<ESLintOutput> => {\n logger.debug('Initialising ESLint...');\n\n const engine = new ESLint({\n cache: true,\n fix: mode === 'format',\n reportUnusedDisableDirectives: 'error',\n });\n\n const cwd = process.cwd();\n\n logger.debug('Processing files...');\n\n const start = process.hrtime.bigint();\n\n const [formatter, results] = await Promise.all([\n engine.loadFormatter(),\n engine.lintFiles('.'),\n ]);\n\n const end = process.hrtime.bigint();\n\n logger.plain(\n `Processed ${pluralise(results.length, 'file')} in ${logger.timing(\n start,\n end,\n )}.`,\n );\n\n const errors: ESLintResult[] = [];\n const warnings: ESLintResult[] = [];\n let fixable = false;\n\n for (const result of results) {\n const relativePath = path.relative(cwd, result.filePath);\n if (result.fixableErrorCount + result.fixableWarningCount) {\n fixable = true;\n }\n\n if (result.errorCount) {\n errors.push({\n filePath: relativePath,\n messages: result.messages,\n });\n }\n\n if (result.warningCount) {\n warnings.push({\n filePath: relativePath,\n messages: result.messages,\n });\n }\n\n logger.debug(symbolForResult(result), relativePath);\n }\n\n const ok = errors.length === 0;\n\n await ESLint.outputFixes(results);\n\n const output = await formatter.format(results);\n\n if (output) {\n logger.plain(output);\n }\n\n return { errors, fixable, ok, output, warnings };\n};\n"],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AO,cAAc;AACvB,eAAS,KAAK;AAAA,QACZ,UAAU;AAAA,QACV,UAAU,OAAO;AAAA,MACnB,CAAC;AAAA,IACH;AAEA,WAAO,MAAM,gBAAgB,MAAM,GAAG,YAAY;AAAA,EACpD;AAEA,QAAM,KAAK,OAAO,WAAW;AAE7B,QAAM,qBAAO,YAAY,OAAO;AAEhC,QAAM,SAAS,MAAM,UAAU,OAAO,OAAO;AAE7C,MAAI,QAAQ;AACV,WAAO,MAAM,MAAM;AAAA,EACrB;AAEA,SAAO,EAAE,QAAQ,SAAS,IAAI,QAAQ,SAAS;AACjD;",
|
|
6
6
|
"names": ["chalk", "path"]
|
|
7
7
|
}
|
package/lib/cli/build/esbuild.js
CHANGED
|
@@ -34,15 +34,10 @@ module.exports = __toCommonJS(esbuild_exports);
|
|
|
34
34
|
var import_util = require("util");
|
|
35
35
|
var import_tsconfig_paths = __toESM(require("@esbuild-plugins/tsconfig-paths"));
|
|
36
36
|
var import_esbuild = require("esbuild");
|
|
37
|
-
var import_typescript =
|
|
37
|
+
var import_typescript = require("typescript");
|
|
38
38
|
var import_logging = require("../../utils/logging");
|
|
39
39
|
var import_args = require("./args");
|
|
40
40
|
var import_tsc = require("./tsc");
|
|
41
|
-
const formatHost = {
|
|
42
|
-
getCanonicalFileName: (fileName) => fileName,
|
|
43
|
-
getCurrentDirectory: import_typescript.default.sys.getCurrentDirectory.bind(void 0),
|
|
44
|
-
getNewLine: () => import_typescript.default.sys.newLine
|
|
45
|
-
};
|
|
46
41
|
const esbuild = async ({ debug }, args = process.argv.slice(2)) => {
|
|
47
42
|
const log = (0, import_logging.createLogger)(debug);
|
|
48
43
|
const tscArgs = (0, import_args.parseTscArgs)(args);
|
|
@@ -53,42 +48,8 @@ const esbuild = async ({ debug }, args = process.argv.slice(2)) => {
|
|
|
53
48
|
process.exitCode = 1;
|
|
54
49
|
return;
|
|
55
50
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"tsconfig",
|
|
59
|
-
...tscArgs.project ? ["--project", tscArgs.project] : []
|
|
60
|
-
)
|
|
61
|
-
);
|
|
62
|
-
log.debug(tscArgs.pathname);
|
|
63
|
-
const tsconfigFile = import_typescript.default.findConfigFile(
|
|
64
|
-
tscArgs.dirname,
|
|
65
|
-
import_typescript.default.sys.fileExists.bind(void 0),
|
|
66
|
-
tscArgs.basename
|
|
67
|
-
);
|
|
68
|
-
if (!tsconfigFile) {
|
|
69
|
-
log.err(`Could not find ${tscArgs.pathname}.`);
|
|
70
|
-
process.exitCode = 1;
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
const readConfigFile = import_typescript.default.readConfigFile(
|
|
74
|
-
tsconfigFile,
|
|
75
|
-
import_typescript.default.sys.readFile.bind(void 0)
|
|
76
|
-
);
|
|
77
|
-
if (readConfigFile.error) {
|
|
78
|
-
log.err(`Could not read ${tscArgs.pathname}.`);
|
|
79
|
-
log.subtle(import_typescript.default.formatDiagnostic(readConfigFile.error, formatHost));
|
|
80
|
-
process.exitCode = 1;
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
const parsedCommandLine = import_typescript.default.parseJsonConfigFileContent(
|
|
84
|
-
readConfigFile.config,
|
|
85
|
-
import_typescript.default.sys,
|
|
86
|
-
tscArgs.dirname
|
|
87
|
-
);
|
|
88
|
-
if (parsedCommandLine.errors.length) {
|
|
89
|
-
log.err(`Could not parse ${tscArgs.pathname}.`);
|
|
90
|
-
log.subtle(import_typescript.default.formatDiagnostics(parsedCommandLine.errors, formatHost));
|
|
91
|
-
process.exitCode = 1;
|
|
51
|
+
const parsedCommandLine = (0, import_tsc.readTsconfig)(args, log);
|
|
52
|
+
if (!parsedCommandLine || process.exitCode) {
|
|
92
53
|
return;
|
|
93
54
|
}
|
|
94
55
|
const { fileNames: entryPoints, options: compilerOptions } = parsedCommandLine;
|
|
@@ -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
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAExB,4BAA0B;AAC1B,qBAAsB;AACtB,
|
|
6
|
-
"names": ["
|
|
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';\n\nimport { parseTscArgs } from './args';\nimport { readTsconfig, tsc } from './tsc';\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 = readTsconfig(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 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,iBAAkC;AAM3B,MAAM,UAAU,OACrB,EAAE,MAAM,GACR,OAAO,QAAQ,KAAK,MAAM,CAAC,MACxB;AACH,QAAM,UAAM,6BAAa,KAAK;AAE9B,QAAM,cAAU,0BAAa,IAAI;AAEjC,MAAI,QAAQ,OAAO;AACjB,QAAI;AAAA,MACF;AAAA,IACF;AACA,YAAQ,WAAW;AACnB;AAAA,EACF;AAEA,QAAM,wBAAoB,yBAAa,MAAM,GAAG;AAEhD,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,IAC3B,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,IAAI;AAE/C,MAAI,gBAAgB,aAAa;AAC/B,cAAM,gBAAI;AAAA,MACR;AAAA,MACA;AAAA,MACA,GAAI,QAAQ,UAAU,CAAC,aAAa,QAAQ,OAAO,IAAI,CAAC;AAAA,IAC1D,CAAC;AAAA,EACH;AACF;",
|
|
6
|
+
"names": ["tsconfigPaths"]
|
|
7
7
|
}
|
package/lib/cli/build/index.js
CHANGED
|
@@ -33,6 +33,7 @@ __export(build_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(build_exports);
|
|
34
34
|
var import_chalk = __toESM(require("chalk"));
|
|
35
35
|
var import_args = require("../../utils/args");
|
|
36
|
+
var import_copy = require("../../utils/copy");
|
|
36
37
|
var import_logging = require("../../utils/logging");
|
|
37
38
|
var import_manifest = require("../../utils/manifest");
|
|
38
39
|
var import_addEmptyExports = require("../configure/addEmptyExports");
|
|
@@ -46,13 +47,13 @@ const build = async (args = process.argv.slice(2)) => {
|
|
|
46
47
|
const debug = (0, import_args.hasDebugFlag)(args);
|
|
47
48
|
import_logging.log.plain(import_chalk.default.yellow("esbuild"));
|
|
48
49
|
await (0, import_esbuild.esbuild)({ debug }, args);
|
|
49
|
-
|
|
50
|
+
break;
|
|
50
51
|
}
|
|
51
52
|
case void 0:
|
|
52
53
|
case "tsc": {
|
|
53
54
|
import_logging.log.plain(import_chalk.default.blue("tsc"));
|
|
54
55
|
await (0, import_tsc.tsc)(args);
|
|
55
|
-
|
|
56
|
+
break;
|
|
56
57
|
}
|
|
57
58
|
default: {
|
|
58
59
|
import_logging.log.err(
|
|
@@ -65,6 +66,12 @@ const build = async (args = process.argv.slice(2)) => {
|
|
|
65
66
|
return;
|
|
66
67
|
}
|
|
67
68
|
}
|
|
69
|
+
const parsedCommandLine = (0, import_tsc.readTsconfig)(args, import_logging.log);
|
|
70
|
+
if (!parsedCommandLine || process.exitCode) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const { options: compilerOptions } = parsedCommandLine;
|
|
74
|
+
await (0, import_copy.copyAssets)(compilerOptions.outDir ?? "lib");
|
|
68
75
|
};
|
|
69
76
|
// Annotate the CommonJS export names for ESM import in node:
|
|
70
77
|
0 && (module.exports = {
|
|
@@ -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';\nimport { log } from '../../utils/logging';\nimport { getStringPropFromConsumerManifest } from '../../utils/manifest';\nimport { tryAddEmptyExports } from '../configure/addEmptyExports';\n\nimport { esbuild } from './esbuild';\nimport { tsc } from './tsc';\n\nexport const build = async (args = process.argv.slice(2)) => {\n await tryAddEmptyExports();\n\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
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,kBAA6B;AAC7B,qBAAoB;AACpB,sBAAkD;AAClD,6BAAmC;AAEnC,qBAAwB;AACxB,
|
|
4
|
+
"sourcesContent": ["import chalk from 'chalk';\n\nimport { hasDebugFlag } from '../../utils/args';\nimport { copyAssets } from '../../utils/copy';\nimport { log } from '../../utils/logging';\nimport { getStringPropFromConsumerManifest } from '../../utils/manifest';\nimport { tryAddEmptyExports } from '../configure/addEmptyExports';\n\nimport { esbuild } from './esbuild';\nimport { readTsconfig, tsc } from './tsc';\n\nexport const build = async (args = process.argv.slice(2)) => {\n await tryAddEmptyExports();\n\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 = readTsconfig(args, log);\n\n if (!parsedCommandLine || process.exitCode) {\n return;\n }\n\n const { options: compilerOptions } = parsedCommandLine;\n await copyAssets(compilerOptions.outDir ?? 'lib');\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,kBAA6B;AAC7B,kBAA2B;AAC3B,qBAAoB;AACpB,sBAAkD;AAClD,6BAAmC;AAEnC,qBAAwB;AACxB,iBAAkC;AAE3B,MAAM,QAAQ,OAAO,OAAO,QAAQ,KAAK,MAAM,CAAC,MAAM;AAC3D,YAAM,2CAAmB;AAIzB,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,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,yBAAa,MAAM,kBAAG;AAEhD,MAAI,CAAC,qBAAqB,QAAQ,UAAU;AAC1C;AAAA,EACF;AAEA,QAAM,EAAE,SAAS,gBAAgB,IAAI;AACrC,YAAM,wBAAW,gBAAgB,UAAU,KAAK;AAClD;",
|
|
6
6
|
"names": ["chalk"]
|
|
7
7
|
}
|
package/lib/cli/build/tsc.d.ts
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import type { Logger } from '../../utils/logging';
|
|
1
3
|
export declare const tsc: (args?: string[]) => Promise<import("execa").ExecaReturnValue<string>>;
|
|
4
|
+
export declare const readTsconfig: (args: string[] | undefined, log: Logger) => ts.ParsedCommandLine | undefined;
|
package/lib/cli/build/tsc.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,22 +17,80 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
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
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
var tsc_exports = {};
|
|
20
30
|
__export(tsc_exports, {
|
|
31
|
+
readTsconfig: () => readTsconfig,
|
|
21
32
|
tsc: () => tsc
|
|
22
33
|
});
|
|
23
34
|
module.exports = __toCommonJS(tsc_exports);
|
|
35
|
+
var import_typescript = __toESM(require("typescript"));
|
|
24
36
|
var import_exec = require("../../utils/exec");
|
|
25
37
|
var import_args = require("./args");
|
|
26
38
|
const DEFAULT_ARGS = ["--project", "tsconfig.build.json"];
|
|
39
|
+
const formatHost = {
|
|
40
|
+
getCanonicalFileName: (fileName) => fileName,
|
|
41
|
+
getCurrentDirectory: import_typescript.default.sys.getCurrentDirectory.bind(void 0),
|
|
42
|
+
getNewLine: () => import_typescript.default.sys.newLine
|
|
43
|
+
};
|
|
27
44
|
const tsc = async (args = process.argv.slice(2)) => {
|
|
28
45
|
const tscArgs = (0, import_args.parseTscArgs)(args);
|
|
29
46
|
const defaultArgs = tscArgs.build || tscArgs.project ? [] : DEFAULT_ARGS;
|
|
30
47
|
return (0, import_exec.exec)("tsc", ...defaultArgs, ...args);
|
|
31
48
|
};
|
|
49
|
+
const readTsconfig = (args = process.argv.slice(2), log) => {
|
|
50
|
+
const tscArgs = (0, import_args.parseTscArgs)(args);
|
|
51
|
+
log.debug(
|
|
52
|
+
log.bold(
|
|
53
|
+
"tsconfig",
|
|
54
|
+
...tscArgs.project ? ["--project", tscArgs.project] : []
|
|
55
|
+
)
|
|
56
|
+
);
|
|
57
|
+
log.debug(tscArgs.pathname);
|
|
58
|
+
const tsconfigFile = import_typescript.default.findConfigFile(
|
|
59
|
+
tscArgs.dirname,
|
|
60
|
+
import_typescript.default.sys.fileExists.bind(void 0),
|
|
61
|
+
tscArgs.basename
|
|
62
|
+
);
|
|
63
|
+
if (!tsconfigFile) {
|
|
64
|
+
log.err(`Could not find ${tscArgs.pathname}.`);
|
|
65
|
+
process.exitCode = 1;
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const readConfigFile = import_typescript.default.readConfigFile(
|
|
69
|
+
tsconfigFile,
|
|
70
|
+
import_typescript.default.sys.readFile.bind(void 0)
|
|
71
|
+
);
|
|
72
|
+
if (readConfigFile.error) {
|
|
73
|
+
log.err(`Could not read ${tscArgs.pathname}.`);
|
|
74
|
+
log.subtle(import_typescript.default.formatDiagnostic(readConfigFile.error, formatHost));
|
|
75
|
+
process.exitCode = 1;
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const parsedCommandLine = import_typescript.default.parseJsonConfigFileContent(
|
|
79
|
+
readConfigFile.config,
|
|
80
|
+
import_typescript.default.sys,
|
|
81
|
+
tscArgs.dirname
|
|
82
|
+
);
|
|
83
|
+
if (parsedCommandLine.errors.length) {
|
|
84
|
+
log.err(`Could not parse ${tscArgs.pathname}.`);
|
|
85
|
+
log.subtle(import_typescript.default.formatDiagnostics(parsedCommandLine.errors, formatHost));
|
|
86
|
+
process.exitCode = 1;
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
return parsedCommandLine;
|
|
90
|
+
};
|
|
32
91
|
// Annotate the CommonJS export names for ESM import in node:
|
|
33
92
|
0 && (module.exports = {
|
|
93
|
+
readTsconfig,
|
|
34
94
|
tsc
|
|
35
95
|
});
|
|
36
96
|
//# sourceMappingURL=tsc.js.map
|
package/lib/cli/build/tsc.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/build/tsc.ts"],
|
|
4
|
-
"sourcesContent": ["import { exec } from '../../utils/exec';\n\nimport { parseTscArgs } from './args';\n\nconst DEFAULT_ARGS = ['--project', 'tsconfig.build.json'] as const;\n\nexport const tsc = async (args = process.argv.slice(2)) => {\n const tscArgs = parseTscArgs(args);\n\n // Build flag is incompatible with project flag.\n const defaultArgs = tscArgs.build || tscArgs.project ? [] : DEFAULT_ARGS;\n\n return exec('tsc', ...defaultArgs, ...args);\n};\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import ts from 'typescript';\n\nimport { exec } from '../../utils/exec';\nimport type { Logger } from '../../utils/logging';\n\nimport { parseTscArgs } from './args';\n\nconst DEFAULT_ARGS = ['--project', 'tsconfig.build.json'] as const;\n\nconst formatHost: ts.FormatDiagnosticsHost = {\n getCanonicalFileName: (fileName) => fileName,\n getCurrentDirectory: ts.sys.getCurrentDirectory.bind(undefined),\n getNewLine: () => ts.sys.newLine,\n};\n\nexport const tsc = async (args = process.argv.slice(2)) => {\n const tscArgs = parseTscArgs(args);\n\n // Build flag is incompatible with project flag.\n const defaultArgs = tscArgs.build || tscArgs.project ? [] : DEFAULT_ARGS;\n\n return exec('tsc', ...defaultArgs, ...args);\n};\n\nexport const readTsconfig = (args = process.argv.slice(2), log: Logger) => {\n const tscArgs = parseTscArgs(args);\n\n log.debug(\n log.bold(\n 'tsconfig',\n ...(tscArgs.project ? ['--project', tscArgs.project] : []),\n ),\n );\n log.debug(tscArgs.pathname);\n\n const tsconfigFile = ts.findConfigFile(\n tscArgs.dirname,\n ts.sys.fileExists.bind(undefined),\n tscArgs.basename,\n );\n if (!tsconfigFile) {\n log.err(`Could not find ${tscArgs.pathname}.`);\n process.exitCode = 1;\n return;\n }\n\n const readConfigFile = ts.readConfigFile(\n tsconfigFile,\n ts.sys.readFile.bind(undefined),\n );\n if (readConfigFile.error) {\n log.err(`Could not read ${tscArgs.pathname}.`);\n log.subtle(ts.formatDiagnostic(readConfigFile.error, formatHost));\n process.exitCode = 1;\n return;\n }\n\n const parsedCommandLine = ts.parseJsonConfigFileContent(\n readConfigFile.config,\n ts.sys,\n tscArgs.dirname,\n );\n\n if (parsedCommandLine.errors.length) {\n log.err(`Could not parse ${tscArgs.pathname}.`);\n log.subtle(ts.formatDiagnostics(parsedCommandLine.errors, formatHost));\n process.exitCode = 1;\n return;\n }\n\n return parsedCommandLine;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAe;AAEf,kBAAqB;AAGrB,kBAA6B;AAE7B,MAAM,eAAe,CAAC,aAAa,qBAAqB;AAExD,MAAM,aAAuC;AAAA,EAC3C,sBAAsB,CAAC,aAAa;AAAA,EACpC,qBAAqB,kBAAAA,QAAG,IAAI,oBAAoB,KAAK,MAAS;AAAA,EAC9D,YAAY,MAAM,kBAAAA,QAAG,IAAI;AAC3B;AAEO,MAAM,MAAM,OAAO,OAAO,QAAQ,KAAK,MAAM,CAAC,MAAM;AACzD,QAAM,cAAU,0BAAa,IAAI;AAGjC,QAAM,cAAc,QAAQ,SAAS,QAAQ,UAAU,CAAC,IAAI;AAE5D,aAAO,kBAAK,OAAO,GAAG,aAAa,GAAG,IAAI;AAC5C;AAEO,MAAM,eAAe,C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|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,14 +17,25 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
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
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
var buildPackage_exports = {};
|
|
20
30
|
__export(buildPackage_exports, {
|
|
21
31
|
buildPackage: () => buildPackage
|
|
22
32
|
});
|
|
23
33
|
module.exports = __toCommonJS(buildPackage_exports);
|
|
34
|
+
var import_chalk = __toESM(require("chalk"));
|
|
24
35
|
var import_args = require("../utils/args");
|
|
36
|
+
var import_copy = require("../utils/copy");
|
|
25
37
|
var import_exec = require("../utils/exec");
|
|
38
|
+
var import_logging = require("../utils/logging");
|
|
26
39
|
var import_addEmptyExports = require("./configure/addEmptyExports");
|
|
27
40
|
const buildPackage = async (args = process.argv.slice(2)) => {
|
|
28
41
|
await (0, import_addEmptyExports.tryAddEmptyExports)();
|
|
@@ -48,6 +61,10 @@ const buildPackage = async (args = process.argv.slice(2)) => {
|
|
|
48
61
|
maxProcesses: (0, import_args.hasSerialFlag)(args) ? 1 : void 0
|
|
49
62
|
}
|
|
50
63
|
);
|
|
64
|
+
await Promise.all([
|
|
65
|
+
(0, import_copy.copyAssets)("lib-commonjs", (0, import_logging.createLogger)(false, import_chalk.default.green("commonjs \u2502"))),
|
|
66
|
+
(0, import_copy.copyAssets)("lib-es2015", (0, import_logging.createLogger)(false, import_chalk.default.yellow("es2015 \u2502")))
|
|
67
|
+
]);
|
|
51
68
|
};
|
|
52
69
|
// Annotate the CommonJS export names for ESM import in node:
|
|
53
70
|
0 && (module.exports = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/cli/buildPackage.ts"],
|
|
4
|
-
"sourcesContent": ["import { hasSerialFlag } from '../utils/args';\nimport { execConcurrently } from '../utils/exec';\n\nimport { tryAddEmptyExports } from './configure/addEmptyExports';\n\nexport const buildPackage = async (args = process.argv.slice(2)) => {\n await tryAddEmptyExports();\n\n await execConcurrently(\n [\n {\n command:\n 'tsc --module CommonJS --outDir lib-commonjs --project tsconfig.build.json',\n name: 'commonjs',\n prefixColor: 'green',\n },\n {\n command:\n 'tsc --module ES2015 --outDir lib-es2015 --project tsconfig.build.json',\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"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import chalk from 'chalk';\n\nimport { hasSerialFlag } from '../utils/args';\nimport { copyAssets } from '../utils/copy';\nimport { execConcurrently } from '../utils/exec';\nimport { createLogger } from '../utils/logging';\n\nimport { tryAddEmptyExports } from './configure/addEmptyExports';\n\nexport const buildPackage = async (args = process.argv.slice(2)) => {\n await tryAddEmptyExports();\n\n await execConcurrently(\n [\n {\n command:\n 'tsc --module CommonJS --outDir lib-commonjs --project tsconfig.build.json',\n name: 'commonjs',\n prefixColor: 'green',\n },\n {\n command:\n 'tsc --module ES2015 --outDir lib-es2015 --project tsconfig.build.json',\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 Promise.all([\n copyAssets('lib-commonjs', createLogger(false, chalk.green('commonjs \u2502'))),\n copyAssets('lib-es2015', createLogger(false, chalk.yellow('es2015 \u2502'))),\n ]);\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,kBAA8B;AAC9B,kBAA2B;AAC3B,kBAAiC;AACjC,qBAA6B;AAE7B,6BAAmC;AAE5B,MAAM,eAAe,OAAO,OAAO,QAAQ,KAAK,MAAM,CAAC,MAAM;AAClE,YAAM,2CAAmB;AAEzB,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,QAAM,QAAQ,IAAI;AAAA,QAChB,wBAAW,oBAAgB,6BAAa,OAAO,aAAAA,QAAM,MAAM,iBAAY,CAAC,CAAC;AAAA,QACzE,wBAAW,kBAAc,6BAAa,OAAO,aAAAA,QAAM,OAAO,iBAAY,CAAC,CAAC;AAAA,EAC1E,CAAC;AACH;",
|
|
6
|
+
"names": ["chalk"]
|
|
7
7
|
}
|
|
@@ -44,6 +44,7 @@ const RENOVATE_PRESETS = [
|
|
|
44
44
|
"local>seekasia/renovate-config",
|
|
45
45
|
"local>seek-jobs/renovate-config"
|
|
46
46
|
];
|
|
47
|
+
const EXISTING_REPO_PRESET_REGEX = /(github|local)>(seek-jobs|seekasia)\//;
|
|
47
48
|
const RenovateConfig = t.Record({
|
|
48
49
|
extends: t.Array(t.String)
|
|
49
50
|
});
|
|
@@ -105,7 +106,8 @@ const patchRenovateConfig = async (dir) => {
|
|
|
105
106
|
!config?.input || // The file appears to mention the baseline preset for the configured Git
|
|
106
107
|
// owner. This is a very naive check that we don't want to overcomplicate
|
|
107
108
|
// because it is invoked before each skuba format and lint.
|
|
108
|
-
config.input.includes(presetToAdd)
|
|
109
|
+
config.input.includes(presetToAdd) || // Ignore any renovate configuration which already extends a SEEK-Jobs or seekasia config
|
|
110
|
+
EXISTING_REPO_PRESET_REGEX.exec(config.input)
|
|
109
111
|
) {
|
|
110
112
|
return;
|
|
111
113
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/configure/patchRenovateConfig.ts"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable new-cap */\n\nimport { inspect } from 'util';\n\nimport fs from 'fs-extra';\nimport * as fleece from 'golden-fleece';\nimport * as t from 'runtypes';\n\nimport * as Git from '../../api/git';\nimport { log } from '../../utils/logging';\n\nimport { createDestinationFileReader } from './analysis/project';\nimport { RENOVATE_CONFIG_FILENAMES } from './modules/renovate';\nimport { formatPrettier } from './processing/prettier';\n\nconst RENOVATE_PRESETS = [\n 'local>seekasia/renovate-config',\n 'local>seek-jobs/renovate-config',\n] as const;\n\ntype RenovateFiletype = 'json' | 'json5';\n\ntype RenovatePreset = (typeof RENOVATE_PRESETS)[number];\n\nconst RenovateConfig = t.Record({\n extends: t.Array(t.String),\n});\n\nconst ownerToRenovatePreset = (owner: string): RenovatePreset | undefined => {\n const lowercaseOwner = owner.toLowerCase();\n\n switch (lowercaseOwner) {\n case 'seekasia':\n return 'local>seekasia/renovate-config';\n\n case 'seek-jobs':\n return 'local>seek-jobs/renovate-config';\n\n default:\n return;\n }\n};\n\ntype PatchFile = (props: {\n filepath: string;\n input: string;\n presetToAdd: RenovatePreset;\n}) => Promise<void>;\n\nconst patchJson: PatchFile = async ({ filepath, input, presetToAdd }) => {\n const config: unknown = JSON.parse(input);\n\n if (!RenovateConfig.guard(config)) {\n return;\n }\n\n config.extends.unshift(presetToAdd);\n\n await fs.promises.writeFile(\n filepath,\n formatPrettier(JSON.stringify(config), { parser: 'json' }),\n );\n\n return;\n};\n\nconst patchJson5: PatchFile = async ({ filepath, input, presetToAdd }) => {\n const config: unknown = fleece.evaluate(input);\n\n if (!RenovateConfig.guard(config)) {\n return;\n }\n\n config.extends.unshift(presetToAdd);\n\n await fs.promises.writeFile(\n filepath,\n formatPrettier(fleece.patch(input, config), { parser: 'json5' }),\n );\n\n return;\n};\n\nconst patchByFiletype: Record<RenovateFiletype, PatchFile> = {\n json: patchJson,\n json5: patchJson5,\n};\n\nconst patchRenovateConfig = async (dir: string) => {\n const readFile = createDestinationFileReader(dir);\n\n const { owner } = await Git.getOwnerAndRepo({ dir });\n\n const presetToAdd = ownerToRenovatePreset(owner);\n\n if (!presetToAdd) {\n // No baseline preset needs to be added for the configured Git owner.\n return;\n }\n\n const maybeConfigs = await Promise.all(\n RENOVATE_CONFIG_FILENAMES.map(async (filepath) => ({\n input: await readFile(filepath),\n filepath,\n })),\n );\n\n const config = maybeConfigs.find((maybeConfig) => Boolean(maybeConfig.input));\n\n if (\n // No file was found.\n !config?.input ||\n // The file appears to mention the baseline preset for the configured Git\n // owner. This is a very naive check that we don't want to overcomplicate\n // because it is invoked before each skuba format and lint.\n config.input.includes(presetToAdd)\n ) {\n return;\n }\n\n const filetype: RenovateFiletype = config.filepath\n .toLowerCase()\n .endsWith('.json5')\n ? 'json5'\n : 'json';\n\n const patchFile = patchByFiletype[filetype];\n\n await patchFile({\n filepath: config.filepath,\n input: config.input,\n presetToAdd,\n });\n};\n\nexport const tryPatchRenovateConfig = async (dir = process.cwd()) => {\n try {\n await patchRenovateConfig(dir);\n } catch (err) {\n log.warn('Failed to patch Renovate config.');\n log.subtle(inspect(err));\n }\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAAwB;AAExB,sBAAe;AACf,aAAwB;AACxB,QAAmB;AAEnB,UAAqB;AACrB,qBAAoB;AAEpB,qBAA4C;AAC5C,sBAA0C;AAC1C,sBAA+B;AAE/B,MAAM,mBAAmB;AAAA,EACvB;AAAA,EACA;AACF;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable new-cap */\n\nimport { inspect } from 'util';\n\nimport fs from 'fs-extra';\nimport * as fleece from 'golden-fleece';\nimport * as t from 'runtypes';\n\nimport * as Git from '../../api/git';\nimport { log } from '../../utils/logging';\n\nimport { createDestinationFileReader } from './analysis/project';\nimport { RENOVATE_CONFIG_FILENAMES } from './modules/renovate';\nimport { formatPrettier } from './processing/prettier';\n\nconst RENOVATE_PRESETS = [\n 'local>seekasia/renovate-config',\n 'local>seek-jobs/renovate-config',\n] as const;\n\nconst EXISTING_REPO_PRESET_REGEX = /(github|local)>(seek-jobs|seekasia)\\//;\n\ntype RenovateFiletype = 'json' | 'json5';\n\ntype RenovatePreset = (typeof RENOVATE_PRESETS)[number];\n\nconst RenovateConfig = t.Record({\n extends: t.Array(t.String),\n});\n\nconst ownerToRenovatePreset = (owner: string): RenovatePreset | undefined => {\n const lowercaseOwner = owner.toLowerCase();\n\n switch (lowercaseOwner) {\n case 'seekasia':\n return 'local>seekasia/renovate-config';\n\n case 'seek-jobs':\n return 'local>seek-jobs/renovate-config';\n\n default:\n return;\n }\n};\n\ntype PatchFile = (props: {\n filepath: string;\n input: string;\n presetToAdd: RenovatePreset;\n}) => Promise<void>;\n\nconst patchJson: PatchFile = async ({ filepath, input, presetToAdd }) => {\n const config: unknown = JSON.parse(input);\n\n if (!RenovateConfig.guard(config)) {\n return;\n }\n\n config.extends.unshift(presetToAdd);\n\n await fs.promises.writeFile(\n filepath,\n formatPrettier(JSON.stringify(config), { parser: 'json' }),\n );\n\n return;\n};\n\nconst patchJson5: PatchFile = async ({ filepath, input, presetToAdd }) => {\n const config: unknown = fleece.evaluate(input);\n\n if (!RenovateConfig.guard(config)) {\n return;\n }\n\n config.extends.unshift(presetToAdd);\n\n await fs.promises.writeFile(\n filepath,\n formatPrettier(fleece.patch(input, config), { parser: 'json5' }),\n );\n\n return;\n};\n\nconst patchByFiletype: Record<RenovateFiletype, PatchFile> = {\n json: patchJson,\n json5: patchJson5,\n};\n\nconst patchRenovateConfig = async (dir: string) => {\n const readFile = createDestinationFileReader(dir);\n\n const { owner } = await Git.getOwnerAndRepo({ dir });\n\n const presetToAdd = ownerToRenovatePreset(owner);\n\n if (!presetToAdd) {\n // No baseline preset needs to be added for the configured Git owner.\n return;\n }\n\n const maybeConfigs = await Promise.all(\n RENOVATE_CONFIG_FILENAMES.map(async (filepath) => ({\n input: await readFile(filepath),\n filepath,\n })),\n );\n\n const config = maybeConfigs.find((maybeConfig) => Boolean(maybeConfig.input));\n\n if (\n // No file was found.\n !config?.input ||\n // The file appears to mention the baseline preset for the configured Git\n // owner. This is a very naive check that we don't want to overcomplicate\n // because it is invoked before each skuba format and lint.\n config.input.includes(presetToAdd) ||\n // Ignore any renovate configuration which already extends a SEEK-Jobs or seekasia config\n EXISTING_REPO_PRESET_REGEX.exec(config.input)\n ) {\n return;\n }\n\n const filetype: RenovateFiletype = config.filepath\n .toLowerCase()\n .endsWith('.json5')\n ? 'json5'\n : 'json';\n\n const patchFile = patchByFiletype[filetype];\n\n await patchFile({\n filepath: config.filepath,\n input: config.input,\n presetToAdd,\n });\n};\n\nexport const tryPatchRenovateConfig = async (dir = process.cwd()) => {\n try {\n await patchRenovateConfig(dir);\n } catch (err) {\n log.warn('Failed to patch Renovate config.');\n log.subtle(inspect(err));\n }\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAAwB;AAExB,sBAAe;AACf,aAAwB;AACxB,QAAmB;AAEnB,UAAqB;AACrB,qBAAoB;AAEpB,qBAA4C;AAC5C,sBAA0C;AAC1C,sBAA+B;AAE/B,MAAM,mBAAmB;AAAA,EACvB;AAAA,EACA;AACF;AAEA,MAAM,6BAA6B;AAMnC,MAAM,iBAAiB,EAAE,OAAO;AAAA,EAC9B,SAAS,EAAE,MAAM,EAAE,MAAM;AAC3B,CAAC;AAED,MAAM,wBAAwB,CAAC,UAA8C;AAC3E,QAAM,iBAAiB,MAAM,YAAY;AAEzC,UAAQ,gBAAgB;AAAA,IACtB,KAAK;AACH,aAAO;AAAA,IAET,KAAK;AACH,aAAO;AAAA,IAET;AACE;AAAA,EACJ;AACF;AAQA,MAAM,YAAuB,OAAO,EAAE,UAAU,OAAO,YAAY,MAAM;AACvE,QAAM,SAAkB,KAAK,MAAM,KAAK;AAExC,MAAI,CAAC,eAAe,MAAM,MAAM,GAAG;AACjC;AAAA,EACF;AAEA,SAAO,QAAQ,QAAQ,WAAW;AAElC,QAAM,gBAAAA,QAAG,SAAS;AAAA,IAChB;AAAA,QACA,gCAAe,KAAK,UAAU,MAAM,GAAG,EAAE,QAAQ,OAAO,CAAC;AAAA,EAC3D;AAEA;AACF;AAEA,MAAM,aAAwB,OAAO,EAAE,UAAU,OAAO,YAAY,MAAM;AACxE,QAAM,SAAkB,OAAO,SAAS,KAAK;AAE7C,MAAI,CAAC,eAAe,MAAM,MAAM,GAAG;AACjC;AAAA,EACF;AAEA,SAAO,QAAQ,QAAQ,WAAW;AAElC,QAAM,gBAAAA,QAAG,SAAS;AAAA,IAChB;AAAA,QACA,gCAAe,OAAO,MAAM,OAAO,MA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65
65
|
path: ".npmrc",
|
|
66
66
|
state: "added"
|
|
67
67
|
},
|
|
68
|
+
{
|
|
69
|
+
// This file may already exist in version control, but we shouldn't commit
|
|
70
|
+
// further changes as the CI environment may have appended an npm token.
|
|
71
|
+
path: ".npmrc",
|
|
72
|
+
state: "modified"
|
|
73
|
+
},
|
|
68
74
|
{
|
|
69
75
|
path: "Dockerfile-incunabulum",
|
|
70
76
|
state: "added"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/lint/autofix.ts"],
|
|
4
|
-
"sourcesContent": ["import path from 'path';\nimport { inspect } from 'util';\n\nimport fs from 'fs-extra';\nimport simpleGit from 'simple-git';\n\nimport * as Git from '../../api/git';\nimport * as GitHub from '../../api/github';\nimport { isCiEnv } from '../../utils/env';\nimport { createLogger, log } from '../../utils/logging';\nimport { throwOnTimeout } from '../../utils/wait';\nimport { runESLint } from '../adapter/eslint';\nimport { runPrettier } from '../adapter/prettier';\nimport { JEST_SETUP_FILES } from '../configure/addEmptyExports';\nimport { RENOVATE_CONFIG_FILENAMES } from '../configure/modules/renovate';\nimport { SERVER_LISTENER_FILENAME } from '../configure/patchServerListener';\nimport { REFRESHABLE_IGNORE_FILES } from '../configure/refreshIgnoreFiles';\n\nimport type { Input } from './types';\n\nconst AUTOFIX_COMMIT_MESSAGE = 'Run `skuba format`';\n\nconst AUTOFIX_DELETE_FILES = [\n // Try to delete this SEEK-Jobs/gutenberg automation file that may have been\n // accidentally committed in a prior autofix.\n 'Dockerfile-incunabulum',\n];\n\nconst AUTOFIX_CODEGEN_FILES = new Set<string>([\n ...AUTOFIX_DELETE_FILES,\n ...JEST_SETUP_FILES,\n ...REFRESHABLE_IGNORE_FILES,\n ...RENOVATE_CONFIG_FILENAMES,\n SERVER_LISTENER_FILENAME,\n]);\n\nexport const AUTOFIX_IGNORE_FILES: Git.ChangedFile[] = [\n {\n path: '.npmrc',\n state: 'added',\n },\n {\n path: 'Dockerfile-incunabulum',\n state: 'added',\n },\n];\n\nconst shouldPush = 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 let headCommitMessage;\n try {\n headCommitMessage = await Git.getHeadCommitMessage({ dir });\n } catch {}\n\n if (headCommitMessage === 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\ninterface AutofixParameters {\n debug: Input['debug'];\n\n eslint: boolean;\n prettier: boolean;\n}\n\n/**\n * @returns Whether skuba codegenned a file change which should be included in\n * an autofix commit.\n */\nconst tryCodegen = async (dir: string): Promise<boolean> => {\n try {\n // Try to forcibly remove `AUTOFIX_DELETE_FILES` from source control.\n // These may include outdated configuration files or internal files that\n // were accidentally committed by an autofix.\n await Promise.all(\n AUTOFIX_DELETE_FILES.map((filename) =>\n fs.promises.rm(path.join(dir, filename), { force: true }),\n ),\n );\n\n // Search codegenned file changes in the local Git working directory.\n // These may include the `AUTOFIX_DELETE_FILES` deleted above or fixups to\n // ignore files and module exports that were run at the start of the\n // `skuba lint` command.\n const changedFiles = await Git.getChangedFiles({\n dir,\n\n ignore: AUTOFIX_IGNORE_FILES,\n });\n\n // Determine if a meaningful codegen change\n return changedFiles.some((changedFile) =>\n AUTOFIX_CODEGEN_FILES.has(changedFile.path),\n );\n } catch (err) {\n log.warn(log.bold('Failed to evaluate codegen changes.'));\n log.subtle(inspect(err));\n\n return false;\n }\n};\n\nexport const autofix = async (params: AutofixParameters): Promise<void> => {\n const dir = process.cwd();\n\n const codegen = await tryCodegen(dir);\n\n if (!params.eslint && !params.prettier && !codegen) {\n return;\n }\n\n let currentBranch;\n try {\n currentBranch = await Git.currentBranch({ dir });\n } catch {}\n\n if (!(await shouldPush({ currentBranch, dir }))) {\n return;\n }\n\n try {\n log.newline();\n if (!params.eslint && !params.prettier) {\n log.warn('Trying to push codegen updates...');\n } else {\n log.warn(\n `Trying to autofix with ${\n params.eslint ? 'ESLint and ' : ''\n }Prettier...`,\n );\n\n const logger = createLogger(params.debug);\n\n if (params.eslint) {\n await runESLint('format', logger);\n }\n // Unconditionally re-run Prettier; reaching here means we have pre-existing\n // format violations or may have created new ones through ESLint fixes.\n await runPrettier('format', logger);\n }\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: AUTOFIX_IGNORE_FILES,\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: AUTOFIX_IGNORE_FILES,\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,kBAAiB;AACjB,kBAAwB;AAExB,sBAAe;AACf,wBAAsB;AAEtB,UAAqB;AACrB,aAAwB;AACxB,iBAAwB;AACxB,qBAAkC;AAClC,kBAA+B;AAC/B,oBAA0B;AAC1B,sBAA4B;AAC5B,6BAAiC;AACjC,sBAA0C;AAC1C,iCAAyC;AACzC,gCAAyC;AAIzC,MAAM,yBAAyB;AAE/B,MAAM,uBAAuB;AAAA;AAAA;AAAA,EAG3B;AACF;AAEA,MAAM,wBAAwB,oBAAI,IAAY;AAAA,EAC5C,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH;AACF,CAAC;AAEM,MAAM,uBAA0C;AAAA,EACrD;AAAA,IACE,MAAM;AAAA,IACN,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,OAAO;AAAA,EACT;AACF;AAEA,MAAM,aAAa,OAAO;AAAA,EACxB;AAAA,EACA;AACF,MAGM;AACJ,MAAI,KAAC,oBAAQ,GAAG;AAId,WAAO;AAAA,EACT;AAEA,QAAM,2BACJ,iBACA,CAAC,QAAQ,IAAI,mCAAmC,UAAU,MAAM,EAAE;AAAA,IAChE;AAAA,EACF;AAEF,QAAM,0BAA0B,QAAQ,IAAI,yBAAyB;AAErE,MAAI,4BAA4B,yBAAyB;AAGvD,WAAO;AAAA,EACT;AAEA,MAAI;AACJ,MAAI;AACF,wBAAoB,MAAM,IAAI,qBAAqB,EAAE,IAAI,CAAC;AAAA,EAC5D,QAAE;AAAA,EAAO;AAET,MAAI,sBAAsB,wBAAwB;AAGhD,WAAO;AAAA,EACT;AAGA,SAAO;AACT;A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QAAI,QAAQ,IAAI,gBAAgB;AAE9B,YAAMC,OAAM,MAAM,IAAI,iBAAiB;AAAA,QACrC;AAAA,QACA,SAAS;AAAA,QAET,QAAQ;AAAA,MACV,CAAC;AAED,UAAI,CAACA,MAAK;AACR,eAAO,mBAAI,KAAK,wBAAwB;AAAA,MAC1C;AAEA,gBAAM,gCAAe,kBAAAC,SAAU,EAAE,KAAK,GAAG,EAAE,GAAG,GAAG,CAAC;AAClD,yBAAI,KAAK,qBAAqBD,OAAM;AACpC;AAAA,IACF;AAGA,QAAI,CAAC,eAAe;AAClB,yBAAI,KAAK,yCAAyC;AAClD,yBAAI;AAAA,QACF;AAAA,MACF;AACA;AAAA,IACF;AAEA,UAAM,MAAM,UAAM;AAAA,MAChB,OAAO,qBAAqB;AAAA,QAC1B,QAAQ;AAAA,QACR;AAAA,QACA,iBAAiB;AAAA,QAEjB,QAAQ;AAAA,MACV,CAAC;AAAA,MACD,EAAE,GAAG,GAAG;AAAA,IACV;AAEA,QAAI,CAAC,KAAK;AACR,aAAO,mBAAI,KAAK,wBAAwB;AAAA,IAC1C;AAEA,uBAAI,KAAK,qBAAqB,MAAM;AAAA,EACtC,SAAS,KAAP;AACA,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;",
|
|
4
|
+
"sourcesContent": ["import path from 'path';\nimport { inspect } from 'util';\n\nimport fs from 'fs-extra';\nimport simpleGit from 'simple-git';\n\nimport * as Git from '../../api/git';\nimport * as GitHub from '../../api/github';\nimport { isCiEnv } from '../../utils/env';\nimport { createLogger, log } from '../../utils/logging';\nimport { throwOnTimeout } from '../../utils/wait';\nimport { runESLint } from '../adapter/eslint';\nimport { runPrettier } from '../adapter/prettier';\nimport { JEST_SETUP_FILES } from '../configure/addEmptyExports';\nimport { RENOVATE_CONFIG_FILENAMES } from '../configure/modules/renovate';\nimport { SERVER_LISTENER_FILENAME } from '../configure/patchServerListener';\nimport { REFRESHABLE_IGNORE_FILES } from '../configure/refreshIgnoreFiles';\n\nimport type { Input } from './types';\n\nconst AUTOFIX_COMMIT_MESSAGE = 'Run `skuba format`';\n\nconst AUTOFIX_DELETE_FILES = [\n // Try to delete this SEEK-Jobs/gutenberg automation file that may have been\n // accidentally committed in a prior autofix.\n 'Dockerfile-incunabulum',\n];\n\nconst AUTOFIX_CODEGEN_FILES = new Set<string>([\n ...AUTOFIX_DELETE_FILES,\n ...JEST_SETUP_FILES,\n ...REFRESHABLE_IGNORE_FILES,\n ...RENOVATE_CONFIG_FILENAMES,\n SERVER_LISTENER_FILENAME,\n]);\n\nexport const AUTOFIX_IGNORE_FILES: Git.ChangedFile[] = [\n {\n path: '.npmrc',\n state: 'added',\n },\n {\n // This file may already exist in version control, but we shouldn't commit\n // further changes as the CI environment may have appended an npm token.\n path: '.npmrc',\n state: 'modified',\n },\n {\n path: 'Dockerfile-incunabulum',\n state: 'added',\n },\n];\n\nconst shouldPush = 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 let headCommitMessage;\n try {\n headCommitMessage = await Git.getHeadCommitMessage({ dir });\n } catch {}\n\n if (headCommitMessage === 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\ninterface AutofixParameters {\n debug: Input['debug'];\n\n eslint: boolean;\n prettier: boolean;\n}\n\n/**\n * @returns Whether skuba codegenned a file change which should be included in\n * an autofix commit.\n */\nconst tryCodegen = async (dir: string): Promise<boolean> => {\n try {\n // Try to forcibly remove `AUTOFIX_DELETE_FILES` from source control.\n // These may include outdated configuration files or internal files that\n // were accidentally committed by an autofix.\n await Promise.all(\n AUTOFIX_DELETE_FILES.map((filename) =>\n fs.promises.rm(path.join(dir, filename), { force: true }),\n ),\n );\n\n // Search codegenned file changes in the local Git working directory.\n // These may include the `AUTOFIX_DELETE_FILES` deleted above or fixups to\n // ignore files and module exports that were run at the start of the\n // `skuba lint` command.\n const changedFiles = await Git.getChangedFiles({\n dir,\n\n ignore: AUTOFIX_IGNORE_FILES,\n });\n\n // Determine if a meaningful codegen change\n return changedFiles.some((changedFile) =>\n AUTOFIX_CODEGEN_FILES.has(changedFile.path),\n );\n } catch (err) {\n log.warn(log.bold('Failed to evaluate codegen changes.'));\n log.subtle(inspect(err));\n\n return false;\n }\n};\n\nexport const autofix = async (params: AutofixParameters): Promise<void> => {\n const dir = process.cwd();\n\n const codegen = await tryCodegen(dir);\n\n if (!params.eslint && !params.prettier && !codegen) {\n return;\n }\n\n let currentBranch;\n try {\n currentBranch = await Git.currentBranch({ dir });\n } catch {}\n\n if (!(await shouldPush({ currentBranch, dir }))) {\n return;\n }\n\n try {\n log.newline();\n if (!params.eslint && !params.prettier) {\n log.warn('Trying to push codegen updates...');\n } else {\n log.warn(\n `Trying to autofix with ${\n params.eslint ? 'ESLint and ' : ''\n }Prettier...`,\n );\n\n const logger = createLogger(params.debug);\n\n if (params.eslint) {\n await runESLint('format', logger);\n }\n // Unconditionally re-run Prettier; reaching here means we have pre-existing\n // format violations or may have created new ones through ESLint fixes.\n await runPrettier('format', logger);\n }\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: AUTOFIX_IGNORE_FILES,\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: AUTOFIX_IGNORE_FILES,\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,kBAAiB;AACjB,kBAAwB;AAExB,sBAAe;AACf,wBAAsB;AAEtB,UAAqB;AACrB,aAAwB;AACxB,iBAAwB;AACxB,qBAAkC;AAClC,kBAA+B;AAC/B,oBAA0B;AAC1B,sBAA4B;AAC5B,6BAAiC;AACjC,sBAA0C;AAC1C,iCAAyC;AACzC,gCAAyC;AAIzC,MAAM,yBAAyB;AAE/B,MAAM,uBAAuB;AAAA;AAAA;AAAA,EAG3B;AACF;AAEA,MAAM,wBAAwB,oBAAI,IAAY;AAAA,EAC5C,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH;AACF,CA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,QAAQ;AAAA,MACV,CAAC;AAAA,MACD,EAAE,GAAG,GAAG;AAAA,IACV;AAEA,QAAI,CAAC,KAAK;AACR,aAAO,mBAAI,KAAK,wBAAwB;AAAA,IAC1C;AAEA,uBAAI,KAAK,qBAAqB,MAAM;AAAA,EACtC,SAAS,KAAP;AACA,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": ["fs", "path", "ref", "simpleGit"]
|
|
7
7
|
}
|
package/lib/utils/copy.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type Logger } from './logging';
|
|
1
2
|
export type TextProcessor = (contents: string) => string;
|
|
2
3
|
interface CopyFilesOptions {
|
|
3
4
|
sourceRoot: string;
|
|
@@ -13,4 +14,5 @@ export declare const createStringReplacer: (replacements: Array<{
|
|
|
13
14
|
output: string;
|
|
14
15
|
}>) => TextProcessor;
|
|
15
16
|
export declare const copyFiles: (opts: CopyFilesOptions, currentSourceDir?: string, currentDestinationDir?: string) => Promise<void>;
|
|
17
|
+
export declare const copyAssets: (destinationDir: string, logger?: Logger) => Promise<void>;
|
|
16
18
|
export {};
|