skuba 0.0.0-master-20230318044948
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/LICENSE +21 -0
- package/README.md +67 -0
- package/config/eslint.js +3 -0
- package/config/jest.js +1 -0
- package/config/prettier.d.ts +3 -0
- package/config/prettier.js +5 -0
- package/config/tsconfig.json +9 -0
- package/jest/moduleNameMapper.js +58 -0
- package/jest/moduleNameMapper.test.ts +64 -0
- package/jest/transform.js +50 -0
- package/jest/transform.test.ts +11 -0
- package/jest/tsConfig.js +26 -0
- package/jest-preset.js +34 -0
- package/lib/api/buildkite/annotate.d.ts +26 -0
- package/lib/api/buildkite/annotate.js +49 -0
- package/lib/api/buildkite/annotate.js.map +7 -0
- package/lib/api/buildkite/index.d.ts +3 -0
- package/lib/api/buildkite/index.js +32 -0
- package/lib/api/buildkite/index.js.map +7 -0
- package/lib/api/buildkite/md.d.ts +6 -0
- package/lib/api/buildkite/md.js +33 -0
- package/lib/api/buildkite/md.js.map +7 -0
- package/lib/api/git/commit.d.ts +15 -0
- package/lib/api/git/commit.js +52 -0
- package/lib/api/git/commit.js.map +7 -0
- package/lib/api/git/commitAllChanges.d.ts +19 -0
- package/lib/api/git/commitAllChanges.js +65 -0
- package/lib/api/git/commitAllChanges.js.map +7 -0
- package/lib/api/git/currentBranch.d.ts +10 -0
- package/lib/api/git/currentBranch.js +58 -0
- package/lib/api/git/currentBranch.js.map +7 -0
- package/lib/api/git/getChangedFiles.d.ts +20 -0
- package/lib/api/git/getChangedFiles.js +63 -0
- package/lib/api/git/getChangedFiles.js.map +7 -0
- package/lib/api/git/index.d.ts +10 -0
- package/lib/api/git/index.js +55 -0
- package/lib/api/git/index.js.map +7 -0
- package/lib/api/git/log.d.ts +19 -0
- package/lib/api/git/log.js +71 -0
- package/lib/api/git/log.js.map +7 -0
- package/lib/api/git/pull.d.ts +35 -0
- package/lib/api/git/pull.js +69 -0
- package/lib/api/git/pull.js.map +7 -0
- package/lib/api/git/push.d.ts +43 -0
- package/lib/api/git/push.js +70 -0
- package/lib/api/git/push.js.map +7 -0
- package/lib/api/git/remote.d.ts +20 -0
- package/lib/api/git/remote.js +72 -0
- package/lib/api/git/remote.js.map +7 -0
- package/lib/api/git/reset.d.ts +12 -0
- package/lib/api/git/reset.js +62 -0
- package/lib/api/git/reset.js.map +7 -0
- package/lib/api/git/statusMatrix.d.ts +7 -0
- package/lib/api/git/statusMatrix.js +47 -0
- package/lib/api/git/statusMatrix.js.map +7 -0
- package/lib/api/github/checkRun.d.ts +44 -0
- package/lib/api/github/checkRun.js +81 -0
- package/lib/api/github/checkRun.js.map +7 -0
- package/lib/api/github/environment.d.ts +18 -0
- package/lib/api/github/environment.js +48 -0
- package/lib/api/github/environment.js.map +7 -0
- package/lib/api/github/index.d.ts +7 -0
- package/lib/api/github/index.js +48 -0
- package/lib/api/github/index.js.map +7 -0
- package/lib/api/github/issueComment.d.ts +59 -0
- package/lib/api/github/issueComment.js +83 -0
- package/lib/api/github/issueComment.js.map +7 -0
- package/lib/api/github/pullRequest.d.ts +21 -0
- package/lib/api/github/pullRequest.js +68 -0
- package/lib/api/github/pullRequest.js.map +7 -0
- package/lib/api/github/push.d.ts +79 -0
- package/lib/api/github/push.js +158 -0
- package/lib/api/github/push.js.map +7 -0
- package/lib/api/jest/index.d.ts +144 -0
- package/lib/api/jest/index.js +41 -0
- package/lib/api/jest/index.js.map +7 -0
- package/lib/api/net/compose.d.ts +4 -0
- package/lib/api/net/compose.js +50 -0
- package/lib/api/net/compose.js.map +7 -0
- package/lib/api/net/index.d.ts +1 -0
- package/lib/api/net/index.js +29 -0
- package/lib/api/net/index.js.map +7 -0
- package/lib/api/net/socket.d.ts +5 -0
- package/lib/api/net/socket.js +68 -0
- package/lib/api/net/socket.js.map +7 -0
- package/lib/api/net/waitFor.d.ts +22 -0
- package/lib/api/net/waitFor.js +40 -0
- package/lib/api/net/waitFor.js.map +7 -0
- package/lib/cli/adapter/eslint.d.ts +14 -0
- package/lib/cli/adapter/eslint.js +112 -0
- package/lib/cli/adapter/eslint.js.map +7 -0
- package/lib/cli/adapter/prettier.d.ts +45 -0
- package/lib/cli/adapter/prettier.js +171 -0
- package/lib/cli/adapter/prettier.js.map +7 -0
- package/lib/cli/build/args.d.ts +7 -0
- package/lib/cli/build/args.js +73 -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 +133 -0
- package/lib/cli/build/esbuild.js.map +7 -0
- package/lib/cli/build/index.d.ts +1 -0
- package/lib/cli/build/index.js +73 -0
- package/lib/cli/build/index.js.map +7 -0
- package/lib/cli/build/tsc.d.ts +1 -0
- package/lib/cli/build/tsc.js +36 -0
- package/lib/cli/build/tsc.js.map +7 -0
- package/lib/cli/buildPackage.d.ts +1 -0
- package/lib/cli/buildPackage.js +56 -0
- package/lib/cli/buildPackage.js.map +7 -0
- package/lib/cli/configure/addEmptyExports.d.ts +6 -0
- package/lib/cli/configure/addEmptyExports.js +76 -0
- package/lib/cli/configure/addEmptyExports.js.map +7 -0
- package/lib/cli/configure/analyseConfiguration.d.ts +9 -0
- package/lib/cli/configure/analyseConfiguration.js +69 -0
- package/lib/cli/configure/analyseConfiguration.js.map +7 -0
- package/lib/cli/configure/analyseDependencies.d.ts +10 -0
- package/lib/cli/configure/analyseDependencies.js +136 -0
- package/lib/cli/configure/analyseDependencies.js.map +7 -0
- package/lib/cli/configure/analysis/diff.d.ts +1 -0
- package/lib/cli/configure/analysis/diff.js +45 -0
- package/lib/cli/configure/analysis/diff.js.map +7 -0
- package/lib/cli/configure/analysis/files.d.ts +1 -0
- package/lib/cli/configure/analysis/files.js +58 -0
- package/lib/cli/configure/analysis/files.js.map +7 -0
- package/lib/cli/configure/analysis/git.d.ts +1 -0
- package/lib/cli/configure/analysis/git.js +54 -0
- package/lib/cli/configure/analysis/git.js.map +7 -0
- package/lib/cli/configure/analysis/package.d.ts +13 -0
- package/lib/cli/configure/analysis/package.js +110 -0
- package/lib/cli/configure/analysis/package.js.map +7 -0
- package/lib/cli/configure/analysis/project.d.ts +3 -0
- package/lib/cli/configure/analysis/project.js +105 -0
- package/lib/cli/configure/analysis/project.js.map +7 -0
- package/lib/cli/configure/dependencies/index.d.ts +5 -0
- package/lib/cli/configure/dependencies/index.js +41 -0
- package/lib/cli/configure/dependencies/index.js.map +7 -0
- package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.d.ts +2 -0
- package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js +59 -0
- package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js.map +7 -0
- package/lib/cli/configure/dependencies/seekKoala.d.ts +2 -0
- package/lib/cli/configure/dependencies/seekKoala.js +56 -0
- package/lib/cli/configure/dependencies/seekKoala.js.map +7 -0
- package/lib/cli/configure/dependencies/skuba.d.ts +2 -0
- package/lib/cli/configure/dependencies/skuba.js +52 -0
- package/lib/cli/configure/dependencies/skuba.js.map +7 -0
- package/lib/cli/configure/dependencies/skubaDeps.d.ts +2 -0
- package/lib/cli/configure/dependencies/skubaDeps.js +56 -0
- package/lib/cli/configure/dependencies/skubaDeps.js.map +7 -0
- package/lib/cli/configure/dependencies/skubaDive.d.ts +3 -0
- package/lib/cli/configure/dependencies/skubaDive.js +70 -0
- package/lib/cli/configure/dependencies/skubaDive.js.map +7 -0
- package/lib/cli/configure/ensureTemplateCompletion.d.ts +9 -0
- package/lib/cli/configure/ensureTemplateCompletion.js +77 -0
- package/lib/cli/configure/ensureTemplateCompletion.js.map +7 -0
- package/lib/cli/configure/getEntryPoint.d.ts +11 -0
- package/lib/cli/configure/getEntryPoint.js +70 -0
- package/lib/cli/configure/getEntryPoint.js.map +7 -0
- package/lib/cli/configure/getProjectType.d.ts +9 -0
- package/lib/cli/configure/getProjectType.js +52 -0
- package/lib/cli/configure/getProjectType.js.map +7 -0
- package/lib/cli/configure/index.d.ts +1 -0
- package/lib/cli/configure/index.js +148 -0
- package/lib/cli/configure/index.js.map +7 -0
- package/lib/cli/configure/modules/eslint.d.ts +2 -0
- package/lib/cli/configure/modules/eslint.js +61 -0
- package/lib/cli/configure/modules/eslint.js.map +7 -0
- package/lib/cli/configure/modules/ignore.d.ts +2 -0
- package/lib/cli/configure/modules/ignore.js +40 -0
- package/lib/cli/configure/modules/ignore.js.map +7 -0
- package/lib/cli/configure/modules/index.d.ts +2 -0
- package/lib/cli/configure/modules/index.js +54 -0
- package/lib/cli/configure/modules/index.js.map +7 -0
- package/lib/cli/configure/modules/jest.d.ts +2 -0
- package/lib/cli/configure/modules/jest.js +86 -0
- package/lib/cli/configure/modules/jest.js.map +7 -0
- package/lib/cli/configure/modules/nodemon.d.ts +2 -0
- package/lib/cli/configure/modules/nodemon.js +30 -0
- package/lib/cli/configure/modules/nodemon.js.map +7 -0
- package/lib/cli/configure/modules/package.d.ts +2 -0
- package/lib/cli/configure/modules/package.js +117 -0
- package/lib/cli/configure/modules/package.js.map +7 -0
- package/lib/cli/configure/modules/prettier.d.ts +2 -0
- package/lib/cli/configure/modules/prettier.js +52 -0
- package/lib/cli/configure/modules/prettier.js.map +7 -0
- package/lib/cli/configure/modules/renovate.d.ts +3 -0
- package/lib/cli/configure/modules/renovate.js +69 -0
- package/lib/cli/configure/modules/renovate.js.map +7 -0
- package/lib/cli/configure/modules/serverless.d.ts +2 -0
- package/lib/cli/configure/modules/serverless.js +36 -0
- package/lib/cli/configure/modules/serverless.js.map +7 -0
- package/lib/cli/configure/modules/skubaDive.d.ts +2 -0
- package/lib/cli/configure/modules/skubaDive.js +72 -0
- package/lib/cli/configure/modules/skubaDive.js.map +7 -0
- package/lib/cli/configure/modules/tsconfig.d.ts +2 -0
- package/lib/cli/configure/modules/tsconfig.js +87 -0
- package/lib/cli/configure/modules/tsconfig.js.map +7 -0
- package/lib/cli/configure/modules/tslint.d.ts +2 -0
- package/lib/cli/configure/modules/tslint.js +30 -0
- package/lib/cli/configure/modules/tslint.js.map +7 -0
- package/lib/cli/configure/patchRenovateConfig.d.ts +1 -0
- package/lib/cli/configure/patchRenovateConfig.js +132 -0
- package/lib/cli/configure/patchRenovateConfig.js.map +7 -0
- package/lib/cli/configure/processing/deleteFiles.d.ts +5 -0
- package/lib/cli/configure/processing/deleteFiles.js +31 -0
- package/lib/cli/configure/processing/deleteFiles.js.map +7 -0
- package/lib/cli/configure/processing/ignoreFile.d.ts +8 -0
- package/lib/cli/configure/processing/ignoreFile.js +74 -0
- package/lib/cli/configure/processing/ignoreFile.js.map +7 -0
- package/lib/cli/configure/processing/javascript.d.ts +2 -0
- package/lib/cli/configure/processing/javascript.js +38 -0
- package/lib/cli/configure/processing/javascript.js.map +7 -0
- package/lib/cli/configure/processing/json.d.ts +2 -0
- package/lib/cli/configure/processing/json.js +57 -0
- package/lib/cli/configure/processing/json.js.map +7 -0
- package/lib/cli/configure/processing/loadFiles.d.ts +5 -0
- package/lib/cli/configure/processing/loadFiles.js +31 -0
- package/lib/cli/configure/processing/loadFiles.js.map +7 -0
- package/lib/cli/configure/processing/module.d.ts +10 -0
- package/lib/cli/configure/processing/module.js +39 -0
- package/lib/cli/configure/processing/module.js.map +7 -0
- package/lib/cli/configure/processing/package.d.ts +73 -0
- package/lib/cli/configure/processing/package.js +87 -0
- package/lib/cli/configure/processing/package.js.map +7 -0
- package/lib/cli/configure/processing/prettier.d.ts +4 -0
- package/lib/cli/configure/processing/prettier.js +44 -0
- package/lib/cli/configure/processing/prettier.js.map +7 -0
- package/lib/cli/configure/processing/record.d.ts +11 -0
- package/lib/cli/configure/processing/record.js +65 -0
- package/lib/cli/configure/processing/record.js.map +7 -0
- package/lib/cli/configure/processing/typescript.d.ts +23 -0
- package/lib/cli/configure/processing/typescript.js +197 -0
- package/lib/cli/configure/processing/typescript.js.map +7 -0
- package/lib/cli/configure/refreshIgnoreFiles.d.ts +3 -0
- package/lib/cli/configure/refreshIgnoreFiles.js +78 -0
- package/lib/cli/configure/refreshIgnoreFiles.js.map +7 -0
- package/lib/cli/configure/types.d.ts +26 -0
- package/lib/cli/configure/types.js +17 -0
- package/lib/cli/configure/types.js.map +7 -0
- package/lib/cli/format.d.ts +1 -0
- package/lib/cli/format.js +70 -0
- package/lib/cli/format.js.map +7 -0
- package/lib/cli/help.d.ts +1 -0
- package/lib/cli/help.js +34 -0
- package/lib/cli/help.js.map +7 -0
- package/lib/cli/init/getConfig.d.ts +26 -0
- package/lib/cli/init/getConfig.js +285 -0
- package/lib/cli/init/getConfig.js.map +7 -0
- package/lib/cli/init/git.d.ts +7 -0
- package/lib/cli/init/git.js +82 -0
- package/lib/cli/init/git.js.map +7 -0
- package/lib/cli/init/index.d.ts +1 -0
- package/lib/cli/init/index.js +146 -0
- package/lib/cli/init/index.js.map +7 -0
- package/lib/cli/init/prompts.d.ts +45 -0
- package/lib/cli/init/prompts.js +97 -0
- package/lib/cli/init/prompts.js.map +7 -0
- package/lib/cli/init/types.d.ts +28 -0
- package/lib/cli/init/types.js +65 -0
- package/lib/cli/init/types.js.map +7 -0
- package/lib/cli/init/validation.d.ts +8 -0
- package/lib/cli/init/validation.js +43 -0
- package/lib/cli/init/validation.js.map +7 -0
- package/lib/cli/init/writePackageJson.d.ts +13 -0
- package/lib/cli/init/writePackageJson.js +58 -0
- package/lib/cli/init/writePackageJson.js.map +7 -0
- package/lib/cli/lint/annotate/buildkite/eslint.d.ts +2 -0
- package/lib/cli/lint/annotate/buildkite/eslint.js +40 -0
- package/lib/cli/lint/annotate/buildkite/eslint.js.map +7 -0
- package/lib/cli/lint/annotate/buildkite/index.d.ts +4 -0
- package/lib/cli/lint/annotate/buildkite/index.js +58 -0
- package/lib/cli/lint/annotate/buildkite/index.js.map +7 -0
- package/lib/cli/lint/annotate/buildkite/prettier.d.ts +2 -0
- package/lib/cli/lint/annotate/buildkite/prettier.js +47 -0
- package/lib/cli/lint/annotate/buildkite/prettier.js.map +7 -0
- package/lib/cli/lint/annotate/buildkite/tsc.d.ts +2 -0
- package/lib/cli/lint/annotate/buildkite/tsc.js +45 -0
- package/lib/cli/lint/annotate/buildkite/tsc.js.map +7 -0
- package/lib/cli/lint/annotate/github/eslint.d.ts +3 -0
- package/lib/cli/lint/annotate/github/eslint.js +45 -0
- package/lib/cli/lint/annotate/github/eslint.js.map +7 -0
- package/lib/cli/lint/annotate/github/index.d.ts +4 -0
- package/lib/cli/lint/annotate/github/index.js +63 -0
- package/lib/cli/lint/annotate/github/index.js.map +7 -0
- package/lib/cli/lint/annotate/github/prettier.d.ts +3 -0
- package/lib/cli/lint/annotate/github/prettier.js +39 -0
- package/lib/cli/lint/annotate/github/prettier.js.map +7 -0
- package/lib/cli/lint/annotate/github/tsc.d.ts +3 -0
- package/lib/cli/lint/annotate/github/tsc.js +63 -0
- package/lib/cli/lint/annotate/github/tsc.js.map +7 -0
- package/lib/cli/lint/annotate/index.d.ts +4 -0
- package/lib/cli/lint/annotate/index.js +36 -0
- package/lib/cli/lint/annotate/index.js.map +7 -0
- package/lib/cli/lint/autofix.d.ts +10 -0
- package/lib/cli/lint/autofix.js +189 -0
- package/lib/cli/lint/autofix.js.map +7 -0
- package/lib/cli/lint/eslint.d.ts +4 -0
- package/lib/cli/lint/eslint.js +55 -0
- package/lib/cli/lint/eslint.js.map +7 -0
- package/lib/cli/lint/external.d.ts +10 -0
- package/lib/cli/lint/external.js +120 -0
- package/lib/cli/lint/external.js.map +7 -0
- package/lib/cli/lint/index.d.ts +2 -0
- package/lib/cli/lint/index.js +49 -0
- package/lib/cli/lint/index.js.map +7 -0
- package/lib/cli/lint/internal.d.ts +1 -0
- package/lib/cli/lint/internal.js +64 -0
- package/lib/cli/lint/internal.js.map +7 -0
- package/lib/cli/lint/prettier.d.ts +4 -0
- package/lib/cli/lint/prettier.js +55 -0
- package/lib/cli/lint/prettier.js.map +7 -0
- package/lib/cli/lint/tsc.d.ts +2 -0
- package/lib/cli/lint/tsc.js +58 -0
- package/lib/cli/lint/tsc.js.map +7 -0
- package/lib/cli/lint/types.d.ts +34 -0
- package/lib/cli/lint/types.js +17 -0
- package/lib/cli/lint/types.js.map +7 -0
- package/lib/cli/node.d.ts +1 -0
- package/lib/cli/node.js +77 -0
- package/lib/cli/node.js.map +7 -0
- package/lib/cli/release.d.ts +1 -0
- package/lib/cli/release.js +32 -0
- package/lib/cli/release.js.map +7 -0
- package/lib/cli/start.d.ts +1 -0
- package/lib/cli/start.js +69 -0
- package/lib/cli/start.js.map +7 -0
- package/lib/cli/test/index.d.ts +1 -0
- package/lib/cli/test/index.js +37 -0
- package/lib/cli/test/index.js.map +7 -0
- package/lib/cli/test/reporters/github/annotations.d.ts +9 -0
- package/lib/cli/test/reporters/github/annotations.js +102 -0
- package/lib/cli/test/reporters/github/annotations.js.map +7 -0
- package/lib/cli/test/reporters/github/index.d.ts +5 -0
- package/lib/cli/test/reporters/github/index.js +77 -0
- package/lib/cli/test/reporters/github/index.js.map +7 -0
- package/lib/cli/version.d.ts +1 -0
- package/lib/cli/version.js +34 -0
- package/lib/cli/version.js.map +7 -0
- package/lib/enquirer.d.js +2 -0
- package/lib/enquirer.d.js.map +7 -0
- package/lib/index.d.ts +22 -0
- package/lib/index.js +51 -0
- package/lib/index.js.map +7 -0
- package/lib/skuba.d.ts +11 -0
- package/lib/skuba.js +55 -0
- package/lib/skuba.js.map +7 -0
- package/lib/utils/args.d.ts +43 -0
- package/lib/utils/args.js +114 -0
- package/lib/utils/args.js.map +7 -0
- package/lib/utils/command.d.ts +6 -0
- package/lib/utils/command.js +72 -0
- package/lib/utils/command.js.map +7 -0
- package/lib/utils/copy.d.ts +16 -0
- package/lib/utils/copy.js +100 -0
- package/lib/utils/copy.js.map +7 -0
- package/lib/utils/dir.d.ts +21 -0
- package/lib/utils/dir.js +91 -0
- package/lib/utils/dir.js.map +7 -0
- package/lib/utils/env.d.ts +5 -0
- package/lib/utils/env.js +29 -0
- package/lib/utils/env.js.map +7 -0
- package/lib/utils/error.d.ts +28 -0
- package/lib/utils/error.js +72 -0
- package/lib/utils/error.js.map +7 -0
- package/lib/utils/exec.d.ts +40 -0
- package/lib/utils/exec.js +166 -0
- package/lib/utils/exec.js.map +7 -0
- package/lib/utils/help.d.ts +1 -0
- package/lib/utils/help.js +34 -0
- package/lib/utils/help.js.map +7 -0
- package/lib/utils/logging.d.ts +27 -0
- package/lib/utils/logging.js +60 -0
- package/lib/utils/logging.js.map +7 -0
- package/lib/utils/logo.d.ts +9 -0
- package/lib/utils/logo.js +74 -0
- package/lib/utils/logo.js.map +7 -0
- package/lib/utils/manifest.d.ts +10 -0
- package/lib/utils/manifest.js +77 -0
- package/lib/utils/manifest.js.map +7 -0
- package/lib/utils/port.d.ts +2 -0
- package/lib/utils/port.js +48 -0
- package/lib/utils/port.js.map +7 -0
- package/lib/utils/template.d.ts +37 -0
- package/lib/utils/template.js +116 -0
- package/lib/utils/template.js.map +7 -0
- package/lib/utils/validation.d.ts +6 -0
- package/lib/utils/validation.js +44 -0
- package/lib/utils/validation.js.map +7 -0
- package/lib/utils/version.d.ts +13 -0
- package/lib/utils/version.js +89 -0
- package/lib/utils/version.js.map +7 -0
- package/lib/utils/wait.d.ts +17 -0
- package/lib/utils/wait.js +59 -0
- package/lib/utils/wait.js.map +7 -0
- package/lib/utils/worker.d.ts +20 -0
- package/lib/utils/worker.js +63 -0
- package/lib/utils/worker.js.map +7 -0
- package/lib/wrapper/function-arguments.d.js +2 -0
- package/lib/wrapper/function-arguments.d.js.map +7 -0
- package/lib/wrapper/functionHandler.d.ts +10 -0
- package/lib/wrapper/functionHandler.js +63 -0
- package/lib/wrapper/functionHandler.js.map +7 -0
- package/lib/wrapper/http.d.ts +20 -0
- package/lib/wrapper/http.js +79 -0
- package/lib/wrapper/http.js.map +7 -0
- package/lib/wrapper/index.d.ts +12 -0
- package/lib/wrapper/index.js +16 -0
- package/lib/wrapper/index.js.map +7 -0
- package/lib/wrapper/main.d.ts +1 -0
- package/lib/wrapper/main.js +47 -0
- package/lib/wrapper/main.js.map +7 -0
- package/lib/wrapper/requestListener.d.ts +11 -0
- package/lib/wrapper/requestListener.js +66 -0
- package/lib/wrapper/requestListener.js.map +7 -0
- package/package.json +167 -0
- package/template/base/.github/CODEOWNERS +5 -0
- package/template/base/.github/renovate.json5 +3 -0
- package/template/base/_.dockerignore +18 -0
- package/template/base/_.eslintignore +14 -0
- package/template/base/_.eslintrc.js +3 -0
- package/template/base/_.gitignore +23 -0
- package/template/base/_.prettierignore +20 -0
- package/template/base/_.prettierrc.js +1 -0
- package/template/base/jest.config.ts +15 -0
- package/template/base/jest.setup.ts +3 -0
- package/template/base/tsconfig.build.json +5 -0
- package/template/base/tsconfig.json +13 -0
- package/template/express-rest-api/.buildkite/pipeline.yml +103 -0
- package/template/express-rest-api/.env +1 -0
- package/template/express-rest-api/.gantry/common.yml +20 -0
- package/template/express-rest-api/.gantry/dev.yml +8 -0
- package/template/express-rest-api/.gantry/prod.yml +8 -0
- package/template/express-rest-api/.nvmrc +1 -0
- package/template/express-rest-api/Dockerfile +37 -0
- package/template/express-rest-api/Dockerfile.dev-deps +11 -0
- package/template/express-rest-api/README.md +106 -0
- package/template/express-rest-api/docker-compose.yml +22 -0
- package/template/express-rest-api/gantry.apply.yml +122 -0
- package/template/express-rest-api/gantry.build.yml +15 -0
- package/template/express-rest-api/package.json +30 -0
- package/template/express-rest-api/skuba.template.js +49 -0
- package/template/express-rest-api/src/api/healthCheck.ts +11 -0
- package/template/express-rest-api/src/api/smokeTest.ts +8 -0
- package/template/express-rest-api/src/app.test.ts +9 -0
- package/template/express-rest-api/src/app.ts +14 -0
- package/template/express-rest-api/src/config.ts +57 -0
- package/template/express-rest-api/src/framework/logging.ts +17 -0
- package/template/express-rest-api/src/listen.ts +23 -0
- package/template/express-rest-api/src/register.ts +1 -0
- package/template/greeter/.buildkite/pipeline.yml +37 -0
- package/template/greeter/.nvmrc +1 -0
- package/template/greeter/Dockerfile +11 -0
- package/template/greeter/README.md +96 -0
- package/template/greeter/docker-compose.yml +22 -0
- package/template/greeter/package.json +24 -0
- package/template/greeter/skuba.template.js +16 -0
- package/template/greeter/src/app.test.ts +5 -0
- package/template/greeter/src/app.ts +4 -0
- package/template/koa-rest-api/.buildkite/pipeline.yml +103 -0
- package/template/koa-rest-api/.env +1 -0
- package/template/koa-rest-api/.gantry/common.yml +20 -0
- package/template/koa-rest-api/.gantry/dev.yml +11 -0
- package/template/koa-rest-api/.gantry/prod.yml +11 -0
- package/template/koa-rest-api/.nvmrc +1 -0
- package/template/koa-rest-api/Dockerfile +37 -0
- package/template/koa-rest-api/Dockerfile.dev-deps +11 -0
- package/template/koa-rest-api/README.md +111 -0
- package/template/koa-rest-api/docker-compose.yml +22 -0
- package/template/koa-rest-api/gantry.apply.yml +129 -0
- package/template/koa-rest-api/gantry.build.yml +15 -0
- package/template/koa-rest-api/package.json +47 -0
- package/template/koa-rest-api/skuba.template.js +49 -0
- package/template/koa-rest-api/src/api/healthCheck.ts +13 -0
- package/template/koa-rest-api/src/api/index.ts +10 -0
- package/template/koa-rest-api/src/api/jobs/getJobs.test.ts +9 -0
- package/template/koa-rest-api/src/api/jobs/getJobs.ts +15 -0
- package/template/koa-rest-api/src/api/jobs/index.ts +10 -0
- package/template/koa-rest-api/src/api/jobs/postJob.test.ts +34 -0
- package/template/koa-rest-api/src/api/jobs/postJob.ts +19 -0
- package/template/koa-rest-api/src/api/smokeTest.ts +11 -0
- package/template/koa-rest-api/src/app.test.ts +21 -0
- package/template/koa-rest-api/src/app.ts +8 -0
- package/template/koa-rest-api/src/config.ts +57 -0
- package/template/koa-rest-api/src/framework/logging.ts +25 -0
- package/template/koa-rest-api/src/framework/metrics.ts +11 -0
- package/template/koa-rest-api/src/framework/middleware.ts +3 -0
- package/template/koa-rest-api/src/framework/server.test.ts +260 -0
- package/template/koa-rest-api/src/framework/server.ts +51 -0
- package/template/koa-rest-api/src/framework/validation.test.ts +72 -0
- package/template/koa-rest-api/src/framework/validation.ts +77 -0
- package/template/koa-rest-api/src/listen.ts +24 -0
- package/template/koa-rest-api/src/register.ts +1 -0
- package/template/koa-rest-api/src/storage/jobs.ts +28 -0
- package/template/koa-rest-api/src/testing/logging.ts +16 -0
- package/template/koa-rest-api/src/testing/metrics.ts +29 -0
- package/template/koa-rest-api/src/testing/server.ts +31 -0
- package/template/koa-rest-api/src/testing/types.ts +24 -0
- package/template/koa-rest-api/src/tracing.ts +61 -0
- package/template/koa-rest-api/src/types/jobs.ts +17 -0
- package/template/koa-rest-api/src/types/koa.ts +8 -0
- package/template/lambda-sqs-worker/.buildkite/pipeline.yml +96 -0
- package/template/lambda-sqs-worker/.env +1 -0
- package/template/lambda-sqs-worker/.nvmrc +1 -0
- package/template/lambda-sqs-worker/Dockerfile +12 -0
- package/template/lambda-sqs-worker/README.md +132 -0
- package/template/lambda-sqs-worker/docker-compose.yml +27 -0
- package/template/lambda-sqs-worker/package.json +44 -0
- package/template/lambda-sqs-worker/serverless.yml +202 -0
- package/template/lambda-sqs-worker/skuba.template.js +32 -0
- package/template/lambda-sqs-worker/src/app.test.ts +116 -0
- package/template/lambda-sqs-worker/src/app.ts +52 -0
- package/template/lambda-sqs-worker/src/config.ts +57 -0
- package/template/lambda-sqs-worker/src/framework/handler.test.ts +61 -0
- package/template/lambda-sqs-worker/src/framework/handler.ts +43 -0
- package/template/lambda-sqs-worker/src/framework/logging.ts +27 -0
- package/template/lambda-sqs-worker/src/framework/metrics.ts +14 -0
- package/template/lambda-sqs-worker/src/framework/validation.test.ts +84 -0
- package/template/lambda-sqs-worker/src/framework/validation.ts +10 -0
- package/template/lambda-sqs-worker/src/hooks.ts +96 -0
- package/template/lambda-sqs-worker/src/mapping/jobScorer.ts +19 -0
- package/template/lambda-sqs-worker/src/services/aws.ts +5 -0
- package/template/lambda-sqs-worker/src/services/jobScorer.test.ts +44 -0
- package/template/lambda-sqs-worker/src/services/jobScorer.ts +56 -0
- package/template/lambda-sqs-worker/src/services/pipelineEventSender.test.ts +40 -0
- package/template/lambda-sqs-worker/src/services/pipelineEventSender.ts +33 -0
- package/template/lambda-sqs-worker/src/testing/handler.ts +13 -0
- package/template/lambda-sqs-worker/src/testing/logging.ts +16 -0
- package/template/lambda-sqs-worker/src/testing/services.ts +28 -0
- package/template/lambda-sqs-worker/src/testing/types.ts +33 -0
- package/template/lambda-sqs-worker/src/types/jobScorer.ts +15 -0
- package/template/lambda-sqs-worker/src/types/pipelineEvents.ts +21 -0
- package/template/lambda-sqs-worker/tsconfig.json +13 -0
- package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +93 -0
- package/template/lambda-sqs-worker-cdk/.nvmrc +1 -0
- package/template/lambda-sqs-worker-cdk/Dockerfile +13 -0
- package/template/lambda-sqs-worker-cdk/cdk.json +25 -0
- package/template/lambda-sqs-worker-cdk/docker-compose.yml +28 -0
- package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +723 -0
- package/template/lambda-sqs-worker-cdk/infra/appStack.test.ts +34 -0
- package/template/lambda-sqs-worker-cdk/infra/appStack.ts +74 -0
- package/template/lambda-sqs-worker-cdk/infra/index.ts +14 -0
- package/template/lambda-sqs-worker-cdk/package.json +30 -0
- package/template/lambda-sqs-worker-cdk/shared/context-types.ts +21 -0
- package/template/lambda-sqs-worker-cdk/skuba.template.js +27 -0
- package/template/lambda-sqs-worker-cdk/src/app.ts +10 -0
- package/template/lambda-sqs-worker-cdk/tsconfig.json +13 -0
- package/template/oss-npm-package/.github/workflows/release.yml +35 -0
- package/template/oss-npm-package/.github/workflows/validate.yml +31 -0
- package/template/oss-npm-package/.nvmrc +1 -0
- package/template/oss-npm-package/LICENSE +21 -0
- package/template/oss-npm-package/README.md +128 -0
- package/template/oss-npm-package/_package.json +41 -0
- package/template/oss-npm-package/skuba.template.js +22 -0
- package/template/oss-npm-package/src/index.test.ts +5 -0
- package/template/oss-npm-package/src/index.ts +7 -0
- package/template/oss-npm-package/tsconfig.json +10 -0
- package/template/private-npm-package/.buildkite/pipeline.yml +5 -0
- package/template/private-npm-package/.nvmrc +1 -0
- package/template/private-npm-package/README.md +109 -0
- package/template/private-npm-package/_package.json +41 -0
- package/template/private-npm-package/skuba.template.js +24 -0
- package/template/private-npm-package/src/index.test.ts +5 -0
- package/template/private-npm-package/src/index.ts +7 -0
- package/template/private-npm-package/tsconfig.json +10 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as t from 'runtypes';
|
|
2
|
+
export declare const TEMPLATE_NAMES: readonly ["express-rest-api", "greeter", "koa-rest-api", "lambda-sqs-worker", "lambda-sqs-worker-cdk", "oss-npm-package", "private-npm-package"];
|
|
3
|
+
export type TemplateName = (typeof TEMPLATE_NAMES)[number];
|
|
4
|
+
export declare const TEMPLATE_NAMES_WITH_BYO: readonly ["express-rest-api", "greeter", "koa-rest-api", "lambda-sqs-worker", "lambda-sqs-worker-cdk", "oss-npm-package", "private-npm-package", "github →"];
|
|
5
|
+
interface TemplateDocumentationConfig {
|
|
6
|
+
/**
|
|
7
|
+
* The semantic version in which the template was first added.
|
|
8
|
+
*
|
|
9
|
+
* This is used to filter out historical changelogs.
|
|
10
|
+
*/
|
|
11
|
+
added: string;
|
|
12
|
+
/**
|
|
13
|
+
* The Markdown file for the template in our `/docs`.
|
|
14
|
+
*
|
|
15
|
+
* This is used to compile per-template changelogs for our documentation site.
|
|
16
|
+
*/
|
|
17
|
+
filename: string;
|
|
18
|
+
}
|
|
19
|
+
export declare const TEMPLATE_DOCUMENTATION_CONFIG: Record<TemplateName, TemplateDocumentationConfig>;
|
|
20
|
+
export type TemplateConfig = t.Static<typeof TemplateConfig>;
|
|
21
|
+
export declare const TemplateConfig: t.Record<{
|
|
22
|
+
fields: t.Array<t.Record<{
|
|
23
|
+
name: t.String;
|
|
24
|
+
message: t.String;
|
|
25
|
+
initial: t.String;
|
|
26
|
+
validate: t.Optional<t.Function>;
|
|
27
|
+
}, false>, false>;
|
|
28
|
+
entryPoint: t.Optional<t.String>;
|
|
29
|
+
noSkip: t.Optional<t.Boolean>;
|
|
30
|
+
type: t.Optional<t.Union<[t.Literal<"application">, t.Literal<"package">]>>;
|
|
31
|
+
}, false>;
|
|
32
|
+
export declare const TEMPLATE_CONFIG_FILENAME = "skuba.template.js";
|
|
33
|
+
export declare const TEMPLATE_DIR: string;
|
|
34
|
+
export declare const BASE_TEMPLATE_DIR: string;
|
|
35
|
+
export declare const ensureTemplateConfigDeletion: (dir: string) => Promise<void>;
|
|
36
|
+
export declare const readBaseTemplateFile: (src: string) => Promise<string>;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var template_exports = {};
|
|
30
|
+
__export(template_exports, {
|
|
31
|
+
BASE_TEMPLATE_DIR: () => BASE_TEMPLATE_DIR,
|
|
32
|
+
TEMPLATE_CONFIG_FILENAME: () => TEMPLATE_CONFIG_FILENAME,
|
|
33
|
+
TEMPLATE_DIR: () => TEMPLATE_DIR,
|
|
34
|
+
TEMPLATE_DOCUMENTATION_CONFIG: () => TEMPLATE_DOCUMENTATION_CONFIG,
|
|
35
|
+
TEMPLATE_NAMES: () => TEMPLATE_NAMES,
|
|
36
|
+
TEMPLATE_NAMES_WITH_BYO: () => TEMPLATE_NAMES_WITH_BYO,
|
|
37
|
+
TemplateConfig: () => TemplateConfig,
|
|
38
|
+
ensureTemplateConfigDeletion: () => ensureTemplateConfigDeletion,
|
|
39
|
+
readBaseTemplateFile: () => readBaseTemplateFile
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(template_exports);
|
|
42
|
+
var import_path = __toESM(require("path"));
|
|
43
|
+
var import_fs_extra = __toESM(require("fs-extra"));
|
|
44
|
+
var t = __toESM(require("runtypes"));
|
|
45
|
+
var import_manifest = require("./manifest");
|
|
46
|
+
const TEMPLATE_NAMES = [
|
|
47
|
+
"express-rest-api",
|
|
48
|
+
"greeter",
|
|
49
|
+
"koa-rest-api",
|
|
50
|
+
"lambda-sqs-worker",
|
|
51
|
+
"lambda-sqs-worker-cdk",
|
|
52
|
+
"oss-npm-package",
|
|
53
|
+
"private-npm-package"
|
|
54
|
+
];
|
|
55
|
+
const TEMPLATE_NAMES_WITH_BYO = [...TEMPLATE_NAMES, "github \u2192"];
|
|
56
|
+
const TEMPLATE_DOCUMENTATION_CONFIG = {
|
|
57
|
+
"express-rest-api": {
|
|
58
|
+
added: "3.8.0",
|
|
59
|
+
filename: "api.md"
|
|
60
|
+
},
|
|
61
|
+
greeter: {
|
|
62
|
+
added: "3.4.1",
|
|
63
|
+
filename: "barebones.md"
|
|
64
|
+
},
|
|
65
|
+
"koa-rest-api": {
|
|
66
|
+
added: "3.4.1",
|
|
67
|
+
filename: "api.md"
|
|
68
|
+
},
|
|
69
|
+
"lambda-sqs-worker": {
|
|
70
|
+
added: "3.4.1",
|
|
71
|
+
filename: "worker.md"
|
|
72
|
+
},
|
|
73
|
+
"lambda-sqs-worker-cdk": {
|
|
74
|
+
added: "3.13.0",
|
|
75
|
+
filename: "worker.md"
|
|
76
|
+
},
|
|
77
|
+
"oss-npm-package": {
|
|
78
|
+
added: "3.7.0",
|
|
79
|
+
filename: "package.md"
|
|
80
|
+
},
|
|
81
|
+
"private-npm-package": {
|
|
82
|
+
added: "3.6.0",
|
|
83
|
+
filename: "package.md"
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
const TemplateConfig = t.Record({
|
|
87
|
+
fields: t.Array(
|
|
88
|
+
t.Record({
|
|
89
|
+
name: t.String,
|
|
90
|
+
message: t.String,
|
|
91
|
+
initial: t.String,
|
|
92
|
+
validate: t.Function.optional()
|
|
93
|
+
})
|
|
94
|
+
),
|
|
95
|
+
entryPoint: t.String.optional(),
|
|
96
|
+
noSkip: t.Boolean.optional(),
|
|
97
|
+
type: import_manifest.ProjectType.optional()
|
|
98
|
+
});
|
|
99
|
+
const TEMPLATE_CONFIG_FILENAME = "skuba.template.js";
|
|
100
|
+
const TEMPLATE_DIR = import_path.default.join(__dirname, "..", "..", "template");
|
|
101
|
+
const BASE_TEMPLATE_DIR = import_path.default.join(TEMPLATE_DIR, "base");
|
|
102
|
+
const ensureTemplateConfigDeletion = (dir) => import_fs_extra.default.promises.rm(import_path.default.join(dir, TEMPLATE_CONFIG_FILENAME));
|
|
103
|
+
const readBaseTemplateFile = (src) => import_fs_extra.default.promises.readFile(import_path.default.join(BASE_TEMPLATE_DIR, src), "utf8");
|
|
104
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
105
|
+
0 && (module.exports = {
|
|
106
|
+
BASE_TEMPLATE_DIR,
|
|
107
|
+
TEMPLATE_CONFIG_FILENAME,
|
|
108
|
+
TEMPLATE_DIR,
|
|
109
|
+
TEMPLATE_DOCUMENTATION_CONFIG,
|
|
110
|
+
TEMPLATE_NAMES,
|
|
111
|
+
TEMPLATE_NAMES_WITH_BYO,
|
|
112
|
+
TemplateConfig,
|
|
113
|
+
ensureTemplateConfigDeletion,
|
|
114
|
+
readBaseTemplateFile
|
|
115
|
+
});
|
|
116
|
+
//# sourceMappingURL=template.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/template.ts"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable new-cap */\n\nimport path from 'path';\n\nimport fs from 'fs-extra';\nimport * as t from 'runtypes';\n\nimport { ProjectType } from './manifest';\n\nexport const TEMPLATE_NAMES = [\n 'express-rest-api',\n 'greeter',\n 'koa-rest-api',\n 'lambda-sqs-worker',\n 'lambda-sqs-worker-cdk',\n 'oss-npm-package',\n 'private-npm-package',\n] as const;\n\nexport type TemplateName = (typeof TEMPLATE_NAMES)[number];\n\nexport const TEMPLATE_NAMES_WITH_BYO = [...TEMPLATE_NAMES, 'github \u2192'] as const;\n\ninterface TemplateDocumentationConfig {\n /**\n * The semantic version in which the template was first added.\n *\n * This is used to filter out historical changelogs.\n */\n added: string;\n\n /**\n * The Markdown file for the template in our `/docs`.\n *\n * This is used to compile per-template changelogs for our documentation site.\n */\n filename: string;\n}\n\nexport const TEMPLATE_DOCUMENTATION_CONFIG: Record<\n TemplateName,\n TemplateDocumentationConfig\n> = {\n 'express-rest-api': {\n added: '3.8.0',\n filename: 'api.md',\n },\n greeter: {\n added: '3.4.1',\n filename: 'barebones.md',\n },\n 'koa-rest-api': {\n added: '3.4.1',\n filename: 'api.md',\n },\n 'lambda-sqs-worker': {\n added: '3.4.1',\n filename: 'worker.md',\n },\n 'lambda-sqs-worker-cdk': {\n added: '3.13.0',\n filename: 'worker.md',\n },\n 'oss-npm-package': {\n added: '3.7.0',\n filename: 'package.md',\n },\n 'private-npm-package': {\n added: '3.6.0',\n filename: 'package.md',\n },\n};\n\nexport type TemplateConfig = t.Static<typeof TemplateConfig>;\n\nexport const TemplateConfig = t.Record({\n fields: t.Array(\n t.Record({\n name: t.String,\n message: t.String,\n initial: t.String,\n validate: t.Function.optional(),\n }),\n ),\n entryPoint: t.String.optional(),\n noSkip: t.Boolean.optional(),\n type: ProjectType.optional(),\n});\n\nexport const TEMPLATE_CONFIG_FILENAME = 'skuba.template.js';\n\nexport const TEMPLATE_DIR = path.join(__dirname, '..', '..', 'template');\n\nexport const BASE_TEMPLATE_DIR = path.join(TEMPLATE_DIR, 'base');\n\nexport const ensureTemplateConfigDeletion = (dir: string): Promise<void> =>\n fs.promises.rm(path.join(dir, TEMPLATE_CONFIG_FILENAME));\n\nexport const readBaseTemplateFile = (src: string): Promise<string> =>\n fs.promises.readFile(path.join(BASE_TEMPLATE_DIR, src), 'utf8');\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAAiB;AAEjB,sBAAe;AACf,QAAmB;AAEnB,sBAA4B;AAErB,MAAM,iBAAiB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAIO,MAAM,0BAA0B,CAAC,GAAG,gBAAgB,eAAU;AAkB9D,MAAM,gCAGT;AAAA,EACF,oBAAoB;AAAA,IAClB,OAAO;AAAA,IACP,UAAU;AAAA,EACZ;AAAA,EACA,SAAS;AAAA,IACP,OAAO;AAAA,IACP,UAAU;AAAA,EACZ;AAAA,EACA,gBAAgB;AAAA,IACd,OAAO;AAAA,IACP,UAAU;AAAA,EACZ;AAAA,EACA,qBAAqB;AAAA,IACnB,OAAO;AAAA,IACP,UAAU;AAAA,EACZ;AAAA,EACA,yBAAyB;AAAA,IACvB,OAAO;AAAA,IACP,UAAU;AAAA,EACZ;AAAA,EACA,mBAAmB;AAAA,IACjB,OAAO;AAAA,IACP,UAAU;AAAA,EACZ;AAAA,EACA,uBAAuB;AAAA,IACrB,OAAO;AAAA,IACP,UAAU;AAAA,EACZ;AACF;AAIO,MAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,QAAQ,EAAE;AAAA,IACR,EAAE,OAAO;AAAA,MACP,MAAM,EAAE;AAAA,MACR,SAAS,EAAE;AAAA,MACX,SAAS,EAAE;AAAA,MACX,UAAU,EAAE,SAAS,SAAS;AAAA,IAChC,CAAC;AAAA,EACH;AAAA,EACA,YAAY,EAAE,OAAO,SAAS;AAAA,EAC9B,QAAQ,EAAE,QAAQ,SAAS;AAAA,EAC3B,MAAM,4BAAY,SAAS;AAC7B,CAAC;AAEM,MAAM,2BAA2B;AAEjC,MAAM,eAAe,YAAAA,QAAK,KAAK,WAAW,MAAM,MAAM,UAAU;AAEhE,MAAM,oBAAoB,YAAAA,QAAK,KAAK,cAAc,MAAM;AAExD,MAAM,+BAA+B,CAAC,QAC3C,gBAAAC,QAAG,SAAS,GAAG,YAAAD,QAAK,KAAK,KAAK,wBAAwB,CAAC;AAElD,MAAM,uBAAuB,CAAC,QACnC,gBAAAC,QAAG,SAAS,SAAS,YAAAD,QAAK,KAAK,mBAAmB,GAAG,GAAG,MAAM;",
|
|
6
|
+
"names": ["path", "fs"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const isFunction: (data: unknown) => data is (...args: unknown[]) => unknown | Promise<unknown>;
|
|
2
|
+
export declare const isIpPort: (value: unknown) => value is number;
|
|
3
|
+
export declare const isObject: (value: unknown) => value is Record<PropertyKey, unknown>;
|
|
4
|
+
export declare const hasProp: <P extends PropertyKey>(value: unknown, prop: P) => value is Record<P, unknown>;
|
|
5
|
+
export declare const hasNumberProp: <P extends PropertyKey>(value: unknown, prop: P) => value is Record<P, string>;
|
|
6
|
+
export declare const hasStringProp: <P extends PropertyKey>(value: unknown, prop: P) => value is Record<P, string>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
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 validation_exports = {};
|
|
20
|
+
__export(validation_exports, {
|
|
21
|
+
hasNumberProp: () => hasNumberProp,
|
|
22
|
+
hasProp: () => hasProp,
|
|
23
|
+
hasStringProp: () => hasStringProp,
|
|
24
|
+
isFunction: () => isFunction,
|
|
25
|
+
isIpPort: () => isIpPort,
|
|
26
|
+
isObject: () => isObject
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(validation_exports);
|
|
29
|
+
const isFunction = (data) => typeof data === "function";
|
|
30
|
+
const isIpPort = (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0 && value <= 65535;
|
|
31
|
+
const isObject = (value) => typeof value === "object" && value !== null;
|
|
32
|
+
const hasProp = (value, prop) => isObject(value) && value.hasOwnProperty(prop);
|
|
33
|
+
const hasNumberProp = (value, prop) => isObject(value) && typeof value[prop] === "number";
|
|
34
|
+
const hasStringProp = (value, prop) => isObject(value) && typeof value[prop] === "string";
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
37
|
+
hasNumberProp,
|
|
38
|
+
hasProp,
|
|
39
|
+
hasStringProp,
|
|
40
|
+
isFunction,
|
|
41
|
+
isIpPort,
|
|
42
|
+
isObject
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/validation.ts"],
|
|
4
|
+
"sourcesContent": ["export const isFunction = (\n data: unknown,\n): data is (...args: unknown[]) => unknown | Promise<unknown> =>\n typeof data === 'function';\n\nexport const isIpPort = (value: unknown): value is number =>\n typeof value === 'number' &&\n Number.isSafeInteger(value) &&\n value >= 0 &&\n value <= 65535;\n\nexport const isObject = (\n value: unknown,\n): value is Record<PropertyKey, unknown> =>\n typeof value === 'object' && value !== null;\n\nexport const hasProp = <P extends PropertyKey>(\n value: unknown,\n prop: P,\n): value is Record<P, unknown> => isObject(value) && value.hasOwnProperty(prop);\n\nexport const hasNumberProp = <P extends PropertyKey>(\n value: unknown,\n prop: P,\n): value is Record<P, string> =>\n isObject(value) && typeof value[prop] === 'number';\n\nexport const hasStringProp = <P extends PropertyKey>(\n value: unknown,\n prop: P,\n): value is Record<P, string> =>\n isObject(value) && typeof value[prop] === 'string';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,aAAa,CACxB,SAEA,OAAO,SAAS;AAEX,MAAM,WAAW,CAAC,UACvB,OAAO,UAAU,YACjB,OAAO,cAAc,KAAK,KAC1B,SAAS,KACT,SAAS;AAEJ,MAAM,WAAW,CACtB,UAEA,OAAO,UAAU,YAAY,UAAU;AAElC,MAAM,UAAU,CACrB,OACA,SACgC,SAAS,KAAK,KAAK,MAAM,eAAe,IAAI;AAEvE,MAAM,gBAAgB,CAC3B,OACA,SAEA,SAAS,KAAK,KAAK,OAAO,MAAM,IAAI,MAAM;AAErC,MAAM,gBAAgB,CAC3B,OACA,SAEA,SAAS,KAAK,KAAK,OAAO,MAAM,IAAI,MAAM;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const latestNpmVersion: (packageName: string) => Promise<string>;
|
|
2
|
+
export declare const getSkubaVersion: () => Promise<string>;
|
|
3
|
+
type SkubaVersionInfo = {
|
|
4
|
+
isStale: true;
|
|
5
|
+
local: string;
|
|
6
|
+
latest: string;
|
|
7
|
+
} | {
|
|
8
|
+
isStale: false;
|
|
9
|
+
local: string;
|
|
10
|
+
latest: string | null;
|
|
11
|
+
};
|
|
12
|
+
export declare const getSkubaVersionInfo: () => Promise<SkubaVersionInfo>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var version_exports = {};
|
|
30
|
+
__export(version_exports, {
|
|
31
|
+
getSkubaVersion: () => getSkubaVersion,
|
|
32
|
+
getSkubaVersionInfo: () => getSkubaVersionInfo,
|
|
33
|
+
latestNpmVersion: () => latestNpmVersion
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(version_exports);
|
|
36
|
+
var import_libnpmsearch = __toESM(require("libnpmsearch"));
|
|
37
|
+
var import_validate_npm_package_name = __toESM(require("validate-npm-package-name"));
|
|
38
|
+
var import_manifest = require("./manifest");
|
|
39
|
+
var import_wait = require("./wait");
|
|
40
|
+
const latestNpmVersion = async (packageName) => {
|
|
41
|
+
const { validForNewPackages } = (0, import_validate_npm_package_name.default)(packageName);
|
|
42
|
+
if (!validForNewPackages) {
|
|
43
|
+
throw new Error(`Package "${packageName}" does not have a valid name`);
|
|
44
|
+
}
|
|
45
|
+
const [result] = await (0, import_libnpmsearch.default)(packageName, { limit: 1, timeout: 5e3 });
|
|
46
|
+
if (result?.name !== packageName) {
|
|
47
|
+
throw new Error(
|
|
48
|
+
`Package "${packageName}" does not exist on the npm registry`
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
return result.version;
|
|
52
|
+
};
|
|
53
|
+
const latestSkubaVersion = async () => {
|
|
54
|
+
try {
|
|
55
|
+
const result = await (0, import_wait.withTimeout)(latestNpmVersion("skuba"), { s: 2 });
|
|
56
|
+
return result.ok ? result.value : null;
|
|
57
|
+
} catch {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
const getSkubaVersion = async () => {
|
|
62
|
+
const { version } = await (0, import_manifest.getSkubaManifest)();
|
|
63
|
+
return version;
|
|
64
|
+
};
|
|
65
|
+
const getSkubaVersionInfo = async () => {
|
|
66
|
+
const [local, latest] = await Promise.all([
|
|
67
|
+
getSkubaVersion(),
|
|
68
|
+
latestSkubaVersion()
|
|
69
|
+
]);
|
|
70
|
+
if (latest === null) {
|
|
71
|
+
return {
|
|
72
|
+
isStale: false,
|
|
73
|
+
local,
|
|
74
|
+
latest
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
isStale: latest !== local,
|
|
79
|
+
local,
|
|
80
|
+
latest
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
84
|
+
0 && (module.exports = {
|
|
85
|
+
getSkubaVersion,
|
|
86
|
+
getSkubaVersionInfo,
|
|
87
|
+
latestNpmVersion
|
|
88
|
+
});
|
|
89
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/version.ts"],
|
|
4
|
+
"sourcesContent": ["import searchNpm from 'libnpmsearch';\nimport validatePackageName from 'validate-npm-package-name';\n\nimport { getSkubaManifest } from './manifest';\nimport { withTimeout } from './wait';\n\nexport const latestNpmVersion = async (\n packageName: string,\n): Promise<string> => {\n const { validForNewPackages } = validatePackageName(packageName);\n\n if (!validForNewPackages) {\n throw new Error(`Package \"${packageName}\" does not have a valid name`);\n }\n\n const [result] = await searchNpm(packageName, { limit: 1, timeout: 5_000 });\n\n if (result?.name !== packageName) {\n throw new Error(\n `Package \"${packageName}\" does not exist on the npm registry`,\n );\n }\n\n return result.version;\n};\n\nconst latestSkubaVersion = async (): Promise<string | null> => {\n try {\n const result = await withTimeout(latestNpmVersion('skuba'), { s: 2 });\n\n return result.ok ? result.value : null;\n } catch {\n return null;\n }\n};\n\nexport const getSkubaVersion = async (): Promise<string> => {\n const { version } = await getSkubaManifest();\n\n return version;\n};\n\ntype SkubaVersionInfo =\n | {\n isStale: true;\n\n local: string;\n latest: string;\n }\n | {\n isStale: false;\n\n local: string;\n latest: string | null;\n };\n\nexport const getSkubaVersionInfo = async (): Promise<SkubaVersionInfo> => {\n const [local, latest] = await Promise.all([\n getSkubaVersion(),\n latestSkubaVersion(),\n ]);\n\n if (latest === null) {\n // Assume we're up to date if we can't reach the npm registry\n return {\n isStale: false,\n local,\n latest,\n };\n }\n\n return {\n isStale: latest !== local,\n local,\n latest,\n };\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAsB;AACtB,uCAAgC;AAEhC,sBAAiC;AACjC,kBAA4B;AAErB,MAAM,mBAAmB,OAC9B,gBACoB;AACpB,QAAM,EAAE,oBAAoB,QAAI,iCAAAA,SAAoB,WAAW;AAE/D,MAAI,CAAC,qBAAqB;AACxB,UAAM,IAAI,MAAM,YAAY,yCAAyC;AAAA,EACvE;AAEA,QAAM,CAAC,MAAM,IAAI,UAAM,oBAAAC,SAAU,aAAa,EAAE,OAAO,GAAG,SAAS,IAAM,CAAC;AAE1E,MAAI,QAAQ,SAAS,aAAa;AAChC,UAAM,IAAI;AAAA,MACR,YAAY;AAAA,IACd;AAAA,EACF;AAEA,SAAO,OAAO;AAChB;AAEA,MAAM,qBAAqB,YAAoC;AAC7D,MAAI;AACF,UAAM,SAAS,UAAM,yBAAY,iBAAiB,OAAO,GAAG,EAAE,GAAG,EAAE,CAAC;AAEpE,WAAO,OAAO,KAAK,OAAO,QAAQ;AAAA,EACpC,QAAE;AACA,WAAO;AAAA,EACT;AACF;AAEO,MAAM,kBAAkB,YAA6B;AAC1D,QAAM,EAAE,QAAQ,IAAI,UAAM,kCAAiB;AAE3C,SAAO;AACT;AAgBO,MAAM,sBAAsB,YAAuC;AACxE,QAAM,CAAC,OAAO,MAAM,IAAI,MAAM,QAAQ,IAAI;AAAA,IACxC,gBAAgB;AAAA,IAChB,mBAAmB;AAAA,EACrB,CAAC;AAED,MAAI,WAAW,MAAM;AAEnB,WAAO;AAAA,MACL,SAAS;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL,SAAS,WAAW;AAAA,IACpB;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
|
+
"names": ["validatePackageName", "searchNpm"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface Timeout extends PromiseLike<void> {
|
|
2
|
+
clear?: () => void;
|
|
3
|
+
}
|
|
4
|
+
export declare const sleep: (ms: number) => Timeout;
|
|
5
|
+
export declare const throwOnTimeout: <T>(promise: PromiseLike<T>, { s }: {
|
|
6
|
+
s: number;
|
|
7
|
+
}) => Promise<T>;
|
|
8
|
+
type TimeoutResult<T> = {
|
|
9
|
+
ok: true;
|
|
10
|
+
value: T;
|
|
11
|
+
} | {
|
|
12
|
+
ok: false;
|
|
13
|
+
};
|
|
14
|
+
export declare const withTimeout: <T>(promise: T | PromiseLike<T>, { s }: {
|
|
15
|
+
s: number;
|
|
16
|
+
}) => Promise<TimeoutResult<T>>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
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 wait_exports = {};
|
|
20
|
+
__export(wait_exports, {
|
|
21
|
+
sleep: () => sleep,
|
|
22
|
+
throwOnTimeout: () => throwOnTimeout,
|
|
23
|
+
withTimeout: () => withTimeout
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(wait_exports);
|
|
26
|
+
var import_error = require("./error");
|
|
27
|
+
var import_logging = require("./logging");
|
|
28
|
+
const sleep = (ms) => {
|
|
29
|
+
let timeout;
|
|
30
|
+
return Object.assign(
|
|
31
|
+
new Promise((resolve) => timeout = setTimeout(resolve, ms)),
|
|
32
|
+
{ clear: () => clearTimeout(timeout) }
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
const throwOnTimeout = async (promise, { s }) => {
|
|
36
|
+
const result = await withTimeout(promise, { s });
|
|
37
|
+
if (!result.ok) {
|
|
38
|
+
throw (0, import_error.createTerseError)(`Timed out after ${(0, import_logging.pluralise)(s, "second")}`);
|
|
39
|
+
}
|
|
40
|
+
return result.value;
|
|
41
|
+
};
|
|
42
|
+
const withTimeout = async (promise, { s }) => {
|
|
43
|
+
const timeout = sleep(s * 1e3);
|
|
44
|
+
try {
|
|
45
|
+
return await Promise.race([
|
|
46
|
+
Promise.resolve(promise).then((value) => ({ ok: true, value })),
|
|
47
|
+
timeout.then(() => ({ ok: false }))
|
|
48
|
+
]);
|
|
49
|
+
} finally {
|
|
50
|
+
timeout.clear?.();
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
54
|
+
0 && (module.exports = {
|
|
55
|
+
sleep,
|
|
56
|
+
throwOnTimeout,
|
|
57
|
+
withTimeout
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=wait.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/wait.ts"],
|
|
4
|
+
"sourcesContent": ["import { createTerseError } from './error';\nimport { pluralise } from './logging';\n\ninterface Timeout extends PromiseLike<void> {\n clear?: () => void;\n}\n\nexport const sleep = (ms: number): Timeout => {\n let timeout: NodeJS.Timeout;\n\n return Object.assign(\n new Promise<void>((resolve) => (timeout = setTimeout(resolve, ms))),\n { clear: () => clearTimeout(timeout) },\n );\n};\n\nexport const throwOnTimeout = async <T>(\n promise: PromiseLike<T>,\n { s }: { s: number },\n): Promise<T> => {\n const result = await withTimeout(promise, { s });\n\n if (!result.ok) {\n throw createTerseError(`Timed out after ${pluralise(s, 'second')}`);\n }\n\n return result.value;\n};\n\ntype TimeoutResult<T> = { ok: true; value: T } | { ok: false };\n\nexport const withTimeout = async <T>(\n promise: T | PromiseLike<T>,\n { s }: { s: number },\n): Promise<TimeoutResult<T>> => {\n const timeout = sleep(s * 1_000);\n\n try {\n return await Promise.race<TimeoutResult<T>>([\n Promise.resolve(promise).then((value) => ({ ok: true, value })),\n timeout.then(() => ({ ok: false })),\n ]);\n } finally {\n timeout.clear?.();\n }\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAiC;AACjC,qBAA0B;AAMnB,MAAM,QAAQ,CAAC,OAAwB;AAC5C,MAAI;AAEJ,SAAO,OAAO;AAAA,IACZ,IAAI,QAAc,CAAC,YAAa,UAAU,WAAW,SAAS,EAAE,CAAE;AAAA,IAClE,EAAE,OAAO,MAAM,aAAa,OAAO,EAAE;AAAA,EACvC;AACF;AAEO,MAAM,iBAAiB,OAC5B,SACA,EAAE,EAAE,MACW;AACf,QAAM,SAAS,MAAM,YAAY,SAAS,EAAE,EAAE,CAAC;AAE/C,MAAI,CAAC,OAAO,IAAI;AACd,cAAM,+BAAiB,uBAAmB,0BAAU,GAAG,QAAQ,GAAG;AAAA,EACpE;AAEA,SAAO,OAAO;AAChB;AAIO,MAAM,cAAc,OACzB,SACA,EAAE,EAAE,MAC0B;AAC9B,QAAM,UAAU,MAAM,IAAI,GAAK;AAE/B,MAAI;AACF,WAAO,MAAM,QAAQ,KAAuB;AAAA,MAC1C,QAAQ,QAAQ,OAAO,EAAE,KAAK,CAAC,WAAW,EAAE,IAAI,MAAM,MAAM,EAAE;AAAA,MAC9D,QAAQ,KAAK,OAAO,EAAE,IAAI,MAAM,EAAE;AAAA,IACpC,CAAC;AAAA,EACH,UAAE;AACA,YAAQ,QAAQ;AAAA,EAClB;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Executes a script at `filepath` in a Node.js worker thread.
|
|
3
|
+
*/
|
|
4
|
+
export declare const execWorkerThread: <Input, Output>(filepath: string, input: Input) => Promise<Output>;
|
|
5
|
+
/**
|
|
6
|
+
* Runs a function in a Node.js worker thread context, forwarding the result
|
|
7
|
+
* to the parent thread.
|
|
8
|
+
*/
|
|
9
|
+
export declare const postWorkerOutput: <Input, Output>(fn: (input: Input) => Promise<Output>, logger?: {
|
|
10
|
+
bold: import("chalk").Chalk;
|
|
11
|
+
formatSubtle: import("chalk").Chalk;
|
|
12
|
+
timing: (start: bigint, end: bigint) => string;
|
|
13
|
+
debug: (...message: unknown[]) => void;
|
|
14
|
+
subtle: (...message: unknown[]) => void;
|
|
15
|
+
err: (...message: unknown[]) => void;
|
|
16
|
+
newline: () => void;
|
|
17
|
+
ok: (...message: unknown[]) => void;
|
|
18
|
+
plain: (...message: unknown[]) => void;
|
|
19
|
+
warn: (...message: unknown[]) => void;
|
|
20
|
+
}) => void;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
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 worker_exports = {};
|
|
20
|
+
__export(worker_exports, {
|
|
21
|
+
execWorkerThread: () => execWorkerThread,
|
|
22
|
+
postWorkerOutput: () => postWorkerOutput
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(worker_exports);
|
|
25
|
+
var import_util = require("util");
|
|
26
|
+
var import_worker_threads = require("worker_threads");
|
|
27
|
+
var import_logging = require("./logging");
|
|
28
|
+
const execWorkerThread = async (filepath, input) => {
|
|
29
|
+
let output;
|
|
30
|
+
let messageReceived = false;
|
|
31
|
+
return new Promise(
|
|
32
|
+
(resolve, reject) => new import_worker_threads.Worker(filepath, {
|
|
33
|
+
workerData: input
|
|
34
|
+
}).on("error", reject).on(
|
|
35
|
+
"exit",
|
|
36
|
+
(code) => messageReceived ? resolve(output) : reject(
|
|
37
|
+
new Error(
|
|
38
|
+
code ? `Worker thread failed with exit code ${code}` : "Worker thread exited without posting a message"
|
|
39
|
+
)
|
|
40
|
+
)
|
|
41
|
+
).on("message", (message) => {
|
|
42
|
+
output = message;
|
|
43
|
+
messageReceived = true;
|
|
44
|
+
}).on("messageerror", (err) => reject(err))
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
const postWorkerOutput = (fn, logger = import_logging.log) => {
|
|
48
|
+
const port = import_worker_threads.parentPort;
|
|
49
|
+
if (!port) {
|
|
50
|
+
logger.err("`postWorkerOutput` called outside of a worker thread context");
|
|
51
|
+
process.exit(1);
|
|
52
|
+
}
|
|
53
|
+
fn(import_worker_threads.workerData).then((output) => port.postMessage(output)).catch((err) => {
|
|
54
|
+
logger.err((0, import_util.inspect)(err));
|
|
55
|
+
process.exit(1);
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
59
|
+
0 && (module.exports = {
|
|
60
|
+
execWorkerThread,
|
|
61
|
+
postWorkerOutput
|
|
62
|
+
});
|
|
63
|
+
//# sourceMappingURL=worker.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/worker.ts"],
|
|
4
|
+
"sourcesContent": ["import { inspect } from 'util';\nimport { Worker, parentPort, workerData } from 'worker_threads';\n\nimport { log } from './logging';\n\n/**\n * Executes a script at `filepath` in a Node.js worker thread.\n */\nexport const execWorkerThread = async <Input, Output>(\n filepath: string,\n input: Input,\n) => {\n let output: Output;\n let messageReceived = false;\n\n return new Promise<Output>((resolve, reject) =>\n new Worker(filepath, {\n workerData: input,\n })\n .on('error', reject)\n .on('exit', (code) =>\n messageReceived\n ? resolve(output)\n : reject(\n new Error(\n code\n ? `Worker thread failed with exit code ${code}`\n : 'Worker thread exited without posting a message',\n ),\n ),\n )\n .on('message', (message: Output) => {\n // Defer promise resolution to `exit` so stdio can settle.\n output = message;\n messageReceived = true;\n })\n .on('messageerror', (err) => reject(err)),\n );\n};\n\n/**\n * Runs a function in a Node.js worker thread context, forwarding the result\n * to the parent thread.\n */\nexport const postWorkerOutput = <Input, Output>(\n fn: (input: Input) => Promise<Output>,\n logger = log,\n) => {\n const port = parentPort;\n\n if (!port) {\n logger.err('`postWorkerOutput` called outside of a worker thread context');\n\n process.exit(1);\n }\n\n fn(workerData as Input)\n .then((output) => port.postMessage(output))\n .catch((err) => {\n logger.err(inspect(err));\n\n process.exit(1);\n });\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AACxB,4BAA+C;AAE/C,qBAAoB;AAKb,MAAM,mBAAmB,OAC9B,UACA,UACG;AACH,MAAI;AACJ,MAAI,kBAAkB;AAEtB,SAAO,IAAI;AAAA,IAAgB,CAAC,SAAS,WACnC,IAAI,6BAAO,UAAU;AAAA,MACnB,YAAY;AAAA,IACd,CAAC,EACE,GAAG,SAAS,MAAM,EAClB;AAAA,MAAG;AAAA,MAAQ,CAAC,SACX,kBACI,QAAQ,MAAM,IACd;AAAA,QACE,IAAI;AAAA,UACF,OACI,uCAAuC,SACvC;AAAA,QACN;AAAA,MACF;AAAA,IACN,EACC,GAAG,WAAW,CAAC,YAAoB;AAElC,eAAS;AACT,wBAAkB;AAAA,IACpB,CAAC,EACA,GAAG,gBAAgB,CAAC,QAAQ,OAAO,GAAG,CAAC;AAAA,EAC5C;AACF;AAMO,MAAM,mBAAmB,CAC9B,IACA,SAAS,uBACN;AACH,QAAM,OAAO;AAEb,MAAI,CAAC,MAAM;AACT,WAAO,IAAI,8DAA8D;AAEzE,YAAQ,KAAK,CAAC;AAAA,EAChB;AAEA,KAAG,gCAAmB,EACnB,KAAK,CAAC,WAAW,KAAK,YAAY,MAAM,CAAC,EACzC,MAAM,CAAC,QAAQ;AACd,WAAO,QAAI,qBAAQ,GAAG,CAAC;AAEvB,YAAQ,KAAK,CAAC;AAAA,EAChB,CAAC;AACL;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface Args {
|
|
2
|
+
availablePort?: number;
|
|
3
|
+
entryPoint: unknown;
|
|
4
|
+
functionName: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Create an HTTP server that calls into an exported function.
|
|
8
|
+
*/
|
|
9
|
+
export declare const runFunctionHandler: ({ availablePort, entryPoint, functionName, }: Args) => Promise<void>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var functionHandler_exports = {};
|
|
30
|
+
__export(functionHandler_exports, {
|
|
31
|
+
runFunctionHandler: () => runFunctionHandler
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(functionHandler_exports);
|
|
34
|
+
var import_function_arguments = __toESM(require("function-arguments"));
|
|
35
|
+
var import_logging = require("../utils/logging");
|
|
36
|
+
var import_validation = require("../utils/validation");
|
|
37
|
+
var import_http = require("./http");
|
|
38
|
+
const runFunctionHandler = async ({
|
|
39
|
+
availablePort,
|
|
40
|
+
entryPoint,
|
|
41
|
+
functionName
|
|
42
|
+
}) => {
|
|
43
|
+
if (!(0, import_validation.isObject)(entryPoint)) {
|
|
44
|
+
import_logging.log.subtle(import_logging.log.bold(functionName), "is not exported");
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const fn = entryPoint[functionName];
|
|
48
|
+
if (!(0, import_validation.isFunction)(fn)) {
|
|
49
|
+
import_logging.log.subtle(import_logging.log.bold(functionName), "is not a function");
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
import_logging.log.warn(
|
|
53
|
+
import_logging.log.bold(functionName),
|
|
54
|
+
`(${(0, import_function_arguments.default)(fn).map((arg) => arg || "?").join(", ")})`
|
|
55
|
+
);
|
|
56
|
+
const requestListener = (0, import_http.createRequestListenerFromFunction)(fn);
|
|
57
|
+
return (0, import_http.serveRequestListener)(requestListener, availablePort);
|
|
58
|
+
};
|
|
59
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
60
|
+
0 && (module.exports = {
|
|
61
|
+
runFunctionHandler
|
|
62
|
+
});
|
|
63
|
+
//# sourceMappingURL=functionHandler.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/wrapper/functionHandler.ts"],
|
|
4
|
+
"sourcesContent": ["import fnArgs from 'function-arguments';\n\nimport { log } from '../utils/logging';\nimport { isFunction, isObject } from '../utils/validation';\n\nimport {\n createRequestListenerFromFunction,\n serveRequestListener,\n} from './http';\n\ninterface Args {\n availablePort?: number;\n entryPoint: unknown;\n functionName: string;\n}\n\n/**\n * Create an HTTP server that calls into an exported function.\n */\nexport const runFunctionHandler = async ({\n availablePort,\n entryPoint,\n functionName,\n}: Args): Promise<void> => {\n if (!isObject(entryPoint)) {\n log.subtle(log.bold(functionName), 'is not exported');\n return;\n }\n\n const fn = entryPoint[functionName];\n\n if (!isFunction(fn)) {\n log.subtle(log.bold(functionName), 'is not a function');\n return;\n }\n\n log.warn(\n log.bold(functionName),\n `(${fnArgs(fn)\n // Add a `?` placeholder for unnamed arguments.\n .map((arg) => arg || '?')\n .join(', ')})`,\n );\n\n const requestListener = createRequestListenerFromFunction(fn);\n\n return serveRequestListener(requestListener, availablePort);\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAAmB;AAEnB,qBAAoB;AACpB,wBAAqC;AAErC,kBAGO;AAWA,MAAM,qBAAqB,OAAO;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AACF,MAA2B;AACzB,MAAI,KAAC,4BAAS,UAAU,GAAG;AACzB,uBAAI,OAAO,mBAAI,KAAK,YAAY,GAAG,iBAAiB;AACpD;AAAA,EACF;AAEA,QAAM,KAAK,WAAW,YAAY;AAElC,MAAI,KAAC,8BAAW,EAAE,GAAG;AACnB,uBAAI,OAAO,mBAAI,KAAK,YAAY,GAAG,mBAAmB;AACtD;AAAA,EACF;AAEA,qBAAI;AAAA,IACF,mBAAI,KAAK,YAAY;AAAA,IACrB,QAAI,0BAAAA,SAAO,EAAE,EAEV,IAAI,CAAC,QAAQ,OAAO,GAAG,EACvB,KAAK,IAAI;AAAA,EACd;AAEA,QAAM,sBAAkB,+CAAkC,EAAE;AAE5D,aAAO,kCAAqB,iBAAiB,aAAa;AAC5D;",
|
|
6
|
+
"names": ["fnArgs"]
|
|
7
|
+
}
|