skuba 4.4.1 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/tsconfig.json +1 -0
- package/jest/moduleNameMapper.js +50 -78
- package/jest/moduleNameMapper.test.ts +4 -14
- package/jest/transform.js +10 -1
- package/jest/tsConfig.js +26 -0
- package/lib/api/buildkite/annotate.js +46 -33
- package/lib/api/buildkite/annotate.js.map +7 -1
- package/lib/api/buildkite/index.js +31 -7
- package/lib/api/buildkite/index.js.map +7 -1
- package/lib/api/buildkite/md.js +31 -8
- package/lib/api/buildkite/md.js.map +7 -1
- package/lib/api/git/commit.js +45 -17
- package/lib/api/git/commit.js.map +7 -1
- package/lib/api/git/commitAllChanges.js +57 -27
- package/lib/api/git/commitAllChanges.js.map +7 -1
- package/lib/api/git/currentBranch.js +50 -28
- package/lib/api/git/currentBranch.js.map +7 -1
- package/lib/api/git/getChangedFiles.js +49 -27
- package/lib/api/git/getChangedFiles.js.map +7 -1
- package/lib/api/git/index.js +54 -22
- package/lib/api/git/index.js.map +7 -1
- package/lib/api/git/log.js +63 -42
- package/lib/api/git/log.js.map +7 -1
- package/lib/api/git/pull.js +62 -31
- package/lib/api/git/pull.js.map +7 -1
- package/lib/api/git/push.js +63 -31
- package/lib/api/git/push.js.map +7 -1
- package/lib/api/git/remote.js +59 -56
- package/lib/api/git/remote.js.map +7 -1
- package/lib/api/git/reset.js +55 -27
- package/lib/api/git/reset.js.map +7 -1
- package/lib/api/git/statusMatrix.js +46 -13
- package/lib/api/git/statusMatrix.js.map +7 -1
- package/lib/api/github/checkRun.js +70 -79
- package/lib/api/github/checkRun.js.map +7 -1
- package/lib/api/github/environment.js +40 -33
- package/lib/api/github/environment.js.map +7 -1
- package/lib/api/github/index.js +47 -17
- package/lib/api/github/index.js.map +7 -1
- package/lib/api/github/issueComment.js +73 -81
- package/lib/api/github/issueComment.js.map +7 -1
- package/lib/api/github/pullRequest.js +60 -61
- package/lib/api/github/pullRequest.js.map +7 -1
- package/lib/api/github/push.js +138 -133
- package/lib/api/github/push.js.map +7 -1
- package/lib/api/jest/index.d.ts +2 -1
- package/lib/api/jest/index.js +35 -14
- package/lib/api/jest/index.js.map +7 -1
- package/lib/api/net/compose.js +45 -17
- package/lib/api/net/compose.js.map +7 -1
- package/lib/api/net/index.js +28 -5
- package/lib/api/net/index.js.map +7 -1
- package/lib/api/net/socket.js +58 -36
- package/lib/api/net/socket.js.map +7 -1
- package/lib/api/net/waitFor.js +38 -18
- package/lib/api/net/waitFor.js.map +7 -1
- package/lib/cli/adapter/eslint.js +95 -72
- package/lib/cli/adapter/eslint.js.map +7 -1
- package/lib/cli/adapter/prettier.js +135 -123
- package/lib/cli/adapter/prettier.js.map +7 -1
- package/lib/cli/build/args.d.ts +7 -0
- package/lib/cli/build/args.js +69 -0
- package/lib/cli/build/args.js.map +7 -0
- package/lib/cli/build/esbuild.d.ts +5 -0
- package/lib/cli/build/esbuild.js +128 -0
- package/lib/cli/build/esbuild.js.map +7 -0
- package/lib/cli/build/index.d.ts +1 -1
- package/lib/cli/build/index.js +68 -5
- package/lib/cli/build/index.js.map +7 -1
- package/lib/cli/build/tsc.d.ts +1 -1
- package/lib/cli/build/tsc.js +34 -23
- package/lib/cli/build/tsc.js.map +7 -1
- package/lib/cli/buildPackage.js +53 -23
- package/lib/cli/buildPackage.js.map +7 -1
- package/lib/cli/configure/addEmptyExports.d.ts +5 -0
- package/lib/cli/configure/addEmptyExports.js +67 -0
- package/lib/cli/configure/addEmptyExports.js.map +7 -0
- package/lib/cli/configure/analyseConfiguration.js +61 -31
- package/lib/cli/configure/analyseConfiguration.js.map +7 -1
- package/lib/cli/configure/analyseDependencies.js +122 -113
- package/lib/cli/configure/analyseDependencies.js.map +7 -1
- package/lib/cli/configure/analysis/diff.js +37 -11
- package/lib/cli/configure/analysis/diff.js.map +7 -1
- package/lib/cli/configure/analysis/files.js +49 -22
- package/lib/cli/configure/analysis/files.js.map +7 -1
- package/lib/cli/configure/analysis/git.js +46 -16
- package/lib/cli/configure/analysis/git.js.map +7 -1
- package/lib/cli/configure/analysis/package.js +99 -52
- package/lib/cli/configure/analysis/package.js.map +7 -1
- package/lib/cli/configure/analysis/project.js +90 -54
- package/lib/cli/configure/analysis/project.js.map +7 -1
- package/lib/cli/configure/dependencies/index.js +40 -13
- package/lib/cli/configure/dependencies/index.js.map +7 -1
- package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js +57 -32
- package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js.map +7 -1
- package/lib/cli/configure/dependencies/seekKoala.js +53 -31
- package/lib/cli/configure/dependencies/seekKoala.js.map +7 -1
- package/lib/cli/configure/dependencies/skuba.js +49 -27
- package/lib/cli/configure/dependencies/skuba.js.map +7 -1
- package/lib/cli/configure/dependencies/skubaDeps.js +49 -28
- package/lib/cli/configure/dependencies/skubaDeps.js.map +7 -1
- package/lib/cli/configure/dependencies/skubaDive.js +65 -38
- package/lib/cli/configure/dependencies/skubaDive.js.map +7 -1
- package/lib/cli/configure/ensureTemplateCompletion.js +69 -41
- package/lib/cli/configure/ensureTemplateCompletion.js.map +7 -1
- package/lib/cli/configure/getEntryPoint.js +62 -32
- package/lib/cli/configure/getEntryPoint.js.map +7 -1
- package/lib/cli/configure/getProjectType.js +50 -28
- package/lib/cli/configure/getProjectType.js.map +7 -1
- package/lib/cli/configure/index.js +134 -109
- package/lib/cli/configure/index.js.map +7 -1
- package/lib/cli/configure/modules/eslint.js +57 -26
- package/lib/cli/configure/modules/eslint.js.map +7 -1
- package/lib/cli/configure/modules/ignore.js +37 -14
- package/lib/cli/configure/modules/ignore.js.map +7 -1
- package/lib/cli/configure/modules/index.js +53 -28
- package/lib/cli/configure/modules/index.js.map +7 -1
- package/lib/cli/configure/modules/jest.js +82 -47
- package/lib/cli/configure/modules/jest.js.map +7 -1
- package/lib/cli/configure/modules/nodemon.js +29 -6
- package/lib/cli/configure/modules/nodemon.js.map +7 -1
- package/lib/cli/configure/modules/package.js +113 -92
- package/lib/cli/configure/modules/package.js.map +7 -1
- package/lib/cli/configure/modules/prettier.js +48 -19
- package/lib/cli/configure/modules/prettier.js.map +7 -1
- package/lib/cli/configure/modules/renovate.js +52 -39
- package/lib/cli/configure/modules/renovate.js.map +7 -1
- package/lib/cli/configure/modules/serverless.js +33 -15
- package/lib/cli/configure/modules/serverless.js.map +7 -1
- package/lib/cli/configure/modules/skubaDive.js +63 -37
- package/lib/cli/configure/modules/skubaDive.js.map +7 -1
- package/lib/cli/configure/modules/tsconfig.js +84 -63
- package/lib/cli/configure/modules/tsconfig.js.map +7 -1
- package/lib/cli/configure/modules/tslint.js +29 -6
- package/lib/cli/configure/modules/tslint.js.map +7 -1
- package/lib/cli/configure/processing/deleteFiles.js +30 -8
- package/lib/cli/configure/processing/deleteFiles.js.map +7 -1
- package/lib/cli/configure/processing/ignoreFile.js +65 -59
- package/lib/cli/configure/processing/ignoreFile.js.map +7 -1
- package/lib/cli/configure/processing/javascript.js +35 -15
- package/lib/cli/configure/processing/javascript.js.map +7 -1
- package/lib/cli/configure/processing/json.js +51 -20
- package/lib/cli/configure/processing/json.js.map +7 -1
- package/lib/cli/configure/processing/loadFiles.js +30 -8
- package/lib/cli/configure/processing/loadFiles.js.map +7 -1
- package/lib/cli/configure/processing/module.js +37 -14
- package/lib/cli/configure/processing/module.js.map +7 -1
- package/lib/cli/configure/processing/package.js +73 -43
- package/lib/cli/configure/processing/package.js.map +7 -1
- package/lib/cli/configure/processing/prettier.js +37 -11
- package/lib/cli/configure/processing/prettier.js.map +7 -1
- package/lib/cli/configure/processing/record.js +54 -31
- package/lib/cli/configure/processing/record.js.map +7 -1
- package/lib/cli/configure/processing/typescript.js +176 -158
- package/lib/cli/configure/processing/typescript.js.map +7 -1
- package/lib/cli/configure/refreshIgnoreFiles.js +64 -40
- package/lib/cli/configure/refreshIgnoreFiles.js.map +7 -1
- package/lib/cli/configure/types.js +16 -2
- package/lib/cli/configure/types.js.map +7 -1
- package/lib/cli/format.js +58 -31
- package/lib/cli/format.js.map +7 -1
- package/lib/cli/help.js +31 -8
- package/lib/cli/help.js.map +7 -1
- package/lib/cli/init/getConfig.d.ts +1 -1
- package/lib/cli/init/getConfig.js +238 -207
- package/lib/cli/init/getConfig.js.map +7 -1
- package/lib/cli/init/git.js +70 -63
- package/lib/cli/init/git.js.map +7 -1
- package/lib/cli/init/index.js +133 -100
- package/lib/cli/init/index.js.map +7 -1
- package/lib/cli/init/prompts.js +84 -54
- package/lib/cli/init/prompts.js.map +7 -1
- package/lib/cli/init/types.js +52 -52
- package/lib/cli/init/types.js.map +7 -1
- package/lib/cli/init/validation.js +34 -12
- package/lib/cli/init/validation.js.map +7 -1
- package/lib/cli/init/writePackageJson.js +51 -22
- package/lib/cli/init/writePackageJson.js.map +7 -1
- package/lib/cli/lint/annotate/buildkite/eslint.js +34 -28
- package/lib/cli/lint/annotate/buildkite/eslint.js.map +7 -1
- package/lib/cli/lint/annotate/buildkite/index.js +50 -44
- package/lib/cli/lint/annotate/buildkite/index.js.map +7 -1
- package/lib/cli/lint/annotate/buildkite/prettier.js +41 -35
- package/lib/cli/lint/annotate/buildkite/prettier.js.map +7 -1
- package/lib/cli/lint/annotate/buildkite/tsc.js +39 -39
- package/lib/cli/lint/annotate/buildkite/tsc.js.map +7 -1
- package/lib/cli/lint/annotate/github/eslint.js +40 -16
- package/lib/cli/lint/annotate/github/eslint.js.map +7 -1
- package/lib/cli/lint/annotate/github/index.js +55 -51
- package/lib/cli/lint/annotate/github/index.js.map +7 -1
- package/lib/cli/lint/annotate/github/prettier.js +36 -13
- package/lib/cli/lint/annotate/github/prettier.js.map +7 -1
- package/lib/cli/lint/annotate/github/tsc.js +52 -52
- package/lib/cli/lint/annotate/github/tsc.js.map +7 -1
- package/lib/cli/lint/annotate/index.d.ts +1 -1
- package/lib/cli/lint/annotate/index.js +33 -10
- package/lib/cli/lint/annotate/index.js.map +7 -1
- package/lib/cli/lint/autofix.js +122 -117
- package/lib/cli/lint/autofix.js.map +7 -1
- package/lib/cli/lint/eslint.js +48 -18
- package/lib/cli/lint/eslint.js.map +7 -1
- package/lib/cli/lint/external.js +102 -81
- package/lib/cli/lint/external.js.map +7 -1
- package/lib/cli/lint/index.js +42 -18
- package/lib/cli/lint/index.js.map +7 -1
- package/lib/cli/lint/internal.js +54 -21
- package/lib/cli/lint/internal.js.map +7 -1
- package/lib/cli/lint/prettier.js +48 -18
- package/lib/cli/lint/prettier.js.map +7 -1
- package/lib/cli/lint/tsc.js +56 -32
- package/lib/cli/lint/tsc.js.map +7 -1
- package/lib/cli/lint/types.js +16 -2
- package/lib/cli/lint/types.js.map +7 -1
- package/lib/cli/node.js +65 -58
- package/lib/cli/node.js.map +7 -1
- package/lib/cli/release.js +29 -6
- package/lib/cli/release.js.map +7 -1
- package/lib/cli/start.js +61 -24
- package/lib/cli/start.js.map +7 -1
- package/lib/cli/test/index.js +35 -11
- package/lib/cli/test/index.js.map +7 -1
- package/lib/cli/test/reporters/github/annotations.js +89 -92
- package/lib/cli/test/reporters/github/annotations.js.map +7 -1
- package/lib/cli/test/reporters/github/index.js +68 -68
- package/lib/cli/test/reporters/github/index.js.map +7 -1
- package/lib/cli/version.js +31 -8
- package/lib/cli/version.js.map +7 -1
- package/lib/enquirer.d.js +2 -0
- package/lib/enquirer.d.js.map +7 -0
- package/lib/index.d.ts +6 -0
- package/lib/index.js +45 -41
- package/lib/index.js.map +7 -1
- package/lib/skuba.js +45 -38
- package/lib/skuba.js.map +7 -1
- package/lib/utils/args.js +97 -96
- package/lib/utils/args.js.map +7 -1
- package/lib/utils/command.js +64 -33
- package/lib/utils/command.js.map +7 -1
- package/lib/utils/copy.js +88 -51
- package/lib/utils/copy.js.map +7 -1
- package/lib/utils/dir.js +79 -67
- package/lib/utils/dir.js.map +7 -1
- package/lib/utils/env.js +27 -7
- package/lib/utils/env.js.map +7 -1
- package/lib/utils/error.js +58 -56
- package/lib/utils/error.js.map +7 -1
- package/lib/utils/exec.js +139 -110
- package/lib/utils/exec.js.map +7 -1
- package/lib/utils/help.js +31 -8
- package/lib/utils/help.js.map +7 -1
- package/lib/utils/logging.js +52 -24
- package/lib/utils/logging.js.map +7 -1
- package/lib/utils/logo.js +65 -27
- package/lib/utils/logo.js.map +7 -1
- package/lib/utils/manifest.d.ts +1 -0
- package/lib/utils/manifest.js +65 -51
- package/lib/utils/manifest.js.map +7 -1
- package/lib/utils/port.js +38 -17
- package/lib/utils/port.js.map +7 -1
- package/lib/utils/template.js +106 -87
- package/lib/utils/template.js.map +7 -1
- package/lib/utils/validation.js +43 -18
- package/lib/utils/validation.js.map +7 -1
- package/lib/utils/version.js +72 -82
- package/lib/utils/version.js.map +7 -1
- package/lib/utils/wait.js +52 -25
- package/lib/utils/wait.js.map +7 -1
- package/lib/utils/worker.js +59 -44
- package/lib/utils/worker.js.map +7 -1
- package/lib/wrapper/function-arguments.d.js +2 -0
- package/lib/wrapper/function-arguments.d.js.map +7 -0
- package/lib/wrapper/functionHandler.js +56 -29
- package/lib/wrapper/functionHandler.js.map +7 -1
- package/lib/wrapper/http.js +66 -56
- package/lib/wrapper/http.js.map +7 -1
- package/lib/wrapper/index.js +9 -21
- package/lib/wrapper/index.js.map +7 -1
- package/lib/wrapper/main.js +39 -20
- package/lib/wrapper/main.js.map +7 -1
- package/lib/wrapper/requestListener.js +50 -35
- package/lib/wrapper/requestListener.js.map +7 -1
- package/package.json +85 -79
- package/template/base/jest.config.ts +0 -6
- package/template/base/jest.setup.ts +2 -0
- package/template/base/tsconfig.json +2 -2
- package/template/express-rest-api/.buildkite/pipeline.yml +1 -1
- package/template/express-rest-api/.nvmrc +1 -1
- package/template/express-rest-api/Dockerfile +1 -1
- package/template/express-rest-api/Dockerfile.dev-deps +1 -1
- package/template/express-rest-api/package.json +14 -14
- package/template/greeter/.buildkite/pipeline.yml +1 -1
- package/template/greeter/.nvmrc +1 -1
- package/template/greeter/Dockerfile +1 -1
- package/template/greeter/package.json +11 -11
- package/template/greeter/src/app.test.ts +3 -1
- package/template/koa-rest-api/.buildkite/pipeline.yml +1 -1
- package/template/koa-rest-api/.nvmrc +1 -1
- package/template/koa-rest-api/Dockerfile +1 -1
- package/template/koa-rest-api/Dockerfile.dev-deps +1 -1
- package/template/koa-rest-api/package.json +20 -21
- package/template/koa-rest-api/src/api/jobs/postJob.test.ts +3 -7
- package/template/koa-rest-api/src/api/jobs/postJob.ts +2 -2
- package/template/koa-rest-api/src/framework/validation.test.ts +17 -15
- package/template/koa-rest-api/src/framework/validation.ts +66 -12
- package/template/koa-rest-api/src/testing/types.ts +5 -10
- package/template/koa-rest-api/src/types/jobs.ts +5 -10
- package/template/lambda-sqs-worker/.buildkite/pipeline.yml +4 -4
- package/template/lambda-sqs-worker/Dockerfile +1 -1
- package/template/lambda-sqs-worker/package.json +16 -20
- package/template/lambda-sqs-worker/src/app.ts +2 -2
- package/template/lambda-sqs-worker/src/framework/validation.test.ts +37 -17
- package/template/lambda-sqs-worker/src/framework/validation.ts +10 -2
- package/template/lambda-sqs-worker/src/services/jobScorer.ts +2 -2
- package/template/lambda-sqs-worker/src/testing/types.ts +5 -10
- package/template/lambda-sqs-worker/src/types/jobScorer.ts +9 -16
- package/template/lambda-sqs-worker/src/types/pipelineEvents.ts +13 -20
- package/template/lambda-sqs-worker/tsconfig.json +13 -0
- package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +4 -4
- package/template/lambda-sqs-worker-cdk/Dockerfile +1 -1
- package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +6 -0
- package/template/lambda-sqs-worker-cdk/infra/appStack.ts +3 -3
- package/template/lambda-sqs-worker-cdk/infra/index.ts +2 -2
- package/template/lambda-sqs-worker-cdk/package.json +14 -14
- package/template/lambda-sqs-worker-cdk/shared/context-types.ts +16 -25
- package/template/lambda-sqs-worker-cdk/tsconfig.json +13 -0
- package/template/oss-npm-package/.nvmrc +1 -1
- package/template/oss-npm-package/_package.json +1 -1
- package/template/private-npm-package/.nvmrc +1 -1
- package/template/private-npm-package/_package.json +1 -1
- package/jest/resolver.js +0 -24
|
@@ -1,32 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
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 });
|
|
4
11
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var currentBranch_exports = {};
|
|
26
|
+
__export(currentBranch_exports, {
|
|
27
|
+
currentBranch: () => currentBranch
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(currentBranch_exports);
|
|
30
|
+
var import_fs_extra = __toESM(require("fs-extra"));
|
|
31
|
+
var import_isomorphic_git = __toESM(require("isomorphic-git"));
|
|
12
32
|
const currentBranchFromEnvironment = (env = process.env) => env.BUILDKITE_BRANCH ?? env.GITHUB_HEAD_REF ?? env.GITHUB_REF_NAME;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return fromRepo ?? undefined;
|
|
33
|
+
const currentBranch = async ({
|
|
34
|
+
dir,
|
|
35
|
+
env = process.env
|
|
36
|
+
} = {}) => {
|
|
37
|
+
const fromEnv = currentBranchFromEnvironment(env);
|
|
38
|
+
if (fromEnv) {
|
|
39
|
+
return fromEnv;
|
|
40
|
+
}
|
|
41
|
+
if (!dir) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const fromRepo = await import_isomorphic_git.default.currentBranch({
|
|
45
|
+
dir,
|
|
46
|
+
fs: import_fs_extra.default
|
|
47
|
+
});
|
|
48
|
+
return fromRepo ?? void 0;
|
|
30
49
|
};
|
|
31
|
-
|
|
32
|
-
|
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
+
0 && (module.exports = {
|
|
52
|
+
currentBranch
|
|
53
|
+
});
|
|
54
|
+
//# sourceMappingURL=currentBranch.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/api/git/currentBranch.ts"],
|
|
4
|
+
"sourcesContent": ["import fs from 'fs-extra';\nimport git from 'isomorphic-git';\n\n/**\n * Tries to return a Git branch name from CI environment variables.\n */\nconst currentBranchFromEnvironment = (env = process.env): string | undefined =>\n env.BUILDKITE_BRANCH ?? env.GITHUB_HEAD_REF ?? env.GITHUB_REF_NAME;\n\ninterface CurrentBranchParameters {\n dir?: string;\n env?: Record<string, string | undefined>;\n}\n\n/**\n * Tries to return a Git branch name from CI environment variables, falling back\n * to the local Git repository when the current working `dir` is supplied.\n */\nexport const currentBranch = async ({\n dir,\n env = process.env,\n}: CurrentBranchParameters = {}): Promise<string | undefined> => {\n const fromEnv = currentBranchFromEnvironment(env);\n\n if (fromEnv) {\n return fromEnv;\n }\n\n if (!dir) {\n return;\n }\n\n const fromRepo = await git.currentBranch({\n dir,\n fs,\n });\n\n return fromRepo ?? undefined;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAe;AACf,4BAAgB;AAKhB,MAAM,+BAA+B,CAAC,MAAM,QAAQ,QAClD,IAAI,oBAAoB,IAAI,mBAAmB,IAAI;AAW9C,MAAM,gBAAgB,OAAO;AAAA,EAClC;AAAA,EACA,MAAM,QAAQ;AAChB,IAA6B,CAAC,MAAmC;AAC/D,QAAM,UAAU,6BAA6B,GAAG;AAEhD,MAAI,SAAS;AACX,WAAO;AAAA,EACT;AAEA,MAAI,CAAC,KAAK;AACR;AAAA,EACF;AAEA,QAAM,WAAW,MAAM,sBAAAA,QAAI,cAAc;AAAA,IACvC;AAAA,IACA,oBAAAC;AAAA,EACF,CAAC;AAED,SAAO,YAAY;AACrB;",
|
|
6
|
+
"names": ["git", "fs"]
|
|
7
|
+
}
|
|
@@ -1,32 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
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 });
|
|
4
11
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var getChangedFiles_exports = {};
|
|
26
|
+
__export(getChangedFiles_exports, {
|
|
27
|
+
getChangedFiles: () => getChangedFiles
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(getChangedFiles_exports);
|
|
30
|
+
var import_fs_extra = __toESM(require("fs-extra"));
|
|
31
|
+
var import_isomorphic_git = __toESM(require("isomorphic-git"));
|
|
32
|
+
var import_statusMatrix = require("./statusMatrix");
|
|
10
33
|
const mapState = (row) => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
34
|
+
if (row[import_statusMatrix.HEAD] === import_statusMatrix.ABSENT) {
|
|
35
|
+
return "added";
|
|
36
|
+
}
|
|
37
|
+
if (row[import_statusMatrix.WORKDIR] === import_statusMatrix.MODIFIED) {
|
|
38
|
+
return "modified";
|
|
39
|
+
}
|
|
40
|
+
return "deleted";
|
|
18
41
|
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
.filter((row) => row[statusMatrix_1.HEAD] !== statusMatrix_1.UNMODIFIED ||
|
|
27
|
-
row[statusMatrix_1.WORKDIR] !== statusMatrix_1.UNMODIFIED ||
|
|
28
|
-
row[statusMatrix_1.STAGE] !== statusMatrix_1.UNMODIFIED)
|
|
29
|
-
.map((row) => ({ path: row[statusMatrix_1.FILEPATH], state: mapState(row) }));
|
|
42
|
+
const getChangedFiles = async ({
|
|
43
|
+
dir
|
|
44
|
+
}) => {
|
|
45
|
+
const allFiles = await import_isomorphic_git.default.statusMatrix({ fs: import_fs_extra.default, dir });
|
|
46
|
+
return allFiles.filter(
|
|
47
|
+
(row) => row[import_statusMatrix.HEAD] !== import_statusMatrix.UNMODIFIED || row[import_statusMatrix.WORKDIR] !== import_statusMatrix.UNMODIFIED || row[import_statusMatrix.STAGE] !== import_statusMatrix.UNMODIFIED
|
|
48
|
+
).map((row) => ({ path: row[import_statusMatrix.FILEPATH], state: mapState(row) }));
|
|
30
49
|
};
|
|
31
|
-
|
|
32
|
-
|
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
+
0 && (module.exports = {
|
|
52
|
+
getChangedFiles
|
|
53
|
+
});
|
|
54
|
+
//# sourceMappingURL=getChangedFiles.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/api/git/getChangedFiles.ts"],
|
|
4
|
+
"sourcesContent": ["import fs from 'fs-extra';\nimport git from 'isomorphic-git';\n\nimport {\n ABSENT,\n FILEPATH,\n HEAD,\n MODIFIED,\n STAGE,\n UNMODIFIED,\n WORKDIR,\n} from './statusMatrix';\n\ntype ChangedFileState = 'added' | 'modified' | 'deleted';\nexport interface ChangedFile {\n path: string;\n state: ChangedFileState;\n}\ninterface ChangedFilesParameters {\n dir: string;\n}\n\nconst mapState = (\n row: [string, 0 | 1, 0 | 1 | 2, 0 | 1 | 2 | 3],\n): ChangedFileState => {\n if (row[HEAD] === ABSENT) {\n return 'added';\n }\n\n if (row[WORKDIR] === MODIFIED) {\n return 'modified';\n }\n\n return 'deleted';\n};\n\n/**\n * Returns all the files which have been added, modified or deleted in the\n * working directory of the local Git repository since the last commit.\n */\nexport const getChangedFiles = async ({\n dir,\n}: ChangedFilesParameters): Promise<ChangedFile[]> => {\n const allFiles = await git.statusMatrix({ fs, dir });\n return allFiles\n .filter(\n (row) =>\n row[HEAD] !== UNMODIFIED ||\n row[WORKDIR] !== UNMODIFIED ||\n row[STAGE] !== UNMODIFIED,\n )\n .map((row) => ({ path: row[FILEPATH], state: mapState(row) }));\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAe;AACf,4BAAgB;AAEhB,0BAQO;AAWP,MAAM,WAAW,CACf,QACqB;AACrB,MAAI,IAAI,8BAAU,4BAAQ;AACxB,WAAO;AAAA,EACT;AAEA,MAAI,IAAI,iCAAa,8BAAU;AAC7B,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAMO,MAAM,kBAAkB,OAAO;AAAA,EACpC;AACF,MAAsD;AACpD,QAAM,WAAW,MAAM,sBAAAA,QAAI,aAAa,EAAE,oBAAAC,SAAI,IAAI,CAAC;AACnD,SAAO,SACJ;AAAA,IACC,CAAC,QACC,IAAI,8BAAU,kCACd,IAAI,iCAAa,kCACjB,IAAI,+BAAW;AAAA,EACnB,EACC,IAAI,CAAC,SAAS,EAAE,MAAM,IAAI,+BAAW,OAAO,SAAS,GAAG,EAAE,EAAE;AACjE;",
|
|
6
|
+
"names": ["git", "fs"]
|
|
7
|
+
}
|
package/lib/api/git/index.js
CHANGED
|
@@ -1,23 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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 git_exports = {};
|
|
20
|
+
__export(git_exports, {
|
|
21
|
+
commit: () => import_commit.commit,
|
|
22
|
+
commitAllChanges: () => import_commitAllChanges.commitAllChanges,
|
|
23
|
+
currentBranch: () => import_currentBranch.currentBranch,
|
|
24
|
+
fastForwardBranch: () => import_pull.fastForwardBranch,
|
|
25
|
+
getChangedFiles: () => import_getChangedFiles.getChangedFiles,
|
|
26
|
+
getHeadCommitId: () => import_log.getHeadCommitId,
|
|
27
|
+
getHeadCommitMessage: () => import_log.getHeadCommitMessage,
|
|
28
|
+
getOwnerAndRepo: () => import_remote.getOwnerAndRepo,
|
|
29
|
+
push: () => import_push.push,
|
|
30
|
+
reset: () => import_reset.reset
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(git_exports);
|
|
33
|
+
var import_commit = require("./commit");
|
|
34
|
+
var import_commitAllChanges = require("./commitAllChanges");
|
|
35
|
+
var import_currentBranch = require("./currentBranch");
|
|
36
|
+
var import_getChangedFiles = require("./getChangedFiles");
|
|
37
|
+
var import_log = require("./log");
|
|
38
|
+
var import_remote = require("./remote");
|
|
39
|
+
var import_push = require("./push");
|
|
40
|
+
var import_pull = require("./pull");
|
|
41
|
+
var import_reset = require("./reset");
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {
|
|
44
|
+
commit,
|
|
45
|
+
commitAllChanges,
|
|
46
|
+
currentBranch,
|
|
47
|
+
fastForwardBranch,
|
|
48
|
+
getChangedFiles,
|
|
49
|
+
getHeadCommitId,
|
|
50
|
+
getHeadCommitMessage,
|
|
51
|
+
getOwnerAndRepo,
|
|
52
|
+
push,
|
|
53
|
+
reset
|
|
54
|
+
});
|
|
55
|
+
//# sourceMappingURL=index.js.map
|
package/lib/api/git/index.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/api/git/index.ts"],
|
|
4
|
+
"sourcesContent": ["export { commit } from './commit';\nexport { commitAllChanges } from './commitAllChanges';\nexport { currentBranch } from './currentBranch';\nexport { getChangedFiles } from './getChangedFiles';\nexport { getHeadCommitId, getHeadCommitMessage } from './log';\nexport { getOwnerAndRepo } from './remote';\nexport { push } from './push';\nexport { fastForwardBranch } from './pull';\nexport { reset } from './reset';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAuB;AACvB,8BAAiC;AACjC,2BAA8B;AAC9B,6BAAgC;AAChC,iBAAsD;AACtD,oBAAgC;AAChC,kBAAqB;AACrB,kBAAkC;AAClC,mBAAsB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/lib/api/git/log.js
CHANGED
|
@@ -1,46 +1,67 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
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 });
|
|
4
11
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*
|
|
13
|
-
* This tries to extract the commit ID from common CI environment variables,
|
|
14
|
-
* and falls back to the local Git repository log.
|
|
15
|
-
*/
|
|
16
|
-
const getHeadCommitId = async ({ dir, env = process.env, }) => {
|
|
17
|
-
const oidFromEnv = env.BUILDKITE_COMMIT ?? env.GITHUB_SHA;
|
|
18
|
-
if (oidFromEnv) {
|
|
19
|
-
return oidFromEnv;
|
|
20
|
-
}
|
|
21
|
-
const [headResult] = await isomorphic_git_1.default.log({ depth: 1, dir, fs: fs_extra_1.default });
|
|
22
|
-
if (!headResult) {
|
|
23
|
-
throw EMPTY_GIT_LOG_ERROR;
|
|
24
|
-
}
|
|
25
|
-
return headResult.oid;
|
|
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;
|
|
26
19
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var log_exports = {};
|
|
26
|
+
__export(log_exports, {
|
|
27
|
+
getHeadCommitId: () => getHeadCommitId,
|
|
28
|
+
getHeadCommitMessage: () => getHeadCommitMessage
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(log_exports);
|
|
31
|
+
var import_fs_extra = __toESM(require("fs-extra"));
|
|
32
|
+
var import_isomorphic_git = __toESM(require("isomorphic-git"));
|
|
33
|
+
const EMPTY_GIT_LOG_ERROR = new Error("Git log does not contain any commits");
|
|
34
|
+
const getHeadCommitId = async ({
|
|
35
|
+
dir,
|
|
36
|
+
env = process.env
|
|
37
|
+
}) => {
|
|
38
|
+
const oidFromEnv = env.BUILDKITE_COMMIT ?? env.GITHUB_SHA;
|
|
39
|
+
if (oidFromEnv) {
|
|
40
|
+
return oidFromEnv;
|
|
41
|
+
}
|
|
42
|
+
const [headResult] = await import_isomorphic_git.default.log({ depth: 1, dir, fs: import_fs_extra.default });
|
|
43
|
+
if (!headResult) {
|
|
44
|
+
throw EMPTY_GIT_LOG_ERROR;
|
|
45
|
+
}
|
|
46
|
+
return headResult.oid;
|
|
44
47
|
};
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
const getHeadCommitMessage = async ({
|
|
49
|
+
dir,
|
|
50
|
+
env = process.env
|
|
51
|
+
}) => {
|
|
52
|
+
const messageFromEnv = env.BUILDKITE_MESSAGE;
|
|
53
|
+
if (messageFromEnv) {
|
|
54
|
+
return messageFromEnv;
|
|
55
|
+
}
|
|
56
|
+
const [headResult] = await import_isomorphic_git.default.log({ depth: 1, dir, fs: import_fs_extra.default });
|
|
57
|
+
if (!headResult) {
|
|
58
|
+
throw EMPTY_GIT_LOG_ERROR;
|
|
59
|
+
}
|
|
60
|
+
return headResult.commit.message;
|
|
61
|
+
};
|
|
62
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
63
|
+
0 && (module.exports = {
|
|
64
|
+
getHeadCommitId,
|
|
65
|
+
getHeadCommitMessage
|
|
66
|
+
});
|
|
67
|
+
//# sourceMappingURL=log.js.map
|
package/lib/api/git/log.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/api/git/log.ts"],
|
|
4
|
+
"sourcesContent": ["import fs from 'fs-extra';\nimport git from 'isomorphic-git';\n\ninterface GetHeadCommitParameters {\n dir: string;\n env?: Record<string, string | undefined>;\n}\n\nconst EMPTY_GIT_LOG_ERROR = new Error('Git log does not contain any commits');\n\n/**\n * Gets the object ID of the head commit.\n *\n * This tries to extract the commit ID from common CI environment variables,\n * and falls back to the local Git repository log.\n */\nexport const getHeadCommitId = async ({\n dir,\n env = process.env,\n}: GetHeadCommitParameters) => {\n const oidFromEnv = env.BUILDKITE_COMMIT ?? env.GITHUB_SHA;\n\n if (oidFromEnv) {\n return oidFromEnv;\n }\n\n const [headResult] = await git.log({ depth: 1, dir, fs });\n\n if (!headResult) {\n throw EMPTY_GIT_LOG_ERROR;\n }\n\n return headResult.oid;\n};\n\n/**\n * Gets the message of the head commit.\n *\n * This tries to extract the message from common CI environment variables,\n * and falls back to the local Git repository log.\n */\nexport const getHeadCommitMessage = async ({\n dir,\n env = process.env,\n}: GetHeadCommitParameters) => {\n const messageFromEnv = env.BUILDKITE_MESSAGE;\n\n if (messageFromEnv) {\n return messageFromEnv;\n }\n\n const [headResult] = await git.log({ depth: 1, dir, fs });\n\n if (!headResult) {\n throw EMPTY_GIT_LOG_ERROR;\n }\n\n return headResult.commit.message;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAe;AACf,4BAAgB;AAOhB,MAAM,sBAAsB,IAAI,MAAM,sCAAsC;AAQrE,MAAM,kBAAkB,OAAO;AAAA,EACpC;AAAA,EACA,MAAM,QAAQ;AAChB,MAA+B;AAC7B,QAAM,aAAa,IAAI,oBAAoB,IAAI;AAE/C,MAAI,YAAY;AACd,WAAO;AAAA,EACT;AAEA,QAAM,CAAC,UAAU,IAAI,MAAM,sBAAAA,QAAI,IAAI,EAAE,OAAO,GAAG,KAAK,oBAAAC,QAAG,CAAC;AAExD,MAAI,CAAC,YAAY;AACf,UAAM;AAAA,EACR;AAEA,SAAO,WAAW;AACpB;AAQO,MAAM,uBAAuB,OAAO;AAAA,EACzC;AAAA,EACA,MAAM,QAAQ;AAChB,MAA+B;AAC7B,QAAM,iBAAiB,IAAI;AAE3B,MAAI,gBAAgB;AAClB,WAAO;AAAA,EACT;AAEA,QAAM,CAAC,UAAU,IAAI,MAAM,sBAAAD,QAAI,IAAI,EAAE,OAAO,GAAG,KAAK,oBAAAC,QAAG,CAAC;AAExD,MAAI,CAAC,YAAY;AACf,UAAM;AAAA,EACR;AAEA,SAAO,WAAW,OAAO;AAC3B;",
|
|
6
|
+
"names": ["git", "fs"]
|
|
7
|
+
}
|
package/lib/api/git/pull.js
CHANGED
|
@@ -1,34 +1,65 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
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 });
|
|
4
11
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Fast forwards the specified `ref` on the local Git repository to match the remote branch.
|
|
14
|
-
*/
|
|
15
|
-
const fastForwardBranch = async ({ auth, dir, ref, remote, remoteRef, }) => {
|
|
16
|
-
const { owner, repo } = await (0, remote_1.getOwnerAndRepo)({ dir });
|
|
17
|
-
const url = `https://github.com/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}`;
|
|
18
|
-
return isomorphic_git_1.default.fastForward({
|
|
19
|
-
onAuth: () => ({
|
|
20
|
-
username: 'x-access-token',
|
|
21
|
-
password: auth.token ?? (0, environment_1.apiTokenFromEnvironment)(),
|
|
22
|
-
}),
|
|
23
|
-
dir,
|
|
24
|
-
fs: fs_extra_1.default,
|
|
25
|
-
http: node_1.default,
|
|
26
|
-
ref,
|
|
27
|
-
remote,
|
|
28
|
-
remoteRef,
|
|
29
|
-
url,
|
|
30
|
-
singleBranch: true,
|
|
31
|
-
});
|
|
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;
|
|
32
19
|
};
|
|
33
|
-
|
|
34
|
-
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var pull_exports = {};
|
|
26
|
+
__export(pull_exports, {
|
|
27
|
+
fastForwardBranch: () => fastForwardBranch
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(pull_exports);
|
|
30
|
+
var import_fs_extra = __toESM(require("fs-extra"));
|
|
31
|
+
var import_isomorphic_git = __toESM(require("isomorphic-git"));
|
|
32
|
+
var import_node = __toESM(require("isomorphic-git/http/node"));
|
|
33
|
+
var import_environment = require("../github/environment");
|
|
34
|
+
var import_remote = require("./remote");
|
|
35
|
+
const fastForwardBranch = async ({
|
|
36
|
+
auth,
|
|
37
|
+
dir,
|
|
38
|
+
ref,
|
|
39
|
+
remote,
|
|
40
|
+
remoteRef
|
|
41
|
+
}) => {
|
|
42
|
+
const { owner, repo } = await (0, import_remote.getOwnerAndRepo)({ dir });
|
|
43
|
+
const url = `https://github.com/${encodeURIComponent(
|
|
44
|
+
owner
|
|
45
|
+
)}/${encodeURIComponent(repo)}`;
|
|
46
|
+
return import_isomorphic_git.default.fastForward({
|
|
47
|
+
onAuth: () => ({
|
|
48
|
+
username: "x-access-token",
|
|
49
|
+
password: auth.token ?? (0, import_environment.apiTokenFromEnvironment)()
|
|
50
|
+
}),
|
|
51
|
+
dir,
|
|
52
|
+
fs: import_fs_extra.default,
|
|
53
|
+
http: import_node.default,
|
|
54
|
+
ref,
|
|
55
|
+
remote,
|
|
56
|
+
remoteRef,
|
|
57
|
+
url,
|
|
58
|
+
singleBranch: true
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
62
|
+
0 && (module.exports = {
|
|
63
|
+
fastForwardBranch
|
|
64
|
+
});
|
|
65
|
+
//# sourceMappingURL=pull.js.map
|
package/lib/api/git/pull.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/api/git/pull.ts"],
|
|
4
|
+
"sourcesContent": ["import fs from 'fs-extra';\nimport git from 'isomorphic-git';\nimport http from 'isomorphic-git/http/node';\n\nimport { apiTokenFromEnvironment } from '../github/environment';\n\nimport { getOwnerAndRepo } from './remote';\n\n/**\n * Use a GitHub app token to auth the Git push.\n *\n * This defaults to the `GITHUB_API_TOKEN` and `GITHUB_TOKEN` environment\n * variables if `token` is not provided.\n */\ninterface GitHubAppAuth {\n type: 'gitHubApp';\n token?: string;\n}\n\ninterface PullParameters {\n /**\n * The auth mechanism for the push.\n *\n * Currently, only GitHub app tokens are supported.\n */\n auth: GitHubAppAuth;\n\n dir: string;\n\n /**\n * The local branch to fast forward.\n */\n ref: string;\n\n remote?: string;\n\n /**\n * The branch or tag on the remote to reference.\n *\n * This defaults to `ref`.\n */\n remoteRef?: string;\n}\n\n/**\n * Fast forwards the specified `ref` on the local Git repository to match the remote branch.\n */\nexport const fastForwardBranch = async ({\n auth,\n dir,\n ref,\n remote,\n remoteRef,\n}: PullParameters) => {\n const { owner, repo } = await getOwnerAndRepo({ dir });\n\n const url = `https://github.com/${encodeURIComponent(\n owner,\n )}/${encodeURIComponent(repo)}`;\n\n return git.fastForward({\n onAuth: () => ({\n username: 'x-access-token',\n password: auth.token ?? apiTokenFromEnvironment(),\n }),\n dir,\n fs,\n http,\n ref,\n remote,\n remoteRef,\n url,\n singleBranch: true,\n });\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAe;AACf,4BAAgB;AAChB,kBAAiB;AAEjB,yBAAwC;AAExC,oBAAgC;AAyCzB,MAAM,oBAAoB,OAAO;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAsB;AACpB,QAAM,EAAE,OAAO,KAAK,IAAI,UAAM,+BAAgB,EAAE,IAAI,CAAC;AAErD,QAAM,MAAM,sBAAsB;AAAA,IAChC;AAAA,EACF,KAAK,mBAAmB,IAAI;AAE5B,SAAO,sBAAAA,QAAI,YAAY;AAAA,IACrB,QAAQ,OAAO;AAAA,MACb,UAAU;AAAA,MACV,UAAU,KAAK,aAAS,4CAAwB;AAAA,IAClD;AAAA,IACA;AAAA,IACA,oBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc;AAAA,EAChB,CAAC;AACH;",
|
|
6
|
+
"names": ["git", "fs", "http"]
|
|
7
|
+
}
|
package/lib/api/git/push.js
CHANGED
|
@@ -1,34 +1,66 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
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 });
|
|
4
11
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Pushes the specified `ref` from the local Git repository to a remote.
|
|
14
|
-
*/
|
|
15
|
-
const push = async ({ auth, dir, ref, remote, remoteRef, force, }) => {
|
|
16
|
-
const { owner, repo } = await (0, remote_1.getOwnerAndRepo)({ dir });
|
|
17
|
-
const url = `https://github.com/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}`;
|
|
18
|
-
return isomorphic_git_1.default.push({
|
|
19
|
-
onAuth: () => ({
|
|
20
|
-
username: 'x-access-token',
|
|
21
|
-
password: auth.token ?? (0, environment_1.apiTokenFromEnvironment)(),
|
|
22
|
-
}),
|
|
23
|
-
dir,
|
|
24
|
-
fs: fs_extra_1.default,
|
|
25
|
-
http: node_1.default,
|
|
26
|
-
ref,
|
|
27
|
-
remote,
|
|
28
|
-
remoteRef,
|
|
29
|
-
url,
|
|
30
|
-
force,
|
|
31
|
-
});
|
|
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;
|
|
32
19
|
};
|
|
33
|
-
|
|
34
|
-
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var push_exports = {};
|
|
26
|
+
__export(push_exports, {
|
|
27
|
+
push: () => push
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(push_exports);
|
|
30
|
+
var import_fs_extra = __toESM(require("fs-extra"));
|
|
31
|
+
var import_isomorphic_git = __toESM(require("isomorphic-git"));
|
|
32
|
+
var import_node = __toESM(require("isomorphic-git/http/node"));
|
|
33
|
+
var import_environment = require("../github/environment");
|
|
34
|
+
var import_remote = require("./remote");
|
|
35
|
+
const push = async ({
|
|
36
|
+
auth,
|
|
37
|
+
dir,
|
|
38
|
+
ref,
|
|
39
|
+
remote,
|
|
40
|
+
remoteRef,
|
|
41
|
+
force
|
|
42
|
+
}) => {
|
|
43
|
+
const { owner, repo } = await (0, import_remote.getOwnerAndRepo)({ dir });
|
|
44
|
+
const url = `https://github.com/${encodeURIComponent(
|
|
45
|
+
owner
|
|
46
|
+
)}/${encodeURIComponent(repo)}`;
|
|
47
|
+
return import_isomorphic_git.default.push({
|
|
48
|
+
onAuth: () => ({
|
|
49
|
+
username: "x-access-token",
|
|
50
|
+
password: auth.token ?? (0, import_environment.apiTokenFromEnvironment)()
|
|
51
|
+
}),
|
|
52
|
+
dir,
|
|
53
|
+
fs: import_fs_extra.default,
|
|
54
|
+
http: import_node.default,
|
|
55
|
+
ref,
|
|
56
|
+
remote,
|
|
57
|
+
remoteRef,
|
|
58
|
+
url,
|
|
59
|
+
force
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
63
|
+
0 && (module.exports = {
|
|
64
|
+
push
|
|
65
|
+
});
|
|
66
|
+
//# sourceMappingURL=push.js.map
|