@sasjs/utils 3.6.6 → 3.7.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/logger/logger.d.ts +9 -2
- package/logger/logger.js +25 -39
- package/logger/logger.js.map +1 -1
- package/package.json +24 -7
- package/types/target.js +4 -7
- package/types/target.js.map +1 -1
- package/utils/base64.js +10 -6
- package/utils/base64.js.map +1 -1
- package/.all-contributorsrc +0 -114
- package/.git-hooks/commit-msg +0 -18
- package/.git-hooks/pre-commit +0 -27
- package/.gitattributes +0 -1
- package/.github/workflows/dependency-staleness.yml +0 -46
- package/.github/workflows/publish.yml +0 -98
- package/.github/workflows/run-tests-windows.yml +0 -39
- package/.github/workflows/run-tests.yml +0 -45
- package/.pre-commit-config.yaml +0 -24
- package/.prettierrc +0 -7
- package/.vscode/extensions.json +0 -6
- package/CONTRIBUTING.md +0 -23
- package/PULL_REQUEST_TEMPLATE.md +0 -22
- package/checkNodeVersion.js +0 -16
- package/scripts/copySASjsCore.ts +0 -36
- package/updateCli +0 -3
- package/updateServer +0 -3
package/logger/logger.d.ts
CHANGED
|
@@ -11,9 +11,16 @@ export declare class Logger {
|
|
|
11
11
|
warn: (message: string, ...args: any) => void;
|
|
12
12
|
error: (message: string, ...args: any) => void;
|
|
13
13
|
log: (message: string, ...args: any) => void;
|
|
14
|
+
/**
|
|
15
|
+
* Prints rows as aligned columns, separated by two spaces. When `head` is
|
|
16
|
+
* given it is printed first, underlined with dashes.
|
|
17
|
+
*
|
|
18
|
+
* Cells may carry colour codes, which occupy no screen columns, so column
|
|
19
|
+
* widths are measured on the text with the codes removed.
|
|
20
|
+
*/
|
|
14
21
|
table: (data: string[][], options?: {
|
|
15
|
-
chars?: {} | undefined;
|
|
16
22
|
head?: string[] | undefined;
|
|
17
|
-
} | undefined
|
|
23
|
+
} | undefined) => void;
|
|
24
|
+
private visibleLength;
|
|
18
25
|
private filterArgs;
|
|
19
26
|
}
|
package/logger/logger.js
CHANGED
|
@@ -8,8 +8,6 @@ const consola_1 = require("consola");
|
|
|
8
8
|
const isLowerThanOrEqualTo_1 = require("./isLowerThanOrEqualTo");
|
|
9
9
|
const isNullOrUndefined_1 = require("./isNullOrUndefined");
|
|
10
10
|
const logLevel_1 = require("./logLevel");
|
|
11
|
-
const formatter_1 = require("../formatter");
|
|
12
|
-
const cli_table_1 = __importDefault(require("cli-table"));
|
|
13
11
|
const chalk_1 = __importDefault(require("chalk"));
|
|
14
12
|
class Logger {
|
|
15
13
|
constructor(logLevel) {
|
|
@@ -47,45 +45,30 @@ class Logger {
|
|
|
47
45
|
this.log = (message, ...args) => {
|
|
48
46
|
consola_1.consola.log(message, ...this.filterArgs(args));
|
|
49
47
|
};
|
|
50
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Prints rows as aligned columns, separated by two spaces. When `head` is
|
|
50
|
+
* given it is printed first, underlined with dashes.
|
|
51
|
+
*
|
|
52
|
+
* Cells may carry colour codes, which occupy no screen columns, so column
|
|
53
|
+
* widths are measured on the text with the codes removed.
|
|
54
|
+
*/
|
|
55
|
+
this.table = (data, options) => {
|
|
51
56
|
var _a;
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
'mid-mid': '┼',
|
|
66
|
-
right: '║',
|
|
67
|
-
'right-mid': '╢',
|
|
68
|
-
middle: '│'
|
|
69
|
-
},
|
|
70
|
-
head: []
|
|
71
|
-
};
|
|
72
|
-
let table;
|
|
73
|
-
if (options && Object.keys(options).length) {
|
|
74
|
-
table = new cli_table_1.default({
|
|
75
|
-
chars: options.chars || defaultOptions.chars,
|
|
76
|
-
head: ((_a = options.head) === null || _a === void 0 ? void 0 : _a.map((header) => chalk_1.default.white.bold(header))) ||
|
|
77
|
-
defaultOptions.head
|
|
78
|
-
});
|
|
57
|
+
const head = (_a = options === null || options === void 0 ? void 0 : options.head) === null || _a === void 0 ? void 0 : _a.map((header) => chalk_1.default.white.bold(header));
|
|
58
|
+
const rows = (head === null || head === void 0 ? void 0 : head.length) ? [head, ...data] : data;
|
|
59
|
+
const widths = [];
|
|
60
|
+
rows.forEach((row) => row.forEach((cell, column) => {
|
|
61
|
+
widths[column] = Math.max(widths[column] || 0, this.visibleLength(cell));
|
|
62
|
+
}));
|
|
63
|
+
const lines = rows.map((row) => row
|
|
64
|
+
.map((cell, column) => cell +
|
|
65
|
+
' '.repeat(Math.max(0, widths[column] - this.visibleLength(cell))))
|
|
66
|
+
.join(' ')
|
|
67
|
+
.trimEnd());
|
|
68
|
+
if (head === null || head === void 0 ? void 0 : head.length) {
|
|
69
|
+
lines.splice(1, 0, widths.map((width) => '-'.repeat(width)).join(' '));
|
|
79
70
|
}
|
|
80
|
-
|
|
81
|
-
table = new cli_table_1.default({
|
|
82
|
-
chars: defaultOptions.chars
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
data.forEach((item) => table.push(item));
|
|
86
|
-
this.log((disableStyling
|
|
87
|
-
? (0, formatter_1.sanitizeSpecialChars)(table.toString())
|
|
88
|
-
: table.toString()) + '\n');
|
|
71
|
+
this.log(lines.join('\n') + '\n');
|
|
89
72
|
};
|
|
90
73
|
if (!(0, isNullOrUndefined_1.isNullOrUndefined)(logLevel) && logLevel in logLevel_1.LogLevel) {
|
|
91
74
|
this._logLevel = logLevel;
|
|
@@ -97,6 +80,9 @@ class Logger {
|
|
|
97
80
|
set logLevel(value) {
|
|
98
81
|
this._logLevel = value;
|
|
99
82
|
}
|
|
83
|
+
visibleLength(value) {
|
|
84
|
+
return String(value).replace(/\u001b\[[0-9;]*m/g, '').length;
|
|
85
|
+
}
|
|
100
86
|
filterArgs(args) {
|
|
101
87
|
return args.filter((arg) => (arg ? arg : false));
|
|
102
88
|
}
|
package/logger/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logger/logger.ts"],"names":[],"mappings":";;;;;;AAAA,qCAAiC;AACjC,iEAA6D;AAC7D,2DAAuD;AACvD,yCAAqC;AACrC,
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logger/logger.ts"],"names":[],"mappings":";;;;;;AAAA,qCAAiC;AACjC,iEAA6D;AAC7D,2DAAuD;AACvD,yCAAqC;AACrC,kDAAyB;AAEzB,MAAa,MAAM;IACjB,YAAY,QAAmB;QAcvB,cAAS,GAAa,mBAAQ,CAAC,KAAK,CAAA;QAE5C,UAAK,GAAG,CAAC,OAAe,EAAE,GAAG,IAAS,EAAQ,EAAE;YAC9C,IAAI,IAAA,2CAAoB,EAAC,IAAI,CAAC,SAAS,EAAE,mBAAQ,CAAC,KAAK,CAAC,EAAE;gBACxD,iBAAO,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAA;aACjD;QACH,CAAC,CAAA;QAED,UAAK,GAAG,CAAC,OAAe,EAAE,GAAG,IAAS,EAAQ,EAAE;YAC9C,IAAI,IAAA,2CAAoB,EAAC,IAAI,CAAC,SAAS,EAAE,mBAAQ,CAAC,KAAK,CAAC,EAAE;gBACxD,iBAAO,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAA;aACjD;QACH,CAAC,CAAA;QAED,SAAI,GAAG,CAAC,OAAe,EAAE,GAAG,IAAS,EAAQ,EAAE;YAC7C,IAAI,IAAA,2CAAoB,EAAC,IAAI,CAAC,SAAS,EAAE,mBAAQ,CAAC,IAAI,CAAC,EAAE;gBACvD,iBAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAA;aAChD;QACH,CAAC,CAAA;QAED,YAAO,GAAG,CAAC,OAAe,EAAE,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A,qCAAiB,EAAC,QAAQ,CAAC,IAAI,QAAS,IAAI,mBAAQ,EAAE;YACzD,IAAI,CAAC,SAAS,GAAG,QAAoB,CAAA;SACtC;IACH,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,SAAS,CAAA;IACvB,CAAC;IAED,IAAI,QAAQ,CAAC,KAAe;QAC1B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAA;IACxB,CAAC;IAkFO,aAAa,CAAC,KAAa;QACjC,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC,MAAM,CAAA;IAC9D,CAAC;IAEO,UAAU,CAAC,IAAW;QAC5B,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAA;IACvD,CAAC;CACF;AAtGD,wBAsGC"}
|
package/package.json
CHANGED
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=22"
|
|
9
|
+
},
|
|
7
10
|
"release": {
|
|
8
11
|
"branches": [
|
|
9
12
|
"main"
|
|
@@ -30,6 +33,26 @@
|
|
|
30
33
|
]
|
|
31
34
|
},
|
|
32
35
|
"typings": "./index.d.ts",
|
|
36
|
+
"files": [
|
|
37
|
+
"index.js",
|
|
38
|
+
"index.js.map",
|
|
39
|
+
"*.d.ts",
|
|
40
|
+
"auth/**",
|
|
41
|
+
"compileTree/**",
|
|
42
|
+
"conversion/**",
|
|
43
|
+
"error/**",
|
|
44
|
+
"file/**",
|
|
45
|
+
"formatter/**",
|
|
46
|
+
"fs/**",
|
|
47
|
+
"input/**",
|
|
48
|
+
"logger/**",
|
|
49
|
+
"macros/**",
|
|
50
|
+
"sasjsCli/**",
|
|
51
|
+
"time/**",
|
|
52
|
+
"types/**",
|
|
53
|
+
"utils/**",
|
|
54
|
+
"README.md"
|
|
55
|
+
],
|
|
33
56
|
"scripts": {
|
|
34
57
|
"nodeVersionMessage": "echo \u001b[33m make sure you are running node lts version \u001b[0m",
|
|
35
58
|
"build": "npm run nodeVersionMessage && npx rimraf build && tsc && npm run copy:macros",
|
|
@@ -39,7 +62,6 @@
|
|
|
39
62
|
"test": "jest --config=jest.config.js --coverage",
|
|
40
63
|
"lint:fix": "npx prettier --write \"{src,test}/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}\"",
|
|
41
64
|
"lint": "npx prettier --check \"{src,test}/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}\"",
|
|
42
|
-
"semantic-release": "semantic-release",
|
|
43
65
|
"setup": "git config core.hooksPath ./.git-hooks"
|
|
44
66
|
},
|
|
45
67
|
"repository": {
|
|
@@ -54,14 +76,10 @@
|
|
|
54
76
|
"homepage": "https://github.com/sasjs/utils#readme",
|
|
55
77
|
"devDependencies": {
|
|
56
78
|
"@sasjs/core": "5.3.0",
|
|
57
|
-
"@semantic-release/exec": "6.0.3",
|
|
58
|
-
"@semantic-release/git": "10.0.1",
|
|
59
|
-
"@types/cli-table": "0.3.4",
|
|
60
79
|
"@types/jest": "29.4.0",
|
|
61
80
|
"babel-jest": "29.4.3",
|
|
62
81
|
"jest": "29.4.3",
|
|
63
82
|
"jest-extended": "3.2.4",
|
|
64
|
-
"semantic-release": "25.0.9",
|
|
65
83
|
"ts-jest": "29.4.14",
|
|
66
84
|
"ts-node": "10.9.2",
|
|
67
85
|
"typescript": "4.5.4",
|
|
@@ -72,11 +90,10 @@
|
|
|
72
90
|
"@types/fs-extra": "11.0.4",
|
|
73
91
|
"@types/prompts": "2.4.9",
|
|
74
92
|
"chalk": "4.1.1",
|
|
75
|
-
"cli-table": "0.3.11",
|
|
76
93
|
"consola": "3.4.2",
|
|
77
94
|
"fs-extra": "11.4.1",
|
|
78
95
|
"jwt-decode": "4.0.0",
|
|
79
96
|
"prompts": "2.4.2"
|
|
80
97
|
},
|
|
81
|
-
"version": "3.
|
|
98
|
+
"version": "3.7.1"
|
|
82
99
|
}
|
package/types/target.js
CHANGED
|
@@ -40,12 +40,9 @@ class Target {
|
|
|
40
40
|
if (json.deployConfig) {
|
|
41
41
|
this._deployConfig = (0, targetValidators_1.validateDeployConfig)(this.getConfig(config_1.ConfigTypes.Deploy, json));
|
|
42
42
|
}
|
|
43
|
-
else
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
deployScripts: []
|
|
47
|
-
});
|
|
48
|
-
}
|
|
43
|
+
// No else: a target that declares no deployConfig has none. Inserting a
|
|
44
|
+
// default here put `deployConfig` into every saved sasjsconfig - see
|
|
45
|
+
// sasjs/utils#221.
|
|
49
46
|
if (json.serviceConfig) {
|
|
50
47
|
this._serviceConfig = (0, targetValidators_1.validateServiceConfig)(this.getConfig(config_1.ConfigTypes.Service, json));
|
|
51
48
|
}
|
|
@@ -153,7 +150,7 @@ class Target {
|
|
|
153
150
|
get sasjsResultsFolder() {
|
|
154
151
|
return this._sasjsResultsFolder;
|
|
155
152
|
}
|
|
156
|
-
toJson(withDefaults =
|
|
153
|
+
toJson(withDefaults = false) {
|
|
157
154
|
var _a, _b, _c;
|
|
158
155
|
const json = {
|
|
159
156
|
name: this.name,
|
package/types/target.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"target.js","sourceRoot":"","sources":["../../src/types/target.ts"],"names":[],"mappings":";;;AAAA,qCAYiB;AACjB,6CAAyC;AAEzC,yDAwB2B;AA8B3B,MAAa,MAAM;IA2HjB,YAAY,IAAS,EAAE,SAAwB,EAAE;QA3GzC,gBAAW,GAAG,uBAAU,CAAC,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"target.js","sourceRoot":"","sources":["../../src/types/target.ts"],"names":[],"mappings":";;;AAAA,qCAYiB;AACjB,6CAAyC;AAEzC,yDAwB2B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EAAE;gBACf,WAAW,EAAE,EAAE;gBACf,SAAS,EAAE,EAAE;aACd,CAAA;QAEH,IAAI,IAAI,CAAC,YAAY,EAAE;YACrB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAA;SACtC;aAAM,IAAI,YAAY;YACrB,IAAI,CAAC,YAAY,GAAG;gBAClB,eAAe,EAAE,EAAE;gBACnB,SAAS,EAAE,KAAK;gBAChB,aAAa,EAAE,EAAE;gBACjB,iBAAiB,EAAE,EAAE;gBACrB,UAAU,EAAE,EAAE;aACf,CAAA;QAEH,IAAI,IAAI,CAAC,UAAU,EAAE;YACnB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAA;SAClC;aAAM,IAAI,YAAY;YACrB,IAAI,CAAC,UAAU,GAAG;gBAChB,WAAW,EAAE,EAAE;gBACf,WAAW,EAAE,EAAE;gBACf,SAAS,EAAE,EAAE;gBACb,SAAS,EAAE,EAAE;gBACb,YAAY,EAAE,EAAE;aACjB,CAAA;QAEH,IAAI,IAAI,CAAC,UAAU,KAAK,uBAAU,CAAC,OAAO,EAAE;YAC1C,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAA;SACpC;aAAM,IAAI,IAAI,CAAC,UAAU,KAAK,uBAAU,CAAC,IAAI,EAAE;YAC9C,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAA;YACjC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAA;SAC1C;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AA3VD,wBA2VC"}
|
package/utils/base64.js
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.decodeFromBase64 = exports.encodeToBase64 = void 0;
|
|
7
|
-
const crypto_1 = __importDefault(require("crypto"));
|
|
8
4
|
const PREFIX = '{sasjs_encoded}';
|
|
5
|
+
const PREFIX_HEX_LENGTH = 200;
|
|
6
|
+
// The prefix is obfuscation, not encryption: decodeFromBase64 strips it by fixed
|
|
7
|
+
// offset (substring(200)), so its only jobs are to make an encoded value unique
|
|
8
|
+
// and to stop it reading as base64 of a password. The Web Crypto global is used
|
|
9
|
+
// directly rather than Node's `crypto` module, so webpack has nothing to alias
|
|
10
|
+
// to crypto-browserify and the browser bundle carries no crypto shim.
|
|
11
|
+
const randomHexPrefix = () => Array.from(crypto.getRandomValues(new Uint8Array(PREFIX_HEX_LENGTH / 2)))
|
|
12
|
+
.map((byte) => byte.toString(16).padStart(2, '0'))
|
|
13
|
+
.join('');
|
|
9
14
|
const encodeToBase64 = (str) => {
|
|
10
|
-
const
|
|
11
|
-
const encodedPassword = Buffer.from(randomString + str).toString('base64');
|
|
15
|
+
const encodedPassword = Buffer.from(randomHexPrefix() + str).toString('base64');
|
|
12
16
|
return PREFIX + encodedPassword;
|
|
13
17
|
};
|
|
14
18
|
exports.encodeToBase64 = encodeToBase64;
|
package/utils/base64.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base64.js","sourceRoot":"","sources":["../../src/utils/base64.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"base64.js","sourceRoot":"","sources":["../../src/utils/base64.ts"],"names":[],"mappings":";;;AAAA,MAAM,MAAM,GAAG,iBAAiB,CAAA;AAChC,MAAM,iBAAiB,GAAG,GAAG,CAAA;AAE7B,iFAAiF;AACjF,gFAAgF;AAChF,gFAAgF;AAChF,+EAA+E;AAC/E,sEAAsE;AACtE,MAAM,eAAe,GAAG,GAAW,EAAE,CACnC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,UAAU,CAAC,iBAAiB,GAAG,CAAC,CAAC,CAAC,CAAC;KACtE,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;KACjD,IAAI,CAAC,EAAE,CAAC,CAAA;AAEN,MAAM,cAAc,GAAG,CAAC,GAAW,EAAE,EAAE;IAC5C,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CAAC,eAAe,EAAE,GAAG,GAAG,CAAC,CAAC,QAAQ,CACnE,QAAQ,CACT,CAAA;IACD,OAAO,MAAM,GAAG,eAAe,CAAA;AACjC,CAAC,CAAA;AALY,QAAA,cAAc,kBAK1B;AACM,MAAM,gBAAgB,GAAG,CAAC,GAAW,EAAE,EAAE;IAC9C,IAAI,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;QAC1B,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAA;QACzC,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAA;QAC7D,OAAO,eAAe,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;KACtC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAPY,QAAA,gBAAgB,oBAO5B"}
|
package/.all-contributorsrc
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"files": [
|
|
3
|
-
"README.md"
|
|
4
|
-
],
|
|
5
|
-
"imageSize": 100,
|
|
6
|
-
"commit": false,
|
|
7
|
-
"contributors": [
|
|
8
|
-
{
|
|
9
|
-
"login": "saadjutt01",
|
|
10
|
-
"name": "Muhammad Saad ",
|
|
11
|
-
"avatar_url": "https://avatars.githubusercontent.com/u/8914650?v=4",
|
|
12
|
-
"profile": "https://github.com/saadjutt01",
|
|
13
|
-
"contributions": [
|
|
14
|
-
"code",
|
|
15
|
-
"test",
|
|
16
|
-
"review",
|
|
17
|
-
"mentoring",
|
|
18
|
-
"doc"
|
|
19
|
-
]
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
"login": "YuryShkoda",
|
|
23
|
-
"name": "Yury Shkoda",
|
|
24
|
-
"avatar_url": "https://avatars.githubusercontent.com/u/25773492?v=4",
|
|
25
|
-
"profile": "https://www.erudicat.com",
|
|
26
|
-
"contributions": [
|
|
27
|
-
"code",
|
|
28
|
-
"projectManagement",
|
|
29
|
-
"test",
|
|
30
|
-
"video",
|
|
31
|
-
"doc"
|
|
32
|
-
]
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"login": "krishna-acondy",
|
|
36
|
-
"name": "Krishna Acondy",
|
|
37
|
-
"avatar_url": "https://avatars.githubusercontent.com/u/2980428?v=4",
|
|
38
|
-
"profile": "https://krishna-acondy.io/",
|
|
39
|
-
"contributions": [
|
|
40
|
-
"code",
|
|
41
|
-
"test",
|
|
42
|
-
"infra",
|
|
43
|
-
"content",
|
|
44
|
-
"maintenance",
|
|
45
|
-
"platform",
|
|
46
|
-
"review"
|
|
47
|
-
]
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"login": "medjedovicm",
|
|
51
|
-
"name": "Mihajlo Medjedovic",
|
|
52
|
-
"avatar_url": "https://avatars.githubusercontent.com/u/18329105?v=4",
|
|
53
|
-
"profile": "https://github.com/medjedovicm",
|
|
54
|
-
"contributions": [
|
|
55
|
-
"code",
|
|
56
|
-
"infra",
|
|
57
|
-
"test",
|
|
58
|
-
"review"
|
|
59
|
-
]
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
"login": "allanbowe",
|
|
63
|
-
"name": "Allan Bowe",
|
|
64
|
-
"avatar_url": "https://avatars.githubusercontent.com/u/4420615?v=4",
|
|
65
|
-
"profile": "https://github.com/allanbowe",
|
|
66
|
-
"contributions": [
|
|
67
|
-
"code",
|
|
68
|
-
"review",
|
|
69
|
-
"test",
|
|
70
|
-
"video",
|
|
71
|
-
"doc"
|
|
72
|
-
]
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
"login": "sabhas",
|
|
76
|
-
"name": "Sabir Hassan",
|
|
77
|
-
"avatar_url": "https://avatars.githubusercontent.com/u/82647447?v=4",
|
|
78
|
-
"profile": "https://github.com/sabhas",
|
|
79
|
-
"contributions": [
|
|
80
|
-
"code",
|
|
81
|
-
"review",
|
|
82
|
-
"test",
|
|
83
|
-
"ideas"
|
|
84
|
-
]
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
"login": "VladislavParhomchik",
|
|
88
|
-
"name": "VladislavParhomchik",
|
|
89
|
-
"avatar_url": "https://avatars.githubusercontent.com/u/83717836?v=4",
|
|
90
|
-
"profile": "https://github.com/VladislavParhomchik",
|
|
91
|
-
"contributions": [
|
|
92
|
-
"test",
|
|
93
|
-
"review"
|
|
94
|
-
]
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
"login": "glM26",
|
|
98
|
-
"name": "glM26",
|
|
99
|
-
"avatar_url": "https://avatars.githubusercontent.com/u/35031631?v=4",
|
|
100
|
-
"profile": "https://github.com/glM26",
|
|
101
|
-
"contributions": [
|
|
102
|
-
"code"
|
|
103
|
-
]
|
|
104
|
-
}
|
|
105
|
-
],
|
|
106
|
-
"contributorsPerLine": 7,
|
|
107
|
-
"projectName": "utils",
|
|
108
|
-
"projectOwner": "sasjs",
|
|
109
|
-
"repoType": "github",
|
|
110
|
-
"repoHost": "https://github.com",
|
|
111
|
-
"skipCi": true,
|
|
112
|
-
"commitType": "docs",
|
|
113
|
-
"commitConvention": "angular"
|
|
114
|
-
}
|
package/.git-hooks/commit-msg
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
RED="\033[1;31m"
|
|
3
|
-
GREEN="\033[1;32m"
|
|
4
|
-
|
|
5
|
-
# Get the commit message (the parameter we're given is just the path to the
|
|
6
|
-
# temporary file which holds the message).
|
|
7
|
-
commit_message=$(cat "$1")
|
|
8
|
-
|
|
9
|
-
if (echo "$commit_message" | grep -Eq "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\([a-z0-9 \-]+\))?!?: .+$") then
|
|
10
|
-
echo "${GREEN} ✔ Commit message meets Conventional Commit standards"
|
|
11
|
-
exit 0
|
|
12
|
-
fi
|
|
13
|
-
|
|
14
|
-
echo "${RED}❌ Commit message does not meet the Conventional Commit standard!"
|
|
15
|
-
echo "An example of a valid message is:"
|
|
16
|
-
echo " feat(login): add the 'remember me' button"
|
|
17
|
-
echo "ℹ More details at: https://www.conventionalcommits.org/en/v1.0.0/#summary"
|
|
18
|
-
exit 1
|
package/.git-hooks/pre-commit
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# Scan staged changes for secrets before anything else runs.
|
|
4
|
-
# The binary is pinned by the @nogoo9/gitleaks devDependency and lands
|
|
5
|
-
# in node_modules/.bin after npm i. Commits are blocked until it is
|
|
6
|
-
# installed so no clone silently skips the secrets scan.
|
|
7
|
-
gitleaks_bin=node_modules/.bin/gitleaks
|
|
8
|
-
|
|
9
|
-
if [ ! -x "$gitleaks_bin" ]; then
|
|
10
|
-
echo "❌ gitleaks not found - run 'npm i' to install it"
|
|
11
|
-
exit 1
|
|
12
|
-
fi
|
|
13
|
-
|
|
14
|
-
if ! "$gitleaks_bin" protect --staged --redact; then
|
|
15
|
-
echo "❌ gitleaks detected a potential secret in your staged changes"
|
|
16
|
-
echo "Remove the secret, or add a .gitleaksignore entry if it is a false positive"
|
|
17
|
-
exit 1
|
|
18
|
-
fi
|
|
19
|
-
|
|
20
|
-
# Avoid commits to the main branch
|
|
21
|
-
BRANCH=`git rev-parse --abbrev-ref HEAD`
|
|
22
|
-
|
|
23
|
-
if [[ "$BRANCH" =~ ^(master|main|develop)$ ]]; then
|
|
24
|
-
echo "You are on branch $BRANCH. Are you sure you want to commit to this branch?"
|
|
25
|
-
echo "If so, commit with -n to bypass the pre-commit hook."
|
|
26
|
-
exit 1
|
|
27
|
-
fi
|
package/.gitattributes
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
* text=auto eol=lf
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
name: Dependency Staleness
|
|
2
|
-
|
|
3
|
-
# Dependabot is not enabled on this repo, so nothing surfaces stale
|
|
4
|
-
# dependencies. The audit gate in the test workflow only fails on
|
|
5
|
-
# known-vulnerable packages; it says nothing about being behind. This runs
|
|
6
|
-
# weekly and writes the outdated direct dependencies to the run summary.
|
|
7
|
-
#
|
|
8
|
-
# It deliberately exits 0 either way. A scheduled job that goes red every week
|
|
9
|
-
# trains people to ignore red; the summary is the signal, and a human decides
|
|
10
|
-
# whether to bump.
|
|
11
|
-
|
|
12
|
-
on:
|
|
13
|
-
schedule:
|
|
14
|
-
- cron: '0 8 * * 1' # Mondays, 08:00 UTC
|
|
15
|
-
workflow_dispatch:
|
|
16
|
-
|
|
17
|
-
jobs:
|
|
18
|
-
report:
|
|
19
|
-
runs-on: ubuntu-latest
|
|
20
|
-
permissions:
|
|
21
|
-
contents: read
|
|
22
|
-
|
|
23
|
-
steps:
|
|
24
|
-
- uses: actions/checkout@v4
|
|
25
|
-
|
|
26
|
-
- name: Use Node.js
|
|
27
|
-
uses: actions/setup-node@v4
|
|
28
|
-
with:
|
|
29
|
-
node-version: 22
|
|
30
|
-
|
|
31
|
-
- name: Install Dependencies
|
|
32
|
-
run: npm ci
|
|
33
|
-
|
|
34
|
-
- name: Report outdated direct dependencies
|
|
35
|
-
run: |
|
|
36
|
-
{
|
|
37
|
-
echo '## Outdated direct dependencies'
|
|
38
|
-
echo
|
|
39
|
-
echo 'Direct dependencies whose latest published version differs from'
|
|
40
|
-
echo 'the pinned one. Dependabot is disabled on this repo, so this is'
|
|
41
|
-
echo 'the substitute - review it and bump deliberately.'
|
|
42
|
-
echo
|
|
43
|
-
echo '```'
|
|
44
|
-
npm outdated --depth=0 || true
|
|
45
|
-
echo '```'
|
|
46
|
-
} >> "$GITHUB_STEP_SUMMARY"
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
2
|
-
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
|
|
3
|
-
|
|
4
|
-
name: SASjs Build and Publish
|
|
5
|
-
|
|
6
|
-
on:
|
|
7
|
-
push:
|
|
8
|
-
branches:
|
|
9
|
-
- main
|
|
10
|
-
|
|
11
|
-
jobs:
|
|
12
|
-
build:
|
|
13
|
-
runs-on: ubuntu-latest
|
|
14
|
-
permissions:
|
|
15
|
-
contents: write
|
|
16
|
-
id-token: write # required for npm provenance (trusted publisher)
|
|
17
|
-
issues: write # optional: lets @semantic-release/github comment on issues
|
|
18
|
-
pull-requests: write # optional: lets @semantic-release/github comment on PRs
|
|
19
|
-
|
|
20
|
-
strategy:
|
|
21
|
-
matrix:
|
|
22
|
-
node-version: [22]
|
|
23
|
-
|
|
24
|
-
steps:
|
|
25
|
-
# Mint a short-lived GitHub App token (bypass-capable)
|
|
26
|
-
- name: Generate token
|
|
27
|
-
id: app-token
|
|
28
|
-
uses: actions/create-github-app-token@v1
|
|
29
|
-
with:
|
|
30
|
-
app-id: ${{ secrets.APP_ID }}
|
|
31
|
-
private-key: ${{ secrets.APP_PRIVATE_KEY }}
|
|
32
|
-
|
|
33
|
-
# Checkout using the app token so the release commit can be pushed
|
|
34
|
-
- uses: actions/checkout@v4
|
|
35
|
-
with:
|
|
36
|
-
token: ${{ steps.app-token.outputs.token }}
|
|
37
|
-
persist-credentials: true
|
|
38
|
-
fetch-depth: 0 # semantic-release needs full history + tags
|
|
39
|
-
|
|
40
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
|
41
|
-
uses: actions/setup-node@v4
|
|
42
|
-
with:
|
|
43
|
-
node-version: ${{ matrix.node-version }}
|
|
44
|
-
registry-url: https://registry.npmjs.org
|
|
45
|
-
|
|
46
|
-
# Node 22 ships npm 10.x — OIDC trusted publishing needs npm >= 11.5.1
|
|
47
|
-
- name: Update npm
|
|
48
|
-
run: npm install -g npm@latest
|
|
49
|
-
|
|
50
|
-
# Restore npm cache manually
|
|
51
|
-
- name: Restore npm cache
|
|
52
|
-
uses: actions/cache@v4
|
|
53
|
-
id: npm-cache
|
|
54
|
-
with:
|
|
55
|
-
path: ~/.npm
|
|
56
|
-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
57
|
-
restore-keys: |
|
|
58
|
-
${{ runner.os }}-node-
|
|
59
|
-
|
|
60
|
-
- name: Install Dependencies
|
|
61
|
-
run: npm ci
|
|
62
|
-
|
|
63
|
-
- name: Check code style
|
|
64
|
-
run: npm run lint
|
|
65
|
-
|
|
66
|
-
- name: Build Project
|
|
67
|
-
run: npm run build
|
|
68
|
-
|
|
69
|
-
- name: Clean up ready for publishing
|
|
70
|
-
run: npm run publishInit
|
|
71
|
-
|
|
72
|
-
- name: Semantic Release
|
|
73
|
-
run: npx semantic-release
|
|
74
|
-
env:
|
|
75
|
-
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} # <-- app token, not secrets.GITHUB_TOKEN
|
|
76
|
-
|
|
77
|
-
# semantic-release only releases when it finds a releasable commit, and the
|
|
78
|
-
# angular convention this repo is configured with does not treat `chore:` or
|
|
79
|
-
# `docs:` as one. This step ran on `if: success()` regardless, so a merge with
|
|
80
|
-
# no releasable commit published the version already in package.json, which
|
|
81
|
-
# npm rejects with "You cannot publish over the previously published
|
|
82
|
-
# versions". Compare against the registry instead, and publish only when
|
|
83
|
-
# there is something new.
|
|
84
|
-
- name: Publish to npm with trusted publisher
|
|
85
|
-
id: publish
|
|
86
|
-
if: success()
|
|
87
|
-
run: |
|
|
88
|
-
local_version=$(node -p "require('./package.json').version")
|
|
89
|
-
published_version=$(npm view @sasjs/utils version 2>/dev/null || echo "")
|
|
90
|
-
|
|
91
|
-
if [ "$local_version" = "$published_version" ]; then
|
|
92
|
-
echo "released=false" >> "$GITHUB_OUTPUT"
|
|
93
|
-
echo "Nothing to publish - $local_version is already on npm"
|
|
94
|
-
exit 0
|
|
95
|
-
fi
|
|
96
|
-
|
|
97
|
-
npm publish --access public
|
|
98
|
-
echo "released=true" >> "$GITHUB_OUTPUT"
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
|
|
2
|
-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
|
3
|
-
|
|
4
|
-
name: SASjs Utils Run Tests on Windows
|
|
5
|
-
|
|
6
|
-
on:
|
|
7
|
-
pull_request:
|
|
8
|
-
push:
|
|
9
|
-
branches:
|
|
10
|
-
- main
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
test:
|
|
14
|
-
runs-on: windows-latest
|
|
15
|
-
|
|
16
|
-
strategy:
|
|
17
|
-
matrix:
|
|
18
|
-
node-version: [22]
|
|
19
|
-
|
|
20
|
-
steps:
|
|
21
|
-
- uses: actions/checkout@v4
|
|
22
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
|
23
|
-
uses: actions/setup-node@v4
|
|
24
|
-
with:
|
|
25
|
-
node-version: ${{ matrix.node-version }}
|
|
26
|
-
|
|
27
|
-
- name: Install Dependencies
|
|
28
|
-
run: npm ci
|
|
29
|
-
|
|
30
|
-
- name: Check Code Style
|
|
31
|
-
run: npm run lint
|
|
32
|
-
|
|
33
|
-
- name: Run Unit Tests
|
|
34
|
-
run: npm test
|
|
35
|
-
|
|
36
|
-
- name: Build Package
|
|
37
|
-
run: npm run package:lib
|
|
38
|
-
env:
|
|
39
|
-
CI: true
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
|
|
2
|
-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
|
3
|
-
|
|
4
|
-
name: SASjs Utils Run Tests
|
|
5
|
-
|
|
6
|
-
on:
|
|
7
|
-
pull_request:
|
|
8
|
-
# Also run on main. Until this was added the workflow only ran on pull
|
|
9
|
-
# requests, so a failure that started on 19 Aug went unnoticed for six weeks -
|
|
10
|
-
# every PR was red and no branch was green, with nothing to compare against.
|
|
11
|
-
push:
|
|
12
|
-
branches:
|
|
13
|
-
- main
|
|
14
|
-
|
|
15
|
-
jobs:
|
|
16
|
-
test:
|
|
17
|
-
runs-on: ubuntu-latest
|
|
18
|
-
|
|
19
|
-
strategy:
|
|
20
|
-
matrix:
|
|
21
|
-
node-version: [22]
|
|
22
|
-
|
|
23
|
-
steps:
|
|
24
|
-
- uses: actions/checkout@v4
|
|
25
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
|
26
|
-
uses: actions/setup-node@v4
|
|
27
|
-
with:
|
|
28
|
-
node-version: ${{ matrix.node-version }}
|
|
29
|
-
|
|
30
|
-
- name: Check npm audit
|
|
31
|
-
run: npm audit --production --audit-level=low
|
|
32
|
-
|
|
33
|
-
- name: Install Dependencies
|
|
34
|
-
run: npm ci
|
|
35
|
-
|
|
36
|
-
- name: Check Code Style
|
|
37
|
-
run: npm run lint
|
|
38
|
-
|
|
39
|
-
- name: Run Unit Tests
|
|
40
|
-
run: npm test
|
|
41
|
-
|
|
42
|
-
- name: Build Package
|
|
43
|
-
run: npm run package:lib
|
|
44
|
-
env:
|
|
45
|
-
CI: true
|
package/.pre-commit-config.yaml
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# Hooks for the pre-commit framework - https://pre-commit.com
|
|
2
|
-
#
|
|
3
|
-
# The repo also ships native hooks in .git-hooks/: gitleaks on the staged
|
|
4
|
-
# content before the commit, and the Conventional Commits check on the message.
|
|
5
|
-
# `npm run setup` activates them by setting core.hooksPath - but .npmrc sets
|
|
6
|
-
# ignore-scripts=true, so no install step runs it, and a fresh clone commits
|
|
7
|
-
# unchecked until someone runs it by hand.
|
|
8
|
-
#
|
|
9
|
-
# This file is the standard route instead: install the framework once with
|
|
10
|
-
# `pre-commit install`, and both hooks run on every commit. gitleaks is pinned
|
|
11
|
-
# to an exact release tag, and the message hook calls the script the native
|
|
12
|
-
# hooks already use, so there is one implementation of the rules.
|
|
13
|
-
repos:
|
|
14
|
-
- repo: https://github.com/gitleaks/gitleaks
|
|
15
|
-
rev: v8.30.1
|
|
16
|
-
hooks:
|
|
17
|
-
- id: gitleaks
|
|
18
|
-
- repo: local
|
|
19
|
-
hooks:
|
|
20
|
-
- id: commit-msg
|
|
21
|
-
name: conventional commit
|
|
22
|
-
entry: .git-hooks/commit-msg
|
|
23
|
-
language: script
|
|
24
|
-
stages: [commit-msg]
|
package/.prettierrc
DELETED
package/.vscode/extensions.json
DELETED
package/CONTRIBUTING.md
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# Contributing to @sasjs/utils
|
|
2
|
-
|
|
3
|
-
## Developer Setup
|
|
4
|
-
|
|
5
|
-
To get started, clone the repo and install dependencies with `npm install`.
|
|
6
|
-
|
|
7
|
-
We use Prettier to maintain uniform code style. If you use VSCode, you can install the Prettier extension and enable automatic formatting of your code on save using the following settings in your configuration.
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
"editor.formatOnPaste": true,
|
|
11
|
-
"editor.formatOnSave": true
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
Alternately, you can run the `lint:fix` NPM script to format your code.
|
|
15
|
-
|
|
16
|
-
You can run the unit tests using the `test` script.
|
|
17
|
-
|
|
18
|
-
Unit tests and correctly formatted code are expected in each pull request, and are enforced by our CI checks.
|
|
19
|
-
|
|
20
|
-
# Local testing
|
|
21
|
-
|
|
22
|
-
You can create a tarball from your local code using the `package:lib` command.
|
|
23
|
-
The created tarball can then be installed in other projects for testing using `npm install <path-to-file>`.
|
package/PULL_REQUEST_TEMPLATE.md
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
## Issue
|
|
2
|
-
|
|
3
|
-
Link any related issue(s) in this section.
|
|
4
|
-
|
|
5
|
-
## Intent
|
|
6
|
-
|
|
7
|
-
What this PR intends to achieve.
|
|
8
|
-
|
|
9
|
-
## Implementation
|
|
10
|
-
|
|
11
|
-
What code changes have been made to achieve the intent.
|
|
12
|
-
|
|
13
|
-
## Checks
|
|
14
|
-
|
|
15
|
-
- [ ] Code is formatted correctly (`npm run lint:fix`).
|
|
16
|
-
- [ ] All unit tests are passing (`npm test`).
|
|
17
|
-
- [ ] All `sasjs-cli` unit tests are passing (`npm test`).
|
|
18
|
-
- [ ] Reviewer is assigned.
|
|
19
|
-
|
|
20
|
-
### Reviewer checks
|
|
21
|
-
|
|
22
|
-
- [ ] Any new code is documented.
|
package/checkNodeVersion.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
const result = process.versions
|
|
2
|
-
if (result && result.node) {
|
|
3
|
-
if (parseInt(result.node) < 20) {
|
|
4
|
-
console.log(
|
|
5
|
-
'\x1b[31m%s\x1b[0m',
|
|
6
|
-
`❌ Process failed due to Node Version,\nPlease install and use Node Version >= 20\nYour current Node Version is: ${result.node}`
|
|
7
|
-
)
|
|
8
|
-
process.exit(1)
|
|
9
|
-
}
|
|
10
|
-
} else {
|
|
11
|
-
console.log(
|
|
12
|
-
'\x1b[31m%s\x1b[0m',
|
|
13
|
-
'Something went wrong while checking Node version'
|
|
14
|
-
)
|
|
15
|
-
process.exit(1)
|
|
16
|
-
}
|
package/scripts/copySASjsCore.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import path from 'path'
|
|
2
|
-
import { asyncForEach, copy, createFolder, deleteFolder } from '../src'
|
|
3
|
-
|
|
4
|
-
const root = path.join(__dirname, '..')
|
|
5
|
-
|
|
6
|
-
const sasjsCorePath = path.join(root, 'node_modules', '@sasjs', 'core')
|
|
7
|
-
|
|
8
|
-
export const macrosPath = path.join(root, 'build', 'macros')
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* We need @sasjs/core macros at runtime for compilation of programs, but we
|
|
12
|
-
* can't directly import them like a javascript file.
|
|
13
|
-
* So, we have to read the macro files directly. For this we can't use the
|
|
14
|
-
* node_modules folder, as it will not always be available after the library is
|
|
15
|
-
* built / packed (eg in the VS Code extension)
|
|
16
|
-
* Therefore, we copy the macros to a folder in the post build step, so that we
|
|
17
|
-
* can read them at runtime.
|
|
18
|
-
*
|
|
19
|
-
* These macros are / will be used by the sasjs fs command / fs sync utilites
|
|
20
|
-
* as well as for general compilation of SAS Jobs, Services, and Tests.
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
export const copySASjsCore = async () => {
|
|
24
|
-
await deleteFolder(macrosPath)
|
|
25
|
-
await createFolder(macrosPath)
|
|
26
|
-
|
|
27
|
-
const foldersToCopy = ['base']
|
|
28
|
-
|
|
29
|
-
await asyncForEach(foldersToCopy, async (coreSubFolder) => {
|
|
30
|
-
const coreSubFolderPath = path.join(sasjsCorePath, coreSubFolder)
|
|
31
|
-
|
|
32
|
-
await copy(coreSubFolderPath, macrosPath)
|
|
33
|
-
})
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
copySASjsCore()
|
package/updateCli
DELETED
package/updateServer
DELETED