skuba 4.4.1 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/tsconfig.json +1 -0
- package/jest/moduleNameMapper.js +50 -78
- package/jest/moduleNameMapper.test.ts +4 -14
- package/jest/transform.js +10 -1
- package/jest/tsConfig.js +26 -0
- package/lib/api/buildkite/annotate.js +46 -33
- package/lib/api/buildkite/annotate.js.map +7 -1
- package/lib/api/buildkite/index.js +31 -7
- package/lib/api/buildkite/index.js.map +7 -1
- package/lib/api/buildkite/md.js +31 -8
- package/lib/api/buildkite/md.js.map +7 -1
- package/lib/api/git/commit.js +45 -17
- package/lib/api/git/commit.js.map +7 -1
- package/lib/api/git/commitAllChanges.js +57 -27
- package/lib/api/git/commitAllChanges.js.map +7 -1
- package/lib/api/git/currentBranch.js +50 -28
- package/lib/api/git/currentBranch.js.map +7 -1
- package/lib/api/git/getChangedFiles.js +49 -27
- package/lib/api/git/getChangedFiles.js.map +7 -1
- package/lib/api/git/index.js +54 -22
- package/lib/api/git/index.js.map +7 -1
- package/lib/api/git/log.js +63 -42
- package/lib/api/git/log.js.map +7 -1
- package/lib/api/git/pull.js +62 -31
- package/lib/api/git/pull.js.map +7 -1
- package/lib/api/git/push.js +63 -31
- package/lib/api/git/push.js.map +7 -1
- package/lib/api/git/remote.js +59 -56
- package/lib/api/git/remote.js.map +7 -1
- package/lib/api/git/reset.js +55 -27
- package/lib/api/git/reset.js.map +7 -1
- package/lib/api/git/statusMatrix.js +46 -13
- package/lib/api/git/statusMatrix.js.map +7 -1
- package/lib/api/github/checkRun.js +70 -79
- package/lib/api/github/checkRun.js.map +7 -1
- package/lib/api/github/environment.js +40 -33
- package/lib/api/github/environment.js.map +7 -1
- package/lib/api/github/index.js +47 -17
- package/lib/api/github/index.js.map +7 -1
- package/lib/api/github/issueComment.js +73 -81
- package/lib/api/github/issueComment.js.map +7 -1
- package/lib/api/github/pullRequest.js +60 -61
- package/lib/api/github/pullRequest.js.map +7 -1
- package/lib/api/github/push.js +138 -133
- package/lib/api/github/push.js.map +7 -1
- package/lib/api/jest/index.d.ts +2 -1
- package/lib/api/jest/index.js +35 -14
- package/lib/api/jest/index.js.map +7 -1
- package/lib/api/net/compose.js +45 -17
- package/lib/api/net/compose.js.map +7 -1
- package/lib/api/net/index.js +28 -5
- package/lib/api/net/index.js.map +7 -1
- package/lib/api/net/socket.js +58 -36
- package/lib/api/net/socket.js.map +7 -1
- package/lib/api/net/waitFor.js +38 -18
- package/lib/api/net/waitFor.js.map +7 -1
- package/lib/cli/adapter/eslint.js +95 -72
- package/lib/cli/adapter/eslint.js.map +7 -1
- package/lib/cli/adapter/prettier.js +135 -123
- package/lib/cli/adapter/prettier.js.map +7 -1
- package/lib/cli/build/args.d.ts +7 -0
- package/lib/cli/build/args.js +69 -0
- package/lib/cli/build/args.js.map +7 -0
- package/lib/cli/build/esbuild.d.ts +5 -0
- package/lib/cli/build/esbuild.js +128 -0
- package/lib/cli/build/esbuild.js.map +7 -0
- package/lib/cli/build/index.d.ts +1 -1
- package/lib/cli/build/index.js +68 -5
- package/lib/cli/build/index.js.map +7 -1
- package/lib/cli/build/tsc.d.ts +1 -1
- package/lib/cli/build/tsc.js +34 -23
- package/lib/cli/build/tsc.js.map +7 -1
- package/lib/cli/buildPackage.js +53 -23
- package/lib/cli/buildPackage.js.map +7 -1
- package/lib/cli/configure/addEmptyExports.d.ts +5 -0
- package/lib/cli/configure/addEmptyExports.js +67 -0
- package/lib/cli/configure/addEmptyExports.js.map +7 -0
- package/lib/cli/configure/analyseConfiguration.js +61 -31
- package/lib/cli/configure/analyseConfiguration.js.map +7 -1
- package/lib/cli/configure/analyseDependencies.js +122 -113
- package/lib/cli/configure/analyseDependencies.js.map +7 -1
- package/lib/cli/configure/analysis/diff.js +37 -11
- package/lib/cli/configure/analysis/diff.js.map +7 -1
- package/lib/cli/configure/analysis/files.js +49 -22
- package/lib/cli/configure/analysis/files.js.map +7 -1
- package/lib/cli/configure/analysis/git.js +46 -16
- package/lib/cli/configure/analysis/git.js.map +7 -1
- package/lib/cli/configure/analysis/package.js +99 -52
- package/lib/cli/configure/analysis/package.js.map +7 -1
- package/lib/cli/configure/analysis/project.js +90 -54
- package/lib/cli/configure/analysis/project.js.map +7 -1
- package/lib/cli/configure/dependencies/index.js +40 -13
- package/lib/cli/configure/dependencies/index.js.map +7 -1
- package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js +57 -32
- package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js.map +7 -1
- package/lib/cli/configure/dependencies/seekKoala.js +53 -31
- package/lib/cli/configure/dependencies/seekKoala.js.map +7 -1
- package/lib/cli/configure/dependencies/skuba.js +49 -27
- package/lib/cli/configure/dependencies/skuba.js.map +7 -1
- package/lib/cli/configure/dependencies/skubaDeps.js +49 -28
- package/lib/cli/configure/dependencies/skubaDeps.js.map +7 -1
- package/lib/cli/configure/dependencies/skubaDive.js +65 -38
- package/lib/cli/configure/dependencies/skubaDive.js.map +7 -1
- package/lib/cli/configure/ensureTemplateCompletion.js +69 -41
- package/lib/cli/configure/ensureTemplateCompletion.js.map +7 -1
- package/lib/cli/configure/getEntryPoint.js +62 -32
- package/lib/cli/configure/getEntryPoint.js.map +7 -1
- package/lib/cli/configure/getProjectType.js +50 -28
- package/lib/cli/configure/getProjectType.js.map +7 -1
- package/lib/cli/configure/index.js +134 -109
- package/lib/cli/configure/index.js.map +7 -1
- package/lib/cli/configure/modules/eslint.js +57 -26
- package/lib/cli/configure/modules/eslint.js.map +7 -1
- package/lib/cli/configure/modules/ignore.js +37 -14
- package/lib/cli/configure/modules/ignore.js.map +7 -1
- package/lib/cli/configure/modules/index.js +53 -28
- package/lib/cli/configure/modules/index.js.map +7 -1
- package/lib/cli/configure/modules/jest.js +82 -47
- package/lib/cli/configure/modules/jest.js.map +7 -1
- package/lib/cli/configure/modules/nodemon.js +29 -6
- package/lib/cli/configure/modules/nodemon.js.map +7 -1
- package/lib/cli/configure/modules/package.js +113 -92
- package/lib/cli/configure/modules/package.js.map +7 -1
- package/lib/cli/configure/modules/prettier.js +48 -19
- package/lib/cli/configure/modules/prettier.js.map +7 -1
- package/lib/cli/configure/modules/renovate.js +52 -39
- package/lib/cli/configure/modules/renovate.js.map +7 -1
- package/lib/cli/configure/modules/serverless.js +33 -15
- package/lib/cli/configure/modules/serverless.js.map +7 -1
- package/lib/cli/configure/modules/skubaDive.js +63 -37
- package/lib/cli/configure/modules/skubaDive.js.map +7 -1
- package/lib/cli/configure/modules/tsconfig.js +84 -63
- package/lib/cli/configure/modules/tsconfig.js.map +7 -1
- package/lib/cli/configure/modules/tslint.js +29 -6
- package/lib/cli/configure/modules/tslint.js.map +7 -1
- package/lib/cli/configure/processing/deleteFiles.js +30 -8
- package/lib/cli/configure/processing/deleteFiles.js.map +7 -1
- package/lib/cli/configure/processing/ignoreFile.js +65 -59
- package/lib/cli/configure/processing/ignoreFile.js.map +7 -1
- package/lib/cli/configure/processing/javascript.js +35 -15
- package/lib/cli/configure/processing/javascript.js.map +7 -1
- package/lib/cli/configure/processing/json.js +51 -20
- package/lib/cli/configure/processing/json.js.map +7 -1
- package/lib/cli/configure/processing/loadFiles.js +30 -8
- package/lib/cli/configure/processing/loadFiles.js.map +7 -1
- package/lib/cli/configure/processing/module.js +37 -14
- package/lib/cli/configure/processing/module.js.map +7 -1
- package/lib/cli/configure/processing/package.js +73 -43
- package/lib/cli/configure/processing/package.js.map +7 -1
- package/lib/cli/configure/processing/prettier.js +37 -11
- package/lib/cli/configure/processing/prettier.js.map +7 -1
- package/lib/cli/configure/processing/record.js +54 -31
- package/lib/cli/configure/processing/record.js.map +7 -1
- package/lib/cli/configure/processing/typescript.js +176 -158
- package/lib/cli/configure/processing/typescript.js.map +7 -1
- package/lib/cli/configure/refreshIgnoreFiles.js +64 -40
- package/lib/cli/configure/refreshIgnoreFiles.js.map +7 -1
- package/lib/cli/configure/types.js +16 -2
- package/lib/cli/configure/types.js.map +7 -1
- package/lib/cli/format.js +58 -31
- package/lib/cli/format.js.map +7 -1
- package/lib/cli/help.js +31 -8
- package/lib/cli/help.js.map +7 -1
- package/lib/cli/init/getConfig.d.ts +1 -1
- package/lib/cli/init/getConfig.js +238 -207
- package/lib/cli/init/getConfig.js.map +7 -1
- package/lib/cli/init/git.js +70 -63
- package/lib/cli/init/git.js.map +7 -1
- package/lib/cli/init/index.js +133 -100
- package/lib/cli/init/index.js.map +7 -1
- package/lib/cli/init/prompts.js +84 -54
- package/lib/cli/init/prompts.js.map +7 -1
- package/lib/cli/init/types.js +52 -52
- package/lib/cli/init/types.js.map +7 -1
- package/lib/cli/init/validation.js +34 -12
- package/lib/cli/init/validation.js.map +7 -1
- package/lib/cli/init/writePackageJson.js +51 -22
- package/lib/cli/init/writePackageJson.js.map +7 -1
- package/lib/cli/lint/annotate/buildkite/eslint.js +34 -28
- package/lib/cli/lint/annotate/buildkite/eslint.js.map +7 -1
- package/lib/cli/lint/annotate/buildkite/index.js +50 -44
- package/lib/cli/lint/annotate/buildkite/index.js.map +7 -1
- package/lib/cli/lint/annotate/buildkite/prettier.js +41 -35
- package/lib/cli/lint/annotate/buildkite/prettier.js.map +7 -1
- package/lib/cli/lint/annotate/buildkite/tsc.js +39 -39
- package/lib/cli/lint/annotate/buildkite/tsc.js.map +7 -1
- package/lib/cli/lint/annotate/github/eslint.js +40 -16
- package/lib/cli/lint/annotate/github/eslint.js.map +7 -1
- package/lib/cli/lint/annotate/github/index.js +55 -51
- package/lib/cli/lint/annotate/github/index.js.map +7 -1
- package/lib/cli/lint/annotate/github/prettier.js +36 -13
- package/lib/cli/lint/annotate/github/prettier.js.map +7 -1
- package/lib/cli/lint/annotate/github/tsc.js +52 -52
- package/lib/cli/lint/annotate/github/tsc.js.map +7 -1
- package/lib/cli/lint/annotate/index.d.ts +1 -1
- package/lib/cli/lint/annotate/index.js +33 -10
- package/lib/cli/lint/annotate/index.js.map +7 -1
- package/lib/cli/lint/autofix.js +122 -117
- package/lib/cli/lint/autofix.js.map +7 -1
- package/lib/cli/lint/eslint.js +48 -18
- package/lib/cli/lint/eslint.js.map +7 -1
- package/lib/cli/lint/external.js +102 -81
- package/lib/cli/lint/external.js.map +7 -1
- package/lib/cli/lint/index.js +42 -18
- package/lib/cli/lint/index.js.map +7 -1
- package/lib/cli/lint/internal.js +54 -21
- package/lib/cli/lint/internal.js.map +7 -1
- package/lib/cli/lint/prettier.js +48 -18
- package/lib/cli/lint/prettier.js.map +7 -1
- package/lib/cli/lint/tsc.js +56 -32
- package/lib/cli/lint/tsc.js.map +7 -1
- package/lib/cli/lint/types.js +16 -2
- package/lib/cli/lint/types.js.map +7 -1
- package/lib/cli/node.js +65 -58
- package/lib/cli/node.js.map +7 -1
- package/lib/cli/release.js +29 -6
- package/lib/cli/release.js.map +7 -1
- package/lib/cli/start.js +61 -24
- package/lib/cli/start.js.map +7 -1
- package/lib/cli/test/index.js +35 -11
- package/lib/cli/test/index.js.map +7 -1
- package/lib/cli/test/reporters/github/annotations.js +89 -92
- package/lib/cli/test/reporters/github/annotations.js.map +7 -1
- package/lib/cli/test/reporters/github/index.js +68 -68
- package/lib/cli/test/reporters/github/index.js.map +7 -1
- package/lib/cli/version.js +31 -8
- package/lib/cli/version.js.map +7 -1
- package/lib/enquirer.d.js +2 -0
- package/lib/enquirer.d.js.map +7 -0
- package/lib/index.d.ts +6 -0
- package/lib/index.js +45 -41
- package/lib/index.js.map +7 -1
- package/lib/skuba.js +45 -38
- package/lib/skuba.js.map +7 -1
- package/lib/utils/args.js +97 -96
- package/lib/utils/args.js.map +7 -1
- package/lib/utils/command.js +64 -33
- package/lib/utils/command.js.map +7 -1
- package/lib/utils/copy.js +88 -51
- package/lib/utils/copy.js.map +7 -1
- package/lib/utils/dir.js +79 -67
- package/lib/utils/dir.js.map +7 -1
- package/lib/utils/env.js +27 -7
- package/lib/utils/env.js.map +7 -1
- package/lib/utils/error.js +58 -56
- package/lib/utils/error.js.map +7 -1
- package/lib/utils/exec.js +139 -110
- package/lib/utils/exec.js.map +7 -1
- package/lib/utils/help.js +31 -8
- package/lib/utils/help.js.map +7 -1
- package/lib/utils/logging.js +52 -24
- package/lib/utils/logging.js.map +7 -1
- package/lib/utils/logo.js +65 -27
- package/lib/utils/logo.js.map +7 -1
- package/lib/utils/manifest.d.ts +1 -0
- package/lib/utils/manifest.js +65 -51
- package/lib/utils/manifest.js.map +7 -1
- package/lib/utils/port.js +38 -17
- package/lib/utils/port.js.map +7 -1
- package/lib/utils/template.js +106 -87
- package/lib/utils/template.js.map +7 -1
- package/lib/utils/validation.js +43 -18
- package/lib/utils/validation.js.map +7 -1
- package/lib/utils/version.js +72 -82
- package/lib/utils/version.js.map +7 -1
- package/lib/utils/wait.js +52 -25
- package/lib/utils/wait.js.map +7 -1
- package/lib/utils/worker.js +59 -44
- package/lib/utils/worker.js.map +7 -1
- package/lib/wrapper/function-arguments.d.js +2 -0
- package/lib/wrapper/function-arguments.d.js.map +7 -0
- package/lib/wrapper/functionHandler.js +56 -29
- package/lib/wrapper/functionHandler.js.map +7 -1
- package/lib/wrapper/http.js +66 -56
- package/lib/wrapper/http.js.map +7 -1
- package/lib/wrapper/index.js +9 -21
- package/lib/wrapper/index.js.map +7 -1
- package/lib/wrapper/main.js +39 -20
- package/lib/wrapper/main.js.map +7 -1
- package/lib/wrapper/requestListener.js +50 -35
- package/lib/wrapper/requestListener.js.map +7 -1
- package/package.json +85 -79
- package/template/base/jest.config.ts +0 -6
- package/template/base/jest.setup.ts +2 -0
- package/template/base/tsconfig.json +2 -2
- package/template/express-rest-api/.buildkite/pipeline.yml +1 -1
- package/template/express-rest-api/.nvmrc +1 -1
- package/template/express-rest-api/Dockerfile +1 -1
- package/template/express-rest-api/Dockerfile.dev-deps +1 -1
- package/template/express-rest-api/package.json +14 -14
- package/template/greeter/.buildkite/pipeline.yml +1 -1
- package/template/greeter/.nvmrc +1 -1
- package/template/greeter/Dockerfile +1 -1
- package/template/greeter/package.json +11 -11
- package/template/greeter/src/app.test.ts +3 -1
- package/template/koa-rest-api/.buildkite/pipeline.yml +1 -1
- package/template/koa-rest-api/.nvmrc +1 -1
- package/template/koa-rest-api/Dockerfile +1 -1
- package/template/koa-rest-api/Dockerfile.dev-deps +1 -1
- package/template/koa-rest-api/package.json +20 -21
- package/template/koa-rest-api/src/api/jobs/postJob.test.ts +3 -7
- package/template/koa-rest-api/src/api/jobs/postJob.ts +2 -2
- package/template/koa-rest-api/src/framework/validation.test.ts +17 -15
- package/template/koa-rest-api/src/framework/validation.ts +66 -12
- package/template/koa-rest-api/src/testing/types.ts +5 -10
- package/template/koa-rest-api/src/types/jobs.ts +5 -10
- package/template/lambda-sqs-worker/.buildkite/pipeline.yml +4 -4
- package/template/lambda-sqs-worker/Dockerfile +1 -1
- package/template/lambda-sqs-worker/package.json +16 -20
- package/template/lambda-sqs-worker/src/app.ts +2 -2
- package/template/lambda-sqs-worker/src/framework/validation.test.ts +37 -17
- package/template/lambda-sqs-worker/src/framework/validation.ts +10 -2
- package/template/lambda-sqs-worker/src/services/jobScorer.ts +2 -2
- package/template/lambda-sqs-worker/src/testing/types.ts +5 -10
- package/template/lambda-sqs-worker/src/types/jobScorer.ts +9 -16
- package/template/lambda-sqs-worker/src/types/pipelineEvents.ts +13 -20
- package/template/lambda-sqs-worker/tsconfig.json +13 -0
- package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +4 -4
- package/template/lambda-sqs-worker-cdk/Dockerfile +1 -1
- package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +6 -0
- package/template/lambda-sqs-worker-cdk/infra/appStack.ts +3 -3
- package/template/lambda-sqs-worker-cdk/infra/index.ts +2 -2
- package/template/lambda-sqs-worker-cdk/package.json +14 -14
- package/template/lambda-sqs-worker-cdk/shared/context-types.ts +16 -25
- package/template/lambda-sqs-worker-cdk/tsconfig.json +13 -0
- package/template/oss-npm-package/.nvmrc +1 -1
- package/template/oss-npm-package/_package.json +1 -1
- package/template/private-npm-package/.nvmrc +1 -1
- package/template/private-npm-package/_package.json +1 -1
- package/jest/resolver.js +0 -24
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/cli/configure/modules/skubaDive.ts"],
|
|
4
|
+
"sourcesContent": ["import path from 'path';\n\nimport { SKUBA_DIVE_HOOKS } from '../dependencies/skubaDive';\nimport { prependImport, stripImports } from '../processing/javascript';\nimport { loadFiles } from '../processing/loadFiles';\nimport { parsePackage } from '../processing/package';\nimport type { Module, Options } from '../types';\n\nconst DEFAULT_FILENAME = 'src/register.ts';\n\nexport const skubaDiveModule = ({ entryPoint, type }: Options): Module => {\n // skuba-dive is a runtime component; it's not appropriate for packages\n if (type === 'package') {\n return {};\n }\n\n return {\n ...loadFiles(DEFAULT_FILENAME, 'package.json'),\n\n [entryPoint]: (inputFile, files) => {\n const packageJson = parsePackage(files['package.json']);\n\n const registerFile = files[DEFAULT_FILENAME];\n\n if (\n !packageJson?.dependencies?.['skuba-dive'] ||\n inputFile === undefined ||\n inputFile.includes('skuba-dive/register') ||\n registerFile?.includes('skuba-dive/register')\n ) {\n return inputFile;\n }\n\n const outputFile = stripImports(SKUBA_DIVE_HOOKS, inputFile);\n\n const relativeToSrc = path.posix.relative(\n path.join(entryPoint, '..'),\n 'src',\n );\n\n // import skuba-dive directly from the entry point\n if (relativeToSrc === '') {\n return prependImport('skuba-dive/register', outputFile);\n }\n\n // import skuba-dive via src/register.ts\n files[DEFAULT_FILENAME] = prependImport(\n 'skuba-dive/register',\n registerFile,\n );\n\n return prependImport(`${relativeToSrc}/register`, outputFile);\n },\n };\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,uBAAiC;AACjC,wBAA4C;AAC5C,uBAA0B;AAC1B,qBAA6B;AAG7B,MAAM,mBAAmB;AAElB,MAAM,kBAAkB,CAAC,EAAE,YAAY,KAAK,MAAuB;AAExE,MAAI,SAAS,WAAW;AACtB,WAAO,CAAC;AAAA,EACV;AAEA,SAAO;AAAA,IACL,OAAG,4BAAU,kBAAkB,cAAc;AAAA,IAE7C,CAAC,aAAa,CAAC,WAAW,UAAU;AAClC,YAAM,kBAAc,6BAAa,MAAM,eAAe;AAEtD,YAAM,eAAe,MAAM;AAE3B,UACE,CAAC,aAAa,eAAe,iBAC7B,cAAc,UACd,UAAU,SAAS,qBAAqB,KACxC,cAAc,SAAS,qBAAqB,GAC5C;AACA,eAAO;AAAA,MACT;AAEA,YAAM,iBAAa,gCAAa,mCAAkB,SAAS;AAE3D,YAAM,gBAAgB,YAAAA,QAAK,MAAM;AAAA,QAC/B,YAAAA,QAAK,KAAK,YAAY,IAAI;AAAA,QAC1B;AAAA,MACF;AAGA,UAAI,kBAAkB,IAAI;AACxB,mBAAO,iCAAc,uBAAuB,UAAU;AAAA,MACxD;AAGA,YAAM,wBAAoB;AAAA,QACxB;AAAA,QACA;AAAA,MACF;AAEA,iBAAO,iCAAc,GAAG,0BAA0B,UAAU;AAAA,IAC9D;AAAA,EACF;AACF;",
|
|
6
|
+
"names": ["path"]
|
|
7
|
+
}
|
|
@@ -1,66 +1,87 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var tsconfig_exports = {};
|
|
20
|
+
__export(tsconfig_exports, {
|
|
21
|
+
tsconfigModule: () => tsconfigModule
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(tsconfig_exports);
|
|
24
|
+
var import_template = require("../../../utils/template");
|
|
25
|
+
var import_validation = require("../../../utils/validation");
|
|
26
|
+
var import_json = require("../processing/json");
|
|
27
|
+
var import_loadFiles = require("../processing/loadFiles");
|
|
28
|
+
var import_record = require("../processing/record");
|
|
29
|
+
const tsconfigModule = async ({
|
|
30
|
+
firstRun,
|
|
31
|
+
type
|
|
32
|
+
}) => {
|
|
33
|
+
const [buildFile, baseFile] = await Promise.all([
|
|
34
|
+
(0, import_template.readBaseTemplateFile)("tsconfig.build.json"),
|
|
35
|
+
(0, import_template.readBaseTemplateFile)("tsconfig.json")
|
|
36
|
+
]);
|
|
37
|
+
const baseData = (0, import_json.parseObject)(baseFile);
|
|
38
|
+
if (type === "package" && (0, import_validation.hasProp)(baseData, "compilerOptions") && (0, import_validation.isObject)(baseData.compilerOptions)) {
|
|
39
|
+
delete baseData.compilerOptions.baseUrl;
|
|
40
|
+
delete baseData.compilerOptions.paths;
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
...(0, import_loadFiles.loadFiles)("Dockerfile"),
|
|
44
|
+
"tsconfig.build.json": (inputFile) => inputFile ?? buildFile,
|
|
45
|
+
"tsconfig.json": (inputFile, files, initialFiles) => {
|
|
46
|
+
const inputData = (0, import_json.parseObject)(inputFile);
|
|
47
|
+
let outDir;
|
|
48
|
+
if ((0, import_validation.hasProp)(inputData, "compilerOptions") && (0, import_validation.hasStringProp)(inputData.compilerOptions, "outDir")) {
|
|
49
|
+
outDir = inputData.compilerOptions.outDir.replace(/\/$/, "");
|
|
50
|
+
}
|
|
51
|
+
if (outDir !== void 0 && outDir !== "lib") {
|
|
52
|
+
files.Dockerfile = files.Dockerfile?.replace(
|
|
53
|
+
new RegExp(`([^\\w])${outDir}([^\\w])`, "g"),
|
|
54
|
+
"$1lib$2"
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
if ((0, import_validation.hasProp)(baseData, "compilerOptions")) {
|
|
58
|
+
if ((0, import_validation.hasProp)(baseData.compilerOptions, "lib") && (0, import_validation.hasProp)(inputData?.compilerOptions, "lib")) {
|
|
59
|
+
delete baseData.compilerOptions.lib;
|
|
60
|
+
}
|
|
61
|
+
if ((0, import_validation.hasProp)(baseData.compilerOptions, "target") && (0, import_validation.hasProp)(inputData?.compilerOptions, "target")) {
|
|
62
|
+
delete baseData.compilerOptions.target;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const outputData = (0, import_record.merge)(inputData ?? {}, baseData);
|
|
66
|
+
if ((0, import_validation.hasProp)(outputData, "exclude") && Array.isArray(outputData.exclude)) {
|
|
67
|
+
const { exclude } = outputData;
|
|
68
|
+
const hasLibStar = exclude.includes("lib*/**/*");
|
|
69
|
+
outputData.exclude = exclude.filter(
|
|
70
|
+
(pattern) => !(hasLibStar && (/* @__PURE__ */ new Set(["lib", "lib/**/*"])).has(pattern))
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
if ((0, import_validation.hasProp)(outputData, "include") && !initialFiles["tsconfig.json"]?.includes("skuba/config/tsconfig.json")) {
|
|
74
|
+
delete outputData.include;
|
|
75
|
+
}
|
|
76
|
+
if (firstRun && type === "package" && (0, import_validation.isObject)(outputData.compilerOptions) && !outputData.compilerOptions.removeComments) {
|
|
77
|
+
outputData.compilerOptions.removeComments = false;
|
|
78
|
+
}
|
|
79
|
+
return (0, import_json.formatObject)(outputData);
|
|
26
80
|
}
|
|
27
|
-
|
|
28
|
-
...(0, loadFiles_1.loadFiles)('Dockerfile'),
|
|
29
|
-
'tsconfig.build.json': (inputFile) => inputFile ?? buildFile,
|
|
30
|
-
'tsconfig.json': (inputFile, files, initialFiles) => {
|
|
31
|
-
const inputData = (0, json_1.parseObject)(inputFile);
|
|
32
|
-
let outDir;
|
|
33
|
-
if ((0, validation_1.hasProp)(inputData, 'compilerOptions') &&
|
|
34
|
-
(0, validation_1.hasStringProp)(inputData.compilerOptions, 'outDir')) {
|
|
35
|
-
outDir = inputData.compilerOptions.outDir.replace(/\/$/, '');
|
|
36
|
-
}
|
|
37
|
-
// optimistically rewire Dockerfile for new output directory
|
|
38
|
-
if (outDir !== undefined && outDir !== 'lib') {
|
|
39
|
-
files.Dockerfile = files.Dockerfile?.replace(new RegExp(`([^\\w])${outDir}([^\\w])`, 'g'), '$1lib$2');
|
|
40
|
-
}
|
|
41
|
-
const outputData = (0, record_1.merge)(inputData ?? {}, baseData);
|
|
42
|
-
// Remove `lib/**/*` and `lib`, which duplicate `lib*/**/*`
|
|
43
|
-
if ((0, validation_1.hasProp)(outputData, 'exclude') && Array.isArray(outputData.exclude)) {
|
|
44
|
-
const { exclude } = outputData;
|
|
45
|
-
const hasLibStar = exclude.includes('lib*/**/*');
|
|
46
|
-
outputData.exclude = exclude.filter((pattern) => !(hasLibStar && new Set(['lib', 'lib/**/*']).has(pattern)));
|
|
47
|
-
}
|
|
48
|
-
// for optimal ESLinting, base config should compile all files and leave
|
|
49
|
-
// exclusions to .eslintignore and tsconfig.build.json
|
|
50
|
-
if ((0, validation_1.hasProp)(outputData, 'include') &&
|
|
51
|
-
!initialFiles['tsconfig.json']?.includes('skuba/config/tsconfig.json')) {
|
|
52
|
-
delete outputData.include;
|
|
53
|
-
}
|
|
54
|
-
// Retain comments for package documentation
|
|
55
|
-
if (firstRun &&
|
|
56
|
-
type === 'package' &&
|
|
57
|
-
(0, validation_1.isObject)(outputData.compilerOptions) &&
|
|
58
|
-
!outputData.compilerOptions.removeComments) {
|
|
59
|
-
outputData.compilerOptions.removeComments = false;
|
|
60
|
-
}
|
|
61
|
-
return (0, json_1.formatObject)(outputData);
|
|
62
|
-
},
|
|
63
|
-
};
|
|
81
|
+
};
|
|
64
82
|
};
|
|
65
|
-
|
|
66
|
-
|
|
83
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
84
|
+
0 && (module.exports = {
|
|
85
|
+
tsconfigModule
|
|
86
|
+
});
|
|
87
|
+
//# sourceMappingURL=tsconfig.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/cli/configure/modules/tsconfig.ts"],
|
|
4
|
+
"sourcesContent": ["import { readBaseTemplateFile } from '../../../utils/template';\nimport { hasProp, hasStringProp, isObject } from '../../../utils/validation';\nimport { formatObject, parseObject } from '../processing/json';\nimport { loadFiles } from '../processing/loadFiles';\nimport { merge } from '../processing/record';\nimport type { Module, Options } from '../types';\n\nexport const tsconfigModule = async ({\n firstRun,\n type,\n}: Options): Promise<Module> => {\n const [buildFile, baseFile] = await Promise.all([\n readBaseTemplateFile('tsconfig.build.json'),\n readBaseTemplateFile('tsconfig.json'),\n ]);\n\n const baseData = parseObject(baseFile);\n\n // packages should not use module aliases\n if (\n type === 'package' &&\n hasProp(baseData, 'compilerOptions') &&\n isObject(baseData.compilerOptions)\n ) {\n delete baseData.compilerOptions.baseUrl;\n delete baseData.compilerOptions.paths;\n }\n\n return {\n ...loadFiles('Dockerfile'),\n\n 'tsconfig.build.json': (inputFile) => inputFile ?? buildFile,\n\n 'tsconfig.json': (inputFile, files, initialFiles) => {\n const inputData = parseObject(inputFile);\n\n let outDir: string | undefined;\n\n if (\n hasProp(inputData, 'compilerOptions') &&\n hasStringProp(inputData.compilerOptions, 'outDir')\n ) {\n outDir = inputData.compilerOptions.outDir.replace(/\\/$/, '');\n }\n\n // optimistically rewire Dockerfile for new output directory\n if (outDir !== undefined && outDir !== 'lib') {\n files.Dockerfile = files.Dockerfile?.replace(\n new RegExp(`([^\\\\w])${outDir}([^\\\\w])`, 'g'),\n '$1lib$2',\n );\n }\n\n // existing project may target earlier Node.js versions than skuba\n if (hasProp(baseData, 'compilerOptions')) {\n if (\n hasProp(baseData.compilerOptions, 'lib') &&\n hasProp(inputData?.compilerOptions, 'lib')\n ) {\n delete baseData.compilerOptions.lib;\n }\n\n if (\n hasProp(baseData.compilerOptions, 'target') &&\n hasProp(inputData?.compilerOptions, 'target')\n ) {\n delete baseData.compilerOptions.target;\n }\n }\n\n const outputData = merge(inputData ?? {}, baseData);\n\n // Remove `lib/**/*` and `lib`, which duplicate `lib*/**/*`\n if (hasProp(outputData, 'exclude') && Array.isArray(outputData.exclude)) {\n const { exclude } = outputData;\n\n const hasLibStar = exclude.includes('lib*/**/*');\n\n outputData.exclude = exclude.filter(\n (pattern: unknown) =>\n !(hasLibStar && new Set<unknown>(['lib', 'lib/**/*']).has(pattern)),\n );\n }\n\n // for optimal ESLinting, base config should compile all files and leave\n // exclusions to .eslintignore and tsconfig.build.json\n if (\n hasProp(outputData, 'include') &&\n !initialFiles['tsconfig.json']?.includes('skuba/config/tsconfig.json')\n ) {\n delete outputData.include;\n }\n\n // Retain comments for package documentation\n if (\n firstRun &&\n type === 'package' &&\n isObject(outputData.compilerOptions) &&\n !outputData.compilerOptions.removeComments\n ) {\n outputData.compilerOptions.removeComments = false;\n }\n\n return formatObject(outputData);\n },\n };\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAqC;AACrC,wBAAiD;AACjD,kBAA0C;AAC1C,uBAA0B;AAC1B,oBAAsB;AAGf,MAAM,iBAAiB,OAAO;AAAA,EACnC;AAAA,EACA;AACF,MAAgC;AAC9B,QAAM,CAAC,WAAW,QAAQ,IAAI,MAAM,QAAQ,IAAI;AAAA,QAC9C,sCAAqB,qBAAqB;AAAA,QAC1C,sCAAqB,eAAe;AAAA,EACtC,CAAC;AAED,QAAM,eAAW,yBAAY,QAAQ;AAGrC,MACE,SAAS,iBACT,2BAAQ,UAAU,iBAAiB,SACnC,4BAAS,SAAS,eAAe,GACjC;AACA,WAAO,SAAS,gBAAgB;AAChC,WAAO,SAAS,gBAAgB;AAAA,EAClC;AAEA,SAAO;AAAA,IACL,OAAG,4BAAU,YAAY;AAAA,IAEzB,uBAAuB,CAAC,cAAc,aAAa;AAAA,IAEnD,iBAAiB,CAAC,WAAW,OAAO,iBAAiB;AACnD,YAAM,gBAAY,yBAAY,SAAS;AAEvC,UAAI;AAEJ,cACE,2BAAQ,WAAW,iBAAiB,SACpC,iCAAc,UAAU,iBAAiB,QAAQ,GACjD;AACA,iBAAS,UAAU,gBAAgB,OAAO,QAAQ,OAAO,EAAE;AAAA,MAC7D;AAGA,UAAI,WAAW,UAAa,WAAW,OAAO;AAC5C,cAAM,aAAa,MAAM,YAAY;AAAA,UACnC,IAAI,OAAO,WAAW,kBAAkB,GAAG;AAAA,UAC3C;AAAA,QACF;AAAA,MACF;AAGA,cAAI,2BAAQ,UAAU,iBAAiB,GAAG;AACxC,gBACE,2BAAQ,SAAS,iBAAiB,KAAK,SACvC,2BAAQ,WAAW,iBAAiB,KAAK,GACzC;AACA,iBAAO,SAAS,gBAAgB;AAAA,QAClC;AAEA,gBACE,2BAAQ,SAAS,iBAAiB,QAAQ,SAC1C,2BAAQ,WAAW,iBAAiB,QAAQ,GAC5C;AACA,iBAAO,SAAS,gBAAgB;AAAA,QAClC;AAAA,MACF;AAEA,YAAM,iBAAa,qBAAM,aAAa,CAAC,GAAG,QAAQ;AAGlD,cAAI,2BAAQ,YAAY,SAAS,KAAK,MAAM,QAAQ,WAAW,OAAO,GAAG;AACvE,cAAM,EAAE,QAAQ,IAAI;AAEpB,cAAM,aAAa,QAAQ,SAAS,WAAW;AAE/C,mBAAW,UAAU,QAAQ;AAAA,UAC3B,CAAC,YACC,EAAE,eAAc,oBAAI,IAAa,CAAC,OAAO,UAAU,CAAC,GAAE,IAAI,OAAO;AAAA,QACrE;AAAA,MACF;AAIA,cACE,2BAAQ,YAAY,SAAS,KAC7B,CAAC,aAAa,kBAAkB,SAAS,4BAA4B,GACrE;AACA,eAAO,WAAW;AAAA,MACpB;AAGA,UACE,YACA,SAAS,iBACT,4BAAS,WAAW,eAAe,KACnC,CAAC,WAAW,gBAAgB,gBAC5B;AACA,mBAAW,gBAAgB,iBAAiB;AAAA,MAC9C;AAEA,iBAAO,0BAAa,UAAU;AAAA,IAChC;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,7 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var tslint_exports = {};
|
|
20
|
+
__export(tslint_exports, {
|
|
21
|
+
tslintModule: () => tslintModule
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(tslint_exports);
|
|
24
|
+
var import_deleteFiles = require("../processing/deleteFiles");
|
|
25
|
+
const tslintModule = () => (0, import_deleteFiles.deleteFiles)("tslint.json", "tslint.yaml");
|
|
26
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
27
|
+
0 && (module.exports = {
|
|
28
|
+
tslintModule
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=tslint.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/cli/configure/modules/tslint.ts"],
|
|
4
|
+
"sourcesContent": ["import { deleteFiles } from '../processing/deleteFiles';\nimport type { Module } from '../types';\n\nexport const tslintModule = (): Module =>\n deleteFiles('tslint.json', 'tslint.yaml');\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAA4B;AAGrB,MAAM,eAAe,UAC1B,gCAAY,eAAe,aAAa;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,9 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var deleteFiles_exports = {};
|
|
20
|
+
__export(deleteFiles_exports, {
|
|
21
|
+
deleteFiles: () => deleteFiles
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(deleteFiles_exports);
|
|
24
|
+
const deleteFiles = (...filenames) => Object.fromEntries(
|
|
25
|
+
filenames.map((filename) => [filename, () => void 0])
|
|
26
|
+
);
|
|
27
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
+
0 && (module.exports = {
|
|
29
|
+
deleteFiles
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=deleteFiles.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/cli/configure/processing/deleteFiles.ts"],
|
|
4
|
+
"sourcesContent": ["import type { Module } from '../types';\n\n/**\n * Load files into cache and schedule them for deletion.\n */\nexport const deleteFiles = (...filenames: string[]): Module =>\n Object.fromEntries(\n filenames.map((filename) => [filename, () => undefined] as const),\n );\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKO,MAAM,cAAc,IAAI,cAC7B,OAAO;AAAA,EACL,UAAU,IAAI,CAAC,aAAa,CAAC,UAAU,MAAM,MAAS,CAAU;AAClE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,68 +1,74 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var ignoreFile_exports = {};
|
|
20
|
+
__export(ignoreFile_exports, {
|
|
21
|
+
generateSimpleVariants: () => generateSimpleVariants,
|
|
22
|
+
mergeWithIgnoreFile: () => mergeWithIgnoreFile
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(ignoreFile_exports);
|
|
25
|
+
const OUTDATED_PATTERNS = ["node_modules_bak/", "tmp-*/"];
|
|
9
26
|
const ASTERISKS = /\*/g;
|
|
10
27
|
const LEADING_SLASH = /^\//;
|
|
11
28
|
const TRAILING_SLASH = /\/$/;
|
|
12
|
-
/**
|
|
13
|
-
* Generate simple variants of an ignore pattern for exact matching purposes.
|
|
14
|
-
*
|
|
15
|
-
* Note that these patterns are not actually equivalent (e.g. `lib` matches more
|
|
16
|
-
* than `lib/`) but they generally represent the same _intent_.
|
|
17
|
-
*/
|
|
18
29
|
const generateSimpleVariants = (patterns) => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
set.add(`${stripped}/`);
|
|
33
|
-
set.add(`/${stripped}/`);
|
|
34
|
-
}
|
|
30
|
+
const set = /* @__PURE__ */ new Set();
|
|
31
|
+
for (const pattern of patterns) {
|
|
32
|
+
const deAsterisked = pattern.replace(ASTERISKS, "");
|
|
33
|
+
const stripped = deAsterisked.replace(LEADING_SLASH, "").replace(TRAILING_SLASH, "");
|
|
34
|
+
set.add(pattern);
|
|
35
|
+
set.add(deAsterisked);
|
|
36
|
+
set.add(deAsterisked.replace(LEADING_SLASH, ""));
|
|
37
|
+
set.add(deAsterisked.replace(TRAILING_SLASH, ""));
|
|
38
|
+
set.add(stripped);
|
|
39
|
+
if (stripped !== "") {
|
|
40
|
+
set.add(`/${stripped}`);
|
|
41
|
+
set.add(`${stripped}/`);
|
|
42
|
+
set.add(`/${stripped}/`);
|
|
35
43
|
}
|
|
36
|
-
|
|
37
|
-
|
|
44
|
+
}
|
|
45
|
+
set.delete("");
|
|
46
|
+
return set;
|
|
38
47
|
};
|
|
39
|
-
exports.generateSimpleVariants = generateSimpleVariants;
|
|
40
48
|
const mergeWithIgnoreFile = (rawTemplateFile) => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
.join('\n')
|
|
61
|
-
.replace(/\n{3,}/g, '\n\n')
|
|
62
|
-
.trim();
|
|
63
|
-
const outputFile = [templateFile, migratedFile].join('\n\n').trim();
|
|
64
|
-
return `${outputFile}\n`;
|
|
65
|
-
};
|
|
49
|
+
const templateFile = rawTemplateFile.trim();
|
|
50
|
+
const templatePatterns = generateSimpleVariants([
|
|
51
|
+
...OUTDATED_PATTERNS,
|
|
52
|
+
...templateFile.split("\n").map((line) => line.trim())
|
|
53
|
+
]);
|
|
54
|
+
return (rawInputFile) => {
|
|
55
|
+
if (rawInputFile === void 0) {
|
|
56
|
+
return `${templateFile}
|
|
57
|
+
`;
|
|
58
|
+
}
|
|
59
|
+
const replacedFile = rawInputFile.replace(/\r?\n/g, "\n").replace(/# managed by skuba[\s\S]*# end managed by skuba/, templateFile);
|
|
60
|
+
if (replacedFile.includes(templateFile)) {
|
|
61
|
+
return replacedFile;
|
|
62
|
+
}
|
|
63
|
+
const migratedFile = replacedFile.split("\n").filter((line) => !templatePatterns.has(line)).join("\n").replace(/\n{3,}/g, "\n\n").trim();
|
|
64
|
+
const outputFile = [templateFile, migratedFile].join("\n\n").trim();
|
|
65
|
+
return `${outputFile}
|
|
66
|
+
`;
|
|
67
|
+
};
|
|
66
68
|
};
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
70
|
+
0 && (module.exports = {
|
|
71
|
+
generateSimpleVariants,
|
|
72
|
+
mergeWithIgnoreFile
|
|
73
|
+
});
|
|
74
|
+
//# sourceMappingURL=ignoreFile.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/cli/configure/processing/ignoreFile.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Patterns that are superseded by skuba's bundled ignore file patterns and are\n * non-trivial to derive using e.g. `generateSimpleVariants`.\n */\nconst OUTDATED_PATTERNS = ['node_modules_bak/', 'tmp-*/'];\n\nconst ASTERISKS = /\\*/g;\nconst LEADING_SLASH = /^\\//;\nconst TRAILING_SLASH = /\\/$/;\n\n/**\n * Generate simple variants of an ignore pattern for exact matching purposes.\n *\n * Note that these patterns are not actually equivalent (e.g. `lib` matches more\n * than `lib/`) but they generally represent the same _intent_.\n */\nexport const generateSimpleVariants = (patterns: string[]) => {\n const set = new Set<string>();\n\n for (const pattern of patterns) {\n const deAsterisked = pattern.replace(ASTERISKS, '');\n const stripped = deAsterisked\n .replace(LEADING_SLASH, '')\n .replace(TRAILING_SLASH, '');\n\n set.add(pattern);\n set.add(deAsterisked);\n set.add(deAsterisked.replace(LEADING_SLASH, ''));\n set.add(deAsterisked.replace(TRAILING_SLASH, ''));\n set.add(stripped);\n\n if (stripped !== '') {\n set.add(`/${stripped}`);\n set.add(`${stripped}/`);\n set.add(`/${stripped}/`);\n }\n }\n\n set.delete('');\n\n return set;\n};\n\nexport const mergeWithIgnoreFile = (rawTemplateFile: string) => {\n const templateFile = rawTemplateFile.trim();\n\n const templatePatterns = generateSimpleVariants([\n ...OUTDATED_PATTERNS,\n ...templateFile.split('\\n').map((line) => line.trim()),\n ]);\n\n return (rawInputFile?: string) => {\n if (rawInputFile === undefined) {\n return `${templateFile}\\n`;\n }\n\n const replacedFile = rawInputFile\n .replace(/\\r?\\n/g, '\\n')\n .replace(/# managed by skuba[\\s\\S]*# end managed by skuba/, templateFile);\n\n if (replacedFile.includes(templateFile)) {\n return replacedFile;\n }\n\n // Crunch the existing lines of a non-skuba config.\n const migratedFile = replacedFile\n .split('\\n')\n .filter((line) => !templatePatterns.has(line))\n .join('\\n')\n .replace(/\\n{3,}/g, '\\n\\n')\n .trim();\n\n const outputFile = [templateFile, migratedFile].join('\\n\\n').trim();\n\n return `${outputFile}\\n`;\n };\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,MAAM,oBAAoB,CAAC,qBAAqB,QAAQ;AAExD,MAAM,YAAY;AAClB,MAAM,gBAAgB;AACtB,MAAM,iBAAiB;AAQhB,MAAM,yBAAyB,CAAC,aAAuB;AAC5D,QAAM,MAAM,oBAAI,IAAY;AAE5B,aAAW,WAAW,UAAU;AAC9B,UAAM,eAAe,QAAQ,QAAQ,WAAW,EAAE;AAClD,UAAM,WAAW,aACd,QAAQ,eAAe,EAAE,EACzB,QAAQ,gBAAgB,EAAE;AAE7B,QAAI,IAAI,OAAO;AACf,QAAI,IAAI,YAAY;AACpB,QAAI,IAAI,aAAa,QAAQ,eAAe,EAAE,CAAC;AAC/C,QAAI,IAAI,aAAa,QAAQ,gBAAgB,EAAE,CAAC;AAChD,QAAI,IAAI,QAAQ;AAEhB,QAAI,aAAa,IAAI;AACnB,UAAI,IAAI,IAAI,UAAU;AACtB,UAAI,IAAI,GAAG,WAAW;AACtB,UAAI,IAAI,IAAI,WAAW;AAAA,IACzB;AAAA,EACF;AAEA,MAAI,OAAO,EAAE;AAEb,SAAO;AACT;AAEO,MAAM,sBAAsB,CAAC,oBAA4B;AAC9D,QAAM,eAAe,gBAAgB,KAAK;AAE1C,QAAM,mBAAmB,uBAAuB;AAAA,IAC9C,GAAG;AAAA,IACH,GAAG,aAAa,MAAM,IAAI,EAAE,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC;AAAA,EACvD,CAAC;AAED,SAAO,CAAC,iBAA0B;AAChC,QAAI,iBAAiB,QAAW;AAC9B,aAAO,GAAG;AAAA;AAAA,IACZ;AAEA,UAAM,eAAe,aAClB,QAAQ,UAAU,IAAI,EACtB,QAAQ,mDAAmD,YAAY;AAE1E,QAAI,aAAa,SAAS,YAAY,GAAG;AACvC,aAAO;AAAA,IACT;AAGA,UAAM,eAAe,aAClB,MAAM,IAAI,EACV,OAAO,CAAC,SAAS,CAAC,iBAAiB,IAAI,IAAI,CAAC,EAC5C,KAAK,IAAI,EACT,QAAQ,WAAW,MAAM,EACzB,KAAK;AAER,UAAM,aAAa,CAAC,cAAc,YAAY,EAAE,KAAK,MAAM,EAAE,KAAK;AAElE,WAAO,GAAG;AAAA;AAAA,EACZ;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,18 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var javascript_exports = {};
|
|
20
|
+
__export(javascript_exports, {
|
|
21
|
+
prependImport: () => prependImport,
|
|
22
|
+
stripImports: () => stripImports
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(javascript_exports);
|
|
25
|
+
const prependImport = (name, file) => [`import '${name}';
|
|
26
|
+
`, file].filter((value) => value !== void 0).join("\n");
|
|
8
27
|
const stripImports = (names, inputFile) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
.join('\n')
|
|
14
|
-
.trim();
|
|
15
|
-
return `${outputFile}\n`;
|
|
28
|
+
const searchStrings = names.flatMap((name) => [`'${name}'`, `"${name}"`]);
|
|
29
|
+
const outputFile = inputFile.split(/\r?\n/).filter((line) => !searchStrings.some((str) => line.includes(str))).join("\n").trim();
|
|
30
|
+
return `${outputFile}
|
|
31
|
+
`;
|
|
16
32
|
};
|
|
17
|
-
|
|
18
|
-
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
prependImport,
|
|
36
|
+
stripImports
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=javascript.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/cli/configure/processing/javascript.ts"],
|
|
4
|
+
"sourcesContent": ["export const prependImport = (name: string, file?: string) =>\n [`import '${name}';\\n`, file]\n .filter((value) => value !== undefined)\n .join('\\n');\n\nexport const stripImports = (names: readonly string[], inputFile: string) => {\n const searchStrings = names.flatMap((name) => [`'${name}'`, `\"${name}\"`]);\n\n const outputFile = inputFile\n .split(/\\r?\\n/)\n .filter((line) => !searchStrings.some((str) => line.includes(str)))\n .join('\\n')\n .trim();\n\n return `${outputFile}\\n`;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,gBAAgB,CAAC,MAAc,SAC1C,CAAC,WAAW;AAAA,GAAY,IAAI,EACzB,OAAO,CAAC,UAAU,UAAU,MAAS,EACrC,KAAK,IAAI;AAEP,MAAM,eAAe,CAAC,OAA0B,cAAsB;AAC3E,QAAM,gBAAgB,MAAM,QAAQ,CAAC,SAAS,CAAC,IAAI,SAAS,IAAI,OAAO,CAAC;AAExE,QAAM,aAAa,UAChB,MAAM,OAAO,EACb,OAAO,CAAC,SAAS,CAAC,cAAc,KAAK,CAAC,QAAQ,KAAK,SAAS,GAAG,CAAC,CAAC,EACjE,KAAK,IAAI,EACT,KAAK;AAER,SAAO,GAAG;AAAA;AACZ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,26 +1,57 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var json_exports = {};
|
|
20
|
+
__export(json_exports, {
|
|
21
|
+
formatObject: () => formatObject,
|
|
22
|
+
parseObject: () => parseObject
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(json_exports);
|
|
25
|
+
var import_validation = require("../../../utils/validation");
|
|
26
|
+
var import_prettier = require("./prettier");
|
|
6
27
|
const formatObject = (data, filepath) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
28
|
+
const sortedData = Object.fromEntries(
|
|
29
|
+
Object.entries(data).sort(
|
|
30
|
+
([keyA], [keyB]) => String(keyA).localeCompare(String(keyB))
|
|
31
|
+
)
|
|
32
|
+
);
|
|
33
|
+
const output = JSON.stringify(sortedData, null, 2);
|
|
34
|
+
return (0, import_prettier.formatPrettier)(
|
|
35
|
+
output,
|
|
36
|
+
filepath === void 0 ? { parser: "json" } : { filepath }
|
|
37
|
+
);
|
|
10
38
|
};
|
|
11
|
-
exports.formatObject = formatObject;
|
|
12
39
|
const parseObject = (input) => {
|
|
13
|
-
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
try {
|
|
17
|
-
const data = JSON.parse(input);
|
|
18
|
-
if ((0, validation_1.isObject)(data)) {
|
|
19
|
-
return data;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
catch { }
|
|
40
|
+
if (input === void 0) {
|
|
23
41
|
return;
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
const data = JSON.parse(input);
|
|
45
|
+
if ((0, import_validation.isObject)(data)) {
|
|
46
|
+
return data;
|
|
47
|
+
}
|
|
48
|
+
} catch {
|
|
49
|
+
}
|
|
50
|
+
return;
|
|
24
51
|
};
|
|
25
|
-
|
|
26
|
-
|
|
52
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
+
0 && (module.exports = {
|
|
54
|
+
formatObject,
|
|
55
|
+
parseObject
|
|
56
|
+
});
|
|
57
|
+
//# sourceMappingURL=json.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/cli/configure/processing/json.ts"],
|
|
4
|
+
"sourcesContent": ["import { isObject } from '../../../utils/validation';\n\nimport { formatPrettier } from './prettier';\n\nexport const formatObject = (\n data: Record<Exclude<PropertyKey, symbol>, unknown>,\n filepath?: string,\n) => {\n const sortedData = Object.fromEntries(\n Object.entries(data).sort(([keyA], [keyB]) =>\n String(keyA).localeCompare(String(keyB)),\n ),\n );\n\n const output = JSON.stringify(sortedData, null, 2);\n\n return formatPrettier(\n output,\n filepath === undefined ? { parser: 'json' } : { filepath },\n );\n};\n\nexport const parseObject = (\n input: string | undefined,\n): Record<Exclude<PropertyKey, symbol>, unknown> | undefined => {\n if (input === undefined) {\n return;\n }\n\n try {\n const data = JSON.parse(input) as unknown;\n\n if (isObject(data)) {\n return data;\n }\n } catch {}\n\n return;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAyB;AAEzB,sBAA+B;AAExB,MAAM,eAAe,CAC1B,MACA,aACG;AACH,QAAM,aAAa,OAAO;AAAA,IACxB,OAAO,QAAQ,IAAI,EAAE;AAAA,MAAK,CAAC,CAAC,IAAI,GAAG,CAAC,IAAI,MACtC,OAAO,IAAI,EAAE,cAAc,OAAO,IAAI,CAAC;AAAA,IACzC;AAAA,EACF;AAEA,QAAM,SAAS,KAAK,UAAU,YAAY,MAAM,CAAC;AAEjD,aAAO;AAAA,IACL;AAAA,IACA,aAAa,SAAY,EAAE,QAAQ,OAAO,IAAI,EAAE,SAAS;AAAA,EAC3D;AACF;AAEO,MAAM,cAAc,CACzB,UAC8D;AAC9D,MAAI,UAAU,QAAW;AACvB;AAAA,EACF;AAEA,MAAI;AACF,UAAM,OAAO,KAAK,MAAM,KAAK;AAE7B,YAAI,4BAAS,IAAI,GAAG;AAClB,aAAO;AAAA,IACT;AAAA,EACF,QAAE;AAAA,EAAO;AAET;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|