skuba 8.0.0 → 8.0.1-cjs-mjs-output-20240326121905
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 +3 -3
- package/lib/cli/build/esbuild.d.ts +2 -1
- package/lib/cli/build/esbuild.js +75 -13
- package/lib/cli/build/esbuild.js.map +2 -2
- package/lib/cli/build/index.js +1 -1
- package/lib/cli/build/index.js.map +2 -2
- package/lib/cli/buildPackage.js +55 -0
- package/lib/cli/buildPackage.js.map +3 -3
- package/package.json +2 -2
- package/template/lambda-sqs-worker/package.json +1 -1
- package/template/oss-npm-package/.github/workflows/release.yml +1 -0
- package/template/oss-npm-package/.github/workflows/validate.yml +1 -0
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
[](https://github.com/seek-oss/skuba/actions?query=workflow%3ARelease)
|
|
6
|
+
[](https://github.com/seek-oss/skuba/actions?query=workflow%3AValidate)
|
|
7
|
+
[](https://nodejs.org/en/)
|
|
8
8
|
[](https://www.npmjs.com/package/skuba)
|
|
9
9
|
|
|
10
10
|
---
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
interface EsbuildParameters {
|
|
2
2
|
debug: boolean;
|
|
3
|
+
mode: 'build' | 'build-package';
|
|
3
4
|
}
|
|
4
|
-
export declare const esbuild: ({ debug }: EsbuildParameters, args?: string[]) => Promise<void>;
|
|
5
|
+
export declare const esbuild: ({ debug, mode }: EsbuildParameters, args?: string[]) => Promise<void>;
|
|
5
6
|
export {};
|
package/lib/cli/build/esbuild.js
CHANGED
|
@@ -38,7 +38,7 @@ 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 esbuild = async ({ debug }, args = process.argv.slice(2)) => {
|
|
41
|
+
const esbuild = async ({ debug, mode }, args = process.argv.slice(2)) => {
|
|
42
42
|
const log = (0, import_logging.createLogger)(debug);
|
|
43
43
|
const tscArgs = (0, import_args.parseTscArgs)(args);
|
|
44
44
|
if (tscArgs.build) {
|
|
@@ -58,15 +58,86 @@ const esbuild = async ({ debug }, args = process.argv.slice(2)) => {
|
|
|
58
58
|
log.debug(log.bold("Compiler options"));
|
|
59
59
|
log.debug((0, import_util.inspect)(compilerOptions));
|
|
60
60
|
const start = process.hrtime.bigint();
|
|
61
|
+
switch (mode) {
|
|
62
|
+
case "build":
|
|
63
|
+
await runBuild({
|
|
64
|
+
compilerOptions,
|
|
65
|
+
debug,
|
|
66
|
+
entryPoints,
|
|
67
|
+
tsconfig: tscArgs.pathname
|
|
68
|
+
});
|
|
69
|
+
break;
|
|
70
|
+
case "build-package":
|
|
71
|
+
await runBuild({
|
|
72
|
+
compilerOptions: {
|
|
73
|
+
...compilerOptions,
|
|
74
|
+
module: import_typescript.ModuleKind.ESNext
|
|
75
|
+
},
|
|
76
|
+
debug,
|
|
77
|
+
entryPoints,
|
|
78
|
+
outExtension: { ".js": ".mjs" },
|
|
79
|
+
tsconfig: tscArgs.pathname
|
|
80
|
+
});
|
|
81
|
+
await runBuild({
|
|
82
|
+
compilerOptions: {
|
|
83
|
+
...compilerOptions,
|
|
84
|
+
module: import_typescript.ModuleKind.NodeNext
|
|
85
|
+
},
|
|
86
|
+
debug,
|
|
87
|
+
entryPoints,
|
|
88
|
+
outExtension: { ".js": ".js" },
|
|
89
|
+
tsconfig: tscArgs.pathname
|
|
90
|
+
});
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
const end = process.hrtime.bigint();
|
|
94
|
+
log.plain(`Built in ${log.timing(start, end)}.`);
|
|
95
|
+
if (compilerOptions.declaration) {
|
|
96
|
+
await (0, import_tsc.tsc)([
|
|
97
|
+
"--declaration",
|
|
98
|
+
"--emitDeclarationOnly",
|
|
99
|
+
...tscArgs.project ? ["--project", tscArgs.project] : []
|
|
100
|
+
]);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
const ES_MODULE_KINDS = /* @__PURE__ */ new Set([
|
|
104
|
+
import_typescript.ModuleKind.ES2015,
|
|
105
|
+
import_typescript.ModuleKind.ES2020,
|
|
106
|
+
import_typescript.ModuleKind.ES2022,
|
|
107
|
+
import_typescript.ModuleKind.ESNext
|
|
108
|
+
]);
|
|
109
|
+
const NODE_MODULE_KINDS = /* @__PURE__ */ new Set([
|
|
110
|
+
import_typescript.ModuleKind.CommonJS,
|
|
111
|
+
import_typescript.ModuleKind.Node16,
|
|
112
|
+
import_typescript.ModuleKind.NodeNext
|
|
113
|
+
]);
|
|
114
|
+
const mapModule = (compilerOptions) => {
|
|
115
|
+
if (NODE_MODULE_KINDS.has(compilerOptions.module)) {
|
|
116
|
+
return { format: "cjs", platform: "node" };
|
|
117
|
+
}
|
|
118
|
+
if (ES_MODULE_KINDS.has(compilerOptions.module)) {
|
|
119
|
+
return { format: "esm", platform: "neutral" };
|
|
120
|
+
}
|
|
121
|
+
return { format: void 0, platform: void 0 };
|
|
122
|
+
};
|
|
123
|
+
const runBuild = async ({
|
|
124
|
+
compilerOptions,
|
|
125
|
+
debug,
|
|
126
|
+
entryPoints,
|
|
127
|
+
outExtension,
|
|
128
|
+
tsconfig
|
|
129
|
+
}) => {
|
|
61
130
|
const bundle = false;
|
|
131
|
+
const { format, platform } = mapModule(compilerOptions);
|
|
62
132
|
await (0, import_esbuild.build)({
|
|
63
133
|
bundle,
|
|
64
134
|
entryPoints,
|
|
65
|
-
format
|
|
135
|
+
format,
|
|
66
136
|
outdir: compilerOptions.outDir,
|
|
67
137
|
logLevel: debug ? "debug" : "info",
|
|
68
138
|
logLimit: 0,
|
|
69
|
-
|
|
139
|
+
outExtension,
|
|
140
|
+
platform,
|
|
70
141
|
plugins: bundle ? [] : [
|
|
71
142
|
// evanw/esbuild#394
|
|
72
143
|
(0, import_tsconfig_paths.default)({
|
|
@@ -79,17 +150,8 @@ const esbuild = async ({ debug }, args = process.argv.slice(2)) => {
|
|
|
79
150
|
// This would be unusual for a typical SEEK project but we can still explore
|
|
80
151
|
// an explicit setting once we implement `skuba.config.ts` (#1167).
|
|
81
152
|
target: compilerOptions.target ? import_typescript.ScriptTarget[compilerOptions.target].toLocaleLowerCase() : void 0,
|
|
82
|
-
tsconfig
|
|
153
|
+
tsconfig
|
|
83
154
|
});
|
|
84
|
-
const end = process.hrtime.bigint();
|
|
85
|
-
log.plain(`Built in ${log.timing(start, end)}.`);
|
|
86
|
-
if (compilerOptions.declaration) {
|
|
87
|
-
await (0, import_tsc.tsc)([
|
|
88
|
-
"--declaration",
|
|
89
|
-
"--emitDeclarationOnly",
|
|
90
|
-
...tscArgs.project ? ["--project", tscArgs.project] : []
|
|
91
|
-
]);
|
|
92
|
-
}
|
|
93
155
|
};
|
|
94
156
|
// Annotate the CommonJS export names for ESM import in node:
|
|
95
157
|
0 && (module.exports = {
|
|
@@ -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,
|
|
4
|
+
"sourcesContent": ["import { inspect } from 'util';\n\nimport tsconfigPaths from '@esbuild-plugins/tsconfig-paths';\nimport { type BuildOptions, build } from 'esbuild';\nimport { type CompilerOptions, ModuleKind, 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 mode: 'build' | 'build-package';\n}\n\nexport const esbuild = async (\n { debug, mode }: 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 switch (mode) {\n case 'build':\n await runBuild({\n compilerOptions,\n debug,\n entryPoints,\n tsconfig: tscArgs.pathname,\n });\n\n break;\n\n case 'build-package':\n await runBuild({\n compilerOptions: {\n ...compilerOptions,\n module: ModuleKind.ESNext,\n },\n debug,\n entryPoints,\n outExtension: { '.js': '.mjs' },\n tsconfig: tscArgs.pathname,\n });\n\n await runBuild({\n compilerOptions: {\n ...compilerOptions,\n module: ModuleKind.NodeNext,\n },\n debug,\n entryPoints,\n outExtension: { '.js': '.js' },\n tsconfig: tscArgs.pathname,\n });\n\n break;\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\nconst ES_MODULE_KINDS = new Set<ModuleKind | undefined>([\n ModuleKind.ES2015,\n ModuleKind.ES2020,\n ModuleKind.ES2022,\n ModuleKind.ESNext,\n]);\n\nconst NODE_MODULE_KINDS = new Set<ModuleKind | undefined>([\n ModuleKind.CommonJS,\n ModuleKind.Node16,\n ModuleKind.NodeNext,\n]);\n\nconst mapModule = (\n compilerOptions: CompilerOptions,\n): Pick<BuildOptions, 'format' | 'platform'> => {\n if (NODE_MODULE_KINDS.has(compilerOptions.module)) {\n return { format: 'cjs', platform: 'node' };\n }\n\n if (ES_MODULE_KINDS.has(compilerOptions.module)) {\n return { format: 'esm', platform: 'neutral' };\n }\n\n return { format: undefined, platform: undefined };\n};\n\ntype RunEsbuildOptions = {\n compilerOptions: Pick<\n CompilerOptions,\n 'baseUrl' | 'module' | 'outDir' | 'paths' | 'sourceMap' | 'target'\n >;\n debug: boolean;\n entryPoints: string[];\n outExtension?: BuildOptions['outExtension'];\n tsconfig: string;\n};\n\nconst runBuild = async ({\n compilerOptions,\n debug,\n entryPoints,\n outExtension,\n tsconfig,\n}: RunEsbuildOptions) => {\n // TODO: support `bundle`, `minify`, `splitting`, `treeShaking`\n const bundle = false;\n\n const { format, platform } = mapModule(compilerOptions);\n\n await build({\n bundle,\n entryPoints,\n format,\n outdir: compilerOptions.outDir,\n logLevel: debug ? 'debug' : 'info',\n logLimit: 0,\n outExtension,\n platform,\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,\n });\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAExB,4BAA0B;AAC1B,qBAAyC;AACzC,wBAA+D;AAE/D,qBAA6B;AAE7B,kBAA6B;AAC7B,iBAAkC;AAO3B,MAAM,UAAU,OACrB,EAAE,OAAO,KAAK,GACd,OAAO,QAAQ,KAAK,MAAM,CAAC,MACxB;AACH,QAAM,UAAM,6BAAa,KAAK;AAE9B,QAAM,cAAU,0BAAa,IAAI;AAEjC,MAAI,QAAQ,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HANGED
|
@@ -44,7 +44,7 @@ const build = async (args = process.argv.slice(2)) => {
|
|
|
44
44
|
case "esbuild": {
|
|
45
45
|
const debug = (0, import_args.hasDebugFlag)(args);
|
|
46
46
|
import_logging.log.plain(import_chalk.default.yellow("esbuild"));
|
|
47
|
-
await (0, import_esbuild.esbuild)({ debug }, args);
|
|
47
|
+
await (0, import_esbuild.esbuild)({ debug, mode: "build" }, args);
|
|
48
48
|
break;
|
|
49
49
|
}
|
|
50
50
|
case void 0:
|
|
@@ -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';\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 // 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;AAElD,oBAA2B;AAC3B,qBAAwB;AACxB,iBAAkC;AAE3B,MAAM,QAAQ,OAAO,OAAO,QAAQ,KAAK,MAAM,CAAC,MAAM;AAG3D,QAAM,OAAO,UAAM,mDAAkC,OAAO;AAE5D,UAAQ,MAAM;AAAA,IACZ,KAAK,WAAW;AACd,YAAM,YAAQ,0BAAa,IAAI;AAE/B,yBAAI,MAAM,aAAAA,QAAM,OAAO,SAAS,CAAC;AACjC,gBAAM,wBAAQ,EAAE,MAAM,GAAG,IAAI;
|
|
4
|
+
"sourcesContent": ["import chalk from 'chalk';\n\nimport { hasDebugFlag } from '../../utils/args';\nimport { log } from '../../utils/logging';\nimport { getStringPropFromConsumerManifest } from '../../utils/manifest';\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 // 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, mode: 'build' }, 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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+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,16 +17,69 @@ 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");
|
|
25
36
|
var import_exec = require("../utils/exec");
|
|
37
|
+
var import_logging = require("../utils/logging");
|
|
38
|
+
var import_manifest = require("../utils/manifest");
|
|
26
39
|
var import_assets = require("./build/assets");
|
|
40
|
+
var import_esbuild = require("./build/esbuild");
|
|
41
|
+
var import_tsc = require("./build/tsc");
|
|
27
42
|
const buildPackage = async (args = process.argv.slice(2)) => {
|
|
43
|
+
const debug = (0, import_args.hasDebugFlag)(args);
|
|
44
|
+
const log = (0, import_logging.createLogger)(debug);
|
|
45
|
+
const tool = await (0, import_manifest.getStringPropFromConsumerManifest)("build");
|
|
46
|
+
switch (tool) {
|
|
47
|
+
case "esbuild": {
|
|
48
|
+
log.plain(import_chalk.default.yellow("esbuild"));
|
|
49
|
+
await runEsbuild(debug, log, args);
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
case void 0:
|
|
53
|
+
case "tsc": {
|
|
54
|
+
log.plain(import_chalk.default.blue("tsc"));
|
|
55
|
+
await tsc(args);
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
default: {
|
|
59
|
+
log.err(
|
|
60
|
+
"We don\u2019t support the build tool specified in your",
|
|
61
|
+
log.bold("package.json"),
|
|
62
|
+
"yet:"
|
|
63
|
+
);
|
|
64
|
+
log.err(log.subtle(JSON.stringify({ skuba: { build: tool } }, null, 2)));
|
|
65
|
+
process.exitCode = 1;
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const runEsbuild = async (debug, log, args) => {
|
|
71
|
+
await (0, import_esbuild.esbuild)({ debug, mode: "build-package" }, args);
|
|
72
|
+
const parsedCommandLine = (0, import_tsc.readTsconfig)(args, log);
|
|
73
|
+
if (!parsedCommandLine || process.exitCode) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const { options: compilerOptions } = parsedCommandLine;
|
|
77
|
+
if (!compilerOptions.outDir) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
await (0, import_assets.copyAssets)(compilerOptions.outDir);
|
|
81
|
+
};
|
|
82
|
+
const tsc = async (args) => {
|
|
28
83
|
await (0, import_exec.execConcurrently)(
|
|
29
84
|
[
|
|
30
85
|
{
|
|
@@ -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 { copyAssetsConcurrently } from './build/assets';\n\nexport const buildPackage = async (args = process.argv.slice(2)) => {\n await execConcurrently(\n [\n {\n command:\n 'tsc --module CommonJS --outDir lib-commonjs --project tsconfig.build.json',\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 copyAssetsConcurrently([\n {\n outDir: 'lib-commonjs',\n name: 'commonjs',\n prefixColor: 'green',\n },\n {\n outDir: 'lib-es2015',\n name: 'es2015',\n prefixColor: 'yellow',\n },\n ]);\n};\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import chalk from 'chalk';\n\nimport { hasDebugFlag, hasSerialFlag } from '../utils/args';\nimport { execConcurrently } from '../utils/exec';\nimport { type Logger, createLogger } from '../utils/logging';\nimport { getStringPropFromConsumerManifest } from '../utils/manifest';\n\nimport { copyAssets, copyAssetsConcurrently } from './build/assets';\nimport { esbuild } from './build/esbuild';\nimport { readTsconfig } from './build/tsc';\n\nexport const buildPackage = async (args = process.argv.slice(2)) => {\n const debug = hasDebugFlag(args);\n\n const log = createLogger(debug);\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 log.plain(chalk.yellow('esbuild'));\n await runEsbuild(debug, log, 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\nconst runEsbuild = async (debug: boolean, log: Logger, args: string[]) => {\n await esbuild({ debug, mode: 'build-package' }, args);\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\nconst tsc = async (args: string[]) => {\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 copyAssetsConcurrently([\n {\n outDir: 'lib-commonjs',\n name: 'commonjs',\n prefixColor: 'green',\n },\n {\n outDir: 'lib-es2015',\n name: 'es2015',\n prefixColor: 'yellow',\n },\n ]);\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,kBAA4C;AAC5C,kBAAiC;AACjC,qBAA0C;AAC1C,sBAAkD;AAElD,oBAAmD;AACnD,qBAAwB;AACxB,iBAA6B;AAEtB,MAAM,eAAe,OAAO,OAAO,QAAQ,KAAK,MAAM,CAAC,MAAM;AAClE,QAAM,YAAQ,0BAAa,IAAI;AAE/B,QAAM,UAAM,6BA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AI,IAAI;AAAA,IAC1C;AAAA,EACF;AAEA,YAAM,sCAAuB;AAAA,IAC3B;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,aAAa;AAAA,IACf;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,aAAa;AAAA,IACf;AAAA,EACF,CAAC;AACH;",
|
|
6
|
+
"names": ["chalk"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skuba",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.1-cjs-mjs-output-20240326121905",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "SEEK development toolkit for backend applications and packages",
|
|
6
6
|
"homepage": "https://github.com/seek-oss/skuba#readme",
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
"@types/supertest": "6.0.2",
|
|
120
120
|
"@types/validate-npm-package-name": "4.0.2",
|
|
121
121
|
"enhanced-resolve": "5.15.0",
|
|
122
|
-
"express": "4.
|
|
122
|
+
"express": "4.19.2",
|
|
123
123
|
"fastify": "4.26.1",
|
|
124
124
|
"jest-diff": "29.7.0",
|
|
125
125
|
"jsonfile": "6.1.0",
|