@soft-artel/ci 1.3.15 → 1.3.16

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/k8s/App.d.ts +22 -0
  2. package/k8s/App.d.ts.map +1 -0
  3. package/k8s/App.js +150 -0
  4. package/k8s/App.js.map +1 -0
  5. package/k8s/DockerImage.d.ts +15 -0
  6. package/k8s/DockerImage.d.ts.map +1 -0
  7. package/k8s/DockerImage.js +112 -0
  8. package/k8s/DockerImage.js.map +1 -0
  9. package/k8s/Node.d.ts +17 -0
  10. package/k8s/Node.d.ts.map +1 -0
  11. package/k8s/Node.js +103 -0
  12. package/k8s/Node.js.map +1 -0
  13. package/k8s-build.d.ts +3 -0
  14. package/k8s-build.d.ts.map +1 -0
  15. package/k8s-build.js +125 -0
  16. package/k8s-build.js.map +1 -0
  17. package/k8s-deploy.d.ts +3 -0
  18. package/k8s-deploy.d.ts.map +1 -0
  19. package/k8s-deploy.js +124 -0
  20. package/k8s-deploy.js.map +1 -0
  21. package/libs/Exception.d.ts +5 -0
  22. package/libs/Exception.d.ts.map +1 -0
  23. package/libs/Exception.js +13 -0
  24. package/libs/Exception.js.map +1 -0
  25. package/libs/Git.d.ts +44 -0
  26. package/libs/Git.d.ts.map +1 -0
  27. package/libs/Git.js +160 -0
  28. package/libs/Git.js.map +1 -0
  29. package/libs/Gitlab.d.ts +12 -0
  30. package/libs/Gitlab.d.ts.map +1 -0
  31. package/libs/Gitlab.js +78 -0
  32. package/libs/Gitlab.js.map +1 -0
  33. package/libs/Jira.d.ts +31 -0
  34. package/libs/Jira.d.ts.map +1 -0
  35. package/libs/Jira.js +157 -0
  36. package/libs/Jira.js.map +1 -0
  37. package/libs/Project.d.ts +39 -0
  38. package/libs/Project.d.ts.map +1 -0
  39. package/libs/Project.js +177 -0
  40. package/libs/Project.js.map +1 -0
  41. package/libs/Reporter.d.ts +34 -0
  42. package/libs/Reporter.d.ts.map +1 -0
  43. package/libs/Reporter.js +131 -0
  44. package/libs/Reporter.js.map +1 -0
  45. package/libs/Shell.d.ts +39 -0
  46. package/libs/Shell.d.ts.map +1 -0
  47. package/libs/Shell.js +107 -0
  48. package/libs/Shell.js.map +1 -0
  49. package/libs/helpers.d.ts +29 -0
  50. package/libs/helpers.d.ts.map +1 -0
  51. package/libs/helpers.js +101 -0
  52. package/libs/helpers.js.map +1 -0
  53. package/libs/prototype.d.ts +9 -0
  54. package/libs/prototype.d.ts.map +1 -0
  55. package/libs/prototype.js +186 -0
  56. package/libs/prototype.js.map +1 -0
  57. package/package.json +1 -1
  58. package/upd_pkg.d.ts +3 -0
  59. package/upd_pkg.d.ts.map +1 -0
  60. package/upd_pkg.js +28 -0
  61. package/upd_pkg.js.map +1 -0
  62. package/xcode.d.ts +3 -0
  63. package/xcode.d.ts.map +1 -0
  64. package/xcode.js +163 -0
  65. package/xcode.js.map +1 -0
  66. package/.env +0 -21
  67. package/.eslintcache +0 -1
  68. package/.eslintignore +0 -4
  69. package/.eslintrc +0 -246
  70. package/.gitlab-ci.yml +0 -12
  71. package/_publish.sh +0 -24
  72. package/k8s/App.ts +0 -200
  73. package/k8s/DockerImage.ts +0 -147
  74. package/k8s/Node.ts +0 -119
  75. package/k8s-build.ts +0 -175
  76. package/k8s-deploy.ts +0 -174
  77. package/libs/Exception.ts +0 -19
  78. package/libs/Git.ts +0 -199
  79. package/libs/Gitlab.ts +0 -86
  80. package/libs/Jira.ts +0 -239
  81. package/libs/Project.ts +0 -215
  82. package/libs/Reporter.ts +0 -181
  83. package/libs/Shell.ts +0 -119
  84. package/libs/helpers.ts +0 -114
  85. package/libs/prototype.ts +0 -313
  86. package/tsconfig.json +0 -24
  87. package/upd_pkg.ts +0 -21
  88. package/xcode.ts +0 -226
