@soft-artel/ci 2.3.87 → 2.3.89

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 (80) hide show
  1. package/Project.d.ts +57 -0
  2. package/Project.d.ts.map +1 -0
  3. package/Project.js +173 -0
  4. package/Project.js.map +1 -0
  5. package/commands/incrementBuild.d.ts +3 -0
  6. package/commands/incrementBuild.d.ts.map +1 -0
  7. package/commands/incrementBuild.js +34 -0
  8. package/commands/incrementBuild.js.map +1 -0
  9. package/commands/k8s-build.d.ts +30 -0
  10. package/commands/k8s-build.d.ts.map +1 -0
  11. package/commands/k8s-build.js +291 -0
  12. package/commands/k8s-build.js.map +1 -0
  13. package/commands/k8s-deploy.d.ts +11 -0
  14. package/commands/k8s-deploy.d.ts.map +1 -0
  15. package/commands/k8s-deploy.js +145 -0
  16. package/commands/k8s-deploy.js.map +1 -0
  17. package/commands/xcode.d.ts +3 -0
  18. package/commands/xcode.d.ts.map +1 -0
  19. package/commands/xcode.js +128 -0
  20. package/commands/xcode.js.map +1 -0
  21. package/package.json +3 -3
  22. package/services/Git.d.ts +46 -0
  23. package/services/Git.d.ts.map +1 -0
  24. package/services/Git.js +138 -0
  25. package/services/Git.js.map +1 -0
  26. package/services/Gitlab.d.ts +14 -0
  27. package/services/Gitlab.d.ts.map +1 -0
  28. package/services/Gitlab.js +101 -0
  29. package/services/Gitlab.js.map +1 -0
  30. package/services/Jira.d.ts +32 -0
  31. package/services/Jira.d.ts.map +1 -0
  32. package/services/Jira.js +136 -0
  33. package/services/Jira.js.map +1 -0
  34. package/services/Reporter.d.ts +43 -0
  35. package/services/Reporter.d.ts.map +1 -0
  36. package/services/Reporter.js +134 -0
  37. package/services/Reporter.js.map +1 -0
  38. package/utils/Exception.d.ts +5 -0
  39. package/utils/Exception.d.ts.map +1 -0
  40. package/utils/Exception.js +14 -0
  41. package/utils/Exception.js.map +1 -0
  42. package/utils/Logger.d.ts +11 -0
  43. package/utils/Logger.d.ts.map +1 -0
  44. package/utils/Logger.js +62 -0
  45. package/utils/Logger.js.map +1 -0
  46. package/utils/Shell.d.ts +39 -0
  47. package/utils/Shell.d.ts.map +1 -0
  48. package/utils/Shell.js +89 -0
  49. package/utils/Shell.js.map +1 -0
  50. package/utils/helpers.d.ts +16 -0
  51. package/utils/helpers.d.ts.map +1 -0
  52. package/utils/helpers.js +109 -0
  53. package/utils/helpers.js.map +1 -0
  54. package/utils/prototype.d.ts +9 -0
  55. package/utils/prototype.d.ts.map +1 -0
  56. package/utils/prototype.js +186 -0
  57. package/utils/prototype.js.map +1 -0
  58. package/.env +0 -21
  59. package/.eslintcache +0 -1
  60. package/.eslintignore +0 -4
  61. package/.eslintrc +0 -246
  62. package/.gitlab-ci.yml +0 -12
  63. package/README.md +0 -33
  64. package/_publish.sh +0 -11
  65. package/src/Project.ts +0 -286
  66. package/src/commands/incrementBuild.ts +0 -46
  67. package/src/commands/k8s-build.ts +0 -441
  68. package/src/commands/k8s-deploy.ts +0 -215
  69. package/src/commands/xcode.ts +0 -192
  70. package/src/services/Git.ts +0 -203
  71. package/src/services/Gitlab.ts +0 -129
  72. package/src/services/Jira.ts +0 -228
  73. package/src/services/Reporter.ts +0 -230
  74. package/src/utils/Exception.ts +0 -19
  75. package/src/utils/Logger.ts +0 -85
  76. package/src/utils/Shell.ts +0 -120
  77. package/src/utils/helpers.ts +0 -126
  78. package/src/utils/prototype.ts +0 -313
  79. package/test.ts +0 -0
  80. package/tsconfig.json +0 -25
