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
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/cli/configure/modules/prettier.ts"],
|
|
4
4
|
"sourcesContent": ["import { readBaseTemplateFile } from '../../../utils/template.js';\nimport { mergeWithConfigFile } from '../processing/configFile.js';\nimport { deleteFiles } from '../processing/deleteFiles.js';\nimport { withPackage } from '../processing/package.js';\nimport type { Module } from '../types.js';\n\nexport const prettierModule = async (): Promise<Module> => {\n const [configFile, ignoreFile] = await Promise.all([\n readBaseTemplateFile('_.prettierrc.js'),\n readBaseTemplateFile('_.prettierignore'),\n ]);\n\n return {\n ...deleteFiles(\n '.prettierrc',\n '.prettierrc.json',\n '.prettierrc.toml',\n '.prettierrc.yaml',\n '.prettierrc.yml',\n 'prettier.config.js',\n ),\n\n '.prettierignore': mergeWithConfigFile(ignoreFile),\n\n // enforce skuba opinions as there's no value in customising Prettier configs\n '.prettierrc.js': () => configFile,\n\n 'package.json': withPackage(({ prettier, ...data }) => data),\n };\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,SAAS,4BAA4B;AACrC,SAAS,2BAA2B;AACpC,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAGrB,MAAM,iBAAiB,YAA6B;AACzD,QAAM,CAAC,YAAY,UAAU,IAAI,MAAM,QAAQ,IAAI;AAAA,IACjD,qBAAqB,iBAAiB;AAAA,IACtC,qBAAqB,kBAAkB;AAAA,EACzC,CAAC;AAED,SAAO;AAAA,IACL,GAAG;AAAA,MACD;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IAEA,mBAAmB,oBAAoB,UAAU;AAAA;AAAA,IAGjD,kBAAkB,MAAM;AAAA,IAExB,gBAAgB,YAAY,CAAC,EAAE,UAAU,GAAG,KAAK,MAAM,IAAI;AAAA,EAC7D;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
import { readBaseTemplateFile } from "../../../utils/template.js";
|
|
3
2
|
import { deleteFiles } from "../processing/deleteFiles.js";
|
|
4
3
|
import { withPackage } from "../processing/package.js";
|
|
@@ -11,11 +10,11 @@ const OTHER_CONFIG_FILENAMES = [
|
|
|
11
10
|
"renovate.json",
|
|
12
11
|
"renovate.json5"
|
|
13
12
|
];
|
|
14
|
-
|
|
13
|
+
const RENOVATE_CONFIG_FILENAMES = [
|
|
15
14
|
".github/renovate.json5",
|
|
16
15
|
...OTHER_CONFIG_FILENAMES
|
|
17
16
|
];
|
|
18
|
-
|
|
17
|
+
const renovateModule = async ({ type }) => {
|
|
19
18
|
const configFile = await readBaseTemplateFile(".github/renovate.json5");
|
|
20
19
|
return {
|
|
21
20
|
...deleteFiles(...OTHER_CONFIG_FILENAMES),
|
|
@@ -40,4 +39,8 @@ export const renovateModule = async ({ type }) => {
|
|
|
40
39
|
)
|
|
41
40
|
};
|
|
42
41
|
};
|
|
42
|
+
export {
|
|
43
|
+
RENOVATE_CONFIG_FILENAMES,
|
|
44
|
+
renovateModule
|
|
45
|
+
};
|
|
43
46
|
//# sourceMappingURL=renovate.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/cli/configure/modules/renovate.ts"],
|
|
4
4
|
"sourcesContent": ["import { readBaseTemplateFile } from '../../../utils/template.js';\nimport { deleteFiles } from '../processing/deleteFiles.js';\nimport { withPackage } from '../processing/package.js';\nimport { formatPrettier } from '../processing/prettier.js';\nimport { getFirstDefined } from '../processing/record.js';\nimport type { Module, Options, PackageJson } from '../types.js';\n\nconst OTHER_CONFIG_FILENAMES = [\n '.github/renovate.json',\n '.renovaterc',\n '.renovaterc.json',\n 'renovate.json',\n 'renovate.json5',\n];\n\nexport const RENOVATE_CONFIG_FILENAMES = [\n '.github/renovate.json5',\n ...OTHER_CONFIG_FILENAMES,\n];\n\nexport const renovateModule = async ({ type }: Options): Promise<Module> => {\n const configFile = await readBaseTemplateFile('.github/renovate.json5');\n\n return {\n ...deleteFiles(...OTHER_CONFIG_FILENAMES),\n\n '.github/renovate.json5': (_inputFile, _files, initialFiles) => {\n // allow migration from other Renovate config files\n const inputFile = getFirstDefined(initialFiles, [\n '.github/renovate.json5',\n ...OTHER_CONFIG_FILENAMES,\n ]);\n\n // allow customised Renovate configs that extend a SEEK configuration\n return inputFile?.includes('seek')\n ? formatPrettier(inputFile, { parser: 'json5' })\n : configFile;\n },\n\n /**\n * Ensure Renovate correctly detects the project as an application/library.\n *\n * @see {@link https://docs.renovatebot.com/configuration-options/#rangestrategy }\n * @see {@link https://github.com/renovatebot/renovate/blob/8c361082842bb157d85ca39ecf4f6075730e74bb/lib/manager/npm/extract/type.ts#L3 }\n */\n 'package.json': withPackage(\n ({ private: _, renovate, ...data }) =>\n ({\n ...data,\n private: type !== 'package',\n }) as PackageJson,\n ),\n };\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,SAAS,4BAA4B;AACrC,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAC/B,SAAS,uBAAuB;AAGhC,MAAM,yBAAyB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,MAAM,4BAA4B;AAAA,EACvC;AAAA,EACA,GAAG;AACL;AAEO,MAAM,iBAAiB,OAAO,EAAE,KAAK,MAAgC;AAC1E,QAAM,aAAa,MAAM,qBAAqB,wBAAwB;AAEtE,SAAO;AAAA,IACL,GAAG,YAAY,GAAG,sBAAsB;AAAA,IAExC,0BAA0B,CAAC,YAAY,QAAQ,iBAAiB;AAE9D,YAAM,YAAY,gBAAgB,cAAc;AAAA,QAC9C;AAAA,QACA,GAAG;AAAA,MACL,CAAC;AAGD,aAAO,WAAW,SAAS,MAAM,IAC7B,eAAe,WAAW,EAAE,QAAQ,QAAQ,CAAC,IAC7C;AAAA,IACN;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQA,gBAAgB;AAAA,MACd,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,KAAK,OAC9B;AAAA,QACC,GAAG;AAAA,QACH,SAAS,SAAS;AAAA,MACpB;AAAA,IACJ;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export const serverlessModule = ({}) => ({
|
|
1
|
+
const serverlessModule = ({}) => ({
|
|
3
2
|
"**/serverless*.yml": (inputFile, _files, _initialFiles) => {
|
|
4
3
|
if (!inputFile) {
|
|
5
4
|
return;
|
|
@@ -7,4 +6,7 @@ export const serverlessModule = ({}) => ({
|
|
|
7
6
|
return inputFile.replace(/- (\.?\/)?dist\//g, "- lib/").replace(/handler: (\.?\/)?dist\//g, "handler: lib/");
|
|
8
7
|
}
|
|
9
8
|
});
|
|
9
|
+
export {
|
|
10
|
+
serverlessModule
|
|
11
|
+
};
|
|
10
12
|
//# sourceMappingURL=serverless.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/cli/configure/modules/serverless.ts"],
|
|
4
4
|
"sourcesContent": ["import type { Module, Options } from '../types.js';\n\nexport const serverlessModule = ({}: Options): Module => ({\n '**/serverless*.yml': (inputFile, _files, _initialFiles) => {\n if (!inputFile) {\n // Only configure files that exist.\n return;\n }\n\n return (\n inputFile\n // Rewire packaging patterns.\n .replace(/- (\\.?\\/)?dist\\//g, '- lib/')\n // Rewire handler paths.\n .replace(/handler: (\\.?\\/)?dist\\//g, 'handler: lib/')\n );\n },\n});\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAEO,MAAM,mBAAmB,CAAC,CAAC,OAAwB;AAAA,EACxD,sBAAsB,CAAC,WAAW,QAAQ,kBAAkB;AAC1D,QAAI,CAAC,WAAW;AAEd;AAAA,IACF;AAEA,WACE,UAEG,QAAQ,qBAAqB,QAAQ,EAErC,QAAQ,4BAA4B,eAAe;AAAA,EAE1D;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
import { deleteFiles } from "../processing/deleteFiles.js";
|
|
3
|
-
|
|
2
|
+
const tslintModule = () => deleteFiles("tslint.json", "tslint.yaml");
|
|
3
|
+
export {
|
|
4
|
+
tslintModule
|
|
5
|
+
};
|
|
4
6
|
//# sourceMappingURL=tslint.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/cli/configure/modules/tslint.ts"],
|
|
4
4
|
"sourcesContent": ["import { deleteFiles } from '../processing/deleteFiles.js';\nimport type { Module } from '../types.js';\n\nexport const tslintModule = (): Module =>\n deleteFiles('tslint.json', 'tslint.yaml');\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,SAAS,mBAAmB;AAGrB,MAAM,eAAe,MAC1B,YAAY,eAAe,aAAa;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
import * as z from "zod";
|
|
3
2
|
const OUTDATED_PATTERNS = ["node_modules_bak/", "tmp-*/"];
|
|
4
3
|
const ASTERISKS = /\*/g;
|
|
5
4
|
const LEADING_SLASH = /^\//;
|
|
6
5
|
const TRAILING_SLASH = /\/$/;
|
|
7
|
-
|
|
6
|
+
const generateIgnoreFileSimpleVariants = (patterns) => {
|
|
8
7
|
const set = /* @__PURE__ */ new Set();
|
|
9
8
|
for (const pattern of patterns) {
|
|
10
9
|
const deAsterisked = pattern.replace(ASTERISKS, "");
|
|
@@ -51,8 +50,8 @@ const amendPnpmWorkspaceTemplate = (templateFile, packageJson) => {
|
|
|
51
50
|
return `${beforeKey + targetKey}
|
|
52
51
|
${excludeLines}${afterKey}`;
|
|
53
52
|
};
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
const replaceManagedSection = (input, template) => input.replace(/# managed by skuba[\s\S]*# end managed by skuba/, template);
|
|
54
|
+
const mergeWithConfigFile = (rawTemplateFile, fileType = "ignore", packageJson) => {
|
|
56
55
|
const templateFile = fileType === "pnpm-workspace" ? amendPnpmWorkspaceTemplate(rawTemplateFile.trim(), packageJson) : rawTemplateFile.trim();
|
|
57
56
|
let generator;
|
|
58
57
|
switch (fileType) {
|
|
@@ -88,4 +87,9 @@ export const mergeWithConfigFile = (rawTemplateFile, fileType = "ignore", packag
|
|
|
88
87
|
`;
|
|
89
88
|
};
|
|
90
89
|
};
|
|
90
|
+
export {
|
|
91
|
+
generateIgnoreFileSimpleVariants,
|
|
92
|
+
mergeWithConfigFile,
|
|
93
|
+
replaceManagedSection
|
|
94
|
+
};
|
|
91
95
|
//# sourceMappingURL=configFile.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/cli/configure/processing/configFile.ts"],
|
|
4
4
|
"sourcesContent": ["import * as z from 'zod';\n\n/**\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 generateIgnoreFileSimpleVariants = (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\nconst amendPnpmWorkspaceTemplate = (\n templateFile: string,\n packageJson?: string,\n) => {\n if (!packageJson) {\n return templateFile;\n }\n let rawJSON;\n try {\n rawJSON = JSON.parse(packageJson) as unknown;\n } catch {\n throw new Error('package.json is not valid JSON');\n }\n const parsed = z\n .object({\n minimumReleaseAgeExcludeOverload: z.array(z.string()).optional(),\n })\n .safeParse(rawJSON);\n\n const excludes = parsed.data?.minimumReleaseAgeExcludeOverload;\n if (\n !excludes ||\n Array.isArray(excludes) === false ||\n excludes.some((e) => typeof e !== 'string')\n ) {\n return templateFile;\n }\n\n const targetKey = 'minimumReleaseAgeExclude:';\n const index = templateFile.indexOf(targetKey);\n\n if (index === -1) {\n return templateFile;\n }\n\n const beforeKey = templateFile.substring(0, index);\n const afterKey = templateFile.substring(index + targetKey.length);\n const excludeLines = excludes.map((exclude) => ` - '${exclude}'`).join('\\n');\n\n return `${beforeKey + targetKey}\\n${excludeLines}${afterKey}`;\n};\n\nexport const replaceManagedSection = (input: string, template: string) =>\n input.replace(/# managed by skuba[\\s\\S]*# end managed by skuba/, template);\n\nexport const mergeWithConfigFile = (\n rawTemplateFile: string,\n fileType: 'ignore' | 'pnpm-workspace' = 'ignore',\n packageJson?: string,\n) => {\n const templateFile =\n fileType === 'pnpm-workspace'\n ? amendPnpmWorkspaceTemplate(rawTemplateFile.trim(), packageJson)\n : rawTemplateFile.trim();\n\n let generator: (s: string[], packageJson?: string) => Set<string>;\n\n switch (fileType) {\n case 'ignore':\n generator = generateIgnoreFileSimpleVariants;\n break;\n case 'pnpm-workspace':\n generator = () => new Set<string>();\n break;\n }\n\n const templatePatterns = generator(\n [\n ...OUTDATED_PATTERNS,\n ...templateFile.split('\\n').map((line) => line.trim()),\n ],\n packageJson,\n );\n\n return (rawInputFile?: string) => {\n if (rawInputFile === undefined) {\n return `${templateFile}\\n`;\n }\n\n const replacedFile = replaceManagedSection(\n rawInputFile.replace(/\\r?\\n/g, '\\n'),\n templateFile,\n );\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": "
|
|
5
|
+
"mappings": "AAAA,YAAY,OAAO;AAMnB,MAAM,oBAAoB,CAAC,qBAAqB,QAAQ;AAExD,MAAM,YAAY;AAClB,MAAM,gBAAgB;AACtB,MAAM,iBAAiB;AAQhB,MAAM,mCAAmC,CAAC,aAAuB;AACtE,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,QAAQ,EAAE;AACtB,UAAI,IAAI,GAAG,QAAQ,GAAG;AACtB,UAAI,IAAI,IAAI,QAAQ,GAAG;AAAA,IACzB;AAAA,EACF;AAEA,MAAI,OAAO,EAAE;AAEb,SAAO;AACT;AAEA,MAAM,6BAA6B,CACjC,cACA,gBACG;AACH,MAAI,CAAC,aAAa;AAChB,WAAO;AAAA,EACT;AACA,MAAI;AACJ,MAAI;AACF,cAAU,KAAK,MAAM,WAAW;AAAA,EAClC,QAAQ;AACN,UAAM,IAAI,MAAM,gCAAgC;AAAA,EAClD;AAC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UAAM,eAAe;AAAA,MACnB,aAAa,QAAQ,UAAU,IAAI;AAAA,MACnC;AAAA,IACF;AAEA,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,UAAU;AAAA;AAAA,EACtB;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
export const deleteFiles = (...filenames) => Object.fromEntries(
|
|
1
|
+
const deleteFiles = (...filenames) => Object.fromEntries(
|
|
3
2
|
filenames.map((filename) => [filename, () => void 0])
|
|
4
3
|
);
|
|
4
|
+
export {
|
|
5
|
+
deleteFiles
|
|
6
|
+
};
|
|
5
7
|
//# sourceMappingURL=deleteFiles.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/cli/configure/processing/deleteFiles.ts"],
|
|
4
4
|
"sourcesContent": ["import type { Module } from '../types.js';\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": "
|
|
5
|
+
"mappings": "AAKO,MAAM,cAAc,IAAI,cAC7B,OAAO;AAAA,EACL,UAAU,IAAI,CAAC,aAAa,CAAC,UAAU,MAAM,MAAS,CAAU;AAClE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
export const prependImport = (name, file) => [`import '${name}';
|
|
1
|
+
const prependImport = (name, file) => [`import '${name}';
|
|
3
2
|
`, file].filter((value) => value !== void 0).join("\n");
|
|
4
|
-
|
|
3
|
+
const stripImports = (names, inputFile) => {
|
|
5
4
|
const searchStrings = names.flatMap((name) => [`'${name}'`, `"${name}"`]);
|
|
6
5
|
const outputFile = inputFile.split(/\r?\n/).filter((line) => !searchStrings.some((str) => line.includes(str))).join("\n").trim();
|
|
7
6
|
return `${outputFile}
|
|
8
7
|
`;
|
|
9
8
|
};
|
|
9
|
+
export {
|
|
10
|
+
prependImport,
|
|
11
|
+
stripImports
|
|
12
|
+
};
|
|
10
13
|
//# sourceMappingURL=javascript.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/cli/configure/processing/javascript.ts"],
|
|
4
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": "
|
|
5
|
+
"mappings": "AAAO,MAAM,gBAAgB,CAAC,MAAc,SAC1C,CAAC,WAAW,IAAI;AAAA,GAAQ,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,IAAI,KAAK,IAAI,IAAI,GAAG,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,UAAU;AAAA;AACtB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
import { isObject } from "../../../utils/validation.js";
|
|
3
2
|
import { formatPrettier } from "./prettier.js";
|
|
4
|
-
|
|
3
|
+
const formatObject = (data, filepath) => {
|
|
5
4
|
const sortedData = Object.fromEntries(
|
|
6
5
|
Object.entries(data).sort(
|
|
7
6
|
([keyA], [keyB]) => String(keyA).localeCompare(String(keyB))
|
|
@@ -13,7 +12,7 @@ export const formatObject = (data, filepath) => {
|
|
|
13
12
|
filepath === void 0 ? { parser: "json" } : { filepath }
|
|
14
13
|
);
|
|
15
14
|
};
|
|
16
|
-
|
|
15
|
+
const parseObject = (input) => {
|
|
17
16
|
if (input === void 0) {
|
|
18
17
|
return;
|
|
19
18
|
}
|
|
@@ -26,4 +25,8 @@ export const parseObject = (input) => {
|
|
|
26
25
|
}
|
|
27
26
|
return;
|
|
28
27
|
};
|
|
28
|
+
export {
|
|
29
|
+
formatObject,
|
|
30
|
+
parseObject
|
|
31
|
+
};
|
|
29
32
|
//# sourceMappingURL=json.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/cli/configure/processing/json.ts"],
|
|
4
4
|
"sourcesContent": ["import { isObject } from '../../../utils/validation.js';\n\nimport { formatPrettier } from './prettier.js';\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": "
|
|
5
|
+
"mappings": "AAAA,SAAS,gBAAgB;AAEzB,SAAS,sBAAsB;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,SAAO;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,QAAI,SAAS,IAAI,GAAG;AAClB,aAAO;AAAA,IACT;AAAA,EACF,QAAQ;AAAA,EAAC;AAET;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
export const loadFiles = (...filenames) => Object.fromEntries(
|
|
1
|
+
const loadFiles = (...filenames) => Object.fromEntries(
|
|
3
2
|
filenames.map((filename) => [filename, (file) => file])
|
|
4
3
|
);
|
|
4
|
+
export {
|
|
5
|
+
loadFiles
|
|
6
|
+
};
|
|
5
7
|
//# sourceMappingURL=loadFiles.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/cli/configure/processing/loadFiles.ts"],
|
|
4
4
|
"sourcesContent": ["import type { Module } from '../types.js';\n\n/**\n * Load files into cache to perform side effects in another module.\n */\nexport const loadFiles = (...filenames: string[]): Module =>\n Object.fromEntries(\n filenames.map((filename) => [filename, (file?: string) => file] as const),\n );\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAKO,MAAM,YAAY,IAAI,cAC3B,OAAO;AAAA,EACL,UAAU,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,SAAkB,IAAI,CAAU;AAC1E;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
import { createStringReplacer } from "../../../utils/copy.js";
|
|
3
|
-
|
|
2
|
+
const replacePackageReferences = (props) => createStringReplacer([
|
|
4
3
|
{
|
|
5
4
|
input: new RegExp(`(['"])${props.old.packageName}(['"/])`, "g"),
|
|
6
5
|
output: `$1${props.new.packageName}$2`
|
|
@@ -10,4 +9,7 @@ export const replacePackageReferences = (props) => createStringReplacer([
|
|
|
10
9
|
output: props.new.repoSlug
|
|
11
10
|
}
|
|
12
11
|
]);
|
|
12
|
+
export {
|
|
13
|
+
replacePackageReferences
|
|
14
|
+
};
|
|
13
15
|
//# sourceMappingURL=module.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/cli/configure/processing/module.ts"],
|
|
4
4
|
"sourcesContent": ["import { createStringReplacer } from '../../../utils/copy.js';\n\nexport const replacePackageReferences = (props: {\n old: {\n packageName: string;\n repoSlug: string;\n };\n new: {\n packageName: string;\n repoSlug: string;\n };\n}) =>\n createStringReplacer([\n {\n input: new RegExp(`(['\"])${props.old.packageName}(['\"/])`, 'g'),\n output: `$1${props.new.packageName}$2`,\n },\n {\n input: new RegExp(props.old.repoSlug, 'ig'),\n output: props.new.repoSlug,\n },\n ]);\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,SAAS,4BAA4B;AAE9B,MAAM,2BAA2B,CAAC,UAUvC,qBAAqB;AAAA,EACnB;AAAA,IACE,OAAO,IAAI,OAAO,SAAS,MAAM,IAAI,WAAW,WAAW,GAAG;AAAA,IAC9D,QAAQ,KAAK,MAAM,IAAI,WAAW;AAAA,EACpC;AAAA,EACA;AAAA,IACE,OAAO,IAAI,OAAO,MAAM,IAAI,UAAU,IAAI;AAAA,IAC1C,QAAQ,MAAM,IAAI;AAAA,EACpB;AACF,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
import normalizeData from "normalize-package-data";
|
|
3
2
|
import { parseObject } from "./json.js";
|
|
4
3
|
import { formatPrettier } from "./prettier.js";
|
|
@@ -8,7 +7,7 @@ const normalizeDataWithoutThrowing = (rawData) => {
|
|
|
8
7
|
} catch {
|
|
9
8
|
}
|
|
10
9
|
};
|
|
11
|
-
|
|
10
|
+
const formatPackage = async (rawData) => {
|
|
12
11
|
normalizeDataWithoutThrowing(rawData);
|
|
13
12
|
delete rawData._id;
|
|
14
13
|
if (rawData.name === "") {
|
|
@@ -24,7 +23,7 @@ export const formatPackage = async (rawData) => {
|
|
|
24
23
|
filepath: "package.json"
|
|
25
24
|
});
|
|
26
25
|
};
|
|
27
|
-
|
|
26
|
+
const parsePackage = (input) => {
|
|
28
27
|
const data = parseObject(input);
|
|
29
28
|
if (data === void 0) {
|
|
30
29
|
return;
|
|
@@ -32,7 +31,7 @@ export const parsePackage = (input) => {
|
|
|
32
31
|
normalizeDataWithoutThrowing(data);
|
|
33
32
|
return data;
|
|
34
33
|
};
|
|
35
|
-
|
|
34
|
+
const createDependencyFilter = (names, type) => {
|
|
36
35
|
const set = new Set(names);
|
|
37
36
|
return (data) => ({
|
|
38
37
|
...data,
|
|
@@ -41,9 +40,15 @@ export const createDependencyFilter = (names, type) => {
|
|
|
41
40
|
)
|
|
42
41
|
});
|
|
43
42
|
};
|
|
44
|
-
|
|
43
|
+
const withPackage = (fn) => (input) => {
|
|
45
44
|
const inputObject = parsePackage(input);
|
|
46
45
|
const outputObject = fn(inputObject ?? {});
|
|
47
46
|
return formatPackage(outputObject);
|
|
48
47
|
};
|
|
48
|
+
export {
|
|
49
|
+
createDependencyFilter,
|
|
50
|
+
formatPackage,
|
|
51
|
+
parsePackage,
|
|
52
|
+
withPackage
|
|
53
|
+
};
|
|
49
54
|
//# sourceMappingURL=package.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/cli/configure/processing/package.ts"],
|
|
4
4
|
"sourcesContent": ["import normalizeData from 'normalize-package-data';\n\nimport type { PackageJson } from '../types.js';\n\nimport { parseObject } from './json.js';\nimport { formatPrettier } from './prettier.js';\n\nconst normalizeDataWithoutThrowing = (rawData: PackageJson) => {\n try {\n normalizeData(rawData);\n } catch {\n // `normalize-package-data` can be picky about e.g. the `name` being valid.\n // This creates issues for partially-init-ed projects.\n }\n};\n\nexport const formatPackage = async (rawData: PackageJson) => {\n normalizeDataWithoutThrowing(rawData);\n\n // normalize-package-data fields that aren't useful for applications\n\n delete rawData._id;\n\n if (rawData.name === '') {\n delete rawData.name;\n }\n\n if (rawData.readme === 'ERROR: No README data found!') {\n delete rawData.readme;\n }\n\n if (rawData.version === '') {\n delete rawData.version;\n }\n\n return formatPrettier(JSON.stringify(rawData), {\n filepath: 'package.json',\n });\n};\n\nexport const parsePackage = (\n input: string | undefined,\n): PackageJson | undefined => {\n const data = parseObject(input) as PackageJson | undefined;\n\n if (data === undefined) {\n return;\n }\n\n normalizeDataWithoutThrowing(data);\n\n return data;\n};\n\nexport const createDependencyFilter = (\n names: readonly string[],\n type: 'dependencies' | 'devDependencies',\n) => {\n const set = new Set(names);\n\n return (data: PackageJson) =>\n ({\n ...data,\n [type]: Object.fromEntries(\n Object.entries(data[type] ?? {}).filter(([name]) => !set.has(name)),\n ),\n }) as PackageJson;\n};\n\nexport const withPackage =\n (fn: (data: PackageJson) => PackageJson) => (input: string | undefined) => {\n const inputObject = parsePackage(input);\n\n const outputObject = fn(inputObject ?? {});\n\n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
|
1
|
-
"use strict";
|
|
2
1
|
import prettierConfig from "../../../../config/prettier.js";
|
|
3
|
-
|
|
2
|
+
const formatPrettier = async (source, options) => {
|
|
4
3
|
const prettier = await import("prettier");
|
|
5
4
|
return prettier.format(source, {
|
|
6
5
|
...options,
|
|
7
6
|
...prettierConfig
|
|
8
7
|
});
|
|
9
8
|
};
|
|
9
|
+
export {
|
|
10
|
+
formatPrettier
|
|
11
|
+
};
|
|
10
12
|
//# sourceMappingURL=prettier.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/cli/configure/processing/prettier.ts"],
|
|
4
4
|
"sourcesContent": ["import type prettier from 'prettier';\n\nimport prettierConfig from '../../../../config/prettier.js';\n\ntype Options = Pick<prettier.Options, 'filepath' | 'parser'>;\n\nexport const formatPrettier = async (source: string, options: Options) => {\n const prettier = await import('prettier');\n return prettier.format(source, {\n ...options,\n ...prettierConfig,\n });\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAEA,OAAO,oBAAoB;AAIpB,MAAM,iBAAiB,OAAO,QAAgB,YAAqB;AACxE,QAAM,WAAW,MAAM,OAAO,UAAU;AACxC,SAAO,SAAS,OAAO,QAAQ;AAAA,IAC7B,GAAG;AAAA,IACH,GAAG;AAAA,EACL,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
import mergeWith from "lodash.mergewith";
|
|
3
2
|
const isArray = (value) => Array.isArray(value);
|
|
4
|
-
|
|
3
|
+
const getFirstDefined = (record, keys) => {
|
|
5
4
|
for (const key of keys) {
|
|
6
5
|
const value = record[key];
|
|
7
6
|
if (value !== void 0) {
|
|
@@ -10,16 +9,21 @@ export const getFirstDefined = (record, keys) => {
|
|
|
10
9
|
}
|
|
11
10
|
return;
|
|
12
11
|
};
|
|
13
|
-
|
|
12
|
+
const merge = (obj, src) => mergeWith({}, obj, src, (objValue, srcValue) => {
|
|
14
13
|
if (isArray(objValue) && isArray(srcValue)) {
|
|
15
14
|
return [...new Set(objValue.concat(srcValue))].sort();
|
|
16
15
|
}
|
|
17
16
|
return;
|
|
18
17
|
});
|
|
19
|
-
|
|
18
|
+
const mergeRaw = (obj, src) => mergeWith(
|
|
20
19
|
{},
|
|
21
20
|
obj,
|
|
22
21
|
src,
|
|
23
22
|
(objValue, srcValue) => isArray(objValue) && isArray(srcValue) ? objValue.concat(srcValue) : void 0
|
|
24
23
|
);
|
|
24
|
+
export {
|
|
25
|
+
getFirstDefined,
|
|
26
|
+
merge,
|
|
27
|
+
mergeRaw
|
|
28
|
+
};
|
|
25
29
|
//# sourceMappingURL=record.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/cli/configure/processing/record.ts"],
|
|
4
4
|
"sourcesContent": ["import mergeWith from 'lodash.mergewith';\n\nconst isArray = (value: unknown): value is unknown[] => Array.isArray(value);\n\nexport const getFirstDefined = <T>(\n record: Record<string, T | undefined>,\n keys: string[],\n): T | undefined => {\n for (const key of keys) {\n const value = record[key];\n if (value !== undefined) {\n return value;\n }\n }\n\n return;\n};\n\n/**\n * Merge two objects together.\n *\n * Array properties are sorted and deduped.\n */\nexport const merge = <A, B>(obj: A, src: B) =>\n mergeWith({}, obj, src, (objValue: unknown, srcValue: unknown) => {\n if (isArray(objValue) && isArray(srcValue)) {\n return [...new Set(objValue.concat(srcValue))].sort();\n }\n\n return;\n });\n\n/**\n * Like `merge`, but arrays are not deduped or sorted to preserve order.\n */\nexport const mergeRaw = <A, B>(obj: A, src: B) =>\n mergeWith({}, obj, src, (objValue: unknown, srcValue: unknown) =>\n isArray(objValue) && isArray(srcValue)\n ? objValue.concat(srcValue)\n : undefined,\n );\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,OAAO,eAAe;AAEtB,MAAM,UAAU,CAAC,UAAuC,MAAM,QAAQ,KAAK;AAEpE,MAAM,kBAAkB,CAC7B,QACA,SACkB;AAClB,aAAW,OAAO,MAAM;AACtB,UAAM,QAAQ,OAAO,GAAG;AACxB,QAAI,UAAU,QAAW;AACvB,aAAO;AAAA,IACT;AAAA,EACF;AAEA;AACF;AAOO,MAAM,QAAQ,CAAO,KAAQ,QAClC,UAAU,CAAC,GAAG,KAAK,KAAK,CAAC,UAAmB,aAAsB;AAChE,MAAI,QAAQ,QAAQ,KAAK,QAAQ,QAAQ,GAAG;AAC1C,WAAO,CAAC,GAAG,IAAI,IAAI,SAAS,OAAO,QAAQ,CAAC,CAAC,EAAE,KAAK;AAAA,EACtD;AAEA;AACF,CAAC;AAKI,MAAM,WAAW,CAAO,KAAQ,QACrC;AAAA,EAAU,CAAC;AAAA,EAAG;AAAA,EAAK;AAAA,EAAK,CAAC,UAAmB,aAC1C,QAAQ,QAAQ,KAAK,QAAQ,QAAQ,IACjC,SAAS,OAAO,QAAQ,IACxB;AACN;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
import ts from "typescript";
|
|
3
2
|
import { formatPrettier } from "./prettier.js";
|
|
4
3
|
const BLANK_LINE_PLACEHOLDER = " __BLANK_LINE_PLACEHOLDER__";
|
|
@@ -119,14 +118,14 @@ const createModuleExportsTransformer = (transformProps) => (context) => (rootNod
|
|
|
119
118
|
},
|
|
120
119
|
context
|
|
121
120
|
);
|
|
122
|
-
|
|
121
|
+
const createPropFilter = (names) => (context, props) => {
|
|
123
122
|
const nameSet = new Set(names);
|
|
124
123
|
const factory = context?.factory ?? ts.factory;
|
|
125
124
|
return factory.createNodeArray(
|
|
126
125
|
props.filter((prop) => nameSet.has(getPropName(prop)))
|
|
127
126
|
);
|
|
128
127
|
};
|
|
129
|
-
|
|
128
|
+
const createPropAppender = (appendingProps) => (context, props) => {
|
|
130
129
|
const nameSet = new Set(
|
|
131
130
|
props.map(getPropName).filter((prop) => typeof prop === "string")
|
|
132
131
|
);
|
|
@@ -136,7 +135,7 @@ export const createPropAppender = (appendingProps) => (context, props) => {
|
|
|
136
135
|
...appendingProps.filter((prop) => !nameSet.has(getPropName(prop)))
|
|
137
136
|
]);
|
|
138
137
|
};
|
|
139
|
-
|
|
138
|
+
const readModuleExports = async (inputFile) => {
|
|
140
139
|
let result;
|
|
141
140
|
await transformModuleImportsAndExports(
|
|
142
141
|
inputFile,
|
|
@@ -144,7 +143,7 @@ export const readModuleExports = async (inputFile) => {
|
|
|
144
143
|
);
|
|
145
144
|
return result;
|
|
146
145
|
};
|
|
147
|
-
|
|
146
|
+
const transformModuleImportsAndExports = async (inputFile, transformProps) => {
|
|
148
147
|
const sourceFile = ts.createSourceFile("", inputFile, ts.ScriptTarget.Latest);
|
|
149
148
|
const moduleExportsTransformer = createModuleExportsTransformer(transformProps);
|
|
150
149
|
const result = ts.transform(sourceFile, [
|
|
@@ -160,4 +159,10 @@ export const transformModuleImportsAndExports = async (inputFile, transformProps
|
|
|
160
159
|
const text = ts.createPrinter().printNode(ts.EmitHint.SourceFile, transformedFile, sourceFile).replace(BLANK_LINE_REGEXP, "");
|
|
161
160
|
return formatPrettier(text, { parser: "typescript" });
|
|
162
161
|
};
|
|
162
|
+
export {
|
|
163
|
+
createPropAppender,
|
|
164
|
+
createPropFilter,
|
|
165
|
+
readModuleExports,
|
|
166
|
+
transformModuleImportsAndExports
|
|
167
|
+
};
|
|
163
168
|
//# sourceMappingURL=typescript.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/cli/configure/processing/typescript.ts"],
|
|
4
4
|
"sourcesContent": ["import ts from 'typescript';\n\nimport { formatPrettier } from './prettier.js';\n\ntype Props = ts.NodeArray<ts.ObjectLiteralElementLike>;\n\ntype Transformer<T> = (context: ts.TransformationContext | null, props: T) => T;\n\nconst BLANK_LINE_PLACEHOLDER = ' __BLANK_LINE_PLACEHOLDER__';\nconst BLANK_LINE_REGEXP = new RegExp(`//${BLANK_LINE_PLACEHOLDER}`, 'g');\n\n/**\n * Append a placeholder comment to the start of a node.\n *\n * Blank lines can be annotated and preserved through the TypeScript printer\n * when this is paired with a dodgy `String.prototype.replace` post-processor.\n */\nconst withLeadingBlankLinePlaceholder = <T extends ts.Node>(node: T) =>\n ts.addSyntheticLeadingComment(\n node,\n ts.SyntaxKind.SingleLineCommentTrivia,\n BLANK_LINE_PLACEHOLDER,\n true,\n );\n\n/**\n * Create the following expression:\n *\n * ```javascript\n * export default {};\n * ```\n */\nconst createExportDefaultObjectLiteralExpression = (\n factory: ts.NodeFactory,\n props: Props,\n callExpression?: ts.Expression,\n): ts.ExportAssignment =>\n factory.createExportAssignment(\n undefined,\n undefined,\n callExpression === undefined\n ? factory.createObjectLiteralExpression(props, true)\n : factory.createCallExpression(callExpression, undefined, [\n factory.createObjectLiteralExpression(props, true),\n ]),\n );\n\nconst createImportFromExpression = (\n factory: ts.NodeFactory,\n moduleName: string,\n importNames: string | string[],\n) => {\n const importClause =\n typeof importNames === 'string'\n ? factory.createImportClause(\n false,\n factory.createIdentifier(importNames),\n undefined,\n )\n : factory.createImportClause(\n false,\n undefined,\n factory.createNamedImports(\n importNames.map((importName) =>\n factory.createImportSpecifier(\n false,\n undefined,\n factory.createIdentifier(importName),\n ),\n ),\n ),\n );\n\n return factory.createImportDeclaration(\n undefined,\n importClause,\n factory.createStringLiteral(moduleName),\n );\n};\n\nconst getPropName = (prop: ts.ObjectLiteralElementLike) =>\n ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name)\n ? prop.name.escapedText.toString()\n : undefined;\n\nconst expressionAsDefaultExport = (\n context: ts.TransformationContext,\n transformProps: Transformer<Props>,\n expression: ts.Expression,\n): ts.ExportAssignment | null =>\n withLeadingBlankLinePlaceholder(\n (() => {\n // {}\n if (ts.isObjectLiteralExpression(expression)) {\n const props = transformProps(context, expression.properties);\n\n return createExportDefaultObjectLiteralExpression(\n context.factory,\n props,\n );\n }\n\n // fn({})\n if (\n ts.isCallExpression(expression) &&\n expression.arguments.length === 1 &&\n expression.arguments[0]\n ) {\n const [firstArgument] = expression.arguments;\n\n if (ts.isObjectLiteralExpression(firstArgument)) {\n const props = transformProps(context, firstArgument.properties);\n\n return createExportDefaultObjectLiteralExpression(\n context.factory,\n props,\n expression.expression,\n );\n }\n }\n\n // Anything else\n return context.factory.createExportAssignment(\n undefined,\n undefined,\n expression,\n );\n })(),\n );\n\n/**\n * Mutate `const x = require('')` into `import x from ''`:\n *\n * ```javascript\n * const x = require('');\n *\n * const { x } = require('');\n * ```\n *\n * There's no recursion needed here as we expect the import statement to be a\n * top-level node and therefore an immediate child of the source file.\n */\nconst requireImportsTransformer: ts.TransformerFactory<ts.Node> =\n (context) => (rootNode) =>\n ts.visitEachChild(\n rootNode,\n (node) => {\n let declaration, moduleName;\n\n if (\n ts.isVariableStatement(node) &&\n node.declarationList.declarations.length === 1 &&\n node.declarationList.declarations[0] &&\n ts.isVariableDeclaration(\n (declaration = node.declarationList.declarations[0]),\n ) &&\n declaration.initializer &&\n ts.isCallExpression(declaration.initializer) &&\n declaration.initializer.arguments.length === 1 &&\n declaration.initializer.arguments[0] &&\n ts.isStringLiteral(\n (moduleName = declaration.initializer.arguments[0]),\n ) &&\n ts.isIdentifier(declaration.initializer.expression) &&\n declaration.initializer.expression.text === 'require'\n ) {\n // const x\n if (ts.isIdentifier(declaration.name)) {\n return createImportFromExpression(\n context.factory,\n moduleName.text,\n declaration.name.text,\n );\n }\n\n // const { x }\n if (ts.isObjectBindingPattern(declaration.name)) {\n return createImportFromExpression(\n context.factory,\n moduleName.text,\n declaration.name.elements.flatMap((element) =>\n ts.isIdentifier(element.name) ? [element.name.text] : [],\n ),\n );\n }\n }\n\n return node;\n },\n context,\n );\n\n/**\n * Create a transformer to mutate `module.exports` and `export default`:\n *\n * ```javascript\n * export default {};\n *\n * module.exports = {};\n * ```\n *\n * If the export is a call expression with a single argument, it will try to\n * transform the props of that argument.\n *\n * ```javascript\n * module.exports = fn({});\n * ```\n *\n * There's no recursion needed here as we expect the export statement to be a\n * top-level node and therefore an immediate child of the source file.\n */\nconst createModuleExportsTransformer =\n (transformProps: Transformer<Props>): ts.TransformerFactory<ts.Node> =>\n (context) =>\n (rootNode) =>\n ts.visitEachChild(\n rootNode,\n (node) => {\n // module.exports =\n if (\n ts.isExpressionStatement(node) &&\n ts.isBinaryExpression(node.expression) &&\n ts.isPropertyAccessExpression(node.expression.left) &&\n ts.isIdentifier(node.expression.left.expression) &&\n node.expression.left.expression.escapedText.toString() === 'module' &&\n node.expression.left.name.text === 'exports' &&\n node.expression.operatorToken.kind === ts.SyntaxKind.EqualsToken\n ) {\n return (\n expressionAsDefaultExport(\n context,\n transformProps,\n node.expression.right,\n ) ?? node\n );\n }\n\n // export default\n if (ts.isExportAssignment(node)) {\n return (\n expressionAsDefaultExport(\n context,\n transformProps,\n node.expression,\n ) ?? node\n );\n }\n\n return node;\n },\n context,\n );\n\n/**\n * Create a transformer to filter out unspecified props from an object literal.\n */\nexport const createPropFilter =\n (names: string[]): Transformer<Props> =>\n (context, props) => {\n const nameSet = new Set<unknown>(names);\n\n const factory = context?.factory ?? ts.factory;\n\n return factory.createNodeArray(\n props.filter((prop) => nameSet.has(getPropName(prop))),\n );\n };\n\nexport const createPropAppender =\n (appendingProps: Props): Transformer<Props> =>\n (context, props) => {\n const nameSet = new Set<unknown>(\n props.map(getPropName).filter((prop) => typeof prop === 'string'),\n );\n\n const factory = context?.factory ?? ts.factory;\n\n return factory.createNodeArray([\n ...props,\n ...appendingProps.filter((prop) => !nameSet.has(getPropName(prop))),\n ]);\n };\n\n/**\n * Read out `export default` or `module.exports` props from a source file.\n *\n * The props can then be used when transforming another source file.\n */\nexport const readModuleExports = async (\n inputFile: string,\n): Promise<Props | undefined> => {\n let result: Props | undefined;\n\n await transformModuleImportsAndExports(\n inputFile,\n (_, props) => (result = props),\n );\n\n return result;\n};\n\n/**\n * Mutate imports and exports in a source file:\n *\n * - Convert `const x = require('')` into `import x from ''`\n * - Convert `module.exports =` into `export default`\n * - Run a transformer over the exported props\n */\nexport const transformModuleImportsAndExports = async (\n inputFile: string,\n transformProps: Transformer<Props>,\n): Promise<string> => {\n const sourceFile = ts.createSourceFile('', inputFile, ts.ScriptTarget.Latest);\n\n const moduleExportsTransformer =\n createModuleExportsTransformer(transformProps);\n\n const result = ts.transform(sourceFile, [\n requireImportsTransformer,\n moduleExportsTransformer,\n ]);\n\n const [transformedFile] = result.transformed;\n\n if (!transformedFile) {\n throw new Error(\n `Could not get transformed result for ${JSON.stringify(result)}`,\n );\n }\n\n const text = ts\n .createPrinter()\n .printNode(ts.EmitHint.SourceFile, transformedFile, sourceFile)\n .replace(BLANK_LINE_REGEXP, '');\n\n return formatPrettier(text, { parser: 'typescript' });\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,OAAO,QAAQ;AAEf,SAAS,sBAAsB;AAM/B,MAAM,yBAAyB;AAC/B,MAAM,oBAAoB,IAAI,OAAO,KAAK,sBAAsB,IAAI,GAAG;AAQvE,MAAM,kCAAkC,CAAoB,SAC1D,GAAG;AAAA,EACD;AAAA,EACA,GAAG,WAAW;AAAA,EACd;AAAA,EACA;AACF;AASF,MAAM,6CAA6C,CACjD,SACA,OACA,mBAEA,QAAQ;AAAA,EACN;AAAA,EACA;AAAA,EACA,mBAAmB,SACf,QAAQ,8BAA8B,OAAO,IAAI,IACjD,QAAQ,qBAAqB,gBAAgB,QAAW;AAAA,IACtD,QAAQ,8BAA8B,OAAO,IAAI;AAAA,EACnD,CAAC;AACP;AAEF,MAAM,6BAA6B,CACjC,SACA,YACA,gBACG;AACH,QAAM,eACJ,OAAO,gBAAgB,WACnB,QAAQ;AAAA,IACN;AAAA,IACA,QAAQ,iBAAiB,WAAW;AAAA,IACpC;AAAA,EACF,IACA,QAAQ;AAAA,IACN;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,MACN,YAAY;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E,QAAQ,aAAa,CAAC;AACtD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/cli/format/index.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
import chalk from "chalk";
|
|
3
2
|
import { hasDebugFlag } from "../../utils/args.js";
|
|
4
3
|
import { createLogger, log } from "../../utils/logging.js";
|
|
5
4
|
import { runESLint } from "../adapter/eslint.js";
|
|
6
5
|
import { runPrettier } from "../adapter/prettier.js";
|
|
7
6
|
import { internalLint } from "../lint/internal.js";
|
|
8
|
-
|
|
7
|
+
const format = async (args = process.argv.slice(2), overrideConfigFile) => {
|
|
9
8
|
const debug = hasDebugFlag(args);
|
|
10
9
|
log.plain(chalk.blueBright("skuba lints"));
|
|
11
10
|
const internal = await internalLint("format", {
|
|
@@ -32,4 +31,7 @@ export const format = async (args = process.argv.slice(2), overrideConfigFile) =
|
|
|
32
31
|
log.err(tools.join(", "), "found issues that require triage.");
|
|
33
32
|
process.exitCode = 1;
|
|
34
33
|
};
|
|
34
|
+
export {
|
|
35
|
+
format
|
|
36
|
+
};
|
|
35
37
|
//# sourceMappingURL=index.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/format/index.ts"],
|
|
4
4
|
"sourcesContent": ["import chalk from 'chalk';\n\nimport { hasDebugFlag } from '../../utils/args.js';\nimport { createLogger, log } from '../../utils/logging.js';\nimport { runESLint } from '../adapter/eslint.js';\nimport { runPrettier } from '../adapter/prettier.js';\nimport { internalLint } from '../lint/internal.js';\n\nexport const format = async (\n args = process.argv.slice(2),\n overrideConfigFile?: string,\n): Promise<void> => {\n const debug = hasDebugFlag(args);\n\n log.plain(chalk.blueBright('skuba lints'));\n\n const internal = await internalLint('format', {\n debug,\n additionalFlags: args.includes('--force-apply-all-patches')\n ? ['--force-apply-all-patches']\n : [],\n serial: true,\n });\n\n const logger = createLogger({ debug });\n\n log.newline();\n log.plain(chalk.magenta('ESLint'));\n\n const eslint = await runESLint('format', logger, overrideConfigFile);\n\n log.newline();\n log.plain(chalk.cyan('Prettier'));\n\n const prettier = await runPrettier('format', logger);\n\n if (eslint.ok && prettier.ok && internal.ok) {\n return;\n }\n\n const tools = [\n ...(eslint.ok ? [] : ['ESLint']),\n ...(prettier.ok ? [] : ['Prettier']),\n ...(internal.ok ? [] : ['skuba']),\n ];\n\n log.newline();\n log.err(tools.join(', '), 'found issues that require triage.');\n\n process.exitCode = 1;\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,OAAO,WAAW;AAElB,SAAS,oBAAoB;AAC7B,SAAS,cAAc,WAAW;AAClC,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAEtB,MAAM,SAAS,OACpB,OAAO,QAAQ,KAAK,MAAM,CAAC,GAC3B,uBACkB;AAClB,QAAM,QAAQ,aAAa,IAAI;AAE/B,MAAI,MAAM,MAAM,WAAW,aAAa,CAAC;AAEzC,QAAM,WAAW,MAAM,aAAa,UAAU;AAAA,IAC5C;AAAA,IACA,iBAAiB,KAAK,SAAS,2BAA2B,IACtD,CAAC,2BAA2B,IAC5B,CAAC;AAAA,IACL,QAAQ;AAAA,EACV,CAAC;AAED,QAAM,SAAS,aAAa,EAAE,MAAM,CAAC;AAErC,MAAI,QAAQ;AACZ,MAAI,MAAM,MAAM,QAAQ,QAAQ,CAAC;AAEjC,QAAM,SAAS,MAAM,UAAU,UAAU,QAAQ,kBAAkB;AAEnE,MAAI,QAAQ;AACZ,MAAI,MAAM,MAAM,KAAK,UAAU,CAAC;AAEhC,QAAM,WAAW,MAAM,YAAY,UAAU,MAAM;AAEnD,MAAI,OAAO,MAAM,SAAS,MAAM,SAAS,IAAI;AAC3C;AAAA,EACF;AAEA,QAAM,QAAQ;AAAA,IACZ,GAAI,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ;AAAA,IAC9B,GAAI,SAAS,KAAK,CAAC,IAAI,CAAC,UAAU;AAAA,IAClC,GAAI,SAAS,KAAK,CAAC,IAAI,CAAC,OAAO;AAAA,EACjC;AAEA,MAAI,QAAQ;AACZ,MAAI,IAAI,MAAM,KAAK,IAAI,GAAG,mCAAmC;AAE7D,UAAQ,WAAW;AACrB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/cli/help/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
import { showHelp } from "../../utils/help.js";
|
|
3
2
|
import { showLogoAndVersionInfo } from "../../utils/logo.js";
|
|
4
|
-
|
|
3
|
+
const help = async () => {
|
|
5
4
|
await showLogoAndVersionInfo();
|
|
6
5
|
showHelp();
|
|
7
6
|
};
|
|
7
|
+
export {
|
|
8
|
+
help
|
|
9
|
+
};
|
|
8
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/help/index.ts"],
|
|
4
4
|
"sourcesContent": ["import { showHelp } from '../../utils/help.js';\nimport { showLogoAndVersionInfo } from '../../utils/logo.js';\n\nexport const help = async () => {\n await showLogoAndVersionInfo();\n\n showHelp();\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAA,SAAS,gBAAgB;AACzB,SAAS,8BAA8B;AAEhC,MAAM,OAAO,YAAY;AAC9B,QAAM,uBAAuB;AAE7B,WAAS;AACX;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|