@soft-artel/ci 1.2.15 → 1.3.15

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.
Files changed (88) hide show
  1. package/.env +21 -0
  2. package/.eslintcache +1 -0
  3. package/.eslintignore +4 -0
  4. package/.eslintrc +246 -0
  5. package/.gitlab-ci.yml +12 -0
  6. package/_publish.sh +24 -0
  7. package/k8s/App.ts +200 -0
  8. package/k8s/DockerImage.ts +147 -0
  9. package/k8s/Node.ts +119 -0
  10. package/k8s-build.ts +175 -0
  11. package/k8s-deploy.ts +174 -0
  12. package/libs/Exception.ts +19 -0
  13. package/libs/Git.ts +199 -0
  14. package/libs/Gitlab.ts +86 -0
  15. package/libs/Jira.ts +239 -0
  16. package/libs/Project.ts +215 -0
  17. package/libs/Reporter.ts +181 -0
  18. package/libs/Shell.ts +119 -0
  19. package/libs/helpers.ts +114 -0
  20. package/libs/prototype.ts +313 -0
  21. package/package.json +1 -1
  22. package/tsconfig.json +24 -0
  23. package/upd_pkg.ts +21 -0
  24. package/xcode.ts +226 -0
  25. package/k8s/App.d.ts +0 -22
  26. package/k8s/App.d.ts.map +0 -1
  27. package/k8s/App.js +0 -150
  28. package/k8s/App.js.map +0 -1
  29. package/k8s/DockerImage.d.ts +0 -15
  30. package/k8s/DockerImage.d.ts.map +0 -1
  31. package/k8s/DockerImage.js +0 -112
  32. package/k8s/DockerImage.js.map +0 -1
  33. package/k8s/Node.d.ts +0 -17
  34. package/k8s/Node.d.ts.map +0 -1
  35. package/k8s/Node.js +0 -103
  36. package/k8s/Node.js.map +0 -1
  37. package/k8s-build.d.ts +0 -3
  38. package/k8s-build.d.ts.map +0 -1
  39. package/k8s-build.js +0 -125
  40. package/k8s-build.js.map +0 -1
  41. package/k8s-deploy.d.ts +0 -3
  42. package/k8s-deploy.d.ts.map +0 -1
  43. package/k8s-deploy.js +0 -128
  44. package/k8s-deploy.js.map +0 -1
  45. package/libs/Exception.d.ts +0 -5
  46. package/libs/Exception.d.ts.map +0 -1
  47. package/libs/Exception.js +0 -13
  48. package/libs/Exception.js.map +0 -1
  49. package/libs/Git.d.ts +0 -44
  50. package/libs/Git.d.ts.map +0 -1
  51. package/libs/Git.js +0 -160
  52. package/libs/Git.js.map +0 -1
  53. package/libs/Gitlab.d.ts +0 -12
  54. package/libs/Gitlab.d.ts.map +0 -1
  55. package/libs/Gitlab.js +0 -78
  56. package/libs/Gitlab.js.map +0 -1
  57. package/libs/Jira.d.ts +0 -31
  58. package/libs/Jira.d.ts.map +0 -1
  59. package/libs/Jira.js +0 -157
  60. package/libs/Jira.js.map +0 -1
  61. package/libs/Project.d.ts +0 -39
  62. package/libs/Project.d.ts.map +0 -1
  63. package/libs/Project.js +0 -177
  64. package/libs/Project.js.map +0 -1
  65. package/libs/Reporter.d.ts +0 -34
  66. package/libs/Reporter.d.ts.map +0 -1
  67. package/libs/Reporter.js +0 -129
  68. package/libs/Reporter.js.map +0 -1
  69. package/libs/Shell.d.ts +0 -39
  70. package/libs/Shell.d.ts.map +0 -1
  71. package/libs/Shell.js +0 -107
  72. package/libs/Shell.js.map +0 -1
  73. package/libs/helpers.d.ts +0 -29
  74. package/libs/helpers.d.ts.map +0 -1
  75. package/libs/helpers.js +0 -101
  76. package/libs/helpers.js.map +0 -1
  77. package/libs/prototype.d.ts +0 -9
  78. package/libs/prototype.d.ts.map +0 -1
  79. package/libs/prototype.js +0 -186
  80. package/libs/prototype.js.map +0 -1
  81. package/upd_pkg.d.ts +0 -3
  82. package/upd_pkg.d.ts.map +0 -1
  83. package/upd_pkg.js +0 -28
  84. package/upd_pkg.js.map +0 -1
  85. package/xcode.d.ts +0 -3
  86. package/xcode.d.ts.map +0 -1
  87. package/xcode.js +0 -163
  88. package/xcode.js.map +0 -1
