@rocket.chat/houston 0.25.2 → 0.27.0-next.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/.swcrc ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "http://json.schemastore.org/swcrc",
3
+ "jsc": {
4
+ "parser": {
5
+ "syntax": "typescript",
6
+ "tsx": false
7
+ }
8
+ },
9
+ "module": {
10
+ "type": "commonjs",
11
+
12
+ // These are defaults.
13
+ "strict": false,
14
+ "strictMode": true,
15
+ "lazy": false,
16
+ "noInterop": false
17
+ }
18
+ }
package/bin/cli.js CHANGED
@@ -25,14 +25,6 @@ const getRepoInfo = async() => {
25
25
  };
26
26
  };
27
27
 
28
- let getMetadata = () => Promise.resolve({});
29
-
30
- try {
31
- getMetadata = require(path.resolve(process.cwd(), '.houston/metadata.js'));
32
- } catch (e) {
33
- //
34
- }
35
-
36
28
  let repoPkg = {};
37
29
  try {
38
30
  repoPkg = require(path.resolve(process.cwd(), './package.json'));
@@ -46,7 +38,7 @@ program
46
38
  .option('-h, --head_name <name>', 'Name of the new release. Will rename the current HEAD section')
47
39
  .option('-t, --min_tag <tag>', 'Minimum tag to scrap the history')
48
40
  .action(async function({head_name, min_tag}) {
49
- logs({headName: head_name, minTag: min_tag, ...await getRepoInfo(), ...repoPkg.houston, getMetadata });
41
+ logs({headName: head_name, minTag: min_tag, ...await getRepoInfo(), ...repoPkg.houston });
50
42
  });
51
43
 
52
44
  program
@@ -67,7 +59,7 @@ program
67
59
  .command('release')
68
60
  .description('Release a new version')
69
61
  .action(async function() {
70
- setVersion(await getRepoInfo(), getMetadata);
62
+ setVersion(await getRepoInfo());
71
63
  });
72
64
 
73
65
  program.parse(process.argv);
package/dist/cli.js ADDED
@@ -0,0 +1,184 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ var _commander = require("commander");
6
+ var _createBranch = require("./commands/createBranch");
7
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
8
+ try {
9
+ var info = gen[key](arg);
10
+ var value = info.value;
11
+ } catch (error) {
12
+ reject(error);
13
+ return;
14
+ }
15
+ if (info.done) {
16
+ resolve(value);
17
+ } else {
18
+ Promise.resolve(value).then(_next, _throw);
19
+ }
20
+ }
21
+ function _async_to_generator(fn) {
22
+ return function() {
23
+ var self = this, args = arguments;
24
+ return new Promise(function(resolve, reject) {
25
+ var gen = fn.apply(self, args);
26
+ function _next(value) {
27
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
28
+ }
29
+ function _throw(err) {
30
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
31
+ }
32
+ _next(undefined);
33
+ });
34
+ };
35
+ }
36
+ function _ts_generator(thisArg, body) {
37
+ var f, y, t, g, _ = {
38
+ label: 0,
39
+ sent: function() {
40
+ if (t[0] & 1) throw t[1];
41
+ return t[1];
42
+ },
43
+ trys: [],
44
+ ops: []
45
+ };
46
+ return(g = {
47
+ next: verb(0),
48
+ "throw": verb(1),
49
+ "return": verb(2)
50
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
51
+ return this;
52
+ }), g);
53
+ function verb(n) {
54
+ return function(v) {
55
+ return step([
56
+ n,
57
+ v
58
+ ]);
59
+ };
60
+ }
61
+ function step(op) {
62
+ if (f) throw new TypeError("Generator is already executing.");
63
+ while(_)try {
64
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
65
+ if (y = 0, t) op = [
66
+ op[0] & 2,
67
+ t.value
68
+ ];
69
+ switch(op[0]){
70
+ case 0:
71
+ case 1:
72
+ t = op;
73
+ break;
74
+ case 4:
75
+ _.label++;
76
+ return {
77
+ value: op[1],
78
+ done: false
79
+ };
80
+ case 5:
81
+ _.label++;
82
+ y = op[1];
83
+ op = [
84
+ 0
85
+ ];
86
+ continue;
87
+ case 7:
88
+ op = _.ops.pop();
89
+ _.trys.pop();
90
+ continue;
91
+ default:
92
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
93
+ _ = 0;
94
+ continue;
95
+ }
96
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
97
+ _.label = op[1];
98
+ break;
99
+ }
100
+ if (op[0] === 6 && _.label < t[1]) {
101
+ _.label = t[1];
102
+ t = op;
103
+ break;
104
+ }
105
+ if (t && _.label < t[2]) {
106
+ _.label = t[2];
107
+ _.ops.push(op);
108
+ break;
109
+ }
110
+ if (t[2]) _.ops.pop();
111
+ _.trys.pop();
112
+ continue;
113
+ }
114
+ op = body.call(thisArg, _);
115
+ } catch (e) {
116
+ op = [
117
+ 6,
118
+ e
119
+ ];
120
+ y = 0;
121
+ } finally{
122
+ f = t = 0;
123
+ }
124
+ if (op[0] & 5) throw op[1];
125
+ return {
126
+ value: op[0] ? op[1] : void 0,
127
+ done: true
128
+ };
129
+ }
130
+ }
131
+ var program = new _commander.Command();
132
+ program.name("houston");
133
+ program.command("create-branch").description("Create a new branch for a new release").requiredOption("-b, --base <branch or version>", "Base branch or version to create the new branch from").requiredOption("-t, --type <patch|minor|major>", "Type of release").action(function() {
134
+ var _ref = _async_to_generator(function(str) {
135
+ var error;
136
+ return _ts_generator(this, function(_state) {
137
+ switch(_state.label){
138
+ case 0:
139
+ _state.trys.push([
140
+ 0,
141
+ 2,
142
+ ,
143
+ 3
144
+ ]);
145
+ if (![
146
+ "patch",
147
+ "minor",
148
+ "major"
149
+ ].includes(str.type)) {
150
+ throw new Error("Invalid release type");
151
+ }
152
+ return [
153
+ 4,
154
+ (0, _createBranch.createBranch)({
155
+ base: str.base,
156
+ type: str.type
157
+ })
158
+ ];
159
+ case 1:
160
+ _state.sent();
161
+ return [
162
+ 3,
163
+ 3
164
+ ];
165
+ case 2:
166
+ error = _state.sent();
167
+ console.error(error);
168
+ process.exit(1);
169
+ return [
170
+ 3,
171
+ 3
172
+ ];
173
+ case 3:
174
+ return [
175
+ 2
176
+ ];
177
+ }
178
+ });
179
+ });
180
+ return function(str) {
181
+ return _ref.apply(this, arguments);
182
+ };
183
+ }());
184
+ program.parse(process.argv);
@@ -0,0 +1,192 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "createBranch", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return createBranch;
9
+ }
10
+ });
11
+ var _simplegit = require("simple-git");
12
+ var _promises = /*#__PURE__*/ _interop_require_default(require("fs/promises"));
13
+ var _path = /*#__PURE__*/ _interop_require_default(require("path"));
14
+ var _semver = /*#__PURE__*/ _interop_require_default(require("semver"));
15
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
16
+ try {
17
+ var info = gen[key](arg);
18
+ var value = info.value;
19
+ } catch (error) {
20
+ reject(error);
21
+ return;
22
+ }
23
+ if (info.done) {
24
+ resolve(value);
25
+ } else {
26
+ Promise.resolve(value).then(_next, _throw);
27
+ }
28
+ }
29
+ function _async_to_generator(fn) {
30
+ return function() {
31
+ var self = this, args = arguments;
32
+ return new Promise(function(resolve, reject) {
33
+ var gen = fn.apply(self, args);
34
+ function _next(value) {
35
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
36
+ }
37
+ function _throw(err) {
38
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
39
+ }
40
+ _next(undefined);
41
+ });
42
+ };
43
+ }
44
+ function _interop_require_default(obj) {
45
+ return obj && obj.__esModule ? obj : {
46
+ default: obj
47
+ };
48
+ }
49
+ function _ts_generator(thisArg, body) {
50
+ var f, y, t, g, _ = {
51
+ label: 0,
52
+ sent: function() {
53
+ if (t[0] & 1) throw t[1];
54
+ return t[1];
55
+ },
56
+ trys: [],
57
+ ops: []
58
+ };
59
+ return g = {
60
+ next: verb(0),
61
+ "throw": verb(1),
62
+ "return": verb(2)
63
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
64
+ return this;
65
+ }), g;
66
+ function verb(n) {
67
+ return function(v) {
68
+ return step([
69
+ n,
70
+ v
71
+ ]);
72
+ };
73
+ }
74
+ function step(op) {
75
+ if (f) throw new TypeError("Generator is already executing.");
76
+ while(_)try {
77
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
78
+ if (y = 0, t) op = [
79
+ op[0] & 2,
80
+ t.value
81
+ ];
82
+ switch(op[0]){
83
+ case 0:
84
+ case 1:
85
+ t = op;
86
+ break;
87
+ case 4:
88
+ _.label++;
89
+ return {
90
+ value: op[1],
91
+ done: false
92
+ };
93
+ case 5:
94
+ _.label++;
95
+ y = op[1];
96
+ op = [
97
+ 0
98
+ ];
99
+ continue;
100
+ case 7:
101
+ op = _.ops.pop();
102
+ _.trys.pop();
103
+ continue;
104
+ default:
105
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
106
+ _ = 0;
107
+ continue;
108
+ }
109
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
110
+ _.label = op[1];
111
+ break;
112
+ }
113
+ if (op[0] === 6 && _.label < t[1]) {
114
+ _.label = t[1];
115
+ t = op;
116
+ break;
117
+ }
118
+ if (t && _.label < t[2]) {
119
+ _.label = t[2];
120
+ _.ops.push(op);
121
+ break;
122
+ }
123
+ if (t[2]) _.ops.pop();
124
+ _.trys.pop();
125
+ continue;
126
+ }
127
+ op = body.call(thisArg, _);
128
+ } catch (e) {
129
+ op = [
130
+ 6,
131
+ e
132
+ ];
133
+ y = 0;
134
+ } finally{
135
+ f = t = 0;
136
+ }
137
+ if (op[0] & 5) throw op[1];
138
+ return {
139
+ value: op[0] ? op[1] : void 0,
140
+ done: true
141
+ };
142
+ }
143
+ }
144
+ var git = (0, _simplegit.simpleGit)();
145
+ function createBranch(_) {
146
+ return _createBranch.apply(this, arguments);
147
+ }
148
+ function _createBranch() {
149
+ _createBranch = _async_to_generator(function(param) {
150
+ var base, type, identifier, mainPackageJson, _JSON_parse, currentVersion, newBranch, localBranch;
151
+ return _ts_generator(this, function(_state) {
152
+ switch(_state.label){
153
+ case 0:
154
+ base = param.base, type = param.type, identifier = param.identifier;
155
+ // checkout base version
156
+ return [
157
+ 4,
158
+ git.checkout(base)
159
+ ];
160
+ case 1:
161
+ _state.sent();
162
+ return [
163
+ 4,
164
+ _promises.default.readFile(_path.default.resolve(process.cwd(), "package.json"), "utf8")
165
+ ];
166
+ case 2:
167
+ mainPackageJson = _state.sent();
168
+ _JSON_parse = JSON.parse(mainPackageJson), currentVersion = _JSON_parse.version;
169
+ newBranch = "release-".concat(_semver.default.inc(currentVersion, type, identifier));
170
+ return [
171
+ 4,
172
+ git.branchLocal()
173
+ ];
174
+ case 3:
175
+ localBranch = _state.sent();
176
+ if (localBranch.all.includes(newBranch)) {
177
+ throw new Error('Branch "'.concat(newBranch, '" already exists'));
178
+ }
179
+ return [
180
+ 4,
181
+ git.checkoutLocalBranch(newBranch)
182
+ ];
183
+ case 4:
184
+ _state.sent();
185
+ return [
186
+ 2
187
+ ];
188
+ }
189
+ });
190
+ });
191
+ return _createBranch.apply(this, arguments);
192
+ }
package/package.json CHANGED
@@ -1,38 +1,45 @@
1
1
  {
2
2
  "name": "@rocket.chat/houston",
3
- "version": "0.25.2",
3
+ "version": "0.27.0-next.0",
4
4
  "description": "Rocket.Chat Command Line Tools",
5
- "main": "index.js",
5
+ "main": "dist/cli.js",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/RocketChat/Rocket.Chat.Houston.git"
9
9
  },
