@antelopejs/dms-antelope-cloud 0.0.0 → 0.1.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/LICENSE +201 -0
- package/README.md +448 -0
- package/dist/cloud-status.d.ts +13 -0
- package/dist/cloud-status.js +77 -0
- package/dist/config.d.ts +84 -0
- package/dist/config.js +104 -0
- package/dist/configured.d.ts +16 -0
- package/dist/configured.js +26 -0
- package/dist/connection/actions.d.ts +40 -0
- package/dist/connection/actions.js +120 -0
- package/dist/connection/announce.d.ts +8 -0
- package/dist/connection/announce.js +20 -0
- package/dist/connection/cloud.d.ts +60 -0
- package/dist/connection/cloud.js +87 -0
- package/dist/connection/content.d.ts +70 -0
- package/dist/connection/content.js +462 -0
- package/dist/connection/current.d.ts +26 -0
- package/dist/connection/current.js +28 -0
- package/dist/connection/device-flow.d.ts +16 -0
- package/dist/connection/device-flow.js +146 -0
- package/dist/connection/refusals.d.ts +51 -0
- package/dist/connection/refusals.js +85 -0
- package/dist/connection/repository.d.ts +28 -0
- package/dist/connection/repository.js +69 -0
- package/dist/connection/seal.d.ts +22 -0
- package/dist/connection/seal.js +47 -0
- package/dist/connection/store.d.ts +294 -0
- package/dist/connection/store.js +165 -0
- package/dist/connection/view.d.ts +39 -0
- package/dist/connection/view.js +39 -0
- package/dist/dashboard/actions.d.ts +40 -0
- package/dist/dashboard/actions.js +115 -0
- package/dist/dashboard/dockerfile.d.ts +34 -0
- package/dist/dashboard/dockerfile.js +71 -0
- package/dist/dashboard/service.d.ts +61 -0
- package/dist/dashboard/service.js +137 -0
- package/dist/dashboard/variables.d.ts +30 -0
- package/dist/dashboard/variables.js +34 -0
- package/dist/deployments/build-log.d.ts +39 -0
- package/dist/deployments/build-log.js +57 -0
- package/dist/deployments/cloud-steps.d.ts +77 -0
- package/dist/deployments/cloud-steps.js +132 -0
- package/dist/deployments/content.d.ts +61 -0
- package/dist/deployments/content.js +268 -0
- package/dist/deployments/deployment.d.ts +96 -0
- package/dist/deployments/deployment.js +3 -0
- package/dist/deployments/follow.d.ts +18 -0
- package/dist/deployments/follow.js +112 -0
- package/dist/deployments/ledger.d.ts +23 -0
- package/dist/deployments/ledger.js +359 -0
- package/dist/deployments/lifecycle.d.ts +123 -0
- package/dist/deployments/lifecycle.js +146 -0
- package/dist/deployments/live.d.ts +28 -0
- package/dist/deployments/live.js +54 -0
- package/dist/deployments/publish-read.d.ts +20 -0
- package/dist/deployments/publish-read.js +24 -0
- package/dist/deployments/refusals.d.ts +13 -0
- package/dist/deployments/refusals.js +35 -0
- package/dist/environments/actions.d.ts +86 -0
- package/dist/environments/actions.js +210 -0
- package/dist/environments/address.d.ts +60 -0
- package/dist/environments/address.js +149 -0
- package/dist/environments/content.d.ts +97 -0
- package/dist/environments/content.js +275 -0
- package/dist/environments/follower.d.ts +32 -0
- package/dist/environments/follower.js +114 -0
- package/dist/environments/pipeline.d.ts +58 -0
- package/dist/environments/pipeline.js +76 -0
- package/dist/environments/publish-targets.d.ts +18 -0
- package/dist/environments/publish-targets.js +55 -0
- package/dist/environments/roles.d.ts +73 -0
- package/dist/environments/roles.js +97 -0
- package/dist/frontend-module.d.ts +12 -0
- package/dist/frontend-module.js +25 -0
- package/dist/git/changed-files.d.ts +30 -0
- package/dist/git/changed-files.js +107 -0
- package/dist/git/changes.d.ts +89 -0
- package/dist/git/changes.js +162 -0
- package/dist/git/command.d.ts +51 -0
- package/dist/git/command.js +231 -0
- package/dist/git/promotion.d.ts +23 -0
- package/dist/git/promotion.js +46 -0
- package/dist/git/publish-input.d.ts +42 -0
- package/dist/git/publish-input.js +62 -0
- package/dist/git/publish-job.d.ts +82 -0
- package/dist/git/publish-job.js +99 -0
- package/dist/git/publish-steps.d.ts +90 -0
- package/dist/git/publish-steps.js +205 -0
- package/dist/git/publisher.d.ts +23 -0
- package/dist/git/publisher.js +206 -0
- package/dist/git/refs.d.ts +99 -0
- package/dist/git/refs.js +178 -0
- package/dist/git/refusal.d.ts +49 -0
- package/dist/git/refusal.js +70 -0
- package/dist/git/repository.d.ts +101 -0
- package/dist/git/repository.js +273 -0
- package/dist/git/versions.d.ts +99 -0
- package/dist/git/versions.js +174 -0
- package/dist/git/write-lock.d.ts +19 -0
- package/dist/git/write-lock.js +49 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +59 -0
- package/dist/lifecycle.d.ts +8 -0
- package/dist/lifecycle.js +78 -0
- package/dist/logs/relay.d.ts +25 -0
- package/dist/logs/relay.js +138 -0
- package/dist/null-prototype.d.ts +7 -0
- package/dist/null-prototype.js +3 -0
- package/dist/overview/content.d.ts +40 -0
- package/dist/overview/content.js +172 -0
- package/dist/pages/changes.d.ts +32 -0
- package/dist/pages/changes.js +141 -0
- package/dist/pages/connection.d.ts +43 -0
- package/dist/pages/connection.js +295 -0
- package/dist/pages/deployment.d.ts +67 -0
- package/dist/pages/deployment.js +261 -0
- package/dist/pages/deployments.d.ts +46 -0
- package/dist/pages/deployments.js +266 -0
- package/dist/pages/environments.d.ts +34 -0
- package/dist/pages/environments.js +368 -0
- package/dist/pages/logs.d.ts +46 -0
- package/dist/pages/logs.js +140 -0
- package/dist/pages/navigation.d.ts +61 -0
- package/dist/pages/navigation.js +107 -0
- package/dist/pages/overview.d.ts +35 -0
- package/dist/pages/overview.js +201 -0
- package/dist/pages/project-guard.d.ts +32 -0
- package/dist/pages/project-guard.js +99 -0
- package/dist/pages/query.d.ts +6 -0
- package/dist/pages/query.js +14 -0
- package/dist/pages/resources.d.ts +37 -0
- package/dist/pages/resources.js +211 -0
- package/dist/pages/setup.d.ts +40 -0
- package/dist/pages/setup.js +271 -0
- package/dist/pages/slugs.d.ts +15 -0
- package/dist/pages/slugs.js +28 -0
- package/dist/pages/variables.d.ts +43 -0
- package/dist/pages/variables.js +327 -0
- package/dist/pages/version.d.ts +26 -0
- package/dist/pages/version.js +214 -0
- package/dist/pages/versions.d.ts +20 -0
- package/dist/pages/versions.js +115 -0
- package/dist/resources/apply.d.ts +15 -0
- package/dist/resources/apply.js +127 -0
- package/dist/resources/cards.d.ts +41 -0
- package/dist/resources/cards.js +211 -0
- package/dist/resources/connect.d.ts +66 -0
- package/dist/resources/connect.js +78 -0
- package/dist/resources/content.d.ts +26 -0
- package/dist/resources/content.js +158 -0
- package/dist/resources/format.d.ts +10 -0
- package/dist/resources/format.js +30 -0
- package/dist/resources/guard.d.ts +23 -0
- package/dist/resources/guard.js +60 -0
- package/dist/resources/modules.d.ts +23 -0
- package/dist/resources/modules.js +39 -0
- package/dist/resources/plan.d.ts +8 -0
- package/dist/resources/plan.js +93 -0
- package/dist/resources/read.d.ts +54 -0
- package/dist/resources/read.js +69 -0
- package/dist/resources/refusals.d.ts +15 -0
- package/dist/resources/refusals.js +33 -0
- package/dist/resources/routes.d.ts +32 -0
- package/dist/resources/routes.js +53 -0
- package/dist/setup/actions.d.ts +79 -0
- package/dist/setup/actions.js +188 -0
- package/dist/setup/apply.d.ts +37 -0
- package/dist/setup/apply.js +172 -0
- package/dist/setup/content.d.ts +50 -0
- package/dist/setup/content.js +440 -0
- package/dist/setup/rollout.d.ts +119 -0
- package/dist/setup/rollout.js +227 -0
- package/dist/setup/steps.d.ts +93 -0
- package/dist/setup/steps.js +95 -0
- package/dist/setup/storage.d.ts +29 -0
- package/dist/setup/storage.js +78 -0
- package/dist/setup/store.d.ts +214 -0
- package/dist/setup/store.js +174 -0
- package/dist/setup/volume.d.ts +31 -0
- package/dist/setup/volume.js +52 -0
- package/dist/slug.d.ts +7 -0
- package/dist/slug.js +26 -0
- package/dist/variables/actions.d.ts +76 -0
- package/dist/variables/actions.js +185 -0
- package/dist/variables/content.d.ts +69 -0
- package/dist/variables/content.js +310 -0
- package/dist/variables/decide.d.ts +27 -0
- package/dist/variables/decide.js +155 -0
- package/dist/variables/decided-dialog.d.ts +11 -0
- package/dist/variables/decided-dialog.js +129 -0
- package/dist/variables/decided.d.ts +80 -0
- package/dist/variables/decided.js +240 -0
- package/dist/variables/dialogs.d.ts +8 -0
- package/dist/variables/dialogs.js +219 -0
- package/dist/variables/model.d.ts +106 -0
- package/dist/variables/model.js +156 -0
- package/dist/variables/project-config.d.ts +117 -0
- package/dist/variables/project-config.js +248 -0
- package/dist/variables/read.d.ts +33 -0
- package/dist/variables/read.js +118 -0
- package/dist/web-url.d.ts +9 -0
- package/dist/web-url.js +19 -0
- package/frontend-vue/app/components/BuildLog.vue +99 -0
- package/frontend-vue/app/components/ChangedFiles.vue +165 -0
- package/frontend-vue/app/components/DashboardEnvironments.vue +102 -0
- package/frontend-vue/app/components/LogLine.vue +33 -0
- package/frontend-vue/app/components/LogViewer.vue +314 -0
- package/frontend-vue/app/components/PublishChipIcon.vue +39 -0
- package/frontend-vue/app/components/PublishForm.vue +505 -0
- package/frontend-vue/app/components/PublishPopover.vue +90 -0
- package/frontend-vue/app/components/PublishRoute.vue +222 -0
- package/frontend-vue/app/composables/usePublishSummary.ts +80 -0
- package/frontend-vue/app/plugins/publish-chip.client.ts +44 -0
- package/frontend-vue/app/types/publishing.ts +154 -0
- package/frontend-vue/app/utils/build-log.ts +96 -0
- package/frontend-vue/app/utils/changed-files.ts +142 -0
- package/frontend-vue/app/utils/log-line.ts +15 -0
- package/frontend-vue/app/utils/log-stream.ts +361 -0
- package/frontend-vue/app/utils/publish-state.ts +299 -0
- package/frontend-vue/dms.frontend.ts +27 -0
- package/frontend-vue/i18n/locales/antelope-cloud-en-GB.json +110 -0
- package/frontend-vue/package.json +38 -0
- package/frontend-vue/pnpm-lock.yaml +2697 -0
- package/package.json +115 -4
package/dist/git/refs.js
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.workBranch = workBranch;
|
|
4
|
+
exports.releaseTagOf = releaseTagOf;
|
|
5
|
+
exports.releaseNumber = releaseNumber;
|
|
6
|
+
exports.isValidEnvironmentName = isValidEnvironmentName;
|
|
7
|
+
exports.environmentName = environmentName;
|
|
8
|
+
exports.environmentBranch = environmentBranch;
|
|
9
|
+
exports.environmentOfBranch = environmentOfBranch;
|
|
10
|
+
exports.isEnvironmentBranch = isEnvironmentBranch;
|
|
11
|
+
exports.commitId = commitId;
|
|
12
|
+
exports.shortSha = shortSha;
|
|
13
|
+
exports.branchRef = branchRef;
|
|
14
|
+
exports.branchOfRef = branchOfRef;
|
|
15
|
+
exports.tagRef = tagRef;
|
|
16
|
+
exports.branchTarget = branchTarget;
|
|
17
|
+
exports.tagTarget = tagTarget;
|
|
18
|
+
exports.environmentTarget = environmentTarget;
|
|
19
|
+
exports.targetRef = targetRef;
|
|
20
|
+
exports.pushArguments = pushArguments;
|
|
21
|
+
const ENVIRONMENT_PREFIX = "env/";
|
|
22
|
+
const RELEASE_PREFIX = "release/v";
|
|
23
|
+
const RELEASE_TAG = /^release\/v([1-9]\d{0,8})$/u;
|
|
24
|
+
const ENVIRONMENT_NAME = /^[a-z0-9][a-z0-9-]{0,39}$/u;
|
|
25
|
+
const OBJECT_ID = /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/u;
|
|
26
|
+
const BRANCH_REFS = "refs/heads/";
|
|
27
|
+
const SHORT_SHA = 7;
|
|
28
|
+
const TAG_REFS = "refs/tags/";
|
|
29
|
+
function isWorkBranch(name) {
|
|
30
|
+
return (name !== "" && !name.startsWith("-") && !name.startsWith(ENVIRONMENT_PREFIX));
|
|
31
|
+
}
|
|
32
|
+
function isReleaseTag(name) {
|
|
33
|
+
return RELEASE_TAG.test(name);
|
|
34
|
+
}
|
|
35
|
+
function isEnvironmentName(name) {
|
|
36
|
+
return ENVIRONMENT_NAME.test(name);
|
|
37
|
+
}
|
|
38
|
+
function isCommitId(raw) {
|
|
39
|
+
return OBJECT_ID.test(raw);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Checks a branch name the publish may commit on.
|
|
43
|
+
*
|
|
44
|
+
* @throws When the name is empty or an `env/*` branch.
|
|
45
|
+
*/
|
|
46
|
+
function workBranch(name) {
|
|
47
|
+
if (!isWorkBranch(name)) {
|
|
48
|
+
throw new Error(`"${name}" is not a branch the publish may commit on`);
|
|
49
|
+
}
|
|
50
|
+
return name;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Checks a version tag name.
|
|
54
|
+
*
|
|
55
|
+
* @throws When the name is not `release/v<N>`.
|
|
56
|
+
*/
|
|
57
|
+
function releaseTag(name) {
|
|
58
|
+
if (!isReleaseTag(name)) {
|
|
59
|
+
throw new Error(`"${name}" is not a release/v<N> tag`);
|
|
60
|
+
}
|
|
61
|
+
return name;
|
|
62
|
+
}
|
|
63
|
+
/** The tag of version `number`, `release/v16` for 16. */
|
|
64
|
+
function releaseTagOf(number) {
|
|
65
|
+
return releaseTag(`${RELEASE_PREFIX}${number}`);
|
|
66
|
+
}
|
|
67
|
+
/** The version number a tag name carries, or `null` for any other name. */
|
|
68
|
+
function releaseNumber(name) {
|
|
69
|
+
const match = RELEASE_TAG.exec(name);
|
|
70
|
+
return match?.[1] === undefined ? null : Number(match[1]);
|
|
71
|
+
}
|
|
72
|
+
/** Whether a name is a valid environment name, `preview` but not `Preview`. */
|
|
73
|
+
function isValidEnvironmentName(name) {
|
|
74
|
+
return isEnvironmentName(name);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Checks an environment name.
|
|
78
|
+
*
|
|
79
|
+
* @throws When the name is not lowercase letters, digits and dashes.
|
|
80
|
+
*/
|
|
81
|
+
function environmentName(name) {
|
|
82
|
+
if (!isEnvironmentName(name)) {
|
|
83
|
+
throw new Error(`"${name}" is not an environment name`);
|
|
84
|
+
}
|
|
85
|
+
return name;
|
|
86
|
+
}
|
|
87
|
+
/** The branch of an environment, `env/preview` for `preview`. */
|
|
88
|
+
function environmentBranch(name) {
|
|
89
|
+
return `${ENVIRONMENT_PREFIX}${name}`;
|
|
90
|
+
}
|
|
91
|
+
/** The environment a branch serves, `preview` for `env/preview`, else `null`. */
|
|
92
|
+
function environmentOfBranch(branch) {
|
|
93
|
+
if (!branch.startsWith(ENVIRONMENT_PREFIX))
|
|
94
|
+
return null;
|
|
95
|
+
const name = branch.slice(ENVIRONMENT_PREFIX.length);
|
|
96
|
+
return isEnvironmentName(name) ? name : null;
|
|
97
|
+
}
|
|
98
|
+
/** Whether HEAD on this branch would let the publish move it as an environment. */
|
|
99
|
+
function isEnvironmentBranch(branch) {
|
|
100
|
+
return branch.startsWith(ENVIRONMENT_PREFIX);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Reads a full commit id, 40 or 64 lowercase hexadecimal digits.
|
|
104
|
+
*
|
|
105
|
+
* @returns The id, or `undefined` for anything else, such as a short id or a
|
|
106
|
+
* ref name.
|
|
107
|
+
*/
|
|
108
|
+
function commitId(raw) {
|
|
109
|
+
return raw && isCommitId(raw) ? raw : undefined;
|
|
110
|
+
}
|
|
111
|
+
/** The first characters of a commit id, as git shows it: `4be81a2`. */
|
|
112
|
+
function shortSha(commit) {
|
|
113
|
+
return commit.slice(0, SHORT_SHA);
|
|
114
|
+
}
|
|
115
|
+
/** The full ref of a branch, `refs/heads/develop`. */
|
|
116
|
+
function branchRef(branch) {
|
|
117
|
+
return `${BRANCH_REFS}${branch}`;
|
|
118
|
+
}
|
|
119
|
+
/** The branch a full ref names, `develop` for `refs/heads/develop`, else `null`. */
|
|
120
|
+
function branchOfRef(ref) {
|
|
121
|
+
return ref.startsWith(BRANCH_REFS) ? ref.slice(BRANCH_REFS.length) : null;
|
|
122
|
+
}
|
|
123
|
+
/** The full ref of a tag, `refs/tags/release/v16`. */
|
|
124
|
+
function tagRef(tag) {
|
|
125
|
+
return `${TAG_REFS}${tag}`;
|
|
126
|
+
}
|
|
127
|
+
/** A branch pushed to origin as a fast-forward. */
|
|
128
|
+
function branchTarget(name) {
|
|
129
|
+
return { kind: "branch", branch: workBranch(name) };
|
|
130
|
+
}
|
|
131
|
+
/** A version tag pushed to origin as a new tag. */
|
|
132
|
+
function tagTarget(name) {
|
|
133
|
+
return { kind: "tag", tag: releaseTag(name) };
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* An environment branch pushed to origin while origin still holds `lease`:
|
|
137
|
+
* to `commit`, or to the local branch of the same name.
|
|
138
|
+
*
|
|
139
|
+
* @throws When `commit` is not a full commit id.
|
|
140
|
+
*/
|
|
141
|
+
function environmentTarget(name, lease, commit = null) {
|
|
142
|
+
if (commit !== null && !isCommitId(commit)) {
|
|
143
|
+
throw new Error(`"${commit}" is not a full commit id`);
|
|
144
|
+
}
|
|
145
|
+
return {
|
|
146
|
+
kind: "environment",
|
|
147
|
+
environment: environmentName(name),
|
|
148
|
+
lease,
|
|
149
|
+
commit,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
/** The full ref a target writes on origin, `refs/heads/env/preview`. */
|
|
153
|
+
function targetRef(target) {
|
|
154
|
+
if (target.kind === "tag")
|
|
155
|
+
return tagRef(target.tag);
|
|
156
|
+
if (target.kind === "branch")
|
|
157
|
+
return branchRef(target.branch);
|
|
158
|
+
return branchRef(environmentBranch(target.environment));
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* The arguments of one atomic push of the targets to origin. No refspec
|
|
162
|
+
* carries `+`: an environment branch moves past a non-fast-forward through
|
|
163
|
+
* its `--force-with-lease`, which git honours only without `+`.
|
|
164
|
+
*/
|
|
165
|
+
function pushArguments(targets) {
|
|
166
|
+
const leases = targets.flatMap((target) => target.kind === "environment"
|
|
167
|
+
? [`--force-with-lease=${targetRef(target)}:${target.lease ?? ""}`]
|
|
168
|
+
: []);
|
|
169
|
+
const refspecs = targets.map((target) => {
|
|
170
|
+
const ref = targetRef(target);
|
|
171
|
+
const source = target.kind === "environment" && target.commit !== null
|
|
172
|
+
? target.commit
|
|
173
|
+
: ref;
|
|
174
|
+
return `${source}:${ref}`;
|
|
175
|
+
});
|
|
176
|
+
return ["push", "--atomic", "--porcelain", ...leases, "origin", ...refspecs];
|
|
177
|
+
}
|
|
178
|
+
//# sourceMappingURL=refs.js.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** Why the project cannot be published now. */
|
|
2
|
+
export type Refusal = {
|
|
3
|
+
readonly code: "not_a_repository";
|
|
4
|
+
readonly message: string;
|
|
5
|
+
} | {
|
|
6
|
+
readonly code: "no_origin";
|
|
7
|
+
readonly message: string;
|
|
8
|
+
} | {
|
|
9
|
+
readonly code: "detached_head";
|
|
10
|
+
readonly message: string;
|
|
11
|
+
} | {
|
|
12
|
+
readonly code: "on_environment_branch";
|
|
13
|
+
readonly message: string;
|
|
14
|
+
readonly branch: string;
|
|
15
|
+
} | {
|
|
16
|
+
readonly code: "nothing_to_publish";
|
|
17
|
+
readonly message: string;
|
|
18
|
+
} | {
|
|
19
|
+
readonly code: "publish_running";
|
|
20
|
+
readonly message: string;
|
|
21
|
+
} | {
|
|
22
|
+
readonly code: "promotion_running";
|
|
23
|
+
readonly message: string;
|
|
24
|
+
} | {
|
|
25
|
+
readonly code: "no_publish_target";
|
|
26
|
+
readonly message: string;
|
|
27
|
+
} | {
|
|
28
|
+
readonly code: "invalid_input";
|
|
29
|
+
readonly message: string;
|
|
30
|
+
readonly field: string;
|
|
31
|
+
};
|
|
32
|
+
/** The repository folder is not the root of a git work tree. */
|
|
33
|
+
export declare function notARepository(path: string, reason: string): Refusal;
|
|
34
|
+
/** The repository has no `origin` remote, or origin did not answer. */
|
|
35
|
+
export declare function noOrigin(message: string): Refusal;
|
|
36
|
+
/** HEAD points at a commit, not at a branch. */
|
|
37
|
+
export declare function detachedHead(): Refusal;
|
|
38
|
+
/** HEAD is an environment branch, which only the publish moves. */
|
|
39
|
+
export declare function onEnvironmentBranch(branch: string): Refusal;
|
|
40
|
+
/** The working copy and HEAD are the latest version already. */
|
|
41
|
+
export declare function nothingToPublish(): Refusal;
|
|
42
|
+
/** Another publish of this process has not finished. */
|
|
43
|
+
export declare function publishRunning(): Refusal;
|
|
44
|
+
/** A promotion of this process is moving an environment branch. */
|
|
45
|
+
export declare function promotionRunning(): Refusal;
|
|
46
|
+
/** No environment of the linked project is deployed by a pushed branch. */
|
|
47
|
+
export declare function noPublishTarget(): Refusal;
|
|
48
|
+
/** A field of the publish request is missing or out of bounds. */
|
|
49
|
+
export declare function invalidInput(field: string, message: string): Refusal;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.notARepository = notARepository;
|
|
4
|
+
exports.noOrigin = noOrigin;
|
|
5
|
+
exports.detachedHead = detachedHead;
|
|
6
|
+
exports.onEnvironmentBranch = onEnvironmentBranch;
|
|
7
|
+
exports.nothingToPublish = nothingToPublish;
|
|
8
|
+
exports.publishRunning = publishRunning;
|
|
9
|
+
exports.promotionRunning = promotionRunning;
|
|
10
|
+
exports.noPublishTarget = noPublishTarget;
|
|
11
|
+
exports.invalidInput = invalidInput;
|
|
12
|
+
/** The repository folder is not the root of a git work tree. */
|
|
13
|
+
function notARepository(path, reason) {
|
|
14
|
+
return {
|
|
15
|
+
code: "not_a_repository",
|
|
16
|
+
message: `${path} is not the root of a git repository: ${reason}`,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/** The repository has no `origin` remote, or origin did not answer. */
|
|
20
|
+
function noOrigin(message) {
|
|
21
|
+
return { code: "no_origin", message };
|
|
22
|
+
}
|
|
23
|
+
/** HEAD points at a commit, not at a branch. */
|
|
24
|
+
function detachedHead() {
|
|
25
|
+
return {
|
|
26
|
+
code: "detached_head",
|
|
27
|
+
message: "HEAD is detached. Check out the branch you work on before you publish.",
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/** HEAD is an environment branch, which only the publish moves. */
|
|
31
|
+
function onEnvironmentBranch(branch) {
|
|
32
|
+
return {
|
|
33
|
+
code: "on_environment_branch",
|
|
34
|
+
message: `HEAD is ${branch}, an environment branch. Check out the branch you work on before you publish.`,
|
|
35
|
+
branch,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/** The working copy and HEAD are the latest version already. */
|
|
39
|
+
function nothingToPublish() {
|
|
40
|
+
return {
|
|
41
|
+
code: "nothing_to_publish",
|
|
42
|
+
message: "Everything is published: the working copy is the latest version.",
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/** Another publish of this process has not finished. */
|
|
46
|
+
function publishRunning() {
|
|
47
|
+
return {
|
|
48
|
+
code: "publish_running",
|
|
49
|
+
message: "A publish is running. Wait for it to finish.",
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/** A promotion of this process is moving an environment branch. */
|
|
53
|
+
function promotionRunning() {
|
|
54
|
+
return {
|
|
55
|
+
code: "promotion_running",
|
|
56
|
+
message: "A promotion is moving an environment branch. Wait for it to finish, then publish again.",
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/** No environment of the linked project is deployed by a pushed branch. */
|
|
60
|
+
function noPublishTarget() {
|
|
61
|
+
return {
|
|
62
|
+
code: "no_publish_target",
|
|
63
|
+
message: "No environment of this project builds an env/ branch, so a publish would deploy nothing. Create one on the Environments page.",
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/** A field of the publish request is missing or out of bounds. */
|
|
67
|
+
function invalidInput(field, message) {
|
|
68
|
+
return { code: "invalid_input", message, field };
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=refusal.js.map
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { type Refusal } from "./refusal";
|
|
2
|
+
/** What origin answered when the module listed its refs, or why it did not. */
|
|
3
|
+
export type OriginState = {
|
|
4
|
+
readonly kind: "missing";
|
|
5
|
+
} | {
|
|
6
|
+
readonly kind: "unreachable";
|
|
7
|
+
readonly url: string;
|
|
8
|
+
readonly reason: string;
|
|
9
|
+
} | {
|
|
10
|
+
readonly kind: "reachable";
|
|
11
|
+
readonly url: string;
|
|
12
|
+
/** Each listed ref origin holds and the object it points to, peeled tags as `<ref>^{}`. */
|
|
13
|
+
readonly refs: ReadonlyMap<string, string>;
|
|
14
|
+
};
|
|
15
|
+
/** A version as its annotated `release/v<N>` tag records it. */
|
|
16
|
+
export type Release = {
|
|
17
|
+
readonly number: number;
|
|
18
|
+
readonly tag: string;
|
|
19
|
+
/** The id of the annotated tag object, which origin lists for the tag when it holds the same one. */
|
|
20
|
+
readonly object: string;
|
|
21
|
+
/** The tag message's subject, "Version <N>" when it has none. */
|
|
22
|
+
readonly name: string;
|
|
23
|
+
/** The tag message after its subject. */
|
|
24
|
+
readonly notes: string;
|
|
25
|
+
/** The tagged commit. */
|
|
26
|
+
readonly commit: string;
|
|
27
|
+
/** The subject of the tagged commit. */
|
|
28
|
+
readonly message: string;
|
|
29
|
+
readonly tagger: {
|
|
30
|
+
readonly name: string;
|
|
31
|
+
readonly email: string;
|
|
32
|
+
};
|
|
33
|
+
/** The tagger date, ISO 8601. */
|
|
34
|
+
readonly taggedAt: string;
|
|
35
|
+
};
|
|
36
|
+
/** What the module reads of the repository before it shows or publishes anything. */
|
|
37
|
+
export type RepositorySnapshot = {
|
|
38
|
+
readonly path: string;
|
|
39
|
+
/** The branch HEAD names, `null` when HEAD is detached. */
|
|
40
|
+
readonly branch: string | null;
|
|
41
|
+
/** The commit HEAD points to, `null` on a branch with no commit yet. */
|
|
42
|
+
readonly head: string | null;
|
|
43
|
+
/** The id of the empty tree in this repository's hash. */
|
|
44
|
+
readonly emptyTree: string;
|
|
45
|
+
/** The annotated `release/v<N>` tags of the repository, newest first. */
|
|
46
|
+
readonly releases: readonly Release[];
|
|
47
|
+
/** The highest N of every `release/v<N>` tag, local or on origin, 0 for none. */
|
|
48
|
+
readonly highestReleaseNumber: number;
|
|
49
|
+
/** Each local `env/<name>` branch and the commit it points to. */
|
|
50
|
+
readonly localEnvironments: ReadonlyMap<string, string>;
|
|
51
|
+
readonly origin: OriginState;
|
|
52
|
+
};
|
|
53
|
+
/** The repository as read, or why the folder is not one. */
|
|
54
|
+
export type RepositoryRead = {
|
|
55
|
+
readonly kind: "refused";
|
|
56
|
+
readonly refusal: Refusal;
|
|
57
|
+
} | {
|
|
58
|
+
readonly kind: "read";
|
|
59
|
+
readonly snapshot: RepositorySnapshot;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Lists the refs origin holds, asking it over the network.
|
|
63
|
+
*
|
|
64
|
+
* @param refs Patterns of the refs to list.
|
|
65
|
+
*/
|
|
66
|
+
export declare function readOrigin(path: string, refs: readonly string[]): Promise<OriginState>;
|
|
67
|
+
/**
|
|
68
|
+
* What origin listed for each repository, kept for `maxAgeMs` so that pages
|
|
69
|
+
* read every few seconds do not ask origin over the network each time. An
|
|
70
|
+
* entry answers for the origin URL it was listed from only, and reads that
|
|
71
|
+
* come while a listing runs share it.
|
|
72
|
+
*/
|
|
73
|
+
export declare class OriginCache {
|
|
74
|
+
private readonly maxAgeMs;
|
|
75
|
+
private readonly now;
|
|
76
|
+
private readonly entries;
|
|
77
|
+
constructor(maxAgeMs: number, now?: () => number);
|
|
78
|
+
/** What origin at `url` listed for the repository at `path` within `maxAgeMs`, else what `list` answers now. */
|
|
79
|
+
read(path: string, url: string, list: () => Promise<OriginState>): Promise<OriginState>;
|
|
80
|
+
/** What `list` answers now, kept as the repository's latest listing. */
|
|
81
|
+
refresh(path: string, url: string, list: () => Promise<OriginState>): Promise<OriginState>;
|
|
82
|
+
/** Drops the repository's listing, so that the next read asks origin. */
|
|
83
|
+
forget(path: string): void;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Where a read of the repository takes origin's refs from: the listing of
|
|
87
|
+
* the last 30 s (`recent`), or a new one (`fresh`) that the next reads reuse.
|
|
88
|
+
*/
|
|
89
|
+
export type OriginRead = "recent" | "fresh";
|
|
90
|
+
/** Drops what origin listed for the repository, after a publish changed it. */
|
|
91
|
+
export declare function forgetOrigin(path: string): void;
|
|
92
|
+
/** The object origin holds at `ref`, peeled to a commit for a tag, if any. */
|
|
93
|
+
export declare function originObject(origin: OriginState, ref: string): string | undefined;
|
|
94
|
+
/** Why the folder at `path` is not the root of a git work tree, or `null` when it is. */
|
|
95
|
+
export declare function readWorkTreeRoot(path: string): Promise<Refusal | null>;
|
|
96
|
+
/**
|
|
97
|
+
* Reads what the module needs of the repository at `path`: its branch and
|
|
98
|
+
* HEAD, its versions and environment branches, and what origin holds, as
|
|
99
|
+
* `origin` says to take it. Writes nothing.
|
|
100
|
+
*/
|
|
101
|
+
export declare function readRepository(path: string, origin: OriginRead): Promise<RepositoryRead>;
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OriginCache = void 0;
|
|
4
|
+
exports.readOrigin = readOrigin;
|
|
5
|
+
exports.forgetOrigin = forgetOrigin;
|
|
6
|
+
exports.originObject = originObject;
|
|
7
|
+
exports.readWorkTreeRoot = readWorkTreeRoot;
|
|
8
|
+
exports.readRepository = readRepository;
|
|
9
|
+
const promises_1 = require("node:fs/promises");
|
|
10
|
+
const command_1 = require("./command");
|
|
11
|
+
const refusal_1 = require("./refusal");
|
|
12
|
+
const refs_1 = require("./refs");
|
|
13
|
+
const RELEASE_FIELDS = [
|
|
14
|
+
"%(refname:strip=2)",
|
|
15
|
+
"%(objectname)",
|
|
16
|
+
"%(objecttype)",
|
|
17
|
+
"%(*objecttype)",
|
|
18
|
+
"%(*objectname)",
|
|
19
|
+
"%(contents:subject)",
|
|
20
|
+
"%(contents:body)",
|
|
21
|
+
"%(taggername)",
|
|
22
|
+
"%(taggeremail)",
|
|
23
|
+
"%(taggerdate:iso-strict)",
|
|
24
|
+
"%(*subject)",
|
|
25
|
+
];
|
|
26
|
+
const ENVIRONMENT_FIELDS = ["%(refname:strip=2)", "%(objectname)"];
|
|
27
|
+
const ANNOTATED = "tag";
|
|
28
|
+
const COMMIT = "commit";
|
|
29
|
+
const PEELED_SUFFIX = "^{}";
|
|
30
|
+
/** The refs of origin the module reads: its branches and its version tags. */
|
|
31
|
+
const ORIGIN_REFS = ["refs/heads/*", "refs/tags/release/*"];
|
|
32
|
+
const EMAIL_BRACKETS = /^<|>$/gu;
|
|
33
|
+
/**
|
|
34
|
+
* Splits `for-each-ref` output written with fields joined and ended by NUL:
|
|
35
|
+
* each record is `fieldCount` fields, and the newline git writes after a
|
|
36
|
+
* record starts the first field of the next one.
|
|
37
|
+
*/
|
|
38
|
+
function parseRecords(output, fieldCount) {
|
|
39
|
+
const tokens = output.split("\0");
|
|
40
|
+
const records = [];
|
|
41
|
+
for (let start = 0; start + fieldCount <= tokens.length; start += fieldCount) {
|
|
42
|
+
const record = tokens.slice(start, start + fieldCount);
|
|
43
|
+
record[0] = (record[0] ?? "").replace(/^\n/u, "");
|
|
44
|
+
records.push(record);
|
|
45
|
+
}
|
|
46
|
+
return records;
|
|
47
|
+
}
|
|
48
|
+
function forEachRefFormat(fields) {
|
|
49
|
+
return `--format=${fields.join("%00")}%00`;
|
|
50
|
+
}
|
|
51
|
+
function parseRelease(fields) {
|
|
52
|
+
const [tag = "", object = "", type, peeledType, commit = "", subject = "", body = "", taggerName = "", taggerEmail = "", taggedAt = "", message = "",] = fields;
|
|
53
|
+
const number = (0, refs_1.releaseNumber)(tag);
|
|
54
|
+
if (number === null || type !== ANNOTATED || peeledType !== COMMIT) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
number,
|
|
59
|
+
tag,
|
|
60
|
+
object,
|
|
61
|
+
name: subject.trim() || `Version ${number}`,
|
|
62
|
+
notes: body.trim(),
|
|
63
|
+
commit,
|
|
64
|
+
message,
|
|
65
|
+
tagger: {
|
|
66
|
+
name: taggerName,
|
|
67
|
+
email: taggerEmail.replace(EMAIL_BRACKETS, ""),
|
|
68
|
+
},
|
|
69
|
+
taggedAt,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
async function readReleases(path) {
|
|
73
|
+
const output = await (0, command_1.git)(path, [
|
|
74
|
+
"for-each-ref",
|
|
75
|
+
forEachRefFormat(RELEASE_FIELDS),
|
|
76
|
+
"refs/tags/release/",
|
|
77
|
+
]);
|
|
78
|
+
const records = parseRecords(output, RELEASE_FIELDS.length);
|
|
79
|
+
const releases = records
|
|
80
|
+
.map(parseRelease)
|
|
81
|
+
.filter((release) => release !== null)
|
|
82
|
+
.sort((a, b) => b.number - a.number);
|
|
83
|
+
const highest = Math.max(0, ...records.map(([tag = ""]) => (0, refs_1.releaseNumber)(tag) ?? 0));
|
|
84
|
+
return { releases, highest };
|
|
85
|
+
}
|
|
86
|
+
async function readLocalEnvironments(path) {
|
|
87
|
+
const output = await (0, command_1.git)(path, [
|
|
88
|
+
"for-each-ref",
|
|
89
|
+
forEachRefFormat(ENVIRONMENT_FIELDS),
|
|
90
|
+
"refs/heads/env/",
|
|
91
|
+
]);
|
|
92
|
+
const environments = new Map();
|
|
93
|
+
for (const [branch = "", commit = ""] of parseRecords(output, ENVIRONMENT_FIELDS.length)) {
|
|
94
|
+
const name = (0, refs_1.environmentOfBranch)(branch);
|
|
95
|
+
if (name !== null)
|
|
96
|
+
environments.set(name, commit);
|
|
97
|
+
}
|
|
98
|
+
return environments;
|
|
99
|
+
}
|
|
100
|
+
/** Parses `git ls-remote` output into each ref and the object it points to. */
|
|
101
|
+
function parseRemoteRefs(output) {
|
|
102
|
+
const refs = new Map();
|
|
103
|
+
for (const line of output.split("\n")) {
|
|
104
|
+
const [object = "", ref = ""] = line.split("\t");
|
|
105
|
+
if (ref !== "")
|
|
106
|
+
refs.set(ref, object);
|
|
107
|
+
}
|
|
108
|
+
return refs;
|
|
109
|
+
}
|
|
110
|
+
async function originUrl(path) {
|
|
111
|
+
const remote = await (0, command_1.runGit)(path, ["remote", "get-url", "origin"]);
|
|
112
|
+
return remote.exitCode === 0 ? remote.stdout.trim() : null;
|
|
113
|
+
}
|
|
114
|
+
async function listOrigin(path, url, refs) {
|
|
115
|
+
const listing = await (0, command_1.runGit)(path, [
|
|
116
|
+
"ls-remote",
|
|
117
|
+
"--heads",
|
|
118
|
+
"--tags",
|
|
119
|
+
"origin",
|
|
120
|
+
...refs,
|
|
121
|
+
]);
|
|
122
|
+
if (listing.exitCode !== 0) {
|
|
123
|
+
return {
|
|
124
|
+
kind: "unreachable",
|
|
125
|
+
url: (0, command_1.redactCredentials)(url),
|
|
126
|
+
reason: (0, command_1.redactCredentials)((0, command_1.lastLine)(listing.stderr)),
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
kind: "reachable",
|
|
131
|
+
url: (0, command_1.redactCredentials)(url),
|
|
132
|
+
refs: parseRemoteRefs(listing.stdout),
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Lists the refs origin holds, asking it over the network.
|
|
137
|
+
*
|
|
138
|
+
* @param refs Patterns of the refs to list.
|
|
139
|
+
*/
|
|
140
|
+
async function readOrigin(path, refs) {
|
|
141
|
+
const url = await originUrl(path);
|
|
142
|
+
return url === null ? { kind: "missing" } : listOrigin(path, url, refs);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* What origin listed for each repository, kept for `maxAgeMs` so that pages
|
|
146
|
+
* read every few seconds do not ask origin over the network each time. An
|
|
147
|
+
* entry answers for the origin URL it was listed from only, and reads that
|
|
148
|
+
* come while a listing runs share it.
|
|
149
|
+
*/
|
|
150
|
+
class OriginCache {
|
|
151
|
+
maxAgeMs;
|
|
152
|
+
now;
|
|
153
|
+
entries = new Map();
|
|
154
|
+
constructor(maxAgeMs, now = Date.now) {
|
|
155
|
+
this.maxAgeMs = maxAgeMs;
|
|
156
|
+
this.now = now;
|
|
157
|
+
}
|
|
158
|
+
/** What origin at `url` listed for the repository at `path` within `maxAgeMs`, else what `list` answers now. */
|
|
159
|
+
read(path, url, list) {
|
|
160
|
+
const entry = this.entries.get(path);
|
|
161
|
+
if (entry?.url === url && this.now() - entry.listedAt < this.maxAgeMs) {
|
|
162
|
+
return entry.state;
|
|
163
|
+
}
|
|
164
|
+
return this.refresh(path, url, list);
|
|
165
|
+
}
|
|
166
|
+
/** What `list` answers now, kept as the repository's latest listing. */
|
|
167
|
+
refresh(path, url, list) {
|
|
168
|
+
const state = list();
|
|
169
|
+
this.entries.set(path, { url, listedAt: this.now(), state });
|
|
170
|
+
return state;
|
|
171
|
+
}
|
|
172
|
+
/** Drops the repository's listing, so that the next read asks origin. */
|
|
173
|
+
forget(path) {
|
|
174
|
+
this.entries.delete(path);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
exports.OriginCache = OriginCache;
|
|
178
|
+
/** How long the pages reuse what origin listed. */
|
|
179
|
+
const ORIGIN_MAX_AGE_MS = 30_000;
|
|
180
|
+
const originCache = new OriginCache(ORIGIN_MAX_AGE_MS);
|
|
181
|
+
async function readOriginAs(path, read) {
|
|
182
|
+
const url = await originUrl(path);
|
|
183
|
+
if (url === null)
|
|
184
|
+
return { kind: "missing" };
|
|
185
|
+
const list = () => listOrigin(path, url, ORIGIN_REFS);
|
|
186
|
+
return read === "fresh"
|
|
187
|
+
? originCache.refresh(path, url, list)
|
|
188
|
+
: originCache.read(path, url, list);
|
|
189
|
+
}
|
|
190
|
+
/** Drops what origin listed for the repository, after a publish changed it. */
|
|
191
|
+
function forgetOrigin(path) {
|
|
192
|
+
originCache.forget(path);
|
|
193
|
+
}
|
|
194
|
+
/** The object origin holds at `ref`, peeled to a commit for a tag, if any. */
|
|
195
|
+
function originObject(origin, ref) {
|
|
196
|
+
return origin.kind === "reachable" ? origin.refs.get(ref) : undefined;
|
|
197
|
+
}
|
|
198
|
+
/** The `release/v<N>` numbers origin holds. */
|
|
199
|
+
function originReleaseNumbers(origin) {
|
|
200
|
+
if (origin.kind !== "reachable")
|
|
201
|
+
return [];
|
|
202
|
+
return [...origin.refs.keys()].flatMap((ref) => {
|
|
203
|
+
if (ref.endsWith(PEELED_SUFFIX))
|
|
204
|
+
return [];
|
|
205
|
+
const number = (0, refs_1.releaseNumber)(ref.replace(/^refs\/tags\//u, ""));
|
|
206
|
+
return number === null ? [] : [number];
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
/** Why the folder at `path` is not the root of a git work tree, or `null` when it is. */
|
|
210
|
+
async function readWorkTreeRoot(path) {
|
|
211
|
+
const top = await (0, command_1.runGit)(path, ["rev-parse", "--show-toplevel"]);
|
|
212
|
+
if (top.exitCode !== 0) {
|
|
213
|
+
return (0, refusal_1.notARepository)(path, (0, command_1.lastLine)(top.stderr) || "git did not answer");
|
|
214
|
+
}
|
|
215
|
+
const [root, folder] = await Promise.all([
|
|
216
|
+
(0, promises_1.realpath)(top.stdout.trim()),
|
|
217
|
+
(0, promises_1.realpath)(path),
|
|
218
|
+
]);
|
|
219
|
+
if (root !== folder) {
|
|
220
|
+
return (0, refusal_1.notARepository)(path, `its work tree starts at ${root}`);
|
|
221
|
+
}
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
224
|
+
async function optionalOutput(path, args) {
|
|
225
|
+
const output = await (0, command_1.runGit)(path, args);
|
|
226
|
+
return output.exitCode === 0 ? output.stdout.trim() : null;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* The branch HEAD names, read from its full ref: `--short` answers
|
|
230
|
+
* `heads/develop` once a tag or another ref is named `develop` too. `null`
|
|
231
|
+
* when HEAD is detached or names a ref outside `refs/heads/`.
|
|
232
|
+
*/
|
|
233
|
+
async function readBranch(path) {
|
|
234
|
+
const ref = await optionalOutput(path, ["symbolic-ref", "--quiet", "HEAD"]);
|
|
235
|
+
return ref === null ? null : (0, refs_1.branchOfRef)(ref);
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Reads what the module needs of the repository at `path`: its branch and
|
|
239
|
+
* HEAD, its versions and environment branches, and what origin holds, as
|
|
240
|
+
* `origin` says to take it. Writes nothing.
|
|
241
|
+
*/
|
|
242
|
+
async function readRepository(path, origin) {
|
|
243
|
+
const refusal = await readWorkTreeRoot(path);
|
|
244
|
+
if (refusal)
|
|
245
|
+
return { kind: "refused", refusal };
|
|
246
|
+
const [branch, head, emptyTree, local, localEnvironments, originState] = await Promise.all([
|
|
247
|
+
readBranch(path),
|
|
248
|
+
optionalOutput(path, [
|
|
249
|
+
"rev-parse",
|
|
250
|
+
"--quiet",
|
|
251
|
+
"--verify",
|
|
252
|
+
"HEAD^{commit}",
|
|
253
|
+
]),
|
|
254
|
+
(0, command_1.git)(path, ["hash-object", "-t", "tree", "--stdin"]),
|
|
255
|
+
readReleases(path),
|
|
256
|
+
readLocalEnvironments(path),
|
|
257
|
+
readOriginAs(path, origin),
|
|
258
|
+
]);
|
|
259
|
+
return {
|
|
260
|
+
kind: "read",
|
|
261
|
+
snapshot: {
|
|
262
|
+
path,
|
|
263
|
+
branch,
|
|
264
|
+
head,
|
|
265
|
+
emptyTree: emptyTree.trim(),
|
|
266
|
+
releases: local.releases,
|
|
267
|
+
highestReleaseNumber: Math.max(local.highest, ...originReleaseNumbers(originState)),
|
|
268
|
+
localEnvironments,
|
|
269
|
+
origin: originState,
|
|
270
|
+
},
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
//# sourceMappingURL=repository.js.map
|