skuba 0.0.0-master-20230319220011 → 0.0.0-master-20230815032514
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/README.md +1 -1
- package/config/tsconfig.json +3 -1
- package/jest-preset.js +7 -1
- package/lib/api/buildkite/md.js.map +1 -1
- package/lib/api/git/commitAllChanges.d.ts +2 -2
- package/lib/api/git/commitAllChanges.js.map +2 -2
- package/lib/api/git/currentBranch.js +2 -1
- package/lib/api/git/currentBranch.js.map +2 -2
- package/lib/api/git/findRoot.d.ts +9 -0
- package/lib/api/git/findRoot.js +52 -0
- package/lib/api/git/findRoot.js.map +7 -0
- package/lib/api/git/index.d.ts +1 -0
- package/lib/api/git/index.js +3 -0
- package/lib/api/git/index.js.map +2 -2
- package/lib/api/git/pull.js.map +1 -1
- package/lib/api/git/push.js.map +1 -1
- package/lib/api/git/remote.js +2 -1
- package/lib/api/git/remote.js.map +2 -2
- package/lib/api/git/reset.js.map +1 -1
- package/lib/api/github/checkRun.d.ts +1 -1
- package/lib/api/github/checkRun.js.map +2 -2
- package/lib/api/github/environment.js.map +1 -1
- package/lib/api/github/issueComment.js.map +1 -1
- package/lib/api/github/pullRequest.js +3 -2
- package/lib/api/github/pullRequest.js.map +2 -2
- package/lib/api/github/push.js.map +1 -1
- package/lib/api/jest/index.d.ts +24 -21
- package/lib/api/net/compose.js.map +1 -1
- package/lib/api/net/socket.js.map +1 -1
- package/lib/api/net/waitFor.d.ts +1 -1
- package/lib/api/net/waitFor.js.map +2 -2
- package/lib/cli/adapter/eslint.d.ts +2 -2
- package/lib/cli/adapter/eslint.js +0 -24
- package/lib/cli/adapter/eslint.js.map +2 -2
- package/lib/cli/adapter/prettier.d.ts +9 -2
- package/lib/cli/adapter/prettier.js +20 -15
- package/lib/cli/adapter/prettier.js.map +2 -2
- package/lib/cli/build/assets.d.ts +10 -0
- package/lib/cli/build/assets.js +107 -0
- package/lib/cli/build/assets.js.map +7 -0
- package/lib/cli/build/esbuild.js +7 -42
- package/lib/cli/build/esbuild.js.map +3 -3
- package/lib/cli/build/index.js +12 -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 +66 -0
- package/lib/cli/build/tsc.js.map +3 -3
- package/lib/cli/buildPackage.js +13 -0
- package/lib/cli/buildPackage.js.map +2 -2
- package/lib/cli/configure/addEmptyExports.js +1 -1
- package/lib/cli/configure/addEmptyExports.js.map +2 -2
- package/lib/cli/configure/analyseDependencies.js +1 -1
- package/lib/cli/configure/analyseDependencies.js.map +2 -2
- package/lib/cli/configure/analysis/files.js.map +1 -1
- package/lib/cli/configure/analysis/package.js.map +2 -2
- package/lib/cli/configure/analysis/project.js +7 -3
- package/lib/cli/configure/analysis/project.js.map +2 -2
- package/lib/cli/configure/ensureTemplateCompletion.d.ts +1 -1
- package/lib/cli/configure/ensureTemplateCompletion.js +1 -1
- package/lib/cli/configure/ensureTemplateCompletion.js.map +2 -2
- package/lib/cli/configure/getEntryPoint.js +3 -0
- package/lib/cli/configure/getEntryPoint.js.map +3 -3
- package/lib/cli/configure/index.js +1 -1
- package/lib/cli/configure/index.js.map +2 -2
- package/lib/cli/configure/modules/jest.js +2 -2
- package/lib/cli/configure/modules/jest.js.map +2 -2
- package/lib/cli/configure/modules/skubaDive.js.map +1 -1
- package/lib/cli/configure/modules/tsconfig.js.map +1 -1
- package/lib/cli/configure/patchDockerfile.d.ts +1 -0
- package/lib/cli/configure/patchDockerfile.js +65 -0
- package/lib/cli/configure/patchDockerfile.js.map +7 -0
- package/lib/cli/configure/patchRenovateConfig.js +9 -4
- package/lib/cli/configure/patchRenovateConfig.js.map +2 -2
- package/lib/cli/configure/patchServerListener.js +1 -1
- package/lib/cli/configure/patchServerListener.js.map +2 -2
- package/lib/cli/configure/processing/ignoreFile.js.map +1 -1
- package/lib/cli/configure/processing/javascript.js.map +1 -1
- package/lib/cli/configure/processing/json.d.ts +1 -1
- package/lib/cli/configure/processing/json.js.map +1 -1
- package/lib/cli/configure/processing/module.js.map +1 -1
- package/lib/cli/configure/processing/package.d.ts +2 -2
- package/lib/cli/configure/processing/prettier.d.ts +1 -1
- package/lib/cli/configure/processing/typescript.d.ts +2 -2
- package/lib/cli/configure/processing/typescript.js +15 -7
- package/lib/cli/configure/processing/typescript.js.map +2 -2
- package/lib/cli/configure/refreshIgnoreFiles.js.map +1 -1
- package/lib/cli/configure/types.d.ts +1 -1
- package/lib/cli/configure/types.js.map +1 -1
- package/lib/cli/format.js +2 -0
- package/lib/cli/format.js.map +2 -2
- package/lib/cli/init/getConfig.d.ts +2 -2
- package/lib/cli/init/getConfig.js +5 -2
- package/lib/cli/init/getConfig.js.map +2 -2
- package/lib/cli/init/git.js.map +1 -1
- package/lib/cli/init/index.js.map +1 -1
- package/lib/cli/init/prompts.d.ts +1 -1
- package/lib/cli/init/prompts.js +1 -1
- package/lib/cli/init/prompts.js.map +2 -2
- package/lib/cli/init/writePackageJson.js +1 -1
- package/lib/cli/init/writePackageJson.js.map +2 -2
- package/lib/cli/lint/annotate/buildkite/prettier.js.map +2 -2
- package/lib/cli/lint/annotate/github/eslint.js.map +1 -1
- package/lib/cli/lint/annotate/github/index.js.map +1 -1
- package/lib/cli/lint/annotate/github/tsc.js +1 -1
- package/lib/cli/lint/annotate/github/tsc.js.map +2 -2
- package/lib/cli/lint/autofix.js +21 -0
- package/lib/cli/lint/autofix.js.map +2 -2
- package/lib/cli/lint/eslint.d.ts +1 -1
- package/lib/cli/lint/eslint.js.map +2 -2
- package/lib/cli/lint/external.js.map +1 -1
- package/lib/cli/lint/internal.js.map +1 -1
- package/lib/cli/lint/prettier.d.ts +1 -1
- package/lib/cli/lint/prettier.js.map +2 -2
- package/lib/cli/lint/tsc.js.map +1 -1
- package/lib/cli/test/reporters/github/annotations.js +1 -1
- package/lib/cli/test/reporters/github/annotations.js.map +2 -2
- package/lib/cli/test/reporters/github/index.js +0 -2
- package/lib/cli/test/reporters/github/index.js.map +1 -1
- package/lib/cli/test/reporters/prettier/index.d.ts +4 -0
- package/lib/cli/test/reporters/prettier/index.js +67 -0
- package/lib/cli/test/reporters/prettier/index.js.map +7 -0
- package/lib/index.js.map +1 -1
- package/lib/skuba.js +1 -0
- package/lib/skuba.js.map +2 -2
- package/lib/utils/args.d.ts +1 -1
- package/lib/utils/args.js.map +2 -2
- package/lib/utils/command.js +1 -1
- package/lib/utils/command.js.map +2 -2
- package/lib/utils/copy.d.ts +2 -1
- package/lib/utils/copy.js +6 -1
- package/lib/utils/copy.js.map +2 -2
- package/lib/utils/dir.d.ts +3 -2
- package/lib/utils/dir.js +6 -6
- package/lib/utils/dir.js.map +2 -2
- package/lib/utils/exec.d.ts +1 -2
- package/lib/utils/exec.js.map +2 -2
- package/lib/utils/logging.js.map +1 -1
- package/lib/utils/logo.js.map +1 -1
- package/lib/utils/manifest.d.ts +2 -2
- package/lib/utils/manifest.js +8 -2
- package/lib/utils/manifest.js.map +2 -2
- package/lib/utils/validation.d.ts +3 -3
- package/lib/utils/validation.js.map +2 -2
- package/lib/utils/version.js.map +1 -1
- package/lib/utils/wait.js.map +1 -1
- package/lib/utils/worker.js.map +1 -1
- package/lib/wrapper/functionHandler.js.map +1 -1
- package/lib/wrapper/http.d.ts +1 -1
- package/lib/wrapper/http.js.map +2 -2
- package/lib/wrapper/index.js.map +1 -1
- package/lib/wrapper/main.js.map +2 -2
- package/lib/wrapper/requestListener.js +3 -0
- package/lib/wrapper/requestListener.js.map +2 -2
- package/package.json +29 -26
- package/template/base/.github/CODEOWNERS +0 -4
- package/template/base/_.prettierignore +1 -13
- package/template/express-rest-api/.buildkite/pipeline.yml +1 -1
- package/template/express-rest-api/Dockerfile +1 -1
- package/template/express-rest-api/gantry.apply.yml +0 -2
- package/template/express-rest-api/package.json +2 -2
- 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/greeter/package.json +1 -1
- package/template/koa-rest-api/.buildkite/pipeline.yml +1 -1
- package/template/koa-rest-api/Dockerfile +1 -1
- package/template/koa-rest-api/gantry.apply.yml +0 -2
- package/template/koa-rest-api/package.json +7 -7
- 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/server.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 +3 -3
- 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 +9 -9
- package/template/lambda-sqs-worker/src/app.test.ts +1 -1
- package/template/lambda-sqs-worker/src/app.ts +10 -5
- package/template/lambda-sqs-worker/src/framework/handler.test.ts +4 -4
- package/template/lambda-sqs-worker/src/framework/handler.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 -3
- package/template/lambda-sqs-worker/src/testing/handler.ts +3 -3
- package/template/lambda-sqs-worker/src/testing/logging.ts +3 -0
- 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 +2 -2
- package/template/lambda-sqs-worker-cdk/src/app.ts +1 -1
- package/template/oss-npm-package/.github/workflows/release.yml +1 -0
- package/template/oss-npm-package/_package.json +4 -1
- package/template/private-npm-package/_package.json +1 -1
|
@@ -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
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,mBAAkB;
|
|
4
|
+
"sourcesContent": ["import path from 'path';\n\nimport chalk from 'chalk';\nimport { ESLint, type Linter } from 'eslint';\n\nimport { type Logger, 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"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,mBAAkB;AAClB,oBAAoC;AAEpC,qBAAuC;AAEvC,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,KAAK,SAAS;AAAA,IACd,+BAA+B;AAAA,EACjC,CAAC;AAED,QAAM,MAAM,QAAQ,IAAI;AAExB,SAAO,MAAM,qBAAqB;AAElC,QAAM,QAAQ,QAAQ,OAAO,OAAO;AAEpC,QAAM,CAAC,WAAW,OAAO,IAAI,MAAM,QAAQ,IAAI;AAAA,IAC7C,OAAO,cAAc;AAAA,IACrB,OAAO,UAAU,GAAG;AAAA,EACtB,CAAC;AAED,QAAM,MAAM,QAAQ,OAAO,OAAO;AAElC,SAAO;AAAA,IACL,iBAAa,0BAAU,QAAQ,QAAQ,MAAM,CAAC,OAAO,OAAO;AAAA,MAC1D;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AAEA,QAAM,SAAyB,CAAC;AAChC,QAAM,WAA2B,CAAC;AAClC,MAAI,UAAU;AAEd,aAAW,UAAU,SAAS;AAC5B,UAAM,eAAe,YAAAC,QAAK,SAAS,KAAK,OAAO,QAAQ;AACvD,QAAI,OAAO,oBAAoB,OAAO,qBAAqB;AACzD,gBAAU;AAAA,IACZ;AAEA,QAAI,OAAO,YAAY;AACrB,aAAO,KAAK;AAAA,QACV,UAAU;AAAA,QACV,UAAU,OAAO;AAAA,MACnB,CAAC;AAAA,IACH;AAEA,QAAI,OAAO,cAAc;AACvB,eAAS,KAAK;AAAA,QACZ,UAAU;AAAA,QACV,UAAU,OAAO;AAAA,MACnB,CAAC;AAAA,IACH;AAEA,WAAO,MAAM,gBAAgB,MAAM,GAAG,YAAY;AAAA,EACpD;AAEA,QAAM,KAAK,OAAO,WAAW;AAE7B,QAAM,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
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Options } from 'prettier';
|
|
2
|
+
import { type Logger } from '../../utils/logging';
|
|
2
3
|
/**
|
|
3
4
|
* Infers a parser for the specified filepath.
|
|
4
5
|
*
|
|
@@ -19,7 +20,12 @@ import type { Logger } from '../../utils/logging';
|
|
|
19
20
|
* - https://github.com/prettier/prettier/blob/2.4.1/src/main/options.js#L167
|
|
20
21
|
* - seek-oss/skuba#659
|
|
21
22
|
*/
|
|
22
|
-
export declare const inferParser: (filepath: string) => string | undefined
|
|
23
|
+
export declare const inferParser: (filepath: string) => Promise<string | undefined>;
|
|
24
|
+
interface File {
|
|
25
|
+
data: string;
|
|
26
|
+
options: Options;
|
|
27
|
+
filepath: string;
|
|
28
|
+
}
|
|
23
29
|
interface Result {
|
|
24
30
|
count: number;
|
|
25
31
|
errored: Array<{
|
|
@@ -29,6 +35,7 @@ interface Result {
|
|
|
29
35
|
touched: string[];
|
|
30
36
|
unparsed: string[];
|
|
31
37
|
}
|
|
38
|
+
export declare const formatOrLintFile: ({ data, filepath, options }: File, mode: 'format' | 'lint', result: Result | null) => Promise<string | undefined>;
|
|
32
39
|
export interface PrettierOutput {
|
|
33
40
|
ok: boolean;
|
|
34
41
|
result: Result;
|
|
@@ -28,6 +28,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var prettier_exports = {};
|
|
30
30
|
__export(prettier_exports, {
|
|
31
|
+
formatOrLintFile: () => formatOrLintFile,
|
|
31
32
|
inferParser: () => inferParser,
|
|
32
33
|
runPrettier: () => runPrettier
|
|
33
34
|
});
|
|
@@ -40,15 +41,15 @@ var import_logging = require("../../utils/logging");
|
|
|
40
41
|
var import_manifest = require("../../utils/manifest");
|
|
41
42
|
var import_package = require("../configure/processing/package");
|
|
42
43
|
let languages;
|
|
43
|
-
const inferParser = (filepath) => {
|
|
44
|
+
const inferParser = async (filepath) => {
|
|
44
45
|
const filename = import_path.default.basename(filepath).toLowerCase();
|
|
45
|
-
languages ??= (0, import_prettier.getSupportInfo)().languages
|
|
46
|
+
languages ??= (await (0, import_prettier.getSupportInfo)()).languages;
|
|
46
47
|
const firstLanguage = languages.find(
|
|
47
48
|
(language) => language.extensions?.some((extension) => filename.endsWith(extension)) || language.filenames?.some((name) => name.toLowerCase() === filename)
|
|
48
49
|
);
|
|
49
50
|
return firstLanguage?.parsers[0];
|
|
50
51
|
};
|
|
51
|
-
const isPackageJsonOk = ({
|
|
52
|
+
const isPackageJsonOk = async ({
|
|
52
53
|
data,
|
|
53
54
|
filepath
|
|
54
55
|
}) => {
|
|
@@ -57,37 +58,37 @@ const isPackageJsonOk = ({
|
|
|
57
58
|
}
|
|
58
59
|
try {
|
|
59
60
|
const packageJson = (0, import_package.parsePackage)(data);
|
|
60
|
-
return !packageJson || (0, import_package.formatPackage)(packageJson) === data;
|
|
61
|
+
return !packageJson || await (0, import_package.formatPackage)(packageJson) === data;
|
|
61
62
|
} catch {
|
|
62
63
|
}
|
|
63
64
|
return true;
|
|
64
65
|
};
|
|
65
|
-
const formatOrLintFile = ({ data, filepath, options }, mode, result) => {
|
|
66
|
+
const formatOrLintFile = async ({ data, filepath, options }, mode, result) => {
|
|
66
67
|
if (mode === "lint") {
|
|
67
68
|
let ok;
|
|
68
69
|
try {
|
|
69
|
-
ok = (0, import_prettier.check)(data, options) && isPackageJsonOk({ data, filepath });
|
|
70
|
+
ok = await (0, import_prettier.check)(data, options) && await isPackageJsonOk({ data, filepath });
|
|
70
71
|
} catch (err) {
|
|
71
|
-
result
|
|
72
|
+
result?.errored.push({ err, filepath });
|
|
72
73
|
return;
|
|
73
74
|
}
|
|
74
75
|
if (!ok) {
|
|
75
|
-
result
|
|
76
|
+
result?.errored.push({ filepath });
|
|
76
77
|
}
|
|
77
78
|
return;
|
|
78
79
|
}
|
|
79
80
|
let formatted;
|
|
80
81
|
try {
|
|
81
|
-
formatted = (0, import_prettier.format)(data, options);
|
|
82
|
+
formatted = await (0, import_prettier.format)(data, options);
|
|
82
83
|
} catch (err) {
|
|
83
|
-
result
|
|
84
|
+
result?.errored.push({ err, filepath });
|
|
84
85
|
return;
|
|
85
86
|
}
|
|
86
87
|
try {
|
|
87
88
|
if (import_path.default.basename(filepath) === "package.json") {
|
|
88
89
|
const packageJson = (0, import_package.parsePackage)(formatted);
|
|
89
90
|
if (packageJson) {
|
|
90
|
-
formatted = (0, import_package.formatPackage)(packageJson);
|
|
91
|
+
formatted = await (0, import_package.formatPackage)(packageJson);
|
|
91
92
|
}
|
|
92
93
|
}
|
|
93
94
|
} catch {
|
|
@@ -95,7 +96,7 @@ const formatOrLintFile = ({ data, filepath, options }, mode, result) => {
|
|
|
95
96
|
if (formatted === data) {
|
|
96
97
|
return;
|
|
97
98
|
}
|
|
98
|
-
result
|
|
99
|
+
result?.touched.push(filepath);
|
|
99
100
|
return formatted;
|
|
100
101
|
};
|
|
101
102
|
const runPrettier = async (mode, logger) => {
|
|
@@ -111,7 +112,10 @@ const runPrettier = async (mode, logger) => {
|
|
|
111
112
|
directory
|
|
112
113
|
);
|
|
113
114
|
logger.debug("Discovering files...");
|
|
114
|
-
const filepaths = await (0, import_dir.crawlDirectory)(directory,
|
|
115
|
+
const filepaths = await (0, import_dir.crawlDirectory)(directory, [
|
|
116
|
+
".gitignore",
|
|
117
|
+
".prettierignore"
|
|
118
|
+
]);
|
|
115
119
|
logger.debug(`Discovered ${(0, import_logging.pluralise)(filepaths.length, "file")}.`);
|
|
116
120
|
const result = {
|
|
117
121
|
count: filepaths.length,
|
|
@@ -121,7 +125,7 @@ const runPrettier = async (mode, logger) => {
|
|
|
121
125
|
};
|
|
122
126
|
logger.debug(mode === "format" ? "Formatting" : "Linting", "files...");
|
|
123
127
|
for (const filepath of filepaths) {
|
|
124
|
-
const parser = inferParser(filepath);
|
|
128
|
+
const parser = await inferParser(filepath);
|
|
125
129
|
logger.debug(filepath);
|
|
126
130
|
logger.debug(" parser:", parser ?? "-");
|
|
127
131
|
if (!parser) {
|
|
@@ -137,7 +141,7 @@ const runPrettier = async (mode, logger) => {
|
|
|
137
141
|
filepath,
|
|
138
142
|
options: { ...config, filepath }
|
|
139
143
|
};
|
|
140
|
-
const formatted = formatOrLintFile(file, mode, result);
|
|
144
|
+
const formatted = await formatOrLintFile(file, mode, result);
|
|
141
145
|
if (typeof formatted === "string") {
|
|
142
146
|
await import_fs_extra.default.promises.writeFile(filepath, formatted);
|
|
143
147
|
}
|
|
@@ -165,6 +169,7 @@ const runPrettier = async (mode, logger) => {
|
|
|
165
169
|
};
|
|
166
170
|
// Annotate the CommonJS export names for ESM import in node:
|
|
167
171
|
0 && (module.exports = {
|
|
172
|
+
formatOrLintFile,
|
|
168
173
|
inferParser,
|
|
169
174
|
runPrettier
|
|
170
175
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/adapter/prettier.ts"],
|
|
4
|
-
"sourcesContent": ["import path from 'path';\n\nimport fs from 'fs-extra';\nimport type
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,sBAAe;
|
|
4
|
+
"sourcesContent": ["import path from 'path';\n\nimport fs from 'fs-extra';\nimport {\n type Options,\n type SupportLanguage,\n check,\n format,\n getSupportInfo,\n resolveConfig,\n} from 'prettier';\n\nimport { crawlDirectory } from '../../utils/dir';\nimport { type Logger, pluralise } from '../../utils/logging';\nimport { getConsumerManifest } from '../../utils/manifest';\nimport { formatPackage, parsePackage } from '../configure/processing/package';\n\nlet languages: SupportLanguage[] | undefined;\n\n/**\n * Infers a parser for the specified filepath.\n *\n * This is a cut-down version of Prettier's built-in function of the same name;\n * ours operates purely on the `filepath` string and does not perform file I/O.\n * Prettier's internal `getInterpreter` function can open a file to read the\n * shebang, and its file descriptor usage can throw warnings on worker threads:\n *\n * ```console\n * Warning: File descriptor 123 closed but not opened in unmanaged mode\n * at Object.closeSync (node:fs:530:11)\n * at Object.closeSync (node_modules/graceful-fs/graceful-fs.js:74:20)\n * ...\n * ```\n *\n * References:\n *\n * - https://github.com/prettier/prettier/blob/2.4.1/src/main/options.js#L167\n * - seek-oss/skuba#659\n */\nexport const inferParser = async (\n filepath: string,\n): Promise<string | undefined> => {\n const filename = path.basename(filepath).toLowerCase();\n\n languages ??= (await getSupportInfo()).languages;\n\n const firstLanguage = languages.find(\n (language) =>\n language.extensions?.some((extension) => filename.endsWith(extension)) ||\n language.filenames?.some((name) => name.toLowerCase() === filename),\n );\n\n return firstLanguage?.parsers[0];\n};\n\nconst isPackageJsonOk = async ({\n data,\n filepath,\n}: {\n data: string;\n filepath: string;\n}): Promise<boolean> => {\n if (path.basename(filepath) !== 'package.json') {\n return true;\n }\n\n try {\n const packageJson = parsePackage(data);\n\n return !packageJson || (await formatPackage(packageJson)) === data;\n } catch {\n // Be more lenient about our custom formatting and don't throw if it errors.\n }\n\n return true;\n};\n\ninterface File {\n data: string;\n options: Options;\n filepath: string;\n}\n\ninterface Result {\n count: number;\n errored: Array<{ err?: unknown; filepath: string }>;\n touched: string[];\n unparsed: string[];\n}\n\nexport const formatOrLintFile = async (\n { data, filepath, options }: File,\n mode: 'format' | 'lint',\n result: Result | null,\n): Promise<string | undefined> => {\n if (mode === 'lint') {\n let ok: boolean;\n try {\n ok =\n (await check(data, options)) &&\n (await isPackageJsonOk({ data, filepath }));\n } catch (err) {\n result?.errored.push({ err, filepath });\n return;\n }\n\n if (!ok) {\n result?.errored.push({ filepath });\n }\n\n return;\n }\n\n let formatted: string;\n try {\n formatted = await format(data, options);\n } catch (err) {\n result?.errored.push({ err, filepath });\n return;\n }\n\n // Perform additional formatting (i.e. sorting) on a `package.json` manifest.\n try {\n if (path.basename(filepath) === 'package.json') {\n const packageJson = parsePackage(formatted);\n if (packageJson) {\n formatted = await formatPackage(packageJson);\n }\n }\n } catch {\n // Be more lenient about our custom formatting and don't throw if it errors.\n }\n\n if (formatted === data) {\n return;\n }\n\n result?.touched.push(filepath);\n return formatted;\n};\n\nexport interface PrettierOutput {\n ok: boolean;\n result: Result;\n}\n\n/**\n * Formats/lints files with Prettier.\n *\n * Prettier doesn't provide a higher-level Node.js API that replicates the\n * behaviour of its CLI, so we have to plumb together its lower-level functions.\n * On the other hand, this affords more flexibility in how we track and report\n * on progress and results.\n */\nexport const runPrettier = async (\n mode: 'format' | 'lint',\n logger: Logger,\n): Promise<PrettierOutput> => {\n logger.debug('Initialising Prettier...');\n\n const start = process.hrtime.bigint();\n\n let directory = process.cwd();\n\n const manifest = await getConsumerManifest();\n if (manifest) {\n directory = path.dirname(manifest.path);\n }\n\n logger.debug(\n manifest ? 'Detected project root:' : 'Detected working directory:',\n directory,\n );\n\n logger.debug('Discovering files...');\n\n // Match Prettier's opinion of respecting `.gitignore`.\n // This avoids exhibiting different behaviour than a Prettier IDE integration,\n // though it may present headaches if `.gitignore` and `.prettierignore` rules\n // conflict.\n const filepaths = await crawlDirectory(directory, [\n '.gitignore',\n '.prettierignore',\n ]);\n\n logger.debug(`Discovered ${pluralise(filepaths.length, 'file')}.`);\n\n const result: Result = {\n count: filepaths.length,\n errored: [],\n touched: [],\n unparsed: [],\n };\n\n logger.debug(mode === 'format' ? 'Formatting' : 'Linting', 'files...');\n\n for (const filepath of filepaths) {\n // Infer parser upfront so we can skip unsupported files.\n const parser = await inferParser(filepath);\n\n logger.debug(filepath);\n logger.debug(' parser:', parser ?? '-');\n\n if (!parser) {\n result.unparsed.push(filepath);\n continue;\n }\n\n const [config, data] = await Promise.all([\n resolveConfig(filepath),\n fs.promises.readFile(filepath, 'utf-8'),\n ]);\n\n const file: File = {\n data,\n filepath,\n options: { ...config, filepath },\n };\n\n const formatted = await formatOrLintFile(file, mode, result);\n\n if (typeof formatted === 'string') {\n await fs.promises.writeFile(filepath, formatted);\n }\n }\n\n const end = process.hrtime.bigint();\n\n logger.plain(\n `Processed ${pluralise(\n result.count - result.unparsed.length,\n 'file',\n )} in ${logger.timing(start, end)}.`,\n );\n\n if (result.touched.length) {\n logger.plain(`Formatted ${pluralise(result.touched.length, 'file')}:`);\n for (const filepath of result.touched) {\n logger.warn(filepath);\n }\n }\n\n if (result.errored.length) {\n logger.plain(`Flagged ${pluralise(result.errored.length, 'file')}:`);\n for (const { err, filepath } of result.errored) {\n logger.warn(filepath, ...(err ? [String(err)] : []));\n }\n }\n\n return { ok: result.errored.length === 0, result };\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,sBAAe;AACf,sBAOO;AAEP,iBAA+B;AAC/B,qBAAuC;AACvC,sBAAoC;AACpC,qBAA4C;AAE5C,IAAI;AAsBG,MAAM,cAAc,OACzB,aACgC;AAChC,QAAM,WAAW,YAAAA,QAAK,SAAS,QAAQ,EAAE,YAAY;AAErD,iBAAe,UAAM,gCAAe,GAAG;AAEvC,QAAM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AE3D,QAAI,OAAO,cAAc,UAAU;AACjC,YAAM,gBAAAA,QAAG,SAAS,UAAU,UAAU,SAAS;AAAA,IACjD;AAAA,EACF;AAEA,QAAM,MAAM,QAAQ,OAAO,OAAO;AAElC,SAAO;AAAA,IACL,iBAAa;AAAA,MACX,OAAO,QAAQ,OAAO,SAAS;AAAA,MAC/B;AAAA,IACF,CAAC,OAAO,OAAO,OAAO,OAAO,GAAG,CAAC;AAAA,EACnC;AAEA,MAAI,OAAO,QAAQ,QAAQ;AACzB,WAAO,MAAM,iBAAa,0BAAU,OAAO,QAAQ,QAAQ,MAAM,CAAC,GAAG;AACrE,eAAW,YAAY,OAAO,SAAS;AACrC,aAAO,KAAK,QAAQ;AAAA,IACtB;AAAA,EACF;AAEA,MAAI,OAAO,QAAQ,QAAQ;AACzB,WAAO,MAAM,eAAW,0BAAU,OAAO,QAAQ,QAAQ,MAAM,CAAC,GAAG;AACnE,eAAW,EAAE,KAAK,SAAS,KAAK,OAAO,SAAS;AAC9C,aAAO,KAAK,UAAU,GAAI,MAAM,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,CAAE;AAAA,IACrD;AAAA,EACF;AAEA,SAAO,EAAE,IAAI,OAAO,QAAQ,WAAW,GAAG,OAAO;AACnD;",
|
|
6
6
|
"names": ["path", "fs"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Color } from 'chalk';
|
|
2
|
+
import { type Logger } from '../../utils/logging';
|
|
3
|
+
export declare const copyAssets: (destinationDir: string, logger?: Logger) => Promise<void>;
|
|
4
|
+
interface CopyAssetsConfig {
|
|
5
|
+
outDir: string;
|
|
6
|
+
name: string;
|
|
7
|
+
prefixColor: typeof Color;
|
|
8
|
+
}
|
|
9
|
+
export declare const copyAssetsConcurrently: (configs: CopyAssetsConfig[]) => Promise<void>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var assets_exports = {};
|
|
30
|
+
__export(assets_exports, {
|
|
31
|
+
copyAssets: () => copyAssets,
|
|
32
|
+
copyAssetsConcurrently: () => copyAssetsConcurrently
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(assets_exports);
|
|
35
|
+
var import_path = __toESM(require("path"));
|
|
36
|
+
var import_chalk = __toESM(require("chalk"));
|
|
37
|
+
var import_fs_extra = __toESM(require("fs-extra"));
|
|
38
|
+
var import_copy = require("../../utils/copy");
|
|
39
|
+
var import_dir = require("../../utils/dir");
|
|
40
|
+
var import_logging = require("../../utils/logging");
|
|
41
|
+
var import_manifest = require("../../utils/manifest");
|
|
42
|
+
const copyAssets = async (destinationDir, logger = import_logging.log) => {
|
|
43
|
+
const manifest = await (0, import_manifest.getConsumerManifest)();
|
|
44
|
+
if (!manifest) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const assets = await (0, import_manifest.getPropFromConsumerManifest)("assets");
|
|
48
|
+
if (!assets) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const entryPoint = await (0, import_manifest.getEntryPointFromManifest)();
|
|
52
|
+
if (!entryPoint) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const pathSegments = entryPoint.split(import_path.default.sep);
|
|
56
|
+
const srcDir = pathSegments.length > 1 && pathSegments[0] || "";
|
|
57
|
+
const resolvedSrcDir = import_path.default.resolve(import_path.default.dirname(manifest.path), srcDir);
|
|
58
|
+
const resolvedDestinationDir = import_path.default.resolve(
|
|
59
|
+
import_path.default.dirname(manifest.path),
|
|
60
|
+
destinationDir
|
|
61
|
+
);
|
|
62
|
+
const allFiles = await (0, import_dir.crawlDirectory)(resolvedSrcDir);
|
|
63
|
+
const filesByPattern = (0, import_dir.buildPatternToFilepathMap)(assets, allFiles, {
|
|
64
|
+
cwd: resolvedSrcDir,
|
|
65
|
+
dot: true
|
|
66
|
+
});
|
|
67
|
+
const matchedFiles = Array.from(
|
|
68
|
+
new Set(Object.values(filesByPattern).flat())
|
|
69
|
+
);
|
|
70
|
+
await Promise.all(
|
|
71
|
+
matchedFiles.map(async (filename) => {
|
|
72
|
+
logger.subtle(`Copying ${filename}`);
|
|
73
|
+
await import_fs_extra.default.promises.mkdir(
|
|
74
|
+
import_path.default.dirname(import_path.default.join(resolvedDestinationDir, filename)),
|
|
75
|
+
{ recursive: true }
|
|
76
|
+
);
|
|
77
|
+
await (0, import_copy.copyFile)(
|
|
78
|
+
import_path.default.join(resolvedSrcDir, filename),
|
|
79
|
+
import_path.default.join(resolvedDestinationDir, filename),
|
|
80
|
+
{ processors: [] }
|
|
81
|
+
);
|
|
82
|
+
})
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
const copyAssetsConcurrently = async (configs) => {
|
|
86
|
+
const maxNameLength = configs.reduce(
|
|
87
|
+
(length, command) => Math.max(length, command.name.length),
|
|
88
|
+
0
|
|
89
|
+
);
|
|
90
|
+
await Promise.all(
|
|
91
|
+
configs.map(
|
|
92
|
+
({ outDir, name, prefixColor }) => copyAssets(
|
|
93
|
+
outDir,
|
|
94
|
+
(0, import_logging.createLogger)(
|
|
95
|
+
false,
|
|
96
|
+
import_chalk.default[prefixColor](`${name.padEnd(maxNameLength)} \u2502`)
|
|
97
|
+
)
|
|
98
|
+
)
|
|
99
|
+
)
|
|
100
|
+
);
|
|
101
|
+
};
|
|
102
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
103
|
+
0 && (module.exports = {
|
|
104
|
+
copyAssets,
|
|
105
|
+
copyAssetsConcurrently
|
|
106
|
+
});
|
|
107
|
+
//# sourceMappingURL=assets.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/cli/build/assets.ts"],
|
|
4
|
+
"sourcesContent": ["import path from 'path';\n\nimport chalk, { type Color } from 'chalk';\nimport fs from 'fs-extra';\n\nimport { copyFile } from '../../utils/copy';\nimport { buildPatternToFilepathMap, crawlDirectory } from '../../utils/dir';\nimport { type Logger, createLogger, log } from '../../utils/logging';\nimport {\n getConsumerManifest,\n getEntryPointFromManifest,\n getPropFromConsumerManifest,\n} from '../../utils/manifest';\n\nexport const copyAssets = async (\n destinationDir: string,\n logger: Logger = log,\n) => {\n const manifest = await getConsumerManifest();\n if (!manifest) {\n return;\n }\n\n const assets = await getPropFromConsumerManifest<string, string[]>('assets');\n if (!assets) {\n return;\n }\n\n const entryPoint = await getEntryPointFromManifest();\n if (!entryPoint) {\n return;\n }\n\n const pathSegments = entryPoint.split(path.sep);\n const srcDir = (pathSegments.length > 1 && pathSegments[0]) || '';\n const resolvedSrcDir = path.resolve(path.dirname(manifest.path), srcDir);\n const resolvedDestinationDir = path.resolve(\n path.dirname(manifest.path),\n destinationDir,\n );\n\n const allFiles = await crawlDirectory(resolvedSrcDir);\n const filesByPattern = buildPatternToFilepathMap(assets, allFiles, {\n cwd: resolvedSrcDir,\n dot: true,\n });\n const matchedFiles = Array.from(\n new Set(Object.values(filesByPattern).flat()),\n );\n\n await Promise.all(\n matchedFiles.map(async (filename) => {\n logger.subtle(`Copying ${filename}`);\n\n await fs.promises.mkdir(\n path.dirname(path.join(resolvedDestinationDir, filename)),\n { recursive: true },\n );\n await copyFile(\n path.join(resolvedSrcDir, filename),\n path.join(resolvedDestinationDir, filename),\n { processors: [] },\n );\n }),\n );\n};\n\ninterface CopyAssetsConfig {\n outDir: string;\n name: string;\n prefixColor: typeof Color;\n}\n\nexport const copyAssetsConcurrently = async (configs: CopyAssetsConfig[]) => {\n const maxNameLength = configs.reduce(\n (length, command) => Math.max(length, command.name.length),\n 0,\n );\n\n await Promise.all(\n configs.map(({ outDir, name, prefixColor }) =>\n copyAssets(\n outDir,\n createLogger(\n false,\n chalk[prefixColor](`${name.padEnd(maxNameLength)} \u2502`),\n ),\n ),\n ),\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,mBAAkC;AAClC,sBAAe;AAEf,kBAAyB;AACzB,iBAA0D;AAC1D,qBAA+C;AAC/C,sBAIO;AAEA,MAAM,aAAa,OACxB,gBACA,SAAiB,uBACd;AACH,QAAM,WAAW,UAAM,qCAAoB;AAC3C,MAAI,CAAC,UAAU;AACb;AAAA,EACF;AA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AM;AAAA,IACzD;AAAA,EACF;AAEA,QAAM,QAAQ;AAAA,IACZ,QAAQ;AAAA,MAAI,CAAC,EAAE,QAAQ,MAAM,YAAY,MACvC;AAAA,QACE;AAAA,YACA;AAAA,UACE;AAAA,UACA,aAAAE,QAAM,WAAW,EAAE,GAAG,KAAK,OAAO,aAAa,CAAC,SAAI;AAAA,QACtD;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
|
+
"names": ["path", "fs", "chalk"]
|
|
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;
|
|
@@ -113,6 +74,10 @@ const esbuild = async ({ debug }, args = process.argv.slice(2)) => {
|
|
|
113
74
|
})
|
|
114
75
|
],
|
|
115
76
|
sourcemap: compilerOptions.sourceMap,
|
|
77
|
+
// TODO: as of 0.18, the esbuild CLI no longer infers the target property to
|
|
78
|
+
// avoid ambiguity where multiple `tsconfig.json`s are involved in a build.
|
|
79
|
+
// This would be unusual for a typical SEEK project but we can still explore
|
|
80
|
+
// an explicit setting once we implement `skuba.config.ts` (#1167).
|
|
116
81
|
target: compilerOptions.target ? import_typescript.ScriptTarget[compilerOptions.target].toLocaleLowerCase() : void 0,
|
|
117
82
|
tsconfig: tscArgs.pathname
|
|
118
83
|
});
|
|
@@ -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 // TODO: as of 0.18, the esbuild CLI no longer infers the target property to\n // avoid ambiguity where multiple `tsconfig.json`s are involved in a build.\n // This would be unusual for a typical SEEK project but we can still explore\n // an explicit setting once we implement `skuba.config.ts` (#1167).\n target: compilerOptions.target\n ? ScriptTarget[compilerOptions.target].toLocaleLowerCase()\n : undefined,\n tsconfig: tscArgs.pathname,\n });\n\n const end = process.hrtime.bigint();\n\n log.plain(`Built in ${log.timing(start, end)}.`);\n\n if (compilerOptions.declaration) {\n await tsc([\n '--declaration',\n '--emitDeclarationOnly',\n ...(tscArgs.project ? ['--project', tscArgs.project] : []),\n ]);\n }\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAExB,4BAA0B;AAC1B,qBAAsB;AACtB,wBAA+D;AAE/D,qBAA6B;AAE7B,kBAA6B;AAC7B,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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|
}
|
package/lib/cli/build/index.js
CHANGED
|
@@ -36,6 +36,7 @@ var import_args = require("../../utils/args");
|
|
|
36
36
|
var import_logging = require("../../utils/logging");
|
|
37
37
|
var import_manifest = require("../../utils/manifest");
|
|
38
38
|
var import_addEmptyExports = require("../configure/addEmptyExports");
|
|
39
|
+
var import_assets = require("./assets");
|
|
39
40
|
var import_esbuild = require("./esbuild");
|
|
40
41
|
var import_tsc = require("./tsc");
|
|
41
42
|
const build = async (args = process.argv.slice(2)) => {
|
|
@@ -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,15 @@ 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
|
+
if (!compilerOptions.outDir) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
await (0, import_assets.copyAssets)(compilerOptions.outDir);
|
|
68
78
|
};
|
|
69
79
|
// Annotate the CommonJS export names for ESM import in node:
|
|
70
80
|
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 { log } from '../../utils/logging';\nimport { getStringPropFromConsumerManifest } from '../../utils/manifest';\nimport { tryAddEmptyExports } from '../configure/addEmptyExports';\n\nimport { copyAssets } from './assets';\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\n if (!compilerOptions.outDir) {\n return;\n }\n\n await copyAssets(compilerOptions.outDir);\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,kBAA6B;AAC7B,qBAAoB;AACpB,sBAAkD;AAClD,6BAAmC;AAEnC,oBAA2B;AAC3B,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;AAErC,MAAI,CAAC,gBAAgB,QAAQ;AAC3B;AAAA,EACF;AAEA,YAAM,0BAAW,gBAAgB,MAAM;AACzC;",
|
|
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;
|