skuba 14.0.0-esmify-skuba-20251031141102 → 14.0.0-esmify-skuba-20251105032119
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cli/adapter/eslint.js +4 -2
- package/lib/cli/adapter/eslint.js.map +1 -1
- package/lib/cli/adapter/prettier.js +8 -4
- package/lib/cli/adapter/prettier.js.map +1 -1
- package/lib/cli/build/args.js +4 -2
- package/lib/cli/build/args.js.map +1 -1
- package/lib/cli/build/assets.js +6 -3
- package/lib/cli/build/assets.js.map +1 -1
- package/lib/cli/build/esbuild.js +5 -3
- package/lib/cli/build/esbuild.js.map +2 -2
- package/lib/cli/build/index.js +4 -2
- package/lib/cli/build/index.js.map +1 -1
- package/lib/cli/build/tsc.js +10 -5
- package/lib/cli/build/tsc.js.map +1 -1
- package/lib/cli/buildPackage/index.js +4 -2
- package/lib/cli/buildPackage/index.js.map +1 -1
- package/lib/cli/configure/analyseConfiguration.js +4 -2
- package/lib/cli/configure/analyseConfiguration.js.map +1 -1
- package/lib/cli/configure/analyseDependencies.js +4 -2
- package/lib/cli/configure/analyseDependencies.js.map +1 -1
- package/lib/cli/configure/analysis/diff.js +4 -2
- package/lib/cli/configure/analysis/diff.js.map +1 -1
- package/lib/cli/configure/analysis/files.js +4 -2
- package/lib/cli/configure/analysis/files.js.map +1 -1
- package/lib/cli/configure/analysis/git.js +4 -2
- package/lib/cli/configure/analysis/git.js.map +1 -1
- package/lib/cli/configure/analysis/package.js +6 -3
- package/lib/cli/configure/analysis/package.js.map +1 -1
- package/lib/cli/configure/analysis/project.js +6 -3
- package/lib/cli/configure/analysis/project.js.map +1 -1
- package/lib/cli/configure/dependencies/index.js +12 -6
- package/lib/cli/configure/dependencies/index.js.map +1 -1
- package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js +4 -2
- package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js.map +1 -1
- package/lib/cli/configure/dependencies/seekKoala.js +4 -2
- package/lib/cli/configure/dependencies/seekKoala.js.map +1 -1
- package/lib/cli/configure/dependencies/skuba.js +4 -2
- package/lib/cli/configure/dependencies/skuba.js.map +1 -1
- package/lib/cli/configure/dependencies/skubaDeps.js +4 -2
- package/lib/cli/configure/dependencies/skubaDeps.js.map +1 -1
- package/lib/cli/configure/dependencies/skubaDive.js +6 -3
- package/lib/cli/configure/dependencies/skubaDive.js.map +1 -1
- package/lib/cli/configure/ensureTemplateCompletion.js +4 -2
- package/lib/cli/configure/ensureTemplateCompletion.js.map +1 -1
- package/lib/cli/configure/getEntryPoint.js +4 -2
- package/lib/cli/configure/getEntryPoint.js.map +1 -1
- package/lib/cli/configure/getProjectType.js +4 -2
- package/lib/cli/configure/getProjectType.js.map +1 -1
- package/lib/cli/configure/index.js +4 -2
- package/lib/cli/configure/index.js.map +1 -1
- package/lib/cli/configure/modules/eslint.js +4 -2
- package/lib/cli/configure/modules/eslint.js.map +1 -1
- package/lib/cli/configure/modules/ignore.js +4 -2
- package/lib/cli/configure/modules/ignore.js.map +1 -1
- package/lib/cli/configure/modules/index.js +4 -2
- package/lib/cli/configure/modules/index.js.map +1 -1
- package/lib/cli/configure/modules/nodemon.js +4 -2
- package/lib/cli/configure/modules/nodemon.js.map +1 -1
- package/lib/cli/configure/modules/package.js +4 -2
- package/lib/cli/configure/modules/package.js.map +1 -1
- package/lib/cli/configure/modules/prettier.js +4 -2
- package/lib/cli/configure/modules/prettier.js.map +1 -1
- package/lib/cli/configure/modules/renovate.js +6 -3
- package/lib/cli/configure/modules/renovate.js.map +1 -1
- package/lib/cli/configure/modules/serverless.js +4 -2
- package/lib/cli/configure/modules/serverless.js.map +1 -1
- package/lib/cli/configure/modules/tslint.js +4 -2
- package/lib/cli/configure/modules/tslint.js.map +1 -1
- package/lib/cli/configure/processing/configFile.js +8 -4
- package/lib/cli/configure/processing/configFile.js.map +1 -1
- package/lib/cli/configure/processing/deleteFiles.js +4 -2
- package/lib/cli/configure/processing/deleteFiles.js.map +1 -1
- package/lib/cli/configure/processing/javascript.js +6 -3
- package/lib/cli/configure/processing/javascript.js.map +1 -1
- package/lib/cli/configure/processing/json.js +6 -3
- package/lib/cli/configure/processing/json.js.map +1 -1
- package/lib/cli/configure/processing/loadFiles.js +4 -2
- package/lib/cli/configure/processing/loadFiles.js.map +1 -1
- package/lib/cli/configure/processing/module.js +4 -2
- package/lib/cli/configure/processing/module.js.map +1 -1
- package/lib/cli/configure/processing/package.js +10 -5
- package/lib/cli/configure/processing/package.js.map +1 -1
- package/lib/cli/configure/processing/prettier.js +4 -2
- package/lib/cli/configure/processing/prettier.js.map +1 -1
- package/lib/cli/configure/processing/record.js +8 -4
- package/lib/cli/configure/processing/record.js.map +1 -1
- package/lib/cli/configure/processing/typescript.js +10 -5
- package/lib/cli/configure/processing/typescript.js.map +1 -1
- package/lib/cli/configure/types.js +0 -1
- package/lib/cli/format/index.js +4 -2
- package/lib/cli/format/index.js.map +1 -1
- package/lib/cli/help/index.js +4 -2
- package/lib/cli/help/index.js.map +1 -1
- package/lib/cli/init/getConfig.js +12 -6
- package/lib/cli/init/getConfig.js.map +1 -1
- package/lib/cli/init/git.js +6 -3
- package/lib/cli/init/git.js.map +1 -1
- package/lib/cli/init/index.js +4 -2
- package/lib/cli/init/index.js.map +1 -1
- package/lib/cli/init/prompts.js +10 -5
- package/lib/cli/init/prompts.js.map +1 -1
- package/lib/cli/init/types.js +4 -2
- package/lib/cli/init/types.js.map +1 -1
- package/lib/cli/init/validation.js +12 -6
- package/lib/cli/init/validation.js.map +1 -1
- package/lib/cli/init/writePackageJson.js +4 -2
- package/lib/cli/init/writePackageJson.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/eslint.js +4 -2
- package/lib/cli/lint/annotate/buildkite/eslint.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/index.js +4 -2
- package/lib/cli/lint/annotate/buildkite/index.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/internal.js +4 -2
- package/lib/cli/lint/annotate/buildkite/internal.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/prettier.js +4 -2
- package/lib/cli/lint/annotate/buildkite/prettier.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/tsc.js +4 -2
- package/lib/cli/lint/annotate/buildkite/tsc.js.map +1 -1
- package/lib/cli/lint/annotate/github/eslint.js +4 -2
- package/lib/cli/lint/annotate/github/eslint.js.map +1 -1
- package/lib/cli/lint/annotate/github/index.js +4 -2
- package/lib/cli/lint/annotate/github/index.js.map +1 -1
- package/lib/cli/lint/annotate/github/internal.js +4 -2
- package/lib/cli/lint/annotate/github/internal.js.map +1 -1
- package/lib/cli/lint/annotate/github/prettier.js +4 -2
- package/lib/cli/lint/annotate/github/prettier.js.map +1 -1
- package/lib/cli/lint/annotate/github/tsc.js +4 -2
- package/lib/cli/lint/annotate/github/tsc.js.map +1 -1
- package/lib/cli/lint/annotate/index.js +4 -2
- package/lib/cli/lint/annotate/index.js.map +1 -1
- package/lib/cli/lint/autofix.js +8 -4
- package/lib/cli/lint/autofix.js.map +1 -1
- package/lib/cli/lint/eslint.js +6 -3
- package/lib/cli/lint/eslint.js.map +1 -1
- package/lib/cli/lint/external.js +6 -3
- package/lib/cli/lint/external.js.map +1 -1
- package/lib/cli/lint/index.js +4 -2
- package/lib/cli/lint/index.js.map +1 -1
- package/lib/cli/lint/internal.js +4 -2
- package/lib/cli/lint/internal.js.map +1 -1
- package/lib/cli/lint/internalLints/detectBadCodeowners.js +6 -3
- package/lib/cli/lint/internalLints/detectBadCodeowners.js.map +1 -1
- package/lib/cli/lint/internalLints/noSkubaTemplateJs.js +4 -2
- package/lib/cli/lint/internalLints/noSkubaTemplateJs.js.map +1 -1
- package/lib/cli/lint/internalLints/patchRenovateConfig.js +4 -2
- package/lib/cli/lint/internalLints/patchRenovateConfig.js.map +1 -1
- package/lib/cli/lint/internalLints/refreshConfigFiles.js +8 -4
- package/lib/cli/lint/internalLints/refreshConfigFiles.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/index.js +4 -2
- package/lib/cli/lint/internalLints/upgrade/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/index.js +4 -2
- package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/removeYarnIgnoreOptionalFlags.js +4 -2
- package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/removeYarnIgnoreOptionalFlags.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/index.js +4 -2
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js +4 -2
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.js +6 -3
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/index.js +4 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js +8 -4
- package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/index.js +4 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.js +6 -3
- package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.js +4 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js +6 -3
- package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js +6 -3
- package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.js +4 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js +6 -3
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.js +12 -6
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/index.js +4 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.js +4 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.js +28 -14
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.js +6 -3
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.js +4 -2
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/index.js +4 -2
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.js +4 -2
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.js +4 -2
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/index.js +4 -2
- package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.js +4 -2
- package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.js +4 -2
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js +4 -2
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.js +4 -2
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.js +4 -2
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.js +4 -2
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/index.js +4 -2
- package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.js +4 -2
- package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js +4 -2
- package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js +4 -2
- package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js.map +1 -1
- package/lib/cli/lint/prettier.js +6 -3
- package/lib/cli/lint/prettier.js.map +1 -1
- package/lib/cli/lint/tsc.js +4 -2
- package/lib/cli/lint/tsc.js.map +1 -1
- package/lib/cli/lint/types.js +0 -1
- package/lib/cli/migrate/index.js +4 -2
- package/lib/cli/migrate/index.js.map +1 -1
- package/lib/cli/migrate/nodeVersion/checks.js +10 -5
- package/lib/cli/migrate/nodeVersion/checks.js.map +1 -1
- package/lib/cli/migrate/nodeVersion/index.js +4 -2
- package/lib/cli/migrate/nodeVersion/index.js.map +1 -1
- package/lib/cli/node/index.js +6 -3
- package/lib/cli/node/index.js.map +1 -1
- package/lib/cli/release/index.js +4 -2
- package/lib/cli/release/index.js.map +1 -1
- package/lib/cli/start/index.js +4 -2
- package/lib/cli/start/index.js.map +1 -1
- package/lib/cli/test/index.js +4 -2
- package/lib/cli/test/index.js.map +1 -1
- package/lib/cli/version/index.js +4 -2
- package/lib/cli/version/index.js.map +1 -1
- package/lib/enquirer.d.js +0 -1
- package/lib/eslint.d.js +0 -1
- package/lib/index.js +10 -5
- package/lib/index.js.map +1 -1
- package/lib/skuba.js +0 -1
- package/lib/skuba.js.map +1 -1
- package/lib/utils/args.js +10 -5
- package/lib/utils/args.js.map +1 -1
- package/lib/utils/command.js +12 -6
- package/lib/utils/command.js.map +1 -1
- package/lib/utils/copy.js +10 -5
- package/lib/utils/copy.js.map +1 -1
- package/lib/utils/dir.js +16 -8
- package/lib/utils/dir.js.map +1 -1
- package/lib/utils/env.js +4 -2
- package/lib/utils/env.js.map +1 -1
- package/lib/utils/error.js +10 -5
- package/lib/utils/error.js.map +1 -1
- package/lib/utils/exec.js +12 -6
- package/lib/utils/exec.js.map +1 -1
- package/lib/utils/fs.js +4 -2
- package/lib/utils/fs.js.map +1 -1
- package/lib/utils/help.js +4 -2
- package/lib/utils/help.js.map +1 -1
- package/lib/utils/logging.js +10 -5
- package/lib/utils/logging.js.map +1 -1
- package/lib/utils/logo.js +4 -2
- package/lib/utils/logo.js.map +1 -1
- package/lib/utils/manifest.js +16 -8
- package/lib/utils/manifest.js.map +1 -1
- package/lib/utils/npmrc.js +4 -2
- package/lib/utils/npmrc.js.map +1 -1
- package/lib/utils/packageManager.js +10 -5
- package/lib/utils/packageManager.js.map +1 -1
- package/lib/utils/port.js +6 -3
- package/lib/utils/port.js.map +1 -1
- package/lib/utils/sleep.js +4 -2
- package/lib/utils/sleep.js.map +1 -1
- package/lib/utils/template.js +20 -10
- package/lib/utils/template.js.map +1 -1
- package/lib/utils/validation.js +14 -7
- package/lib/utils/validation.js.map +1 -1
- package/lib/utils/version.js +10 -5
- package/lib/utils/version.js.map +1 -1
- package/lib/utils/wait.js +6 -3
- package/lib/utils/wait.js.map +1 -1
- package/lib/utils/worker.js +6 -3
- package/lib/utils/worker.js.map +1 -1
- package/lib/wrapper/function-arguments.d.js +0 -1
- package/lib/wrapper/functionHandler.js +4 -2
- package/lib/wrapper/functionHandler.js.map +1 -1
- package/lib/wrapper/http.js +6 -3
- package/lib/wrapper/http.js.map +1 -1
- package/lib/wrapper/index.js +0 -1
- package/lib/wrapper/index.js.map +1 -1
- package/lib/wrapper/main.js +4 -2
- package/lib/wrapper/main.js.map +1 -1
- package/lib/wrapper/requestListener.js +4 -2
- package/lib/wrapper/requestListener.js.map +1 -1
- package/lib/wrapper/server.js +4 -2
- package/lib/wrapper/server.js.map +1 -1
- package/package.json +4 -4
- package/template/greeter/package.json +2 -2
- package/template/lambda-sqs-worker-cdk/package.json +2 -2
package/lib/cli/node/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
import path from "path";
|
|
3
2
|
import execa from "execa";
|
|
4
3
|
import getPort from "get-port";
|
|
@@ -6,8 +5,8 @@ import { parseRunArgs } from "../../utils/args.js";
|
|
|
6
5
|
import { createExec } from "../../utils/exec.js";
|
|
7
6
|
import { isIpPort } from "../../utils/validation.js";
|
|
8
7
|
import { getCustomConditions } from "../build/tsc.js";
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const longRunning = true;
|
|
9
|
+
const node = async () => {
|
|
11
10
|
const args = parseRunArgs(process.argv.slice(2));
|
|
12
11
|
const customConditions = getCustomConditions();
|
|
13
12
|
const uniqueConditions = [
|
|
@@ -48,4 +47,8 @@ export const node = async () => {
|
|
|
48
47
|
}
|
|
49
48
|
);
|
|
50
49
|
};
|
|
50
|
+
export {
|
|
51
|
+
longRunning,
|
|
52
|
+
node
|
|
53
|
+
};
|
|
51
54
|
//# sourceMappingURL=index.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/node/index.ts"],
|
|
4
4
|
"sourcesContent": ["import path from 'path';\n\nimport execa from 'execa';\nimport getPort from 'get-port';\n\nimport { parseRunArgs } from '../../utils/args.js';\nimport { createExec } from '../../utils/exec.js';\nimport { isIpPort } from '../../utils/validation.js';\nimport { getCustomConditions } from '../build/tsc.js';\n\nexport const longRunning = true;\n\nexport const node = async () => {\n const args = parseRunArgs(process.argv.slice(2));\n const customConditions = getCustomConditions();\n\n const uniqueConditions = [\n ...new Set([...(args.conditions ?? []), ...customConditions]),\n ];\n\n const availablePort = await getPort();\n\n const commonArgs = [\n ...args.node,\n ...uniqueConditions.map((condition) => `--conditions=${condition}`),\n '--env-file-if-exists',\n '.env',\n ];\n\n if (args.entryPoint) {\n const exec = createExec({\n env: {\n __SKUBA_ENTRY_POINT: args.entryPoint,\n __SKUBA_PORT: String(isIpPort(args.port) ? args.port : availablePort),\n },\n });\n\n return exec(\n 'tsx',\n ...commonArgs,\n path.join(import.meta.dirname, '..', '..', 'wrapper', 'index.js'),\n ...args.script,\n );\n }\n\n return execa(\n new URL(import.meta.resolve('tsx/cli')).pathname,\n [\n ...commonArgs,\n '--import',\n // Unsure if bug or feature that this is needed, but tsx appears to not do anything typescript in the REPL without this!\n // Doesn't occur when just running the tsx binary directly \uD83E\uDDD0\n new URL(import.meta.resolve('tsx/patch-repl')).pathname,\n ],\n {\n stdio: 'inherit',\n },\n );\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,OAAO,UAAU;AAEjB,OAAO,WAAW;AAClB,OAAO,aAAa;AAEpB,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAC3B,SAAS,gBAAgB;AACzB,SAAS,2BAA2B;AAE7B,MAAM,cAAc;AAEpB,MAAM,OAAO,YAAY;AAC9B,QAAM,OAAO,aAAa,QAAQ,KAAK,MAAM,CAAC,CAAC;AAC/C,QAAM,mBAAmB,oBAAoB;AAE7C,QAAM,mBAAmB;AAAA,IACvB,GAAG,oBAAI,IAAI,CAAC,GAAI,KAAK,cAAc,CAAC,GAAI,GAAG,gBAAgB,CAAC;AAAA,EAC9D;AAEA,QAAM,gBAAgB,MAAM,QAAQ;AAEpC,QAAM,aAAa;AAAA,IACjB,GAAG,KAAK;AAAA,IACR,GAAG,iBAAiB,IAAI,CAAC,cAAc,gBAAgB,SAAS,EAAE;AAAA,IAClE;AAAA,IACA;AAAA,EACF;AAEA,MAAI,KAAK,YAAY;AACnB,UAAM,OAAO,WAAW;AAAA,MACtB,KAAK;AAAA,QACH,qBAAqB,KAAK;AAAA,QAC1B,cAAc,OAAO,SAAS,KAAK,IAAI,IAAI,KAAK,OAAO,aAAa;AAAA,MACtE;AAAA,IACF,CAAC;AAED,WAAO;AAAA,MACL;AAAA,MACA,GAAG;AAAA,MACH,KAAK,KAAK,YAAY,SAAS,MAAM,MAAM,WAAW,UAAU;AAAA,MAChE,GAAG,KAAK;AAAA,IACV;AAAA,EACF;AAEA,SAAO;AAAA,IACL,IAAI,IAAI,YAAY,QAAQ,SAAS,CAAC,EAAE;AAAA,IACxC;AAAA,MACE,GAAG;AAAA,MACH;AAAA;AAAA;AAAA,MAGA,IAAI,IAAI,YAAY,QAAQ,gBAAgB,CAAC,EAAE;AAAA,IACjD;AAAA,IACA;AAAA,MACE,OAAO;AAAA,IACT;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/cli/release/index.js
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/release/index.ts"],
|
|
4
4
|
"sourcesContent": ["import { exec } from '../../utils/exec.js';\n\nexport const release = async () => {\n await exec('semantic-release', '--success', 'false');\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,SAAS,YAAY;AAEd,MAAM,UAAU,YAAY;AACjC,QAAM,KAAK,oBAAoB,aAAa,OAAO;AACrD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/cli/start/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
import path from "path";
|
|
3
2
|
import getPort from "get-port";
|
|
4
3
|
import { parseRunArgs } from "../../utils/args.js";
|
|
@@ -6,7 +5,7 @@ import { createExec } from "../../utils/exec.js";
|
|
|
6
5
|
import { getEntryPointFromManifest } from "../../utils/manifest.js";
|
|
7
6
|
import { isIpPort } from "../../utils/validation.js";
|
|
8
7
|
import { getCustomConditions } from "../build/tsc.js";
|
|
9
|
-
|
|
8
|
+
const start = async () => {
|
|
10
9
|
const customConditions = getCustomConditions();
|
|
11
10
|
const args = parseRunArgs(process.argv.slice(2));
|
|
12
11
|
const availablePort = await getPort();
|
|
@@ -34,4 +33,7 @@ export const start = async () => {
|
|
|
34
33
|
...args.script
|
|
35
34
|
);
|
|
36
35
|
};
|
|
36
|
+
export {
|
|
37
|
+
start
|
|
38
|
+
};
|
|
37
39
|
//# sourceMappingURL=index.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/start/index.ts"],
|
|
4
4
|
"sourcesContent": ["import path from 'path';\n\nimport getPort from 'get-port';\n\nimport { parseRunArgs } from '../../utils/args.js';\nimport { createExec } from '../../utils/exec.js';\nimport { getEntryPointFromManifest } from '../../utils/manifest.js';\nimport { isIpPort } from '../../utils/validation.js';\nimport { getCustomConditions } from '../build/tsc.js';\n\nexport const start = async () => {\n const customConditions = getCustomConditions();\n const args = parseRunArgs(process.argv.slice(2));\n const availablePort = await getPort();\n\n const uniqueConditions = [\n ...new Set([...(args.conditions ?? []), ...customConditions]),\n ];\n\n args.entryPoint ??= await getEntryPointFromManifest();\n\n const execProcess = createExec({\n env: {\n __SKUBA_ENTRY_POINT: args.entryPoint,\n __SKUBA_PORT: String(isIpPort(args.port) ? args.port : availablePort),\n },\n });\n\n return execProcess(\n 'tsx',\n 'watch',\n '--clear-screen=false',\n ...args.node,\n ...uniqueConditions.map((condition) => `--conditions=${condition}`),\n '--env-file-if-exists',\n '.env',\n '--require',\n 'tsconfig-paths/register',\n path.join(import.meta.dirname, '..', '..', 'wrapper', 'index.js'),\n ...args.script,\n );\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,OAAO,UAAU;AAEjB,OAAO,aAAa;AAEpB,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAC3B,SAAS,iCAAiC;AAC1C,SAAS,gBAAgB;AACzB,SAAS,2BAA2B;AAE7B,MAAM,QAAQ,YAAY;AAC/B,QAAM,mBAAmB,oBAAoB;AAC7C,QAAM,OAAO,aAAa,QAAQ,KAAK,MAAM,CAAC,CAAC;AAC/C,QAAM,gBAAgB,MAAM,QAAQ;AAEpC,QAAM,mBAAmB;AAAA,IACvB,GAAG,oBAAI,IAAI,CAAC,GAAI,KAAK,cAAc,CAAC,GAAI,GAAG,gBAAgB,CAAC;AAAA,EAC9D;AAEA,OAAK,eAAe,MAAM,0BAA0B;AAEpD,QAAM,cAAc,WAAW;AAAA,IAC7B,KAAK;AAAA,MACH,qBAAqB,KAAK;AAAA,MAC1B,cAAc,OAAO,SAAS,KAAK,IAAI,IAAI,KAAK,OAAO,aAAa;AAAA,IACtE;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG,KAAK;AAAA,IACR,GAAG,iBAAiB,IAAI,CAAC,cAAc,gBAAgB,SAAS,EAAE;AAAA,IAClE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,KAAK,KAAK,YAAY,SAAS,MAAM,MAAM,WAAW,UAAU;AAAA,IAChE,GAAG,KAAK;AAAA,EACV;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/cli/test/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
import { exec } from "../../utils/exec.js";
|
|
3
|
-
|
|
2
|
+
const test = async () => {
|
|
4
3
|
const argv = process.argv.slice(2);
|
|
5
4
|
return exec("vitest", ...argv);
|
|
6
5
|
};
|
|
6
|
+
export {
|
|
7
|
+
test
|
|
8
|
+
};
|
|
7
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/test/index.ts"],
|
|
4
4
|
"sourcesContent": ["import { exec } from '../../utils/exec.js';\n\nexport const test = async () => {\n const argv = process.argv.slice(2);\n\n return exec('vitest', ...argv);\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,SAAS,YAAY;AAEd,MAAM,OAAO,YAAY;AAC9B,QAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;AAEjC,SAAO,KAAK,UAAU,GAAG,IAAI;AAC/B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/cli/version/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
import { log } from "../../utils/logging.js";
|
|
3
2
|
import { getSkubaVersion } from "../../utils/version.js";
|
|
4
|
-
|
|
3
|
+
const version = async () => {
|
|
5
4
|
const skubaVersion = await getSkubaVersion();
|
|
6
5
|
log.plain(skubaVersion);
|
|
7
6
|
};
|
|
7
|
+
export {
|
|
8
|
+
version
|
|
9
|
+
};
|
|
8
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/version/index.ts"],
|
|
4
4
|
"sourcesContent": ["import { log } from '../../utils/logging.js';\nimport { getSkubaVersion } from '../../utils/version.js';\n\nexport const version = async () => {\n const skubaVersion = await getSkubaVersion();\n\n log.plain(skubaVersion);\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,SAAS,WAAW;AACpB,SAAS,uBAAuB;AAEzB,MAAM,UAAU,YAAY;AACjC,QAAM,eAAe,MAAM,gBAAgB;AAE3C,MAAI,MAAM,YAAY;AACxB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/enquirer.d.js
CHANGED
package/lib/eslint.d.js
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export
|
|
1
|
+
import * as Buildkite from "@skuba-lib/api/buildkite";
|
|
2
|
+
import * as Git from "@skuba-lib/api/git";
|
|
3
|
+
import * as GitHub from "@skuba-lib/api/github";
|
|
4
|
+
import * as Net from "@skuba-lib/api/net";
|
|
5
|
+
export {
|
|
6
|
+
Buildkite,
|
|
7
|
+
Git,
|
|
8
|
+
GitHub,
|
|
9
|
+
Net
|
|
10
|
+
};
|
|
6
11
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * Entry point for the Node.js development API.\n *\n * This is where skuba imports point to:\n *\n * ```typescript\n * import { Net } from 'skuba';\n *\n * const { Net } = require('skuba');\n * ```\n */\n\nexport * as Buildkite from '@skuba-lib/api/buildkite';\nexport * as Git from '@skuba-lib/api/git';\nexport * as GitHub from '@skuba-lib/api/github';\nexport * as Net from '@skuba-lib/api/net';\n\n// evanw/esbuild#2388\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace WebAssembly {\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n interface Module {}\n }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAYA,YAAY,eAAe;AAC3B,YAAY,SAAS;AACrB,YAAY,YAAY;AACxB,YAAY,SAAS;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/skuba.js
CHANGED
package/lib/skuba.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/skuba.ts"],
|
|
4
4
|
"sourcesContent": ["#!/usr/bin/env node\n\n/**\n * Entry point for the CLI.\n *\n * This is where you end up when you run:\n *\n * ```bash\n * [pnpm|yarn] skuba help\n * ```\n */\n\nimport path from 'path';\n\nimport { parseProcessArgs } from './utils/args.js';\nimport {\n COMMAND_DIR,\n COMMAND_SET,\n type Command,\n commandToModule,\n} from './utils/command.js';\nimport { isCiEnv } from './utils/env.js';\nimport { handleCliError } from './utils/error.js';\nimport { showHelp } from './utils/help.js';\nimport { log } from './utils/logging.js';\nimport { showLogoAndVersionInfo } from './utils/logo.js';\nimport { isObject } from './utils/validation.js';\n\nconst THIRTY_MINUTES = 30 * 60 * 1000;\n\nconst skuba = async () => {\n const { commandName } = parseProcessArgs(process.argv);\n\n if (COMMAND_SET.has(commandName)) {\n const moduleName = commandToModule(commandName as Command);\n\n const commandModule = (await import(\n path.join(COMMAND_DIR, moduleName, 'index.js')\n )) as unknown;\n\n if (!isObject(commandModule) || !(moduleName in commandModule)) {\n log.err(log.bold(commandName), \"couldn't run! Please submit an issue.\");\n process.exitCode = 1;\n return;\n }\n\n const run = commandModule[moduleName] as () => Promise<unknown>;\n\n if (commandModule.longRunning) {\n // This is a long-running command, so we don't want to impose a timeout.\n return run();\n }\n\n // If we're not in a CI environment, we don't need to worry about timeouts, which are primarily to prevent\n // builds running \"forever\" in CI without our knowledge.\n // Local commands may run for a long time, e.g. `skuba start` or `skuba test --watch`, which are unlikely to be used in CI.\n if (!isCiEnv() || process.env.SKUBA_NO_TIMEOUT === 'true') {\n return run();\n }\n\n const timeoutId = setTimeout(\n () => {\n log.err(\n log.bold(commandName),\n 'timed out. This may indicate a process hanging - please file an issue.',\n );\n\n // Need to force exit because promises may be hanging so node won't exit on its own.\n process.exit(1);\n },\n process.env.SKUBA_TIMEOUT_MS\n ? parseInt(process.env.SKUBA_TIMEOUT_MS, 10)\n : THIRTY_MINUTES,\n );\n\n return run().finally(() => clearTimeout(timeoutId));\n }\n\n log.err(log.bold(commandName), 'is not recognised as a command.');\n await showLogoAndVersionInfo();\n showHelp();\n\n process.exitCode = 1;\n return;\n};\n\nskuba().catch(handleCliError);\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAYA,OAAO,UAAU;AAEjB,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,EACA;AAAA,EAEA;AAAA,OACK;AACP,SAAS,eAAe;AACxB,SAAS,sBAAsB;AAC/B,SAAS,gBAAgB;AACzB,SAAS,WAAW;AACpB,SAAS,8BAA8B;AACvC,SAAS,gBAAgB;AAEzB,MAAM,iBAAiB,KAAK,KAAK;AAEjC,MAAM,QAAQ,YAAY;AACxB,QAAM,EAAE,YAAY,IAAI,iBAAiB,QAAQ,IAAI;AAErD,MAAI,YAAY,IAAI,WAAW,GAAG;AAChC,UAAM,aAAa,gBAAgB,WAAsB;AAEzD,UAAM,gBAAiB,MAAM,OAC3B,KAAK,KAAK,aAAa,YAAY,UAAU;AAG/C,QAAI,CAAC,SAAS,aAAa,KAAK,EAAE,cAAc,gBAAgB;AAC9D,UAAI,IAAI,IAAI,KAAK,WAAW,GAAG,uCAAuC;AACtE,cAAQ,WAAW;AACnB;AAAA,IACF;AAEA,UAAM,MAAM,cAAc,UAAU;AAEpC,QAAI,cAAc,aAAa;AAE7B,aAAO,IAAI;AAAA,IACb;AAKA,QAAI,CAAC,QAAQ,KAAK,QAAQ,IAAI,qBAAqB,QAAQ;AACzD,aAAO,IAAI;AAAA,IACb;AAEA,UAAM,YAAY;AAAA,MAChB,MAAM;AACJ,YAAI;AAAA,UACF,IAAI,KAAK,WAAW;AAAA,UACpB;AAAA,QACF;AAGA,gBAAQ,KAAK,CAAC;AAAA,MAChB;AAAA,MACA,QAAQ,IAAI,mBACR,SAAS,QAAQ,IAAI,kBAAkB,EAAE,IACzC;AAAA,IACN;AAEA,WAAO,IAAI,EAAE,QAAQ,MAAM,aAAa,SAAS,CAAC;AAAA,EACpD;AAEA,MAAI,IAAI,IAAI,KAAK,WAAW,GAAG,iCAAiC;AAChE,QAAM,uBAAuB;AAC7B,WAAS;AAET,UAAQ,WAAW;AACnB;AACF;AAEA,MAAM,EAAE,MAAM,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/utils/args.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
import assert from "assert";
|
|
3
2
|
import { COMMAND_ALIASES } from "./command.js";
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const hasDebugFlag = (args = process.argv) => args.some((arg) => arg.toLocaleLowerCase() === "--debug");
|
|
4
|
+
const hasSerialFlag = (args = process.argv, env = process.env) => args.some((arg) => arg.toLocaleLowerCase() === "--serial") || Boolean(
|
|
6
5
|
// Run serially on SEEK's central npm publishing pipeline.
|
|
7
6
|
// Exhausting agents here can cause grief.
|
|
8
7
|
env.BUILDKITE_AGENT_META_DATA_QUEUE?.split(",").some(
|
|
9
8
|
(queueName) => queueName.startsWith("artefacts:npm")
|
|
10
9
|
)
|
|
11
10
|
);
|
|
12
|
-
|
|
11
|
+
const parseProcessArgs = (args = process.argv) => {
|
|
13
12
|
const skubaIdx = args.findIndex((chunk) => /skuba(\.[jt]s)?$/.test(chunk));
|
|
14
13
|
assert(skubaIdx >= 0, "Cannot parse args for `skuba`");
|
|
15
14
|
const rawCommand = (args[skubaIdx + 1] ?? "help").toLocaleLowerCase();
|
|
@@ -21,7 +20,7 @@ export const parseProcessArgs = (args = process.argv) => {
|
|
|
21
20
|
args.splice(skubaIdx + 1, 1);
|
|
22
21
|
return payload;
|
|
23
22
|
};
|
|
24
|
-
|
|
23
|
+
const parseRunArgs = (argv) => {
|
|
25
24
|
const state = {
|
|
26
25
|
node: [],
|
|
27
26
|
script: []
|
|
@@ -74,4 +73,10 @@ const parseRunArgsIteration = (state, args) => {
|
|
|
74
73
|
state.script.push(...args.slice(1));
|
|
75
74
|
return [];
|
|
76
75
|
};
|
|
76
|
+
export {
|
|
77
|
+
hasDebugFlag,
|
|
78
|
+
hasSerialFlag,
|
|
79
|
+
parseProcessArgs,
|
|
80
|
+
parseRunArgs
|
|
81
|
+
};
|
|
77
82
|
//# sourceMappingURL=args.js.map
|
package/lib/utils/args.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/args.ts"],
|
|
4
4
|
"sourcesContent": ["import assert from 'assert';\n\nimport { COMMAND_ALIASES } from './command.js';\n\nexport const hasDebugFlag = (args = process.argv) =>\n args.some((arg) => arg.toLocaleLowerCase() === '--debug');\n\nexport const hasSerialFlag = (args = process.argv, env = process.env) =>\n args.some((arg) => arg.toLocaleLowerCase() === '--serial') ||\n Boolean(\n // Run serially on SEEK's central npm publishing pipeline.\n // Exhausting agents here can cause grief.\n env.BUILDKITE_AGENT_META_DATA_QUEUE?.split(',').some((queueName) =>\n queueName.startsWith('artefacts:npm'),\n ),\n );\n\n/**\n * Parse process arguments.\n *\n * This function mutates the input list by removing the command name element.\n * Downstream commands can access their args with an ordinary\n * `process.argv.slice(2)`.\n *\n * Example input:\n *\n * ```typescript\n * ['/bin/node', 'node_modules/.bin/skuba', 'test', '--foo', '--bar']\n * ```\n */\nexport const parseProcessArgs = (args = process.argv) => {\n const skubaIdx = args.findIndex((chunk) => /skuba(\\.[jt]s)?$/.test(chunk));\n\n assert(skubaIdx >= 0, 'Cannot parse args for `skuba`');\n\n const rawCommand = (args[skubaIdx + 1] ?? 'help').toLocaleLowerCase();\n\n const commandName = COMMAND_ALIASES[rawCommand] ?? rawCommand;\n\n const payload = {\n commandName,\n args: args.slice(skubaIdx + 2),\n };\n\n args.splice(skubaIdx + 1, 1);\n\n return payload;\n};\n\ninterface RunArgs {\n /** The conditions to pass to the entry point script. */\n conditions?: string[];\n\n /** The path to the entry point script. */\n entryPoint?: string;\n\n /** The port to start an HTTP server on. */\n port?: number;\n\n /** Arguments passed through to the Node.js executable. */\n node: string[];\n\n /** Arguments passed through to the entry point script. */\n script: string[];\n}\n\n/**\n * Make a best effort to parse \"run\" args.\n *\n * These are arguments that would be passed to `skuba node` or `skuba start`.\n * Parsing is handrolled because we support some weird and wonderful behaviour:\n *\n * - The `--port` option may be intended for skuba itself\n * - The `--inspect` options may be intended for the Node.js inspector\n * - The entry point may be omitted in favour of `package.json` inference\n * - Other args may be intended for propagation to the entry point\n */\nexport const parseRunArgs = (argv: string[]): RunArgs => {\n const state: RunArgs = {\n node: [],\n script: [],\n };\n\n let args = argv.filter((element) => element.length);\n\n while (args.length) {\n args = parseRunArgsIteration(state, args);\n }\n\n return state;\n};\n\nconst isDigits = (arg: unknown): arg is string =>\n typeof arg === 'string' && /^\\d+$/.test(arg);\n\nconst parseRunArgsIteration = (state: RunArgs, args: string[]): string[] => {\n const [arg1, arg2] = args;\n\n if (!arg1) {\n return [];\n }\n\n if (/^--inspect(-brk)?=\\d+$/.test(arg1)) {\n state.node.push(arg1);\n return args.slice(1);\n }\n\n // Node.js inspector options that are optionally followed by a numeric port.\n if (['--inspect', '--inspect-brk'].includes(arg1)) {\n if (isDigits(arg2)) {\n state.node.push(`${arg1}=${arg2}`);\n return args.slice(2);\n }\n\n state.node.push(arg1);\n\n if (arg2) {\n // Some other string that doesn't relate to the Node.js inspector option.\n // This is presumably the entry point script to run.\n state.entryPoint = arg2;\n state.script.push(...args.slice(2));\n }\n\n return [];\n }\n\n if (/^--port=\\d+$/.test(arg1)) {\n state.port = Number(arg1.slice(7));\n return args.slice(1);\n }\n\n if (arg1 === '--port') {\n if (isDigits(arg2)) {\n state.port = Number(arg2);\n return args.slice(2);\n }\n\n // Invalid port argument; eat it.\n return args.slice(1);\n }\n\n if (arg1.startsWith('--conditions=')) {\n state.conditions ??= [];\n state.conditions.push(arg1.slice(13));\n return args.slice(1);\n }\n\n state.entryPoint = arg1;\n state.script.push(...args.slice(1));\n return [];\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,OAAO,YAAY;AAEnB,SAAS,uBAAuB;AAEzB,MAAM,eAAe,CAAC,OAAO,QAAQ,SAC1C,KAAK,KAAK,CAAC,QAAQ,IAAI,kBAAkB,MAAM,SAAS;AAEnD,MAAM,gBAAgB,CAAC,OAAO,QAAQ,MAAM,MAAM,QAAQ,QAC/D,KAAK,KAAK,CAAC,QAAQ,IAAI,kBAAkB,MAAM,UAAU,KACzD;AAAA;AAAA;AAAA,EAGE,IAAI,iCAAiC,MAAM,GAAG,EAAE;AAAA,IAAK,CAAC,cACpD,UAAU,WAAW,eAAe;AAAA,EACtC;AACF;AAeK,MAAM,mBAAmB,CAAC,OAAO,QAAQ,SAAS;AACvD,QAAM,WAAW,KAAK,UAAU,CAAC,UAAU,mBAAmB,KAAK,KAAK,CAAC;AAEzE,SAAO,YAAY,GAAG,+BAA+B;AAErD,QAAM,cAAc,KAAK,WAAW,CAAC,KAAK,QAAQ,kBAAkB;AAEpE,QAAM,cAAc,gBAAgB,UAAU,KAAK;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,YAAM,OAAO,OAAO,IAAI;AACxB,aAAO,KAAK,MAAM,CAAC;AAAA,IACrB;AAGA,WAAO,KAAK,MAAM,CAAC;AAAA,EACrB;AAEA,MAAI,KAAK,WAAW,eAAe,GAAG;AACpC,UAAM,eAAe,CAAC;AACtB,UAAM,WAAW,KAAK,KAAK,MAAM,EAAE,CAAC;AACpC,WAAO,KAAK,MAAM,CAAC;AAAA,EACrB;AAEA,QAAM,aAAa;AACnB,QAAM,OAAO,KAAK,GAAG,KAAK,MAAM,CAAC,CAAC;AAClC,SAAO,CAAC;AACV;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/utils/command.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
import path from "path";
|
|
3
|
-
|
|
2
|
+
const COMMAND_ALIASES = {
|
|
4
3
|
"-h": "help",
|
|
5
4
|
"--help": "help",
|
|
6
5
|
"-v": "version",
|
|
7
6
|
"--version": "version"
|
|
8
7
|
};
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const COMMAND_DIR = path.join(import.meta.dirname, "..", "cli");
|
|
9
|
+
const COMMAND_LIST = [
|
|
11
10
|
"build",
|
|
12
11
|
"build-package",
|
|
13
12
|
"configure",
|
|
@@ -22,8 +21,15 @@ export const COMMAND_LIST = [
|
|
|
22
21
|
"test",
|
|
23
22
|
"version"
|
|
24
23
|
];
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
const COMMAND_SET = new Set(COMMAND_LIST);
|
|
25
|
+
const commandToModule = (command) => command.split("-").map(
|
|
27
26
|
(segment, index) => index === 0 ? segment : `${(segment[0] ?? "").toLocaleUpperCase()}${segment.slice(1)}`
|
|
28
27
|
).join("");
|
|
28
|
+
export {
|
|
29
|
+
COMMAND_ALIASES,
|
|
30
|
+
COMMAND_DIR,
|
|
31
|
+
COMMAND_LIST,
|
|
32
|
+
COMMAND_SET,
|
|
33
|
+
commandToModule
|
|
34
|
+
};
|
|
29
35
|
//# sourceMappingURL=command.js.map
|
package/lib/utils/command.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/command.ts"],
|
|
4
4
|
"sourcesContent": ["import path from 'path';\n\nexport type Command = (typeof COMMAND_LIST)[number];\n\nexport const COMMAND_ALIASES: Record<string, Command> = {\n '-h': 'help',\n '--help': 'help',\n '-v': 'version',\n '--version': 'version',\n};\n\nexport const COMMAND_DIR = path.join(import.meta.dirname, '..', 'cli');\n\nexport const COMMAND_LIST = [\n 'build',\n 'build-package',\n 'configure',\n 'format',\n 'help',\n 'init',\n 'lint',\n 'migrate',\n 'node',\n 'release',\n 'start',\n 'test',\n 'version',\n] as const;\n\nexport const COMMAND_SET = new Set<string>(COMMAND_LIST);\n\nexport const commandToModule = (command: Command): string =>\n command\n .split('-')\n .map((segment, index) =>\n index === 0\n ? segment\n : `${(segment[0] ?? '').toLocaleUpperCase()}${segment.slice(1)}`,\n )\n .join('');\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,OAAO,UAAU;AAIV,MAAM,kBAA2C;AAAA,EACtD,MAAM;AAAA,EACN,UAAU;AAAA,EACV,MAAM;AAAA,EACN,aAAa;AACf;AAEO,MAAM,cAAc,KAAK,KAAK,YAAY,SAAS,MAAM,KAAK;AAE9D,MAAM,eAAe;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,MAAM,cAAc,IAAI,IAAY,YAAY;AAEhD,MAAM,kBAAkB,CAAC,YAC9B,QACG,MAAM,GAAG,EACT;AAAA,EAAI,CAAC,SAAS,UACb,UAAU,IACN,UACA,IAAI,QAAQ,CAAC,KAAK,IAAI,kBAAkB,CAAC,GAAG,QAAQ,MAAM,CAAC,CAAC;AAClE,EACC,KAAK,EAAE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/utils/copy.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
import path from "path";
|
|
3
2
|
import ejs from "ejs";
|
|
4
3
|
import fs from "fs-extra";
|
|
5
4
|
import { isErrorWithCode } from "./error.js";
|
|
6
5
|
import { log } from "./logging.js";
|
|
7
|
-
|
|
6
|
+
const copyFile = async (sourcePath, destinationPath, {
|
|
8
7
|
overwrite = true,
|
|
9
8
|
processors
|
|
10
9
|
}) => {
|
|
@@ -27,7 +26,7 @@ export const copyFile = async (sourcePath, destinationPath, {
|
|
|
27
26
|
throw err;
|
|
28
27
|
}
|
|
29
28
|
};
|
|
30
|
-
|
|
29
|
+
const createEjsRenderer = (templateData) => (sourcePath, contents) => {
|
|
31
30
|
try {
|
|
32
31
|
return ejs.render(contents, templateData, { strict: false });
|
|
33
32
|
} catch (err) {
|
|
@@ -36,11 +35,11 @@ export const createEjsRenderer = (templateData) => (sourcePath, contents) => {
|
|
|
36
35
|
return contents;
|
|
37
36
|
}
|
|
38
37
|
};
|
|
39
|
-
|
|
38
|
+
const createStringReplacer = (replacements) => (_sourcePath, contents) => replacements.reduce(
|
|
40
39
|
(newContents, { input, output }) => newContents.replace(input, output),
|
|
41
40
|
contents
|
|
42
41
|
);
|
|
43
|
-
|
|
42
|
+
const copyFiles = async (opts, currentSourceDir = opts.sourceRoot, currentDestinationDir = opts.destinationRoot) => {
|
|
44
43
|
const filenames = await fs.promises.readdir(currentSourceDir);
|
|
45
44
|
const toDestinationPath = (filename) => path.join(
|
|
46
45
|
currentDestinationDir,
|
|
@@ -68,4 +67,10 @@ export const copyFiles = async (opts, currentSourceDir = opts.sourceRoot, curren
|
|
|
68
67
|
})
|
|
69
68
|
);
|
|
70
69
|
};
|
|
70
|
+
export {
|
|
71
|
+
copyFile,
|
|
72
|
+
copyFiles,
|
|
73
|
+
createEjsRenderer,
|
|
74
|
+
createStringReplacer
|
|
75
|
+
};
|
|
71
76
|
//# sourceMappingURL=copy.js.map
|
package/lib/utils/copy.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/copy.ts"],
|
|
4
4
|
"sourcesContent": ["import path from 'path';\n\nimport ejs from 'ejs';\nimport fs from 'fs-extra';\n\nimport { isErrorWithCode } from './error.js';\nimport { log } from './logging.js';\n\nexport type TextProcessor = (sourcePath: string, contents: string) => string;\n\nexport const copyFile = async (\n sourcePath: string,\n destinationPath: string,\n {\n overwrite = true,\n processors,\n }: Pick<CopyFilesOptions, 'overwrite' | 'processors'>,\n) => {\n const oldContents = await fs.promises.readFile(sourcePath, 'utf8');\n\n const newContents = processors.reduce(\n (contents, process) => process(sourcePath, contents),\n oldContents,\n );\n\n if (oldContents === newContents && sourcePath === destinationPath) {\n return;\n }\n\n try {\n await fs.promises.writeFile(destinationPath, newContents, {\n flag: overwrite ? 'w' : 'wx',\n });\n } catch (err) {\n if (isErrorWithCode(err, 'EEXIST')) {\n return;\n }\n\n throw err;\n }\n};\n\ninterface CopyFilesOptions {\n sourceRoot: string;\n destinationRoot: string;\n\n include: (pathname: string) => boolean;\n overwrite?: boolean;\n processors: TextProcessor[];\n stripUnderscorePrefix?: boolean;\n}\n\nexport const createEjsRenderer =\n (templateData: Record<string, unknown>): TextProcessor =>\n (sourcePath: string, contents) => {\n try {\n return ejs.render(contents, templateData, { strict: false });\n } catch (err) {\n log.err('Failed to render', log.bold(sourcePath));\n log.subtle(err);\n return contents;\n }\n };\n\nexport const createStringReplacer =\n (\n replacements: Array<{\n input: RegExp;\n output: string;\n }>,\n ): TextProcessor =>\n (_sourcePath: string, contents) =>\n replacements.reduce(\n (newContents, { input, output }) => newContents.replace(input, output),\n contents,\n );\n\nexport const copyFiles = async (\n opts: CopyFilesOptions,\n currentSourceDir: string = opts.sourceRoot,\n currentDestinationDir: string = opts.destinationRoot,\n) => {\n const filenames = await fs.promises.readdir(currentSourceDir);\n\n const toDestinationPath = (filename: string) =>\n path.join(\n currentDestinationDir,\n opts.stripUnderscorePrefix\n ? filename\n .replace(/^_\\./, '.')\n .replace(/^_package\\.json/, 'package.json')\n .replace(/^_eslint\\.config\\.js/, 'eslint.config.js')\n .replace(/^_pnpm-workspace\\.yaml/, 'pnpm-workspace.yaml')\n : filename,\n );\n\n const filteredFilenames = filenames.filter((filename) =>\n opts.include(\n path.relative(opts.destinationRoot, toDestinationPath(filename)),\n ),\n );\n\n await Promise.all(\n filteredFilenames.map(async (filename) => {\n const sourcePath = path.join(currentSourceDir, filename);\n const destinationPath = toDestinationPath(filename);\n\n try {\n await copyFile(sourcePath, destinationPath, opts);\n } catch (err) {\n if (isErrorWithCode(err, 'EISDIR')) {\n await fs.promises.mkdir(destinationPath, { recursive: true });\n return copyFiles(opts, sourcePath, destinationPath);\n }\n\n log.err('Failed to render', log.bold(sourcePath));\n\n throw err;\n }\n }),\n );\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,OAAO,UAAU;AAEjB,OAAO,SAAS;AAChB,OAAO,QAAQ;AAEf,SAAS,uBAAuB;AAChC,SAAS,WAAW;AAIb,MAAM,WAAW,OACtB,YACA,iBACA;AAAA,EACE,YAAY;AAAA,EACZ;AACF,MACG;AACH,QAAM,cAAc,MAAM,GAAG,SAAS,SAAS,YAAY,MAAM;AAEjE,QAAM,cAAc,WAAW;AAAA,IAC7B,CAAC,UAAU,YAAY,QAAQ,YAAY,QAAQ;AAAA,IACnD;AAAA,EACF;AAEA,MAAI,gBAAgB,eAAe,eAAe,iBAAiB;AACjE;AAAA,EACF;AAEA,MAAI;AACF,UAAM,GAAG,SAAS,UAAU,iBAAiB,aAAa;AAAA,MACxD,MAAM,YAAY,MAAM;AAAA,IAC1B,CAAC;AAAA,EACH,SAAS,KAAK;AACZ,QAAI,gBAAgB,KAAK,QAAQ,GAAG;AAClC;AAAA,IACF;AAEA,UAAM;AAAA,EACR;AACF;AAYO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IAAI,oBAAoB,IAAI,KAAK,UAAU,CAAC;AAEhD,cAAM;AAAA,MACR;AAAA,IACF,CAAC;AAAA,EACH;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/utils/dir.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
import path from "path";
|
|
3
2
|
import fs from "fs-extra";
|
|
4
3
|
import ignore from "ignore";
|
|
@@ -6,14 +5,14 @@ import picomatch from "picomatch";
|
|
|
6
5
|
import { isErrorWithCode } from "./error.js";
|
|
7
6
|
import { pathExists } from "./fs.js";
|
|
8
7
|
import * as Git from "@skuba-lib/api/git";
|
|
9
|
-
|
|
8
|
+
const buildPatternToFilepathMap = (patterns, allFilepaths, options) => Object.fromEntries(
|
|
10
9
|
patterns.map((pattern) => {
|
|
11
10
|
const isMatch = picomatch(pattern, options);
|
|
12
11
|
const filepaths = allFilepaths.filter((filepath) => isMatch(filepath));
|
|
13
12
|
return [pattern, filepaths];
|
|
14
13
|
})
|
|
15
14
|
);
|
|
16
|
-
|
|
15
|
+
const crawlDirectory = async (root, ignoreFilenames = [".gitignore"]) => {
|
|
17
16
|
const ignoreFileFilter = await createInclusionFilter(
|
|
18
17
|
ignoreFilenames.map((ignoreFilename) => path.join(root, ignoreFilename))
|
|
19
18
|
);
|
|
@@ -26,7 +25,7 @@ export const crawlDirectory = async (root, ignoreFilenames = [".gitignore"]) =>
|
|
|
26
25
|
);
|
|
27
26
|
return relativeFilepaths;
|
|
28
27
|
};
|
|
29
|
-
|
|
28
|
+
const createInclusionFilter = async (ignoreFilepaths) => {
|
|
30
29
|
const ignoreFiles = await Promise.all(
|
|
31
30
|
ignoreFilepaths.map(async (ignoreFilepath) => {
|
|
32
31
|
try {
|
|
@@ -62,7 +61,7 @@ async function crawl(directoryPath, filters, paths = []) {
|
|
|
62
61
|
}
|
|
63
62
|
return paths;
|
|
64
63
|
}
|
|
65
|
-
|
|
64
|
+
const locateNearestFile = async ({
|
|
66
65
|
cwd,
|
|
67
66
|
filename
|
|
68
67
|
}) => {
|
|
@@ -76,7 +75,7 @@ export const locateNearestFile = async ({
|
|
|
76
75
|
}
|
|
77
76
|
return null;
|
|
78
77
|
};
|
|
79
|
-
|
|
78
|
+
const locateFurthestFile = async ({
|
|
80
79
|
cwd,
|
|
81
80
|
filename
|
|
82
81
|
}) => {
|
|
@@ -92,7 +91,7 @@ export const locateFurthestFile = async ({
|
|
|
92
91
|
return furthestFilePath;
|
|
93
92
|
};
|
|
94
93
|
const workspaceRootCache = {};
|
|
95
|
-
|
|
94
|
+
const findWorkspaceRoot = async (cwd = process.cwd()) => {
|
|
96
95
|
const find = async () => {
|
|
97
96
|
const [pnpmLock, yarnLock, packageJson, gitRoot] = await Promise.all([
|
|
98
97
|
locateNearestFile({ cwd, filename: "pnpm-lock.yaml" }),
|
|
@@ -118,11 +117,20 @@ export const findWorkspaceRoot = async (cwd = process.cwd()) => {
|
|
|
118
117
|
};
|
|
119
118
|
return workspaceRootCache[cwd] ??= await find();
|
|
120
119
|
};
|
|
121
|
-
|
|
120
|
+
const findCurrentWorkspaceProjectRoot = async (cwd = process.cwd()) => {
|
|
122
121
|
const packageJson = await locateNearestFile({
|
|
123
122
|
cwd,
|
|
124
123
|
filename: "package.json"
|
|
125
124
|
});
|
|
126
125
|
return packageJson ? path.dirname(packageJson) : null;
|
|
127
126
|
};
|
|
127
|
+
export {
|
|
128
|
+
buildPatternToFilepathMap,
|
|
129
|
+
crawlDirectory,
|
|
130
|
+
createInclusionFilter,
|
|
131
|
+
findCurrentWorkspaceProjectRoot,
|
|
132
|
+
findWorkspaceRoot,
|
|
133
|
+
locateFurthestFile,
|
|
134
|
+
locateNearestFile
|
|
135
|
+
};
|
|
128
136
|
//# sourceMappingURL=dir.js.map
|
package/lib/utils/dir.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/dir.ts"],
|
|
4
4
|
"sourcesContent": ["import path from 'path';\n\nimport fs from 'fs-extra';\nimport ignore from 'ignore';\nimport picomatch from 'picomatch';\n\nimport { isErrorWithCode } from './error.js';\nimport { pathExists } from './fs.js';\n\nimport * as Git from '@skuba-lib/api/git';\n\n/**\n * Build a map that associates each glob pattern with its matching filepaths.\n */\nexport const buildPatternToFilepathMap = (\n patterns: string[],\n allFilepaths: string[],\n options?: picomatch.PicomatchOptions,\n) =>\n Object.fromEntries(\n patterns.map((pattern) => {\n const isMatch = picomatch(pattern, options);\n\n const filepaths = allFilepaths.filter((filepath) => isMatch(filepath));\n\n return [pattern, filepaths] as const;\n }),\n );\n\n/**\n * List relative filepaths contained within a directory root.\n *\n * This excludes:\n *\n * - Patterns in the ignore files specified in `ignoreFilenames`\n * - `.git` subdirectories\n * - `node_modules` subdirectories\n */\nexport const crawlDirectory = async (\n root: string,\n ignoreFilenames = ['.gitignore'],\n) => {\n const ignoreFileFilter = await createInclusionFilter(\n ignoreFilenames.map((ignoreFilename) => path.join(root, ignoreFilename)),\n );\n\n const absoluteFilenames = await crawl(root, {\n includeDirName: (dirname) => !['.git', 'node_modules'].includes(dirname),\n includeFilePath: (pathname) =>\n ignoreFileFilter(path.relative(root, pathname)),\n });\n\n const relativeFilepaths = absoluteFilenames.map((filepath) =>\n path.relative(root, filepath),\n );\n\n return relativeFilepaths;\n};\n\n/**\n * Create a filter function that excludes filepaths based on ignore files like\n * `.gitignore` and `.prettierignore`.\n */\nexport const createInclusionFilter = async (ignoreFilepaths: string[]) => {\n const ignoreFiles = await Promise.all(\n ignoreFilepaths.map(async (ignoreFilepath) => {\n try {\n return await fs.promises.readFile(ignoreFilepath, 'utf8');\n } catch (err) {\n if (isErrorWithCode(err, 'ENOENT')) {\n return;\n }\n\n throw err;\n }\n }),\n );\n\n const managers = ignoreFiles\n .filter((value): value is string => typeof value === 'string')\n .map((value) => ignore().add(value));\n\n return ignore().add('.git').add(managers).createFilter();\n};\n\n/**\n * Recursively crawl a directory and return all file paths that match the\n * filters. `paths` is mutated and returned.\n */\nasync function crawl(\n directoryPath: string,\n filters: {\n includeDirName: (dirName: string) => boolean;\n includeFilePath: (path: string) => boolean;\n },\n paths: string[] = [],\n) {\n try {\n const entries = await fs.promises.readdir(directoryPath, {\n withFileTypes: true,\n });\n\n await Promise.all(\n entries.map(async (entry) => {\n const fullPath = path.join(directoryPath, entry.name);\n\n if (\n (entry.isFile() || entry.isSymbolicLink()) &&\n filters.includeFilePath(fullPath)\n ) {\n paths.push(fullPath);\n }\n\n if (entry.isDirectory() && filters.includeDirName(entry.name)) {\n await crawl(fullPath, filters, paths);\n }\n }),\n );\n } catch {\n // Ignore errors, because of e.g. permission issues reading directories\n }\n\n return paths;\n}\n\nexport const locateNearestFile = async ({\n cwd,\n filename,\n}: {\n cwd: string;\n filename: string;\n}) => {\n let currentDir = cwd;\n while (currentDir !== path.dirname(currentDir)) {\n const filePath = path.join(currentDir, filename);\n if (await pathExists(filePath)) {\n return filePath;\n }\n currentDir = path.dirname(currentDir);\n }\n\n return null;\n};\n\nexport const locateFurthestFile = async ({\n cwd,\n filename,\n}: {\n cwd: string;\n filename: string;\n}) => {\n let currentDir = cwd;\n let furthestFilePath: string | null = null;\n\n while (currentDir !== path.dirname(currentDir)) {\n const filePath = path.join(currentDir, filename);\n if (await pathExists(filePath)) {\n furthestFilePath = filePath;\n }\n currentDir = path.dirname(currentDir);\n }\n\n return furthestFilePath;\n};\n\nconst workspaceRootCache: Record<string, string | null> = {};\n\nexport const findWorkspaceRoot = async (\n cwd = process.cwd(),\n): Promise<string | null> => {\n const find = async (): Promise<string | null> => {\n const [pnpmLock, yarnLock, packageJson, gitRoot] = await Promise.all([\n locateNearestFile({ cwd, filename: 'pnpm-lock.yaml' }),\n locateNearestFile({ cwd, filename: 'yarn.lock' }),\n locateFurthestFile({ cwd, filename: 'package.json' }),\n Git.findRoot({ dir: cwd }),\n ]);\n\n const candidates = [\n pnpmLock ? path.dirname(pnpmLock) : null,\n yarnLock ? path.dirname(yarnLock) : null,\n packageJson ? path.dirname(packageJson) : null,\n gitRoot,\n ].filter((dir): dir is string => dir !== null);\n\n if (candidates[0]) {\n // Pick the longest path. This will be the most specific, which helps guard against someone\n // having an accidental lockfile in a parent directory by mistake.\n\n return candidates.reduce((longest, current) => {\n if (current.split(path.sep).length > longest.split(path.sep).length) {\n return current;\n }\n return longest;\n }, candidates[0]);\n }\n\n return null;\n };\n\n return (workspaceRootCache[cwd] ??= await find());\n};\n\nexport const findCurrentWorkspaceProjectRoot = async (\n cwd = process.cwd(),\n): Promise<string | null> => {\n const packageJson = await locateNearestFile({\n cwd,\n filename: 'package.json',\n });\n return packageJson ? path.dirname(packageJson) : null;\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,OAAO,UAAU;AAEjB,OAAO,QAAQ;AACf,OAAO,YAAY;AACnB,OAAO,eAAe;AAEtB,SAAS,uBAAuB;AAChC,SAAS,kBAAkB;AAE3B,YAAY,SAAS;AAKd,MAAM,4BAA4B,CACvC,UACA,cACA,YAEA,OAAO;AAAA,EACL,SAAS,IAAI,CAAC,YAAY;AACxB,UAAM,UAAU,UAAU,SAAS,OAAO;AAE1C,UAAM,YAAY,aAAa,OAAO,CAAC,aAAa,QAAQ,QAAQ,CAAC;AAErE,WAAO,CAAC,SAAS,SAAS;AAAA,EAC5B,CAAC;AACH;AAWK,MAAM,iBAAiB,OAC5B,MACA,kBAAkB,CAAC,YAAY,MAC5B;AACH,QAAM,mBAAmB,MAAM;AAAA,IAC7B,gBAAgB,IAAI,CAAC,mBAAmB,KAAK,KAAK,MAAM,cAAc,CAAC;AAAA,EACzE;AAEA,QAAM,oBAAoB,MAAM,MAAM,MAAM;AAAA,IAC1C,gBAAgB,CAAC,YAAY,CAAC,CAAC,QAAQ,cAAc,EAAE,SAAS,OAAO;AAAA,IACvE,iBAAiB,CAAC,aAChB,iBAAiB,KAAK,SAAS,MAAM,QAAQ,CAAC;AAAA,EAClD,CAAC;AAED,QAAM,oBAA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S,QAAQ,MAAM,KAAK,GAAG,EAAE,QAAQ;AACnE,iBAAO;AAAA,QACT;AACA,eAAO;AAAA,MACT,GAAG,WAAW,CAAC,CAAC;AAAA,IAClB;AAEA,WAAO;AAAA,EACT;AAEA,SAAQ,mBAAmB,GAAG,MAAM,MAAM,KAAK;AACjD;AAEO,MAAM,kCAAkC,OAC7C,MAAM,QAAQ,IAAI,MACS;AAC3B,QAAM,cAAc,MAAM,kBAAkB;AAAA,IAC1C;AAAA,IACA,UAAU;AAAA,EACZ,CAAC;AACD,SAAO,cAAc,KAAK,QAAQ,WAAW,IAAI;AACnD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/utils/env.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
const isCiEnv = (env = process.env) => Boolean(env.BUILDKITE || env.CI || env.GITHUB_ACTIONS);
|
|
2
|
+
export {
|
|
3
|
+
isCiEnv
|
|
4
|
+
};
|
|
3
5
|
//# sourceMappingURL=env.js.map
|
package/lib/utils/env.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/env.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * Whether the code is executing in a CI environment.\n */\nexport const isCiEnv = (env = process.env): boolean =>\n Boolean(env.BUILDKITE || env.CI || env.GITHUB_ACTIONS);\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAGO,MAAM,UAAU,CAAC,MAAM,QAAQ,QACpC,QAAQ,IAAI,aAAa,IAAI,MAAM,IAAI,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/utils/error.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
import { inspect } from "util";
|
|
3
2
|
import * as z from "zod/v4";
|
|
4
3
|
import { log } from "./logging.js";
|
|
5
4
|
import { hasNumberProp, hasProp } from "./validation.js";
|
|
6
|
-
|
|
5
|
+
const concurrentlyErrorsSchema = z.array(
|
|
7
6
|
z.object({
|
|
8
7
|
command: z.object({
|
|
9
8
|
command: z.string(),
|
|
@@ -13,11 +12,11 @@ export const concurrentlyErrorsSchema = z.array(
|
|
|
13
12
|
exitCode: z.number()
|
|
14
13
|
})
|
|
15
14
|
);
|
|
16
|
-
|
|
15
|
+
const createTerseError = (message) => Object.assign(new Error(message), {
|
|
17
16
|
[inspect.custom]: () => message
|
|
18
17
|
});
|
|
19
18
|
const isExecaError = (err) => hasNumberProp(err, "exitCode");
|
|
20
|
-
|
|
19
|
+
const handleCliError = (err) => {
|
|
21
20
|
if (isExecaError(err)) {
|
|
22
21
|
process.exitCode = err.exitCode;
|
|
23
22
|
return;
|
|
@@ -26,5 +25,11 @@ export const handleCliError = (err) => {
|
|
|
26
25
|
process.exitCode = 1;
|
|
27
26
|
return;
|
|
28
27
|
};
|
|
29
|
-
|
|
28
|
+
const isErrorWithCode = (err, code) => hasProp(err, "code") && err.code === code;
|
|
29
|
+
export {
|
|
30
|
+
concurrentlyErrorsSchema,
|
|
31
|
+
createTerseError,
|
|
32
|
+
handleCliError,
|
|
33
|
+
isErrorWithCode
|
|
34
|
+
};
|
|
30
35
|
//# sourceMappingURL=error.js.map
|
package/lib/utils/error.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/error.ts"],
|
|
4
4
|
"sourcesContent": ["import { inspect } from 'util';\n\nimport type { ExecaError } from 'execa';\nimport * as z from 'zod/v4';\n\nimport { log } from './logging.js';\nimport { hasNumberProp, hasProp } from './validation.js';\n\nexport type ConcurrentlyErrors = z.infer<typeof concurrentlyErrorsSchema>;\n\nexport const concurrentlyErrorsSchema = z.array(\n z.object({\n command: z.object({\n command: z.string(),\n name: z.string(),\n }),\n index: z.number(),\n exitCode: z.number(),\n }),\n);\n\n/**\n * Creates an error that returns its plain `message` rather than a full stack\n * trace when `util.inspect`ed.\n *\n * This can be useful for terser handling and logging of known error scenarios\n * that have descriptive messages.\n *\n * https://nodejs.org/api/util.html#custom-inspection-functions-on-objects\n */\nexport const createTerseError = (message?: string) =>\n Object.assign(new Error(message), {\n [inspect.custom]: () => message,\n });\n\nconst isExecaError = (err: unknown): err is ExecaError =>\n hasNumberProp(err, 'exitCode');\n\nexport const handleCliError = (err: unknown) => {\n if (isExecaError(err)) {\n process.exitCode = err.exitCode;\n return;\n }\n\n log.err(inspect(err));\n process.exitCode = 1;\n return;\n};\n\nexport const isErrorWithCode = <T>(\n err: unknown,\n code: T,\n): err is Record<PropertyKey, unknown> & { code: T } =>\n hasProp(err, 'code') && err.code === code;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,SAAS,eAAe;AAGxB,YAAY,OAAO;AAEnB,SAAS,WAAW;AACpB,SAAS,eAAe,eAAe;AAIhC,MAAM,2BAA2B,EAAE;AAAA,EACxC,EAAE,OAAO;AAAA,IACP,SAAS,EAAE,OAAO;AAAA,MAChB,SAAS,EAAE,OAAO;AAAA,MAClB,MAAM,EAAE,OAAO;AAAA,IACjB,CAAC;AAAA,IACD,OAAO,EAAE,OAAO;AAAA,IAChB,UAAU,EAAE,OAAO;AAAA,EACrB,CAAC;AACH;AAWO,MAAM,mBAAmB,CAAC,YAC/B,OAAO,OAAO,IAAI,MAAM,OAAO,GAAG;AAAA,EAChC,CAAC,QAAQ,MAAM,GAAG,MAAM;AAC1B,CAAC;AAEH,MAAM,eAAe,CAAC,QACpB,cAAc,KAAK,UAAU;AAExB,MAAM,iBAAiB,CAAC,QAAiB;AAC9C,MAAI,aAAa,GAAG,GAAG;AACrB,YAAQ,WAAW,IAAI;AACvB;AAAA,EACF;AAEA,MAAI,IAAI,QAAQ,GAAG,CAAC;AACpB,UAAQ,WAAW;AACnB;AACF;AAEO,MAAM,kBAAkB,CAC7B,KACA,SAEA,QAAQ,KAAK,MAAM,KAAK,IAAI,SAAS;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/utils/exec.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
import { cpus } from "os";
|
|
3
2
|
import stream from "stream";
|
|
4
3
|
import util from "util";
|
|
@@ -58,9 +57,9 @@ const runCommand = (command, args, opts) => {
|
|
|
58
57
|
};
|
|
59
58
|
const whichCallback = npmWhich(import.meta.dirname);
|
|
60
59
|
const which = util.promisify(whichCallback);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
const createExec = (opts) => (command, ...args) => runCommand(command, args, opts);
|
|
61
|
+
const exec = (command, ...args) => runCommand(command, args);
|
|
62
|
+
const execConcurrently = async (commands, { maxProcesses, nameLength, outputStream } = {}) => {
|
|
64
63
|
const maxNameLength = nameLength ?? commands.reduce(
|
|
65
64
|
(length, command) => Math.max(length, command.name.length),
|
|
66
65
|
0
|
|
@@ -91,7 +90,7 @@ export const execConcurrently = async (commands, { maxProcesses, nameLength, out
|
|
|
91
90
|
);
|
|
92
91
|
}
|
|
93
92
|
};
|
|
94
|
-
|
|
93
|
+
const ensureCommands = async (...names) => {
|
|
95
94
|
let success = true;
|
|
96
95
|
await Promise.all(
|
|
97
96
|
names.map(async (name) => {
|
|
@@ -106,7 +105,7 @@ export const ensureCommands = async (...names) => {
|
|
|
106
105
|
process.exit(1);
|
|
107
106
|
}
|
|
108
107
|
};
|
|
109
|
-
|
|
108
|
+
const hasCommand = async (name) => {
|
|
110
109
|
try {
|
|
111
110
|
await which(name);
|
|
112
111
|
return true;
|
|
@@ -117,4 +116,11 @@ export const hasCommand = async (name) => {
|
|
|
117
116
|
throw err;
|
|
118
117
|
}
|
|
119
118
|
};
|
|
119
|
+
export {
|
|
120
|
+
createExec,
|
|
121
|
+
ensureCommands,
|
|
122
|
+
exec,
|
|
123
|
+
execConcurrently,
|
|
124
|
+
hasCommand
|
|
125
|
+
};
|
|
120
126
|
//# sourceMappingURL=exec.js.map
|