@@ -1,126 +0,0 @@
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
- if(str.length < 2){ return str}
32
- return str.replace(/^\w/, (c) => c.toUpperCase());
33
- }
34
-
35
- // ------------------
36
-
37
- function nlToBr(str: string) {
38
- return str.replace(/\n/g, '<br>\n');
39
- }
40
-
41
- export function htmlToMd(html: string) {
42
- return NodeHtmlMarkdown.translate(nlToBr(html));
43
- }
44
-
45
- // ------------------
46
-
47
- export function resolvePath(filepath: string) {
48
- if (filepath.startsWith('~')) {
49
- filepath = path.join(process.env.HOME!, filepath.slice(1));
50
- }
51
- return path.resolve(filepath);
52
- }
53
-
54
- // ------------------
55
-
56
- export function asyncSleep(sec: number, fn?: (id: NodeJS.Timeout) => void){
57
- return new Promise((resolve) => {
58
- const id = setTimeout(resolve, sec * 1000);
59
- if (fn) {
60
- fn(id);
61
- }
62
- });
63
- }
64
-
65
- // ------------------
66
-
67
- export function stripTags(html: string){
68
- return nlToBr(html)
69
- .replace(/&#(\d+);/g, (match, i) => String.fromCharCode(parseInt(i, 10)))
70
- .replace(/<\/?([a-z][a-z0-9]*)\b[^>]*>?/gi, '').replace(/\s{2,}/g, ' ')
71
- .trim()
72
- .replace(/🛠/g, '')
73
- .replace(/🐞/g, '');
74
- }
75
-
76
- // ------------------
77
-
78
- export const md5 = (contents: string) => crypto.createHash('md5').update(contents).digest('hex');
79
-
80
- // ------------------
81
-
82
- export async function objectFromIniFile(path: string): Promise<Record<string, any> | undefined>{
83
- const file = await asyncFs.readFile(path, 'utf8');
84
- if(!file || file === ''){
85
- return undefined;
86
- }
87
-
88
- const rows = file.split('\n');
89
- if(!rows || rows.length < 1){
90
- return undefined;
91
- }
92
-
93
- const obj: Record<string, any> = {};
94
-
95
- for (const row of rows) {
96
- const match = /^([^=:#]+?)[=:](.*)/.exec(row);
97
- if (match) {
98
- const key = match[1].trim();
99
- const value = match[2].trim();
100
- obj[ key ] = value;
101
- }
102
- }
103
-
104
- return obj;
105
- }
106
-
107
- export async function fillEnvVarsFromFile(path: string){
108
- const fileEnv = await objectFromIniFile(path);
109
-
110
- if(!fileEnv){
111
- return;
112
- }
113
-
114
- for (const key in fileEnv) {
115
- if (Object.prototype.hasOwnProperty.call(fileEnv, key)) {
116
- const value = fileEnv[key];
117
- process.env[ key ] = value;
118
- }
119
- }
120
- }
121
-
122
- export function htmlEntities(rawStr: string){
123
- return rawStr.replace(/[\u00A0-\u9999<>\&]/g, function(i) {
124
- return '&#'+i.charCodeAt(0)+';';
125
- });
126
- }
@@ -1,313 +0,0 @@
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/test.ts DELETED
File without changes
package/tsconfig.json DELETED
@@ -1,25 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ESNEXT", /* 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"], /* 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": "_dist", /* 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
- "include": ["src/**/*", "k8s"],
24
- "exclude": ["node_modules.", "_dist", "*.sh"]
25
- }