10
10
  "scripts": {
11
+ "build": "npx swc ./src -d dist",
12
+ "cli": "ts-node --swc src/cli.ts",
11
13
  "test": "echo \"Error: no test specified\" && exit 1"
12
14
  },
13
15
  "author": "Rodrigo Nascimento <rodrigo.nascimento@rocket.chat>",
14
16
  "private": false,
15
17
  "license": "MIT",
16
18
  "bin": {
17
- "houston": "./bin/cli.js"
19
+ "houston": "./dist/cli.js"
18
20
  },
19
21
  "dependencies": {
20
- "@octokit/rest": "^18.6.7",
21
- "commander": "^2.19.0",
22
- "eslint": "^7.30.0",
23
- "git-url-parse": "^11.5.0",
24
- "handlebars": "^4.7.7",
25
- "inquirer": "^5.2.0",
26
- "just-handlebars-helpers": "^1.0.18",
27
- "progress": "^2.0.3",
28
- "semver": "^7.3.5",
29
- "simple-git": "^2.40.0",
30
- "underscore": "^1.13.1",
31
- "update-notifier": "^2.5.0"
22
+ "@actions/core": "^1.10.0",
23
+ "@actions/exec": "^1.1.1",
24
+ "@octokit/rest": "^19.0.11",
25
+ "commander": "^10.0.1",
26
+ "eslint": "^8.41.0",
27
+ "semver": "^7.5.1",
28
+ "simple-git": "^3.19.0"
29
+ },
30
+ "engines": {
31
+ "node": ">= 16"
32
32
  },
