@rocket.chat/houston 0.27.0-next.3 → 2.1.9
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 +1 -1
- package/README.md +109 -15
- package/bin/houston +62 -0
- package/data/docs/ARCHITECTURE.md +387 -0
- package/data/docs/automation.md +107 -0
- package/data/docs/e2ee.md +76 -0
- package/data/docs/eks.md +258 -0
- package/data/docs/gui.md +282 -0
- package/data/docs/guide.md +642 -0
- package/data/docs/kubernetes.md +138 -0
- package/data/docs/loadtest.md +264 -0
- package/data/docs/troubleshooting.md +203 -0
- package/data/docs/upgrading.md +84 -0
- package/data/docs/voice.md +253 -0
- package/data/iam/engineer-policy.json +11 -0
- package/data/iam/engineer-rbac.yaml +42 -0
- package/data/iam/operator-policy.json +211 -0
- package/data/loadtest/badbot.js +22 -0
- package/data/loadtest/common.js +170 -0
- package/data/loadtest/custom.js +20 -0
- package/data/loadtest/journey.js +58 -0
- package/data/loadtest/login.js +18 -0
- package/data/loadtest/messages.js +13 -0
- package/data/loadtest/mixed.js +57 -0
- package/data/loadtest/read.js +12 -0
- package/data/loadtest/webhook.js +20 -0
- package/data/monitoring/houston-logs.json +98 -0
- package/data/monitoring/k6-loadtest.json +610 -0
- package/data/monitoring/mongodb-exporter.json +3007 -0
- package/data/monitoring/node-exporter-full.json +16114 -0
- package/data/monitoring/rocketchat-metrics.json +6471 -0
- package/data/presets/airgapped.yaml +16 -0
- package/data/presets/default.yaml +9 -0
- package/data/seed/avatar-0.png +0 -0
- package/data/seed/avatar-1.png +0 -0
- package/data/seed/avatar-2.png +0 -0
- package/data/seed/avatar-3.png +0 -0
- package/data/seed/avatar-4.png +0 -0
- package/data/seed/avatar-5.png +0 -0
- package/data/seed/avatar-6.png +0 -0
- package/data/seed/avatar-7.png +0 -0
- package/data/seed/seed-metrics.csv +3 -0
- package/data/seed/seed-preview.png +0 -0
- package/data/seed/seed-report.pdf +32 -0
- package/data/seed/seed-runbook.txt +3 -0
- package/data/skill/SKILL.md +399 -0
- package/data/versions.yaml +55 -0
- package/data/voice/freeswitch/drachtio.xml +52 -0
- package/data/voice/freeswitch/public.xml +87 -0
- package/data/webui/app.css +2003 -0
- package/data/webui/index.html +678 -0
- package/data/webui/js/api.js +561 -0
- package/data/webui/js/boot.js +44 -0
- package/data/webui/js/clusters-tail.js +1377 -0
- package/data/webui/js/clusters.js +896 -0
- package/data/webui/js/create.js +276 -0
- package/data/webui/js/detail.js +507 -0
- package/data/webui/js/jobs.js +636 -0
- package/data/webui/js/logs.js +634 -0
- package/data/webui/js/main.js +14 -0
- package/data/webui/js/options.js +408 -0
- package/data/webui/js/people.js +438 -0
- package/data/webui/js/perf.js +303 -0
- package/data/webui/js/render.js +438 -0
- package/data/webui/js/shared.js +3 -0
- package/data/webui/js/state.js +583 -0
- package/data/webui/js/theme.js +123 -0
- package/data/webui/js/util.js +584 -0
- package/dist/cli/app.js +593 -0
- package/dist/cli/capabilities.js +76 -0
- package/dist/cli/cell-widths.js +495 -0
- package/dist/cli/entry.js +10 -0
- package/dist/cli/error-panel.js +492 -0
- package/dist/cli/handlers/actor.js +84 -0
- package/dist/cli/handlers/https.js +614 -0
- package/dist/cli/handlers/prompt.js +299 -0
- package/dist/cli/handlers/users.js +226 -0
- package/dist/cli/handlers.js +3694 -0
- package/dist/cli/help.js +183 -0
- package/dist/cli/index.js +15 -0
- package/dist/cli/perf.js +814 -0
- package/dist/cli/render.js +254 -0
- package/dist/cli/serve.js +858 -0
- package/dist/cli/spec-data.js +2599 -0
- package/dist/cli/spec-types.js +8 -0
- package/dist/cli/usage-error.js +520 -0
- package/dist/cli/wire.js +70 -0
- package/dist/core/audit.js +346 -0
- package/dist/core/backup-compat.js +85 -0
- package/dist/core/backup.js +1639 -0
- package/dist/core/cluster.js +1398 -0
- package/dist/core/configimport.js +345 -0
- package/dist/core/data.js +267 -0
- package/dist/core/database-of.js +82 -0
- package/dist/core/diagnose.js +159 -0
- package/dist/core/doctor.js +1518 -0
- package/dist/core/edge/acme.js +338 -0
- package/dist/core/edge/engine.js +500 -0
- package/dist/core/edge/networks.js +174 -0
- package/dist/core/edge/paths.js +107 -0
- package/dist/core/edge/routes.js +251 -0
- package/dist/core/edge/routeyml.js +195 -0
- package/dist/core/edge/runtime.js +493 -0
- package/dist/core/edge/spec.js +305 -0
- package/dist/core/edge/types.js +202 -0
- package/dist/core/eks-docs.js +135 -0
- package/dist/core/eks.js +2240 -0
- package/dist/core/envvars.js +562 -0
- package/dist/core/eventlog.js +541 -0
- package/dist/core/firstrun.js +153 -0
- package/dist/core/journal.js +694 -0
- package/dist/core/kube/ask.js +231 -0
- package/dist/core/kube/capabilities.js +269 -0
- package/dist/core/kube/certmanager.js +452 -0
- package/dist/core/kube/chart.js +413 -0
- package/dist/core/kube/cluster.js +196 -0
- package/dist/core/kube/context.js +545 -0
- package/dist/core/kube/endpoints.js +448 -0
- package/dist/core/kube/exec.js +195 -0
- package/dist/core/kube/forward.js +732 -0
- package/dist/core/kube/grafana-ingress.js +110 -0
- package/dist/core/kube/ingress.js +218 -0
- package/dist/core/kube/manifests.js +361 -0
- package/dist/core/kube/monitoring.js +768 -0
- package/dist/core/kube/names.js +237 -0
- package/dist/core/kube/namespace.js +678 -0
- package/dist/core/kube/operator.js +941 -0
- package/dist/core/kube/probe.js +202 -0
- package/dist/core/kube/reachability.js +163 -0
- package/dist/core/kube/release.js +439 -0
- package/dist/core/kube/replicaset.js +180 -0
- package/dist/core/kube/scale.js +398 -0
- package/dist/core/kube/status.js +633 -0
- package/dist/core/kube/tools.js +238 -0
- package/dist/core/kube/transfer.js +173 -0
- package/dist/core/kube/workspace.js +423 -0
- package/dist/core/lifecycle/admin.js +64 -0
- package/dist/core/lifecycle/create-docker.js +1549 -0
- package/dist/core/lifecycle/create-k8s.js +960 -0
- package/dist/core/lifecycle/destroy.js +339 -0
- package/dist/core/lifecycle/inspect.js +636 -0
- package/dist/core/lifecycle/naming.js +298 -0
- package/dist/core/lifecycle/notes.js +862 -0
- package/dist/core/lifecycle/ownership.js +313 -0
- package/dist/core/lifecycle/payload.js +401 -0
- package/dist/core/lifecycle/ports.js +388 -0
- package/dist/core/lifecycle/preconditions.js +367 -0
- package/dist/core/lifecycle/pruning.js +551 -0
- package/dist/core/lifecycle/ready.js +818 -0
- package/dist/core/lifecycle/request.js +510 -0
- package/dist/core/lifecycle/seeding.js +281 -0
- package/dist/core/lifecycle/sizing.js +392 -0
- package/dist/core/lifecycle/state.js +286 -0
- package/dist/core/lifecycle/tlsplan.js +704 -0
- package/dist/core/lifecycle/types.js +232 -0
- package/dist/core/loadtest.js +1051 -0
- package/dist/core/migrate.js +612 -0
- package/dist/core/monitor.js +494 -0
- package/dist/core/postready.js +976 -0
- package/dist/core/promote.js +804 -0
- package/dist/core/rcapi.js +1336 -0
- package/dist/core/recovery.js +75 -0
- package/dist/core/runner/engine.js +394 -0
- package/dist/core/runner/host.js +298 -0
- package/dist/core/runner/locks.js +129 -0
- package/dist/core/runner/paths.js +173 -0
- package/dist/core/runner/ports.js +172 -0
- package/dist/core/runner/queries.js +612 -0
- package/dist/core/runner/record.js +563 -0
- package/dist/core/scaleseed.js +271 -0
- package/dist/core/seed-db.js +208 -0
- package/dist/core/sessions.js +472 -0
- package/dist/core/skill.js +326 -0
- package/dist/core/sso-identities.js +172 -0
- package/dist/core/sso.js +703 -0
- package/dist/core/tls-local.js +311 -0
- package/dist/core/tls.js +878 -0
- package/dist/core/topology.js +482 -0
- package/dist/core/upgrade.js +877 -0
- package/dist/core/users.js +739 -0
- package/dist/lib/audit.js +100 -0
- package/dist/lib/close-matches.js +238 -0
- package/dist/lib/compose.js +672 -0
- package/dist/lib/config.js +1398 -0
- package/dist/lib/context.js +18 -0
- package/dist/lib/errors.js +305 -0
- package/dist/lib/events.js +208 -0
- package/dist/lib/float-text.js +126 -0
- package/dist/lib/format.js +1320 -0
- package/dist/lib/home.js +325 -0
- package/dist/lib/journal.js +122 -0
- package/dist/lib/json-text.js +733 -0
- package/dist/lib/jsonout.js +382 -0
- package/dist/lib/lock.js +516 -0
- package/dist/lib/login-name.js +202 -0
- package/dist/lib/map-limit.js +29 -0
- package/dist/lib/mkdir-parents.js +90 -0
- package/dist/lib/mongo-kernel.js +67 -0
- package/dist/lib/monitoring.js +492 -0
- package/dist/lib/platform-name.js +59 -0
- package/dist/lib/presets/common.js +390 -0
- package/dist/lib/presets/composite.js +326 -0
- package/dist/lib/presets/e2ee.js +143 -0
- package/dist/lib/presets/email.js +172 -0
- package/dist/lib/presets/guides.js +27 -0
- package/dist/lib/presets/index.js +490 -0
- package/dist/lib/presets/keycloak.js +371 -0
- package/dist/lib/presets/ldap.js +1285 -0
- package/dist/lib/presets/livechat.js +220 -0
- package/dist/lib/presets/multi-instance.js +124 -0
- package/dist/lib/presets/oidc.js +161 -0
- package/dist/lib/presets/public.js +496 -0
- package/dist/lib/presets/registry.js +64 -0
- package/dist/lib/presets/s3-minio.js +300 -0
- package/dist/lib/presets/saml.js +149 -0
- package/dist/lib/presets/scenario.js +51 -0
- package/dist/lib/presets/types.js +86 -0
- package/dist/lib/presets/voice-pbx.js +320 -0
- package/dist/lib/presets/voice.js +345 -0
- package/dist/lib/presets/webhooks.js +182 -0
- package/dist/lib/redact.js +106 -0
- package/dist/lib/seed-options.js +68 -0
- package/dist/lib/seed-profiles.js +59 -0
- package/dist/lib/targz.js +1383 -0
- package/dist/lib/teammode.js +25 -0
- package/dist/lib/tempdir.js +162 -0
- package/dist/lib/unicode-tables.js +2335 -0
- package/dist/lib/version-spec.js +357 -0
- package/dist/lib/versions.js +463 -0
- package/dist/lib/yaml-dump.js +1361 -0
- package/dist/perf/baseline.js +168 -0
- package/dist/perf/constrain.js +299 -0
- package/dist/perf/k6.js +235 -0
- package/dist/perf/mongoprof.js +171 -0
- package/dist/perf/rcmetrics.js +191 -0
- package/dist/perf/report.js +386 -0
- package/dist/perf/resources.js +236 -0
- package/dist/perf/slo.js +111 -0
- package/dist/perf/timeline.js +187 -0
- package/dist/perf/timings.js +85 -0
- package/dist/perf/verdict.js +201 -0
- package/dist/seams/aws-cli.js +126 -0
- package/dist/seams/docker-cli.js +280 -0
- package/dist/seams/exec.js +861 -0
- package/dist/seams/fs/lock.js +528 -0
- package/dist/seams/kubectl.js +83 -0
- package/dist/seams/rc-http.js +921 -0
- package/dist/seed/apply.js +190 -0
- package/dist/seed/assets.js +76 -0
- package/dist/seed/check.js +391 -0
- package/dist/seed/client.js +172 -0
- package/dist/seed/executor.js +726 -0
- package/dist/seed/history.js +281 -0
- package/dist/seed/kinds.js +91 -0
- package/dist/seed/plan.js +432 -0
- package/dist/seed/receipt.js +339 -0
- package/dist/seed/repairs.js +75 -0
- package/dist/seed/verification.js +363 -0
- package/dist/seed/wording.js +248 -0
- package/dist/web/app.js +326 -0
- package/dist/web/jobs.js +510 -0
- package/dist/web/route-deps.js +211 -0
- package/dist/web/route-table.js +213 -0
- package/dist/web/routes/backup.js +244 -0
- package/dist/web/routes/clusters.js +303 -0
- package/dist/web/routes/data.js +187 -0
- package/dist/web/routes/edge.js +82 -0
- package/dist/web/routes/index.js +63 -0
- package/dist/web/routes/jobs.js +95 -0
- package/dist/web/routes/logs.js +297 -0
- package/dist/web/routes/meta.js +191 -0
- package/dist/web/routes/people.js +151 -0
- package/dist/web/routes/perf.js +95 -0
- package/dist/web/routes/repros.js +550 -0
- package/dist/web/routes/session.js +361 -0
- package/dist/web/routes/spa.js +198 -0
- package/dist/web/security.js +475 -0
- package/dist/web/signin.js +246 -0
- package/package.json +70 -32
- package/.eslintrc +0 -94
- package/.swcrc +0 -18
- package/dist/bin.js +0 -3
- package/dist/cli.js +0 -184
- package/dist/commands/createBranch.js +0 -194
- package/dist/outputCI.js +0 -59
- package/src/bin.js +0 -4
- package/src/cli.ts +0 -25
- package/src/commands/createBranch.ts +0 -28
- package/src/outputCI.ts +0 -12
- package/src-old/logs.js +0 -323
- package/src-old/md.js +0 -191
- package/src-old/release-table.js +0 -60
- package/src-old/set-version.js +0 -614
- package/src-old/utils.js +0 -15
package/src-old/set-version.js
DELETED
|
@@ -1,614 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
const { promisify } = require('util');
|
|
4
|
-
const semver = require('semver');
|
|
5
|
-
const inquirer = require('inquirer');
|
|
6
|
-
const git = require('simple-git/promise')(process.cwd());
|
|
7
|
-
const logs = require('./logs');
|
|
8
|
-
const { Octokit } = require('@octokit/rest');
|
|
9
|
-
const md = require('../src/md');
|
|
10
|
-
const { getMetadata } = require('./utils');
|
|
11
|
-
|
|
12
|
-
const octokit = new Octokit({
|
|
13
|
-
auth: process.env.GITHUB_TOKEN
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
const files = [];
|
|
17
|
-
|
|
18
|
-
const readFile = promisify(fs.readFile);
|
|
19
|
-
const writeFile = promisify(fs.writeFile);
|
|
20
|
-
|
|
21
|
-
const {
|
|
22
|
-
PUSH_TAG_OPTIONS = '',
|
|
23
|
-
PUSH_CURRENT_BRANCH_OPTIONS = ''
|
|
24
|
-
} = process.env;
|
|
25
|
-
|
|
26
|
-
class Houston {
|
|
27
|
-
constructor({
|
|
28
|
-
owner,
|
|
29
|
-
repo,
|
|
30
|
-
version
|
|
31
|
-
} = {}) {
|
|
32
|
-
this.owner = owner;
|
|
33
|
-
this.repo = repo;
|
|
34
|
-
this.version = version;
|
|
35
|
-
this.minTag = '';
|
|
36
|
-
|
|
37
|
-
if (!this.version) {
|
|
38
|
-
this.readVersionFromPackageJson();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
readVersionFromPackageJson() {
|
|
43
|
-
const filePath = path.resolve(process.cwd(), './package.json');
|
|
44
|
-
const file = JSON.parse(fs.readFileSync(filePath));
|
|
45
|
-
this.version = file.version;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
async init() {
|
|
49
|
-
if (!await this.isClean()) {
|
|
50
|
-
throw new Error('Branch not synced or changes in files. Please run this only on clean stage.');
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
await this.fetch();
|
|
54
|
-
await this.getRemote();
|
|
55
|
-
await this.selectAction();
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
async isClean() {
|
|
59
|
-
const {files, ahead, behind} = await git.status();
|
|
60
|
-
return files.length === 0 && ahead === 0 && behind === 0;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// read repo config
|
|
64
|
-
async readConfig() {
|
|
65
|
-
const filePath = path.resolve(process.cwd(), './package.json');
|
|
66
|
-
const file = JSON.parse(fs.readFileSync(filePath));
|
|
67
|
-
if (!file.houston) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
const { houston } = file;
|
|
71
|
-
if (houston.updateFiles) {
|
|
72
|
-
houston.updateFiles.forEach((file) => {
|
|
73
|
-
files.push(file);
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (houston.minTag) {
|
|
78
|
-
this.minTag = houston.minTag;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
async getRemote() {
|
|
83
|
-
if (this.owner && this.repo) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
let remotes = await git.listRemote(['--get-url']);
|
|
88
|
-
remotes = remotes.split(/\n/);
|
|
89
|
-
|
|
90
|
-
if (remotes.length === 0) {
|
|
91
|
-
throw new Error('No git remote found');
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// TODO: Allow select remote when more then one exists
|
|
95
|
-
|
|
96
|
-
const [, owner, repo] = String(remotes[0]).match(/[\/:]([^\/]+)\/([^\/]+)\.git$/);
|
|
97
|
-
this.owner = owner;
|
|
98
|
-
this.repo = repo;
|
|
99
|
-
console.log(`Working with repository ${ owner }/${ repo }`);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
async fetch() {
|
|
103
|
-
await git.fetch();
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
async currentBranch() {
|
|
107
|
-
const {current} = await git.status();
|
|
108
|
-
return current;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
async selectAction() {
|
|
112
|
-
const branch = await this.currentBranch();
|
|
113
|
-
let defaultOption;
|
|
114
|
-
|
|
115
|
-
if (branch === 'release-candidate') {
|
|
116
|
-
defaultOption = 'release-candidate';
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (branch === 'master') {
|
|
120
|
-
defaultOption = 'develop-sync';
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
if (/release-\d+\.\d+\.\d+/.test(branch)) {
|
|
124
|
-
defaultOption = 'release';
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (branch === 'develop-sync') {
|
|
128
|
-
defaultOption = 'develop-sync';
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
const { answer } = await inquirer.prompt([{
|
|
132
|
-
type: 'list',
|
|
133
|
-
message: 'Which action you want to execute?',
|
|
134
|
-
name: 'answer',
|
|
135
|
-
default: defaultOption,
|
|
136
|
-
choices: [{
|
|
137
|
-
name: 'Beta Release', value: 'beta-release'
|
|
138
|
-
}, {
|
|
139
|
-
name: 'Release Candidate', value: 'release-candidate'
|
|
140
|
-
}, {
|
|
141
|
-
name: 'Final Release', value: 'release'
|
|
142
|
-
}, {
|
|
143
|
-
name: 'Final Release From Cherry Picks', value: 'release-from-cherry-picks'
|
|
144
|
-
}, {
|
|
145
|
-
name: 'Develop Sync', value: 'develop-sync'
|
|
146
|
-
}, {
|
|
147
|
-
name: 'Create release issue', value: 'create-release-issue'
|
|
148
|
-
}]
|
|
149
|
-
}]);
|
|
150
|
-
|
|
151
|
-
if (answer === 'release-candidate') {
|
|
152
|
-
return await this.newReleaseCandidate();
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if (answer === 'beta-release') {
|
|
156
|
-
return await this.newBetaRelease();
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
if (answer === 'release') {
|
|
160
|
-
return await this.newFinalRelease();
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
if (answer === 'release-from-cherry-picks') {
|
|
164
|
-
return await this.newFinalReleaseFromCherryPicks();
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
if (answer === 'develop-sync') {
|
|
168
|
-
return await this.newSyncRelease();
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
if (answer === 'create-release-issue') {
|
|
172
|
-
return await this.createReleaseIssue();
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
throw new Error(`No release action for branch ${ status.current }`);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
async createReleaseIssue() {
|
|
179
|
-
await this.goToBranch({branch: 'develop', readVersion: true});
|
|
180
|
-
await this.selectVersionToUpdate({currentVersion: this.version, release: 'patch'});
|
|
181
|
-
await this.createReleaseIssueOnGitHub();
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
async newReleaseCandidate() {
|
|
185
|
-
// TODO: Allow start from develop and ask for create the release-candidate branch
|
|
186
|
-
await this.goToBranch({branch: 'release-candidate', readVersion: true});
|
|
187
|
-
await this.shouldMergeFromTo({from: 'origin/develop', to: 'release-candidate'});
|
|
188
|
-
await this.selectVersionToUpdate({currentVersion: this.version, release: 'prerelease', identifier: 'rc'});
|
|
189
|
-
await this.updateVersionInFiles();
|
|
190
|
-
await this.updateHistory();
|
|
191
|
-
await this.shouldPushCurrentBranch();
|
|
192
|
-
await this.shouldAddTag();
|
|
193
|
-
await this.shouldSetHistoryToGithubRelease(true);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
async newBetaRelease() {
|
|
197
|
-
// TODO: Allow start from develop and ask for create the release-candidate branch
|
|
198
|
-
await this.goToBranch({branch: 'beta-release', readVersion: true});
|
|
199
|
-
await this.shouldMergeFromTo({from: 'origin/develop', to: 'beta-release'});
|
|
200
|
-
await this.selectVersionToUpdate({currentVersion: this.version, release: 'prerelease', identifier: 'beta'});
|
|
201
|
-
await this.updateVersionInFiles();
|
|
202
|
-
await this.updateHistory();
|
|
203
|
-
await this.shouldPushCurrentBranch();
|
|
204
|
-
await this.shouldAddTag();
|
|
205
|
-
await this.shouldSetHistoryToGithubRelease(true);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
async newFinalRelease() {
|
|
209
|
-
await this.goToBranch({branch: 'release-candidate', readVersion: true});
|
|
210
|
-
await this.selectVersionToUpdate({currentVersion: this.version, release: 'patch'});
|
|
211
|
-
await this.goToBranch({branch: 'master', pull: true});
|
|
212
|
-
await this.createAndGoToBranch({branch: `release-${ this.version }`});
|
|
213
|
-
await this.shouldMergeFromTo({from: 'origin/release-candidate', to: `release-${ this.version }`});
|
|
214
|
-
await this.updateVersionInFiles();
|
|
215
|
-
await this.updateHistory();
|
|
216
|
-
await this.shouldPushCurrentBranch();
|
|
217
|
-
await this.shouldCreateDraftReleaseWithHistory();
|
|
218
|
-
await this.shouldCreateReleasePullRequest();
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
async newFinalReleaseFromCherryPicks() {
|
|
222
|
-
await this.goToBranch({branch: 'master', pull: true, readVersion: true});
|
|
223
|
-
await this.selectVersionToUpdate({currentVersion: this.version, release: 'patch'});
|
|
224
|
-
await this.createAndGoToBranch({branch: `release-${ this.version }`});
|
|
225
|
-
console.log('---\nExecute the cherry picks\n---');
|
|
226
|
-
await this.shouldContinue();
|
|
227
|
-
await this.updateVersionInFiles();
|
|
228
|
-
await this.updateHistory();
|
|
229
|
-
await this.shouldPushCurrentBranch();
|
|
230
|
-
await this.shouldCreateDraftReleaseWithHistory();
|
|
231
|
-
await this.shouldCreateReleasePullRequest();
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
async newSyncRelease() {
|
|
235
|
-
await this.goToBranch({branch: 'master', pull: true, readVersion: true});
|
|
236
|
-
await this.goToBranch({branch: 'develop', pull: true});
|
|
237
|
-
await this.createAndGoToBranch({branch: 'develop-sync'});
|
|
238
|
-
await this.shouldMergeFromTo({from: 'origin/master', to: 'develop-sync'});
|
|
239
|
-
await this.selectVersionToUpdate({currentVersion: this.version, release: 'minor', suffix: '-develop'});
|
|
240
|
-
await this.updateVersionInFiles();
|
|
241
|
-
await this.shouldPushCurrentBranch();
|
|
242
|
-
await this.shouldCreateDevelopSyncPullRequest();
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
async createReleaseIssueOnGitHub() {
|
|
246
|
-
const filePath = '.github/ISSUE_TEMPLATE/release.md';
|
|
247
|
-
let body = await readFile(filePath, 'utf8');
|
|
248
|
-
body = body.replace(/\{version\}/g, this.version);
|
|
249
|
-
body = body.replace(/---(.|\n)+?---\n/m, '');
|
|
250
|
-
|
|
251
|
-
const { data: me } = await octokit.users.get({});
|
|
252
|
-
|
|
253
|
-
console.log('Creating release issue');
|
|
254
|
-
const issue = await octokit.issues.create({
|
|
255
|
-
owner: this.owner,
|
|
256
|
-
repo: this.repo,
|
|
257
|
-
title: `Release ${ this.version }`,
|
|
258
|
-
assignee: me.login,
|
|
259
|
-
// milestone
|
|
260
|
-
body
|
|
261
|
-
});
|
|
262
|
-
if (issue.data) {
|
|
263
|
-
console.log(`Issue created: ${ issue.data.title }`);
|
|
264
|
-
console.log(issue.data.html_url);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
async shouldPushTag() {
|
|
269
|
-
const answers = await inquirer.prompt([{
|
|
270
|
-
type: 'confirm',
|
|
271
|
-
message: 'Push tag?',
|
|
272
|
-
name: 'pushTag'
|
|
273
|
-
}]);
|
|
274
|
-
|
|
275
|
-
return answers.pushTag && await git.push(['-u', 'origin', this.version, ...PUSH_TAG_OPTIONS.split(' ').filter(i => i)]);
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
async shouldPushCurrentBranch() {
|
|
279
|
-
const status = await git.status();
|
|
280
|
-
|
|
281
|
-
const answers = await inquirer.prompt([{
|
|
282
|
-
type: 'confirm',
|
|
283
|
-
message: `Push ${ status.current } branch?`,
|
|
284
|
-
name: 'pushBranch'
|
|
285
|
-
}]);
|
|
286
|
-
|
|
287
|
-
return answers.pushBranch && await git.push(['-u', 'origin', status.current, ...PUSH_CURRENT_BRANCH_OPTIONS.split(' ').filter(i => i)]);
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
async shouldAddTag() {
|
|
291
|
-
const answers = await inquirer.prompt([{
|
|
292
|
-
type: 'confirm',
|
|
293
|
-
message: `Add tag ${ this.version }?`,
|
|
294
|
-
name: 'tag'
|
|
295
|
-
}]);
|
|
296
|
-
|
|
297
|
-
if (answers.tag) {
|
|
298
|
-
await git.addTag(this.version);
|
|
299
|
-
await this.shouldPushTag();
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
async checkoutBranch({branch, askToChange = true}) {
|
|
304
|
-
const currentBranch = await this.currentBranch();
|
|
305
|
-
if (currentBranch === branch) {
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
if (askToChange) {
|
|
310
|
-
const { answer } = await inquirer.prompt([{
|
|
311
|
-
type: 'list',
|
|
312
|
-
message: `You\'re not on branch ${ branch }. Would you?`,
|
|
313
|
-
name: 'answer',
|
|
314
|
-
default: 'change',
|
|
315
|
-
choices: [{
|
|
316
|
-
name: `Change to ${ branch }`,
|
|
317
|
-
value: 'change'
|
|
318
|
-
}, {
|
|
319
|
-
name: 'Continue from here',
|
|
320
|
-
value: 'continue'
|
|
321
|
-
}]
|
|
322
|
-
}]);
|
|
323
|
-
|
|
324
|
-
if (answer === 'continue') {
|
|
325
|
-
return;
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
console.log('Switching to branch', branch);
|
|
330
|
-
|
|
331
|
-
const localBranch = await git.branchLocal();
|
|
332
|
-
if (!localBranch.all.includes(branch)) {
|
|
333
|
-
return git.checkoutLocalBranch(branch);
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
git.checkout(branch);
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
async goToBranch({branch, readVersion = false, pull = false, askToChange = true}) {
|
|
340
|
-
await this.checkoutBranch({branch, askToChange});
|
|
341
|
-
|
|
342
|
-
if (pull) {
|
|
343
|
-
await this.pull();
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
if (readVersion) {
|
|
347
|
-
this.readVersionFromPackageJson();
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
async pull() {
|
|
352
|
-
const answers = await inquirer.prompt([{
|
|
353
|
-
type: 'confirm',
|
|
354
|
-
message: 'Pull from origin?',
|
|
355
|
-
name: 'pull'
|
|
356
|
-
}]);
|
|
357
|
-
|
|
358
|
-
if (!answers.pull) {
|
|
359
|
-
return;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
await git.pull();
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
async shouldContinue() {
|
|
366
|
-
const answers = await inquirer.prompt([{
|
|
367
|
-
type: 'confirm',
|
|
368
|
-
message: 'Do you want to continue?',
|
|
369
|
-
name: 'continue'
|
|
370
|
-
}]);
|
|
371
|
-
|
|
372
|
-
if (!answers.continue) {
|
|
373
|
-
process.exit();
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
async createAndGoToBranch({branch}) {
|
|
378
|
-
const branchs = (await git.branchLocal()).all;
|
|
379
|
-
if (branchs.includes(branch)) {
|
|
380
|
-
const answers = await inquirer.prompt([{
|
|
381
|
-
type: 'confirm',
|
|
382
|
-
message: `Branch ${ branch } already exists, should delete and recreate?`,
|
|
383
|
-
name: 'deleteBranch'
|
|
384
|
-
}]);
|
|
385
|
-
|
|
386
|
-
if (answers.deleteBranch) {
|
|
387
|
-
console.log('Deleting branch', branch);
|
|
388
|
-
await git.deleteLocalBranch(branch);
|
|
389
|
-
console.log('Creating branch', branch);
|
|
390
|
-
await git.checkoutLocalBranch(branch);
|
|
391
|
-
} else {
|
|
392
|
-
await this.goToBranch({branch});
|
|
393
|
-
}
|
|
394
|
-
} else {
|
|
395
|
-
console.log('Creating branch', branch);
|
|
396
|
-
await git.checkoutLocalBranch(branch);
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
async shouldMergeFromTo({from, to}) {
|
|
401
|
-
const answers = await inquirer.prompt([{
|
|
402
|
-
type: 'confirm',
|
|
403
|
-
message: `Merge from ${ from }?`,
|
|
404
|
-
name: 'merge'
|
|
405
|
-
}]);
|
|
406
|
-
|
|
407
|
-
try {
|
|
408
|
-
return answers.merge && await git.mergeFromTo(from, to);
|
|
409
|
-
} catch (error) {
|
|
410
|
-
console.log('Error while merging, please do it manually');
|
|
411
|
-
console.error(error);
|
|
412
|
-
return this.shouldContinue();
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
async selectVersionToUpdate({currentVersion, release, identifier, suffix = ''}) {
|
|
417
|
-
const nextVersion = semver.inc(currentVersion, release, identifier) + suffix;
|
|
418
|
-
let answers = await inquirer.prompt([{
|
|
419
|
-
type: 'list',
|
|
420
|
-
message: `The current version is ${ this.version }. Update to version:`,
|
|
421
|
-
name: 'version',
|
|
422
|
-
choices: [
|
|
423
|
-
nextVersion,
|
|
424
|
-
'custom'
|
|
425
|
-
]
|
|
426
|
-
}]);
|
|
427
|
-
|
|
428
|
-
if (answers.version === 'custom') {
|
|
429
|
-
answers = await inquirer.prompt([{
|
|
430
|
-
name: 'version',
|
|
431
|
-
message: 'Enter your custom version:'
|
|
432
|
-
}]);
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
const { version } = answers;
|
|
436
|
-
this.oldVersion = this.version;
|
|
437
|
-
this.version = version;
|
|
438
|
-
return version;
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
async updateVersionInFiles() {
|
|
442
|
-
await this.readConfig();
|
|
443
|
-
|
|
444
|
-
await Promise.all(files.map(async(file) => {
|
|
445
|
-
let data = await readFile(`./${ file }`, 'utf8');
|
|
446
|
-
data = data.replace(this.oldVersion, this.version);
|
|
447
|
-
if (file.includes('sandstorm-pkgdef.capnp')) {
|
|
448
|
-
data = data.replace(/appVersion\s=\s(\d+),\s\s#\sIncrement/, (s, number) => {
|
|
449
|
-
number = parseInt(number, 10);
|
|
450
|
-
return s.replace(number, ++number);
|
|
451
|
-
});
|
|
452
|
-
}
|
|
453
|
-
return await writeFile(file, data, 'utf8');
|
|
454
|
-
}));
|
|
455
|
-
|
|
456
|
-
await this.shouldCommitFiles();
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
async updateHistory() {
|
|
460
|
-
await logs({headName: this.version, getMetadata: getMetadata(), owner: this.owner, repo: this.repo, minTag: this.minTag });
|
|
461
|
-
await md({ owner: this.owner, repo: this.repo });
|
|
462
|
-
await this.shouldCommitFiles({amend: true});
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
async shouldCommitFiles({amend = false} = {}) {
|
|
466
|
-
let answers = await inquirer.prompt([{
|
|
467
|
-
type: 'confirm',
|
|
468
|
-
message: 'Commit files?',
|
|
469
|
-
name: 'commit'
|
|
470
|
-
}]);
|
|
471
|
-
|
|
472
|
-
if (!answers.commit) {
|
|
473
|
-
return;
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
const status = await git.status();
|
|
477
|
-
|
|
478
|
-
answers = await inquirer.prompt([{
|
|
479
|
-
type: 'checkbox',
|
|
480
|
-
message: 'Select files to commit?',
|
|
481
|
-
name: 'files',
|
|
482
|
-
choices: status.files.map(file => { return {name: `${ file.working_dir } ${ file.path }`, checked: true}; })
|
|
483
|
-
}]);
|
|
484
|
-
|
|
485
|
-
if (answers.files.length) {
|
|
486
|
-
await git.add(answers.files.map(file => file.slice(2)));
|
|
487
|
-
|
|
488
|
-
const options = [];
|
|
489
|
-
|
|
490
|
-
if (amend) {
|
|
491
|
-
options.push('--amend');
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
await git.commit(`Bump version to ${ this.version }`, options);
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
async shouldSetHistoryToGithubRelease(prerelease = false) {
|
|
499
|
-
const answers = await inquirer.prompt([{
|
|
500
|
-
type: 'confirm',
|
|
501
|
-
message: 'Set history to tag?',
|
|
502
|
-
name: 'pushTag'
|
|
503
|
-
}]);
|
|
504
|
-
|
|
505
|
-
const body = await md({tag: this.version, write: false, title: false, owner: this.owner, repo: this.repo});
|
|
506
|
-
if (answers.pushTag) {
|
|
507
|
-
try {
|
|
508
|
-
const release = await octokit.repos.getReleaseByTag({owner: this.owner, repo: this.repo, tag: this.version});
|
|
509
|
-
console.log('Editing release');
|
|
510
|
-
await octokit.repos.editRelease({
|
|
511
|
-
owner: this.owner,
|
|
512
|
-
repo: this.repo,
|
|
513
|
-
id: release.data.id,
|
|
514
|
-
tag_name: this.version,
|
|
515
|
-
body,
|
|
516
|
-
name: this.version,
|
|
517
|
-
prerelease
|
|
518
|
-
});
|
|
519
|
-
} catch (error) {
|
|
520
|
-
if (error.status === 404) {
|
|
521
|
-
console.log('Creating release');
|
|
522
|
-
await octokit.repos.createRelease({
|
|
523
|
-
owner: this.owner,
|
|
524
|
-
repo: this.repo,
|
|
525
|
-
tag_name: this.version,
|
|
526
|
-
name: this.version,
|
|
527
|
-
body,
|
|
528
|
-
draft: false,
|
|
529
|
-
prerelease
|
|
530
|
-
});
|
|
531
|
-
} else {
|
|
532
|
-
throw error;
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
async shouldCreateDraftReleaseWithHistory({branch = 'master'} = {}) {
|
|
539
|
-
const answers = await inquirer.prompt([{
|
|
540
|
-
type: 'confirm',
|
|
541
|
-
message: `Create a GitHub draft release "${ this.version }"?`,
|
|
542
|
-
name: 'create'
|
|
543
|
-
}]);
|
|
544
|
-
|
|
545
|
-
const body = await md({tag: this.version, write: false, title: false, owner: this.owner, repo: this.repo});
|
|
546
|
-
if (answers.create) {
|
|
547
|
-
console.log('Creating draft release');
|
|
548
|
-
await octokit.repos.createRelease({
|
|
549
|
-
owner: this.owner,
|
|
550
|
-
repo: this.repo,
|
|
551
|
-
tag_name: this.version,
|
|
552
|
-
target_commitish: branch,
|
|
553
|
-
name: this.version,
|
|
554
|
-
body,
|
|
555
|
-
draft: true,
|
|
556
|
-
prerelease: this.version.includes('-rc.')
|
|
557
|
-
});
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
async shouldCreateReleasePullRequest() {
|
|
562
|
-
const answers = await inquirer.prompt([{
|
|
563
|
-
type: 'confirm',
|
|
564
|
-
message: `Create a GitHub Pull Request for release "${ this.version }"?`,
|
|
565
|
-
name: 'create'
|
|
566
|
-
}]);
|
|
567
|
-
|
|
568
|
-
const body = await md({tag: this.version, write: false, title: false, owner: this.owner, repo: this.repo});
|
|
569
|
-
if (answers.create) {
|
|
570
|
-
console.log('Creating pull request');
|
|
571
|
-
const pr = await octokit.pulls.create({
|
|
572
|
-
owner: this.owner,
|
|
573
|
-
repo: this.repo,
|
|
574
|
-
title: `Release ${ this.version }`,
|
|
575
|
-
head: await this.currentBranch(),
|
|
576
|
-
base: 'master',
|
|
577
|
-
body: body.slice(0, 65536)
|
|
578
|
-
});
|
|
579
|
-
if (pr.data) {
|
|
580
|
-
console.log(`Pull Request created: ${ pr.data.title }`);
|
|
581
|
-
console.log(pr.data.html_url);
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
async shouldCreateDevelopSyncPullRequest() {
|
|
587
|
-
const answers = await inquirer.prompt([{
|
|
588
|
-
type: 'confirm',
|
|
589
|
-
message: 'Create a GitHub Pull Request for develop sync?',
|
|
590
|
-
name: 'create'
|
|
591
|
-
}]);
|
|
592
|
-
|
|
593
|
-
if (answers.create) {
|
|
594
|
-
console.log('Creating pull request');
|
|
595
|
-
const pr = await octokit.pulls.create({
|
|
596
|
-
owner: this.owner,
|
|
597
|
-
repo: this.repo,
|
|
598
|
-
title: `Merge master into develop & Set version to ${ this.version }`,
|
|
599
|
-
head: await this.currentBranch(),
|
|
600
|
-
base: 'develop'
|
|
601
|
-
});
|
|
602
|
-
if (pr.data) {
|
|
603
|
-
console.log(`Pull Request created: ${ pr.data.title }`);
|
|
604
|
-
console.log(pr.data.html_url);
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
module.exports = function({ owner, repo }) {
|
|
611
|
-
const houston = new Houston({ owner, repo });
|
|
612
|
-
houston.init().catch(error => console.error(error));
|
|
613
|
-
};
|
|
614
|
-
|
package/src-old/utils.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
|
|
3
|
-
const getMetadata = () => {
|
|
4
|
-
try {
|
|
5
|
-
const fn = require(path.resolve(process.cwd(), '.houston/metadata.js'));
|
|
6
|
-
return fn;
|
|
7
|
-
} catch (e) {
|
|
8
|
-
//
|
|
9
|
-
}
|
|
10
|
-
return () => Promise.resolve({});
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
module.exports = {
|
|
14
|
-
getMetadata
|
|
15
|
-
};
|