arui-scripts 13.4.0 → 13.5.0-feat-NEWCLICKUI-1746.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [13.5.0-feat-NEWCLICKUI-1746.1](https://git.moscow.alfaintra.net/ef/arui-scripts/compare/v13.4.0...v13.5.0-feat-NEWCLICKUI-1746.1) (2023-02-28)
2
+
3
+
4
+ ### Features
5
+
6
+ * added a new command "changelog" ([95d5a34](https://git.moscow.alfaintra.net/ef/arui-scripts/commit/95d5a34558322108a7f8afab7608491291f4d4aa))
7
+
1
8
  # [13.4.0](https://git.moscow.alfaintra.net/ef/arui-scripts/compare/v13.3.1...v13.4.0) (2023-02-06)
2
9
 
3
10
 
@@ -10,6 +10,7 @@ const commands = {
10
10
  'ensure-yarn': () => require('../commands/ensure-yarn'),
11
11
  'archive-build': () => require('../commands/archive-build'),
12
12
  'bundle-analyze': () => require('../commands/bundle-analyze'),
13
+ changelog: () => require('../commands/changelog'),
13
14
  };
14
15
  const command = process.argv[2];
15
16
  if (!command || !commands[command]) {
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Формирует описание версии в `CHANGELOG.md` на основе данных введенных в Jenkins при старте пайплайна.
3
+ * `standard-version` запускает этот скрипт как `postchangelog` хук.
4
+ */
5
+ declare const execSync: any;
6
+ declare const createReadStream: any, createWriteStream: any, readFile: any, rename: any, unlink: any;
7
+ declare const resolve: any;
8
+ declare const readline: any;
9
+ declare const nodeModulesBinPath: any;
10
+ declare const changelogPath: any;
11
+ declare const changelogTmpPath: any;
12
+ /**
13
+ * Сюда пайплайн Jenkins складывает соответствующие части описания версии. Не получается использовать
14
+ * переменные окружения, т.к. `standard-version` запускает хуки через `child_process.exec`, не передавая туда
15
+ * ни аргументы ни переменные окружения.
16
+ */
17
+ declare const changelogFeaturesPath: any;
18
+ declare const changelogBugfixesPath: any;
19
+ declare const changelogBreakingChangesPath: any;
20
+ declare const changelogHeaderRegExp: RegExp;
21
+ declare type getVersionDescriptionParams = {
22
+ features: string;
23
+ bugFixes: string;
24
+ breakingChanges: string;
25
+ };
26
+ declare function getVersionDescription({ features, bugFixes, breakingChanges }: getVersionDescriptionParams): string;
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ /**
3
+ * Формирует описание версии в `CHANGELOG.md` на основе данных введенных в Jenkins при старте пайплайна.
4
+ * `standard-version` запускает этот скрипт как `postchangelog` хук.
5
+ */
6
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
7
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
8
+ return new (P || (P = Promise))(function (resolve, reject) {
9
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
10
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
11
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
12
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
13
+ });
14
+ };
15
+ var __asyncValues = (this && this.__asyncValues) || function (o) {
16
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
17
+ var m = o[Symbol.asyncIterator], i;
18
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
19
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
20
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
21
+ };
22
+ /* eslint-disable @typescript-eslint/no-var-requires */
23
+ const { execSync } = require('child_process');
24
+ const { createReadStream, createWriteStream, promises: { readFile, rename, unlink }, } = require('fs');
25
+ const { resolve } = require('path');
26
+ const readline = require('readline');
27
+ const nodeModulesBinPath = resolve(__dirname, './node_modules/.bin');
28
+ const changelogPath = resolve(__dirname, './CHANGELOG.md');
29
+ const changelogTmpPath = resolve(__dirname, './CHANGELOG_TMP.md');
30
+ /**
31
+ * Сюда пайплайн Jenkins складывает соответствующие части описания версии. Не получается использовать
32
+ * переменные окружения, т.к. `standard-version` запускает хуки через `child_process.exec`, не передавая туда
33
+ * ни аргументы ни переменные окружения.
34
+ */
35
+ const changelogFeaturesPath = resolve(__dirname, './changelog_features.tmp');
36
+ const changelogBugfixesPath = resolve(__dirname, './changelog_bugfixes.tmp');
37
+ const changelogBreakingChangesPath = resolve(__dirname, './changelog_breaking_changes.tmp');
38
+ // Пример заголовка – `## [50.1.0](http://git.moscow.alfaintra.net/...) (2022-07-27)`.
39
+ const changelogHeaderRegExp = /^###? \[\d+\.\d+\.\d+]\([^)]+\) \(\d{4}-\d{2}-\d{2}\)/;
40
+ (() => __awaiter(void 0, void 0, void 0, function* () {
41
+ var e_1, _a;
42
+ const rl = readline.createInterface({
43
+ input: createReadStream(changelogPath),
44
+ });
45
+ const ws = createWriteStream(changelogTmpPath);
46
+ let modifyingStatus = 'PENDING'; // 'PENDING' | 'MODIFYING' | 'MODIFIED'
47
+ try {
48
+ // eslint-disable-next-line no-restricted-syntax
49
+ for (var rl_1 = __asyncValues(rl), rl_1_1; rl_1_1 = yield rl_1.next(), !rl_1_1.done;) {
50
+ const line = rl_1_1.value;
51
+ switch (modifyingStatus) {
52
+ // Копируем всё как есть до первого заголовка.
53
+ case 'PENDING':
54
+ if (changelogHeaderRegExp.test(line)) {
55
+ modifyingStatus = 'MODIFYING';
56
+ }
57
+ ws.write(`${line}\n`);
58
+ break;
59
+ // Игнорируем описание версии, сгенерированное пакетом `standard-version`, пишем своё
60
+ // до второго заголовка. См. описание задачи http://jira.moscow.alfaintra.net/browse/NEWCLICKUI-1048
61
+ case 'MODIFYING':
62
+ if (changelogHeaderRegExp.test(line)) {
63
+ modifyingStatus = 'MODIFIED';
64
+ const [features, bugFixes, breakingChanges] = yield Promise.all([
65
+ readFile(changelogFeaturesPath, 'utf-8'),
66
+ readFile(changelogBugfixesPath, 'utf-8'),
67
+ readFile(changelogBreakingChangesPath, 'utf-8'),
68
+ ]).then((files) => files.map((content) => content.trim()));
69
+ ws.write(getVersionDescription({ features, bugFixes, breakingChanges }));
70
+ ws.write(`${line}\n`);
71
+ }
72
+ break;
73
+ // Дальше просто копируем всё как есть.
74
+ case 'MODIFIED':
75
+ ws.write(`${line}\n`);
76
+ break;
77
+ }
78
+ }
79
+ }
80
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
81
+ finally {
82
+ try {
83
+ if (rl_1_1 && !rl_1_1.done && (_a = rl_1.return)) yield _a.call(rl_1);
84
+ }
85
+ finally { if (e_1) throw e_1.error; }
86
+ }
87
+ ws.close();
88
+ execSync(`${nodeModulesBinPath}/prettier -w "${changelogTmpPath}"`);
89
+ yield unlink(changelogPath);
90
+ yield rename(changelogTmpPath, changelogPath);
91
+ process.exit(0);
92
+ }))();
93
+ function getVersionDescription({ features, bugFixes, breakingChanges }) {
94
+ let versionDescription = '';
95
+ if (features) {
96
+ versionDescription += `### Features\n${features}\n`;
97
+ }
98
+ if (bugFixes) {
99
+ versionDescription += `### Bug Fixes\n${bugFixes}\n`;
100
+ }
101
+ if (breakingChanges) {
102
+ versionDescription += `### ⚠ BREAKING CHANGES\n${breakingChanges}\n`;
103
+ }
104
+ return versionDescription;
105
+ }
@@ -767,7 +767,7 @@
767
767
  "affectsGlobalScope": false
768
768
  },
769
769
  "../src/bin/index.ts": {
770
- "version": "989e9550da559b01f884b77ac08b818a7d9467b0b8bc219ef508725e60a4db27",
770
+ "version": "5405ed3a093a5e9749fc010600120c81b509f89ac9c470da3f6ba7225e6bad0f",
771
771
  "signature": "0aab0bf7f6fd8e5a1386e7bb5e1a534b67ebe9bef3629d8504336e595b1ac851",
772
772
  "affectsGlobalScope": true
773
773
  },
@@ -1331,6 +1331,11 @@
1331
1331
  "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881",
1332
1332
  "affectsGlobalScope": false
1333
1333
  },
1334
+ "../src/commands/changelog/index.ts": {
1335
+ "version": "5b1d51d993c5db91a6d87b564604aad795a4168111a5c13eb3ebd056038d5411",
1336
+ "signature": "43b6e61ffc3703a8141a5061e231a378ba362ce8ac5627dc06ad643d74955c97",
1337
+ "affectsGlobalScope": true
1338
+ },
1334
1339
  "../src/templates/dockerfile.template.ts": {
1335
1340
  "version": "e26f54cb9b5f1a70cc129e7e718a794d5734b4e5c1872bc820f7c09f547ebd2b",
1336
1341
  "signature": "0fffbf1a5f54522ff7b89592bab1cf72966d7bdc613d52b0087717fcfec14b29",
@@ -4860,6 +4865,13 @@
4860
4865
  "../src/configs/app-configs/index.ts",
4861
4866
  "../src/configs/webpack.client.prod.ts"
4862
4867
  ],
4868
+ "../src/commands/changelog/index.ts": [
4869
+ "../../../node_modules/@types/graceful-fs/index.d.ts",
4870
+ "../node_modules/@types/node/ts3.1/fs.d.ts",
4871
+ "../node_modules/@types/node/ts3.1/util.d.ts",
4872
+ "../node_modules/@types/node/ts3.3/fs.d.ts",
4873
+ "../node_modules/@types/node/ts3.3/util.d.ts"
4874
+ ],
4863
4875
  "../src/commands/docker-build-compiled/index.ts": [
4864
4876
  "../../../node_modules/@types/fs-extra/index.d.ts",
4865
4877
  "../../../node_modules/@types/graceful-fs/index.d.ts",
@@ -8745,6 +8757,7 @@
8745
8757
  "../src/commands/build/index.ts",
8746
8758
  "../src/commands/build/server.ts",
8747
8759
  "../src/commands/bundle-analyze/index.ts",
8760
+ "../src/commands/changelog/index.ts",
8748
8761
  "../src/commands/docker-build-compiled/index.ts",
8749
8762
  "../src/commands/docker-build/index.ts",
8750
8763
  "../src/commands/ensure-yarn/index.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arui-scripts",
3
- "version": "13.4.0",
3
+ "version": "13.5.0-feat-NEWCLICKUI-1746.1",
4
4
  "main": "./build/index.js",
5
5
  "typings": "./build/index.d.ts",
6
6
  "license": "MPL-2.0",