package/libs/Shell.ts ADDED
@@ -0,0 +1,119 @@
1
+ import shelljs from 'shelljs';
2
+
3
+ import { log, resolvePath, asyncSleep } from '../libs/helpers';
4
+
5
+ // ===========================================
6
+
7
+ function exec(cmd: string, opt: ExecOptions = { silent: !log.debug, ignoreError: false }): Promise<string>{
8
+ return new Promise((resolve, reject) => {
9
+
10
+ if(opt.silent === undefined){
11
+ opt.silent = true;
12
+ }
13
+
14
+ if(opt.silent === false){
15
+ log.dbg(cmd);
16
+ }
17
+
18
+ shelljs.exec(cmd, opt, (code, stdout, stderr) => {
19
+ if(code === 0){
20
+ resolve(stdout.trim());
21
+ return;
22
+ }
23
+
24
+ if(code !== 0 && opt.ignoreError){
25
+ resolve('');
26
+ return;
27
+ }
28
+
29
+ const e = new Error();
30
+ e.message = cmd+'\n'+ (stderr.length > 0 ? stderr : stdout);
31
+ e.name = String(code);
32
+ reject(e);
33
+
34
+ }
35
+ );
36
+ });
37
+ }
38
+
39
+ // -------------
40
+
41
+ async function execRepeat(cmd: string, repeats = 10, sleep = 10, opt = { silent: !log.debug, ignoreError: false }){
42
+
43
+ let tryCount = repeats;
44
+ let e = new Error();
45
+
46
+ while(tryCount > 0) {
47
+ tryCount -= 1;
48
+ try{
49
+
50
+ return await exec(cmd, { silent: opt.silent, ignoreError: false });
51
+
52
+ } catch(err){
53
+ e = err;
54
+ log.error(`Exec Repeats [${tryCount + 1}] FAIL: ${ cmd }`);
55
+ log.error(err);
56
+ await asyncSleep(sleep);
57
+ }
58
+ }
59
+
60
+ if(opt.ignoreError){
61
+ return e.message;
62
+ }
63
+
64
+ throw e;
65
+
66
+ }
67
+
68
+ // -------------
69
+
70
+ async function mkdir(dir: string, opt?: ExecOptions){
71
+ return exec(`mkdir -p ${ resolvePath(dir) }`, opt);
72
+ }
73
+
74
+ async function cat(file: string, opt = { silent: true, ignoreError: false }){
75
+ const filePath = resolvePath(file);
76
+ if(shelljs.test('-e', filePath) === false && opt && opt.ignoreError === true){
77
+ return undefined;
78
+ }
79
+ return exec('cat '+filePath, opt);
80
+ }
81
+
82
+ async function find(where: string, filename = '', maxdepth = 3, ignore: string[] = [], pars = '', opt = { silent: true, ignoreError: false }){
83
+
84
+ let cmd = `find ${ where } ${pars}`;
85
+
86
+ for (const path of ignore) {
87
+ cmd += ` -not -path '${path}'`;
88
+ }
89
+
90
+ cmd += ` -maxdepth ${maxdepth}`;
91
+ cmd += ` -name ${filename}`;
92
+
93
+ return (await exec(cmd, opt)).split('\n').filter((f)=>f.length > 2);
94
+ }
95
+
96
+ async function ls(where: string, pars = '', opt = { silent: true, ignoreError: false }){
97
+ return (await exec(`ls ${ where } ${ pars }`, opt)).split('\n').filter((f)=>f.length > 2);
98
+ }
99
+
100
+ export interface ExecOptions {
101
+ silent?: boolean;
102
+ ignoreError?: boolean;
103
+ }
104
+
105
+ export default {
106
+ cd: shelljs.cd,
107
+ chmod: shelljs.chmod,
108
+ grep: shelljs.grep,
109
+ pwd: shelljs.pwd,
110
+ sed: shelljs.sed,
111
+ test: shelljs.test,
112
+
113
+ exec,
114
+ execRepeat,
115
+ mkdir,
116
+ cat,
117
+ find,
118
+ ls,
119
+ };
@@ -0,0 +1,114 @@
1
+ import { NodeHtmlMarkdown } from 'node-html-markdown';
2
+ import { promises as asyncFs } from 'fs';
3
+ import path from 'path';
4
+ import crypto from 'crypto';
5
+
6
+ const ENV = process.env;
7
+
8
+ // ------------------
9
+
10
+ export function checkVarsExisting(variables: { field: any; exceptionMessage: string }[]) {
11
+ for (const { field, exceptionMessage } of variables) {
12
+ if (field === undefined) {
13
+ throw new Error(exceptionMessage);
14
+ }
15
+ }
16
+ }
17
+
18
+ // ------------------
19
+
20
+ export function checkEnvVars(variables: string[]) {
21
+ for (const key of variables) {
22
+ if (ENV[ key ] === undefined) {
23
+ throw new Error(`Missed variable in ENV: ${ key }`);
24
+ }
25
+ }
26
+ }
27
+
28
+ // ------------------
29
+
30
+ export function capitalizeFirstLetter(str: string) {
31
+ return str.replace(/^\w/, (c) => c.toUpperCase());
32
+ }
33
+
34
+ // ------------------
35
+
36
+ function nlToBr(str: string) {
37
+ return str.replace(/\n/g, '<br>\n');
38
+ }
39
+
40
+ export function htmlToMd(html: string) {
41
+ return NodeHtmlMarkdown.translate(nlToBr(html));
42
+ }
43
+
44
+ // ------------------
45
+
46
+ export const log = {
47
+ // eslint-disable-next-line no-console
48
+ dbg: console.log, info: console.log, error: console.error, debug: true,
49
+ };
50
+
51
+ // ------------------
52
+
53
+ export function resolvePath(filepath: string) {
54
+ if (filepath.startsWith('~')) {
55
+ filepath = path.join(process.env.HOME!, filepath.slice(1));
56
+ }
57
+ return path.resolve(filepath);
58
+ }
59
+
60
+ // ------------------
61
+
62
+ export function asyncSleep(sec: number, fn?: (id: NodeJS.Timeout) => void){
63
+ return new Promise((resolve) => {
64
+ const id = setTimeout(resolve, sec * 1000);
65
+ if (fn) {
66
+ fn(id);
67
+ }
68
+ });
69
+ }
70
+
71
+ // ------------------
72
+
73
+ export function stripTags(html: string){
74
+ return nlToBr(html)
75
+ .replace(/<\/?([a-z][a-z0-9]*)\b[^>]*>?/gi, '').replace(/\s{2,}/g, ' ')
76
+ .trim()
77
+ .replace(/🛠/g, '')
78
+ .replace(/🐞/g, '');
79
+ }
80
+
81
+ // ------------------
82
+
83
+ export const md5 = (contents: string) => crypto.createHash('md5').update(contents).digest('hex');
84
+
85
+ // ------------------
86
+
87
+ export async function objectFromIniFile(path: string): Promise<Record<string, any> | undefined>{
88
+ const file = await asyncFs.readFile(path, 'utf8');
89
+ if(!file || file === ''){
90
+ return undefined;
91
+ }
92
+
93
+ const rows = file.split('\n');
94
+ if(!rows || rows.length < 1){
95
+ return undefined;
96
+ }
97
+
98
+ const obj: Record<string, any> = {};
99
+
100
+ for (const row of rows) {
101
+ const rowParts = row.split('=');
102
+ if(rowParts.length !== 2){
103
+ continue;
104
+ }
105
+ const key = rowParts[0].trim();
106
+ const value = rowParts[1];
107
+
108
+ obj[ key ] = value;
109
+ }
110
+
111
+ return obj;
112
+ }
113
+
114
+ // ------------------
@@ -0,0 +1,313 @@
1
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2
+
3
+
4
+ // ===========================================
5
+ // String
6
+
7
+ export interface String {
8
+ replaceAll(search: string, replacement: string): string;
9
+ }
10
+
11
+ Object.defineProperties(String.prototype, {
12
+
13
+ replaceAll: {
14
+ value(search: string, replacement: string): any {
15
+ const escapedSearch = search.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
16
+ return this.replace(new RegExp(escapedSearch, 'g'), replacement);
17
+ },
18
+ enumerable : false,
19
+ writable : true,
20
+ },
21
+
22
+ }
23
+ );
24
+
25
+ // ===========================================
26
+ // Array
27
+
28
+ export interface Array<T> {
29
+ randomElement: T;
30
+ delete(elm: T): T[];
31
+ match(str: string): boolean;
32
+ }
33
+
34
+ Object.defineProperties(Array.prototype, {
35
+
36
+ randomElement: {
37
+ value(): any {
38
+ return this[ Math.round(Math.random() * (this.length - 1)) ];
39
+ },
40
+ enumerable : false,
41
+ writable : true,
42
+ },
43
+
44
+ // ----------------------------
45
+
46
+ delete: {
47
+ value(elm: any): any {
48
+ const index = this.indexOf(elm);
49
+ if(index === -1){
50
+ return this;
51
+ }
52
+
53
+ this.splice(index, 1);
54
+
55
+ return this;
56
+ },
57
+ enumerable : false,
58
+ writable : true,
59
+ },
60
+
61
+ // ----------------------------
62
+
63
+ match: {
64
+ value(str: string): boolean {
65
+ for (const item of this) {
66
+ if(typeof item === 'string' && (RegExp(item).exec(str))){
67
+ return true;
68
+ }
69
+ }
70
+ return false;
71
+ },
72
+ enumerable : false,
73
+ writable : true,
74
+ },
75
+
76
+ });
77
+
78
+
79
+ // ===========================================
80
+ // Object
81
+
82
+ function isObjectDefined(obj: any): boolean {
83
+ return obj !== undefined && typeof(obj) === 'object' && obj !== null && (obj instanceof Date) === false && Array.isArray(obj) === false;
84
+ }
85
+
86
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
87
+ interface Object {
88
+ copy(maxDepth?: number, excludeKeysStart?: string[]): any;
89
+ diff(toObj: any, excludeKeysStart?: string[]): {from?: any; to?: any} | undefined;
90
+ pickKeys<O>(keys: keyof O[]): Partial<O>;
91
+ mergeFrom(fromObj: Record<string, any>, addFromObjKeys: boolean): void;
92
+ isEqual(toObj: Record<string, any>): boolean;
93
+ }
94
+
95
+ Object.defineProperties(Object.prototype, {
96
+
97
+ copy: {
98
+ value(maxDepth?: number, excludeKeysStart?: string[]): any {
99
+ const maxDeep = maxDepth === undefined ? 5 : maxDepth - 1;
100
+ const excludeKeys = excludeKeysStart === undefined ? ['_', '$'] : excludeKeysStart;
101
+
102
+ const objCopy: Record<any, any> = {};
103
+ for(const key of Object.keys(this)){
104
+ if(excludeKeys.includes(key[0])){
105
+ continue;
106
+ }
107
+
108
+ const value = (this)[key];
109
+
110
+ if (isObjectDefined(value)) {
111
+ objCopy[key] = (maxDeep >= 0) ? value.copy(maxDeep, excludeKeys) : {};
112
+ } else {
113
+ objCopy[key] = value;
114
+ }
115
+ }
116
+ return objCopy;
117
+ },
118
+ enumerable : false,
119
+ writable : true,
120
+ },
121
+
122
+
123
+ // ----------------------------
124
+
125
+
126
+ diff: {
127
+ value(toObj: any, excludeKeysStart?: string[]): {from?: any; to?: any} | undefined{
128
+ if(isObjectDefined(toObj) === false){
129
+ return { from: this.copy(), to: toObj};
130
+ }
131
+
132
+ const excludeKeys = excludeKeysStart === undefined ? ['_', '$'] : excludeKeysStart;
133
+
134
+ const result: Record<any, any> = {};
135
+
136
+ const fromKeys = Object.keys(this);
137
+ const toKeys = Object.keys(toObj);
138
+
139
+ if(fromKeys.length === toKeys.length && toKeys.length === 0){
140
+ return undefined;
141
+ }
142
+
143
+ for (const key of toKeys) {
144
+
145
+ const i = fromKeys.indexOf(key);
146
+ if(i !== -1){
147
+ fromKeys.splice(i, 1);
148
+ }
149
+
150
+ if(excludeKeys.includes(key[0])){
151
+ continue;
152
+ }
153
+
154
+ const oldVal = (this)[ key ];
155
+ const newVal = toObj[ key ];
156
+
157
+
158
+ if(oldVal === newVal
159
+ || (isObjectDefined(oldVal) && isObjectDefined(newVal) && Object.keys(oldVal).length === 0 && Object.keys(newVal).length === 0)
160
+ || (oldVal instanceof Date && newVal instanceof Date && oldVal.getTime() === newVal.getTime())
161
+ ){
162
+ continue;
163
+ }
164
+
165
+ if(oldVal === undefined || oldVal === null || oldVal === '' || isObjectDefined(oldVal) && Object.keys(oldVal).length === 0){
166
+ result[ key ] = { to : newVal };
167
+ continue;
168
+ }
169
+
170
+
171
+ if(isObjectDefined(oldVal) && isObjectDefined(newVal)){
172
+ const nestedResult = oldVal.diff(newVal);
173
+
174
+ if(nestedResult && Object.keys(nestedResult).length > 0){
175
+ result[ key ] = nestedResult;
176
+ }
177
+ continue;
178
+ }
179
+
180
+ result[ key ] = {
181
+ from : oldVal,
182
+ to : newVal,
183
+ };
184
+
185
+ }
186
+
187
+
188
+ for (const key of fromKeys) {
189
+
190
+ if(excludeKeys.includes(key[0])){
191
+ continue;
192
+ }
193
+
194
+ const oldVal = (this)[ key ];
195
+
196
+ if(oldVal !== undefined || oldVal !== null){
197
+ result[ key ] = {
198
+ from : oldVal,
199
+ };
200
+ }
201
+
202
+ }
203
+
204
+ return result;
205
+ },
206
+ enumerable : false,
207
+ writable : true,
208
+ },
209
+
210
+ // ----------------------------
211
+
212
+ pickKeys: {
213
+ value<O>(keys: keyof O[]): Partial<O> {
214
+ if(!Array.isArray(keys) || keys.length === 0) return {};
215
+
216
+ const obj: Partial<O> = {};
217
+
218
+ for (const key of keys) {
219
+ obj[ key as keyof O ] = (this)[ key ];
220
+ }
221
+
222
+ return obj;
223
+ },
224
+ enumerable : false,
225
+ writable : true,
226
+ },
227
+
228
+ // // ----------------------------
229
+
230
+ // applayObject: {
231
+ // value(fromObj: { [x: string]: any }, exeptKeys: string | string[]) {
232
+ // if(!fromObj || typeof fromObj !== 'object') return this;
233
+
234
+ // Object.keys(fromObj).forEach(key => {
235
+
236
+ // if(!exeptKeys || !Array.isArray(exeptKeys) || !exeptKeys.includes(key)){
237
+ // this[ key ] = fromObj[ key ];
238
+ // }
239
+
240
+ // });
241
+
242
+ // return this;
243
+
244
+ // },
245
+ // enumerable : false,
246
+ // writable : true,
247
+ // },
248
+
249
+ // ----------------------------
250
+
251
+ mergeFrom: {
252
+ value(fromObj: { [x: string]: any }, addFromObjKeys = true) {
253
+
254
+ if(!fromObj || typeof fromObj !== 'object') return this;
255
+
256
+ const keys = Object.keys(this);
257
+
258
+ const fromKeys = Object.keys(fromObj);
259
+
260
+ // Обходим те кулючи что у нас уже есть!
261
+ keys.forEach(key => {
262
+
263
+ const i = fromKeys.indexOf(key);
264
+ if(i !== -1){
265
+ fromKeys.splice(i, 1);
266
+ }
267
+
268
+ const fromValue = fromObj[ key ];
269
+ if(fromValue === undefined || fromValue === null){
270
+ return;
271
+ }
272
+
273
+ if(typeof this[ key ] !== 'object' ||
274
+ typeof this[ key ] !== typeof fromValue ||
275
+ Array.isArray(this[ key ])){
276
+ this[ key ] = fromValue;
277
+ return;
278
+ }
279
+
280
+ this[ key ].mergeFrom(fromValue);
281
+
282
+ });
283
+
284
+ // Добавляем те что есть только у fromObj
285
+ if(addFromObjKeys && fromKeys.length >0){
286
+
287
+ fromKeys.forEach(key => {
288
+ this[ key ] = fromObj[ key ];
289
+ });
290
+
291
+ }
292
+
293
+ return this;
294
+
295
+ },
296
+ enumerable : false,
297
+ writable : true,
298
+ },
299
+
300
+ // ----------------------------
301
+
302
+ isEqual: {
303
+ value(toObj: Record<string, any>): boolean{
304
+ const diff = this.diff(toObj);
305
+
306
+ return diff ? Object.keys(diff).length === 0 : true;
307
+ },
308
+ enumerable : false,
309
+ writable : true,
310
+ },
311
+
312
+
313
+ });
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "url": "http://gitlab.soft-artel.com/sp/cluster.git"
8
8
  },