33
33
  "bugs": {
34
34
  "url": "https://github.com/RocketChat/Rocket.Chat.Houston/issues"
35
35
  },
36
36
  "homepage": "https://github.com/RocketChat/Rocket.Chat.Houston#readme",
37
- "devDependencies": {}
37
+ "devDependencies": {
38
+ "@swc/cli": "^0.1.62",
39
+ "@swc/core": "^1.3.61",
40
+ "@types/node": "16",
41
+ "prettier": "^2.8.8",
42
+ "ts-node": "^10.9.1",
43
+ "typescript": "^5.0.4"
44
+ }
38
45
  }
package/src/cli.ts ADDED
@@ -0,0 +1,25 @@
1
+ import { Command } from 'commander';
2
+ import { createBranch } from './commands/createBranch';
3
+
4
+ const program = new Command();
5
+
6
+ program.name('houston');
7
+
8
+ program
9
+ .command('create-branch')
10
+ .description('Create a new branch for a new release')
11
+ .requiredOption('-b, --base <branch or version>', 'Base branch or version to create the new branch from')
12
+ .requiredOption('-t, --type <patch|minor|major>', 'Type of release')
13
+ .action(async function(str) {
14
+ try {
15
+ if (!['patch', 'minor', 'major'].includes(str.type)) {
16
+ throw new Error('Invalid release type');
17
+ }
18
+ await createBranch({ base: str.base, type: str.type });
19
+ } catch (error) {
20
+ console.error(error);
21
+ process.exit(1);
22
+ }
23
+ });
24
+
25
+ program.parse(process.argv);
@@ -0,0 +1,25 @@
1
+ import { simpleGit } from 'simple-git';
2
+ import fs from 'fs/promises';
3
+ import path from 'path';
4
+ import semver from 'semver';
5
+
6
+ const git = simpleGit();
7
+
8
+ export async function createBranch({ base, type }: { base: string; type: 'patch' | 'minor' | 'major' }) {
9
+ // checkout base version
10
+ await git.checkout(base);
11
+
12
+ // get current version and increment based on type
13
+ const mainPackageJson = await fs.readFile(path.resolve(process.cwd(), 'package.json'), 'utf8');
14
+ const { version: currentVersion } = JSON.parse(mainPackageJson);
15
+
16
+ const newBranch = `release-${semver.inc(currentVersion, type)}`;
17
+
18
+ const localBranch = await git.branchLocal();
19
+
20
+ if (localBranch.all.includes(newBranch)) {
21
+ throw new Error(`Branch "${newBranch}" already exists`);
22
+ }
23
+
24
+ await git.checkoutLocalBranch(newBranch);
25
+ }
@@ -5,6 +5,7 @@ const ProgressBar = require('progress');
5
5
  const _ = require('underscore');