package/libs/Project.ts DELETED
@@ -1,215 +0,0 @@
1
- import axios from 'axios';
2
- import { promises as fsAsync } from 'fs';
3
-
4
- import { Exception } from './Exception';
5
- import { log, capitalizeFirstLetter, htmlToMd, resolvePath } from './helpers';
6
- import Shell from './Shell';
7
-
8
- const ENV = process.env;
9
-
10
- export type Stage = keyof typeof ALLOW_STAGES;
11
- const ALLOW_STAGES: Record<string, string> = {
12
- dev: 'dev',
13
- alpha: 'alpha',
14
- rc:'rc',
15
- hotfix:'hotfix',
16
- prod:'prod',
17
- };
18
-
19
- export class Project {
20
-
21
- // ENV FROM GitLab Runner ---------------
22
- isRunner = ENV.CI_JOB_ID !== undefined;
23
-
24
- id = (Number(ENV.CI_PROJECT_ID as unknown as number || 0));
25
- path = ENV.CI_PROJECT_PATH || ''; // <group>/<project>
26
- url = ENV.CI_PROJECT_URL || ''; // http://<gitlab>/<group>/<project>
27
-
28
- name = ENV.CI_PROJECT_NAME || '';
29
- group = ENV.CI_PROJECT_NAMESPACE || '';
30
-
31
- // Common proporties ---------------
32
- rootPath: string = '';
33
-
34
- build = 0;
35
- version = '0.0.0';
36
- stage: Stage = 'dev';
37
-
38
-
39
- $stages: Stage[] = ['dev'];
40
- $stagesVersions: Record<string, string> = { dev: '0.0.0' };
41
-
42
- job = {
43
-
44
- id: ENV.CI_JOB_ID,
45
- name: ENV.CI_JOB_NAME || 'No Job',
46
- step: ENV.CI_JOB_STAGE || 'build',
47
- branch: ENV.CI_COMMIT_REF_NAME || 'dev',
48
-
49
- url: ENV.CI_JOB_URL || '',
50
- pipline: ENV.CI_PIPELINE_URL || '',
51
-
52
- user: {
53
- ID: ENV.GITLAB_USER_ID || '',
54
- login: ENV.GITLAB_USER_LOGIN || '',
55
- name: ENV.GITLAB_USER_NAME || '',
56
- email: ENV.GITLAB_USER_EMAIL || '',
57
- },
58
- };
59
-
60
- // --------------
61
-
62
- constructor(workdir: string | undefined, stage?: Stage){
63
- this.rootPath = resolvePath(workdir || ENV.CI_PROJECT_DIR || Shell.pwd().toString());
64
- const branch = ENV.CI_COMMIT_REF_NAME || 'dev';
65
- this.stage = stage || ALLOW_STAGES[ branch ] || 'dev';
66
-
67
- try{
68
- this.$stages = JSON.parse(ENV.CI_STAGES || '[dev]');
69
- log.dbg('Allowed stages:', this.$stages);
70
- }catch(e){
71
- log.dbg('CI VARIABLE: CI_STAGES is invalid!');
72
- }
73
-
74
- try{
75
- this.$stagesVersions = JSON.parse(ENV.VERSIONS || '{}');
76
- log.dbg('stagesVersions:', this.$stagesVersions);
77
- }catch(e){
78
- log.dbg('CI VARIABLE:VERSIONS is invalid!');
79
- }
80
-
81
- this.build = Number(ENV.LAST_BUILD) || 0;
82
-
83
-
84
- this.version = '0.0.' + this.build; // Mast init later! [ depends fom platform]
85
-
86
- Shell.cd(this.rootPath);
87
- log.dbg(`[${this.stage}, ${this.version}] `+this.rootPath);
88
- }
89
-
90
- // --------------
91
-
92
- get shortVersion(){
93
- return this.version.split('.').splice(0, 2).join('.');
94
- }
95
-
96
- get prevVersion(){
97
- const pV = this.$stagesVersions[ this.stage ];
98
- return pV !== '0.0.0' ? pV : undefined;
99
- }
100
-
101
- // --------------
102
-
103
- incrementBuild(newBuild?: number){
104
- if (newBuild) {
105
- this.build = newBuild;
106
- } else {
107
- this.build += 1;
108
- }
109
- this.version = `${ this.shortVersion }.${ this.build}`;
110
- }
111
-
112
- // --------------
113
-
114
- async saveGitLabBuild(){
115
- await saveGitLabVariable(this, 'LAST_BUILD', this.build);
116
- }
117
-
118
- // ----------------
119
-
120
- async saveGitLabStagesVersions(){
121
- this.$stagesVersions[ this.stage ] = this.version;
122
- await saveGitLabVariable(this, 'VERSIONS', JSON.stringify(this.$stagesVersions, null, 3));
123
- }
124
-
125
- // --------------
126
-
127
- async updateChangeLog(whatsNewHtml: string, filename = 'CHANGELOG.md') {
128
-
129
- const filePath = `${ this.rootPath}/${ filename }`;
130
-
131
- let title = `# ${ capitalizeFirstLetter(this.group) }: **${ this.name.toUpperCase() }**`;
132
-
133
- log.info(`Update ${filename}:\n${title}`);
134
-
135
- let changeLog = await Shell.cat(filePath, {silent:true, ignoreError:true}) || '';
136
- const lines = changeLog.split('\n');
137
-
138
- if(Array.isArray(lines) && lines.length > 1){
139
- title = lines.shift() || title;
140
- changeLog = lines.join('\n');
141
- }
142
-
143
- const dateTime = new Date().toLocaleString('ru-RU', {
144
- weekday: 'long',
145
- year: 'numeric',
146
- month: 'short',
147
- day: 'numeric',
148
- timeZone: 'Europe/Moscow',
149
- hour12: false,
150
- hour: 'numeric',
151
- minute: 'numeric',
152
- });
153
-
154
- const whatsNewMd = htmlToMd(whatsNewHtml);
155
-
156
- changeLog = `${ title }
157
- ## **${ this.version }**
158
- ${ capitalizeFirstLetter(dateTime) }
159
-
160
- ${ whatsNewMd }
161
-
162
-
163
-
164
-
165
- ${ changeLog }
166
- `;
167
-
168
- await fsAsync.writeFile(filePath, changeLog, { encoding: 'utf8', flag: 'w+'});
169
- }
170
-
171
- }
172
-
173
-
174
- // ==================================
175
- // GitLab Helpers
176
-
177
- async function saveGitLabVariable(prj: Project, name: string, value: any) {
178
-
179
- try{
180
- const resp = await axios({
181
- method:'PUT',
182
- timeout: 6000,
183
- url: `${ ENV.CONFIG_GITLAB_URL || 'https://gitlab.soft-artel.com' }/api/v4/projects/${ prj.id }/variables/${ name }`,
184
- headers:{ 'PRIVATE-TOKEN': ENV.GITLAB_API_TOKEN || '' },
185
- data:{
186
- value,
187
- },
188
- });
189
-
190
- log.dbg(resp.data);
191
- return JSON.parse(resp.data.value);
192
-
193
- } catch(e){
194
-
195
- const errTitle = `GitLab project [${ prj.id }] has not`;
196
-
197
- if(e.response && (e.response.status === 401 || e.response.status === 403)){
198
- const err = new Exception(`${ errTitle } access, HTTP-401`);
199
- err.params = e.config;
200
- throw err;
201
- }
202
-
203
- if(e.response && e.response.status === 404){
204
- const err = new Exception(`${ errTitle } CI VARIABLE: ${ name }`);
205
- err.params = e.config;
206
- throw err;
207
- }
208
-
209
- e.request = '...';
210
- e.connection = '...';
211
-
212
- throw e;
213
- }
214
-
215
- }
package/libs/Reporter.ts DELETED
@@ -1,181 +0,0 @@
1
-
2
- const ENV = process.env;
3
- ENV.NTBA_FIX_319='true';
4
-
5
- import './prototype';
6
-
7
- import TelegramBot from 'node-telegram-bot-api';
8
-
9
- import { log } from '../libs/helpers';
10
- import { Project } from './Project';
11
-
12
- // ------------
13
-
14
- type PipelineTypes = 'build' | 'deploy' | 'setup';
15
-
16
- // ------------------------
17
-
18
- export interface ReporterOptions {
19
- chat_id: number;
20
- chat_rel?: number;
21
-
22
- token: string;
23
-
24
- showGroup?: boolean;
25
- shortVersion?: boolean;
26
- showBuild?: boolean;
27
-
28
- preTitle?: string;
29
- postTitle?: string;
30
- }
31
-
32
- // ------------------------
33
-
34
- export class Reporter {
35
-
36
- $bot;
37
- $chat_id = 0;
38
- $message_id = 0;
39
- $message_text = '';
40
-
41
- title = '';
42
- stage: string | undefined;
43
-
44
- $prj: Project;
45
- $chat_rel = 0;
46
- $opt: ReporterOptions;
47
- $ver = '';
48
-
49
- // --------------
50
-
51
- constructor(prj: Project, opt: ReporterOptions){
52
- this.$prj = prj;
53
- this.$chat_id = opt.chat_id;
54
- this.$opt = opt;
55
-
56
- this.$bot = new TelegramBot(opt.token);
57
-
58
- if(opt.chat_rel){
59
- this.$chat_rel = opt.chat_rel;
60
- }
61
- this.updateTitle();
62
- }
63
-
64
- // --------------
65
- updateTitle(){
66
-
67
- this.title = this.$opt.preTitle ? this.$opt.preTitle + ' ' : '';
68
-
69
- this.title += this.$opt.showGroup ? this.$prj.group.toUpperCase() + ': ': '';
70
- this.title += this.$prj.name.toUpperCase();
71
-
72
- this.title += this.$opt.postTitle ? ' ' + this.$opt.postTitle : '';
73
-
74
- if(this.$opt.shortVersion){
75
- this.$ver= `v${ this.$prj.shortVersion } #${ this.$prj.build }`;
76
- }else{
77
- this.$ver= `v${ this.$prj.version }`;
78
- }
79
-
80
- this.title += ' ' + this.$ver;
81
- }
82
- // --------------
83
-
84
- async startBuild(){
85
- this.updateTitle();
86
- await this.send(`📦 ${ this.title } <a href="${ this.$prj.job.url }">BUILD</a> [${this.$prj.job.user.name}]`);
87
- }
88
-
89
- async startDeploy(to: string){
90
- await this.send(`🚀 ${ this.title } <a href="${ this.$prj.job.url }">DEPLOY</a>: <b>${ to.toUpperCase() }</b> [${this.$prj.job.user.name}]`);
91
- }
92
-
93
- async deploy(to: string){
94
- await this.send(`\n\n🚀 <a href="${ this.$prj.job.url }">DEPLOY</a>: <b>${ to.toUpperCase() }</b>`);
95
- }
96
-
97
- // --------------
98
-
99
- async fail(err: Error){
100
- let msg = '\n';
101
- if(this.$message_id === 0){
102
- msg = `${ this.$prj.group.toUpperCase() }: <b>${ this.$prj.name.toUpperCase() } v${ this.$prj.version }</b>\n`;
103
- }
104
- msg += `‼️ <b><a href="${ this.$prj.job.url }">FAIL</a></b>\n${ htmlEntities(err.stack || err.message) }`;
105
- await this.send(msg, ' ');
106
- }
107
-
108
- // --------------
109
-
110
- async release(changelog: string){
111
- await this.send(`\n✅ RELEASED: <b>${ this.$ver }</b> ${ this.stage ? `to ${ this.stage }` : '' }`, ' ');
112
-
113
-
114
- let msg = `🎉 ${ this.title } ${ this.stage ? ` [ ${ this.stage } ]` : `` }`;
115
-
116
- if(changelog.length > 0){
117
- msg += `
118
- ---------------------
119
- ${ changelog }`;
120
- }
121
-
122
- if(this.$chat_rel !== 0){
123
- // Дублируем сообщение в другой чат если указан
124
- await this.send(msg, '', this.$chat_rel);
125
- } else if(changelog.length > 0){
126
- await this.send(msg, '', this.$chat_id);
127
- }
128
-
129
- }
130
-
131
- // --------------
132
-
133
- async send(text: string, appendExist = '...', chat_id_opt = this.$chat_id){
134
-
135
- const chat_id = chat_id_opt;
136
- const message_id = this.$message_id;
137
-
138
- try {
139
- if(message_id && message_id !== 0 && appendExist){
140
-
141
- let fullMsg = this.$message_text + '\n' + text;
142
- fullMsg = fullMsg.length < 4090 ? fullMsg : fullMsg.slice(0, 4090);
143
-
144
- await this.$bot.editMessageText(fullMsg + '\n' + appendExist, {
145
- chat_id, message_id, parse_mode:'HTML', disable_web_page_preview: true,
146
- });
147
-
148
- this.$message_text = fullMsg;
149
- return this.$message_id;
150
- }
151
-
152
- text = text.length < 4090 ? text : text.slice(0, 4090);
153
-
154
- const res = await this.$bot.sendMessage(chat_id, appendExist && appendExist.length > 0 ? text + '\n' + appendExist : text, { parse_mode: 'HTML', disable_web_page_preview: true });
155
-
156
- if(appendExist){
157
- this.$message_id = res.message_id;
158
- this.$message_text = text;
159
- }
160
-
161
- return res.message_id;
162
-
163
- } catch (err) {
164
- err.message = 'ERROR Sending message\n' + err.message;
165
- log.error(err.message);
166
- log.error(err, { chat_id, message_id, text });
167
- return 0;
168
- }
169
-
170
- }
171
-
172
- }
173
-
174
- // -------------
175
- // Helpers:
176
-
177
- function htmlEntities(rawStr: string){
178
- return rawStr.replace(/[\u00A0-\u9999<>\&]/g, function(i) {
179
- return '&#'+i.charCodeAt(0)+';';
180
- });
181
- }
package/libs/Shell.ts DELETED
@@ -1,119 +0,0 @@
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
- };
package/libs/helpers.ts DELETED
@@ -1,114 +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
- 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
- // ------------------