9
9
  "name": "@soft-artel/ci",
10
- "version": "1.2.15",
10
+ "version": "1.3.15",
11
11
  "main": "sa-ci-k8s.js",
12
12
  "bin": {
13
13
  "sa-ci-k8s-build": "./k8s-build.js",
package/tsconfig.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
4
+ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
5
+ "lib": ["esnext", "DOM"], /* Specify library files to be included in the compilation. */
6
+ "allowJs": true, /* Allow javascript files to be compiled. */
7
+ "declaration": true, /* Generates corresponding '.d.ts' file. */
8
+ "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
9
+ "sourceMap": true, /* Generates corresponding '.map' file. */
10
+ "outDir": "_publish", /* Redirect output structure to the directory. */
11
+ "removeComments": true, /* Do not emit comments to output. */
12
+ "preserveConstEnums": true,
13
+ "noEmitOnError": true, /* Do not emit outputs if any errors were reported. */
14
+ "strict": true, /* Enable all strict type-checking options. */
15
+ "resolveJsonModule": true,
16
+ "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
17
+ "typeRoots": ["node_modules/@types", "../node_modules/@types"], /* List of folders to include type definitions from. */
18
+ "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
19
+ "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
20
+ "forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */
21
+ "useUnknownInCatchVariables": false
22
+ },
23
+ "exclude": ["node_modules.", "_publish", "*.sh"]
24
+ }
package/upd_pkg.ts ADDED
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ts-node
2
+ import { promises as asyncFs } from 'fs';
3
+
4
+ main();
5
+
6
+ async function main() {
7
+
8
+ const pkg = JSON.parse(await asyncFs.readFile('./package.json', 'utf-8'));
9
+
10
+ let v = pkg.version;
11
+ const comp: string[] = v.split('.');
12
+ comp[ comp.length - 1 ] = `${ Number(comp[ comp.length - 1 ]) + 1 }`;
13
+ v = comp.join('.');
14
+ pkg.version = v;
15
+
16
+ await asyncFs.writeFile('./package.json', JSON.stringify(pkg, null, 3));
17
+ await asyncFs.writeFile('../package.json', JSON.stringify(pkg, null, 3)); // ts pkg
18
+
19
+ process.env.PUBLISH_VERSION = pkg.version;
20
+
21
+ }