6
6
  const git = require('simple-git/promise')(process.cwd());
7
7
  const { Octokit } = require('@octokit/rest');
8
+ const { getMetadata } = require('./utils');
8
9
 
9
10
  const commitRegexString = '(^Merge pull request #([0-9]+) from )|( ?\\(?#([0-9]+)\\)?$)';
10
11
  const commitRegex = new RegExp(commitRegexString);
@@ -62,14 +63,14 @@ function promiseRetryRateLimit(promiseFn, retryWait = 60000) {
62
63
  promiseFn()
63
64
  .then(data => resolve(data))
64
65
  .catch(error => {
65
- if (error.headers['status'] === '403 Forbidden' && error.headers['retry-after']) {
66
- const reset = error.headers['retry-after'];
66
+ if (error.response.headers['status'] === '403 Forbidden' && error.response.headers['retry-after']) {
67
+ const reset = error.response.headers['retry-after'];
67
68
 
68
69
  console.error('Retrying in', reset, 'seconds');
69
70
  console.log('Retrying in', reset, 'seconds');
70
71
  setTimeout(exec, reset * 1000);
71
- } else if (error.headers['x-ratelimit-remaining'] === '0') {
72
- let reset = error.headers['x-ratelimit-reset'];
72
+ } else if (error.response.headers['x-ratelimit-remaining'] === '0') {
73
+ let reset = error.response.headers['x-ratelimit-reset'];
73
74
  if (reset) {
74
75
  reset = parseInt(reset) * 1000 - Date.now();
75
76
  }
@@ -273,7 +274,7 @@ async function getMissingTags({ minTag }) {
273
274
  return _.pick(tags, missingTags);
274
275
  }
275
276
 
276
- module.exports = function({headName = 'HEAD', owner:_owner = '', repo:_repo = '', minTag = '', getMetadata = () => Promise.resolve({}) }) {
277
+ module.exports = function({headName = 'HEAD', owner:_owner = '', repo:_repo = '', minTag = '' }) {
277
278
  owner = _owner;
278
279
  repo = _repo;
279
280
 
@@ -301,7 +302,7 @@ module.exports = function({headName = 'HEAD', owner:_owner = '', repo:_repo = ''
301
302
  const to = item.tag;
302
303
  console.log('Fetching data for tag:', to, `(from ${ from })`);
303
304
  getPullRequests(from, to).then(pull_requests => {
304
- getMetadata({ version: to, git, request }).then(metadata => {
305
+ getMetadata()({ version: to, git, request }).then(metadata => {
305
306
  pull_requests = _.compact(pull_requests);
306
307
  // console.log(' ', pull_requests.length, 'item(s) found');
307
308
  historyData.releases = Object.assign(historyData.releases, {
@@ -7,6 +7,7 @@ const git = require('simple-git/promise')(process.cwd());
7
7
  const logs = require('./logs');
8
8
  const { Octokit } = require('@octokit/rest');
9
9
  const md = require('../src/md');
10
+ const { getMetadata } = require('./utils');
10
11
 
11
12
  const octokit = new Octokit({
12
13
  auth: process.env.GITHUB_TOKEN
@@ -26,14 +27,12 @@ class Houston {
26
27
  constructor({
27
28
  owner,
28
29
  repo,
29
- version,
30
- getMetadata
30
+ version
31
31
  } = {}) {
32
32
  this.owner = owner;
33
33
  this.repo = repo;
34
34
  this.version = version;
35
35
  this.minTag = '';
36
- this.getMetadata = getMetadata;
37
36
 
38
37
  if (!this.version) {
39
38
  this.readVersionFromPackageJson();
@@ -458,7 +457,7 @@ class Houston {
458
457
  }
459
458
 
460
459
  async updateHistory() {
461
- await logs({headName: this.version, getMetadata: this.getMetadata, owner: this.owner, repo: this.repo, minTag: this.minTag });
460
+ await logs({headName: this.version, getMetadata: getMetadata(), owner: this.owner, repo: this.repo, minTag: this.minTag });
462
461
  await md({ owner: this.owner, repo: this.repo });
463
462
  await this.shouldCommitFiles({amend: true});
464
463
  }
@@ -608,8 +607,8 @@ class Houston {
608
607
  }
609
608
  }
610
609
 
611
- module.exports = function({ owner, repo }, getMetadata) {
612
- const houston = new Houston({ owner, repo, getMetadata });
610
+ module.exports = function({ owner, repo }) {
611
+ const houston = new Houston({ owner, repo });
613
612
  houston.init().catch(error => console.error(error));
614
613
  };
615
614
 
@@ -0,0 +1,15 @@
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
+ };
@@ -1,128 +0,0 @@
1
- const _ = require('underscore');
2
-
3
- const systemUsers = ['web-flow', 'kodiakhq[bot]'];
4
-
5
- const SummaryNameEmoticons = {
6
- IMPROVE: '🚀',
7
- FIX: '🐛',
8
- NEW: '🎉',
9
- BREAK: '️️️⚠️',
10
- NOGROUP: '🔍',
11
- contributor: '👩‍💻👨‍💻'
12
- };
13
-
14
- const GroupNames = {
15
- IMPROVE: '### 🚀 Improvements',
16
- FIX: '### 🐛 Bug fixes',
17
- NEW: '### 🎉 New features',
18
- BREAK: '### ⚠️ BREAKING CHANGES',
19
- MINOR: '🔍 Minor changes',
20
- NOGROUP: '🔍 Minor changes'
21
- };
22
-
23
- function removeDuplicates(prs) {
24
- return prs.filter((pr1, index1) => pr1.manual || !prs.some((pr2, index2) => pr1.pr === pr2.pr && index1 !== index2));
25
- }
26
-
27
- const sort = (a, b) => {
28
- return a.title.localeCompare(b.title);
29
- };
30
-
31
- module.exports = {
32
- let(data, name, value) {
33
- data[name] = value;
34
- },
35
-
36
- groupedPRs(prs) {
37
- const groups = {
38
- BREAK: [],
39
- NEW: [],
40
- IMPROVE: [],
41
- FIX: [],
42
- NOGROUP: []
43
- };
44
-
45
- prs = removeDuplicates(prs);
46
-
47
- prs.forEach(pr => {
48
- const match = pr.title.match(/\[(FIX|IMPROVE|NEW|BREAK)\]\s*(.+)/);
49
- if (match) {
50
- pr.title = match[2];
51
- pr.title = pr.title.replace(/^\[\s*(.+?)\s*\]/, '**$1:**');
52
- groups[match[1]].push(pr);
53
- } else {
54
- groups.NOGROUP.push(pr);
55
- }
56
- });
57
-
58
- return Object.entries(groups).map(([key, values]) => ({key, values: values.sort(sort)}));
59
- },
60
-
61
- groupTitle(group) {
62
- return GroupNames[group];
63
- },
64
-
65
- getPRContributors(pr, {data}) {
66
- const contributors = _.compact(_.difference(pr.contributors, data.root.teamMembers, systemUsers))
67
- .sort()
68
- .map(contributor => `[@${ contributor }](https://github.com/${ contributor })`)
69
- .join(' & ');
70
-
71
- if (contributors) {
72
- return ` by ${ contributors }`;
73
- }
74
- },
75
-
76
- prUrl(pr, {data}) {
77
- return `https://github.com/${ data.root.owner }/${ data.root.repo }/pull/${ pr }`;
78
- },
79
-
80
- description(pr) {
81
- return pr.description.replace(/(?=(^|\s)([*-]\s|\d+\.\s))/gm, ' ').replace(/^(?=[^\s])/gm, ' ');
82
- },
83
-
84
- getSummary({groupedPRs, externalContributors, teamContributors}) {
85
- const summary = [];
86
-
87
- groupedPRs.forEach(({key, values}) => {
88
- if (values.length) {
89
- summary.push(`${ values.length } ${ SummaryNameEmoticons[key] }`);
90
- }
91
- });
92
-
93
- if (externalContributors.length + teamContributors.length) {
94
- summary.push(`${ externalContributors.length + teamContributors.length } ${ SummaryNameEmoticons.contributor }`);
95
- }
96
-
97
- if (summary.length) {
98
- return summary.join(' · ');
99
- }
100
- },
101
-
102
- getExternalContributors(prs, {data}) {
103
- prs = removeDuplicates(prs);
104
-
105
- return _.compact(_.difference(prs.reduce((value, pr) => {
106
- return _.unique(value.concat(pr.contributors));
107
- }, []), data.root.teamMembers, systemUsers)).sort();
108
- },
109
-
110
- getTeamContributors(prs, {data}) {
111
- prs = removeDuplicates(prs);
112
-
113
- return _.compact(_.intersection(prs.reduce((value, pr) => {
114
- return _.unique(value.concat(pr.contributors));
115
- }, []), data.root.teamMembers)).sort();
116
- },
117
-
118
- getTagDate({tag, lastCommitDate, release}) {
119
- return tag === 'HEAD' ? lastCommitDate : (release.tagDate || lastCommitDate);
120
- },
121
-
122
- reverse(arr) {
123
- if (!Array.isArray(arr)) {
124
- return arr;
125
- }
126
- return arr.reverse();
127
- }
128
- };
@@ -1,3 +0,0 @@
1
- {{#each releases}}
2
- {{> release .. release=release tag=tag}}
3
- {{/each}}
@@ -1,8 +0,0 @@
1
- {{#if contributors }}
2
-
3
- {{ title }}
4
-
5
- {{#each contributors}}
6
- - [@{{ . }}](https://github.com/{{ . }})
7
- {{/each}}
8
- {{/if}}
@@ -1,3 +0,0 @@
1
- {{#if showTitle}}
2
- {{#if releaseCandidate}}#{{/if}}# {{#if (eq tag 'HEAD')}}Next{{else}}{{ tag }}{{/if}}{{#if release.noMainRelease}} (Under Release Candidate Process){{/if}}
3
- {{/if}}
package/templates/prs.hbs DELETED
@@ -1,18 +0,0 @@
1
- {{#each groupedPRs}}
2
- {{#if values}}
3
-
4
- {{#if (neq key 'NOGROUP')}}
5
- {{ groupTitle key }}
6
-
7
- {{> pull_requests}}
8
- {{/if}}
9
- {{#if (eq key 'NOGROUP')}}
10
- <details>
11
- <summary>{{ groupTitle key }}</summary>
12
-
13
- {{> pull_requests}}
14
-
15
- </details>
16
- {{/if}}
17
- {{/if}}
18
- {{/each}}
@@ -1,8 +0,0 @@
1
- {{#each values}}
2
-
3
- - {{{ title }}}{{#if pr}} ([#{{ pr }}]({{ prUrl pr }}){{{ getPRContributors . }}}){{/if}}
4
- {{#if description}}
5
-
6
- {{{description .}}}
7
- {{/if}}
8
- {{/each}}
package/templates/rcs.hbs DELETED
@@ -1,5 +0,0 @@
1
- {{#if release.rcs ~}}
2
- {{~#each (reverse release.rcs)}}
3
- {{> release .. release=. tag=tag releaseCandidate=true}}
4
- {{/each~}}
5
- {{~/if}}
@@ -1,9 +0,0 @@
1
- {{~let . 'groupedPRs' (groupedPRs release.pull_requests)}}
2
- {{~let . 'externalContributors' (getExternalContributors release.pull_requests)}}
3
- {{~let . 'teamContributors' (getTeamContributors release.pull_requests)}}
4
- {{> header}}
5
- {{> summary}}
6
- {{> prs}}
7
- {{> contributors contributors=externalContributors title='### 👩‍💻👨‍💻 Contributors 😍'}}
8
- {{> contributors contributors=teamContributors title='### 👩‍💻👨‍💻 Core Team 🤓'}}
9
- {{> rcs}}
@@ -1,3 +0,0 @@
1
- {{#unless release.noMainRelease}}
2
- `{{ getTagDate . }} · {{ getSummary .}}`
3
- {{/unless}}
File without changes
File without changes