@sprucelabs/spruce-skill-utils 31.0.544 → 31.0.546
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/build/errors/SpruceError.js +1 -2
- package/build/renderers/locationRenderer.js +1 -2
- package/build/services/AuthService.js +1 -2
- package/build/services/PkgService.js +2 -3
- package/build/services/SettingsService.js +2 -4
- package/build/utilities/addon.utility.js +2 -2
- package/build/utilities/buildLog.js +16 -20
- package/build/utilities/joinIntoSentence.utility.js +1 -1
- package/package.json +9 -9
- package/tsconfig.json +1 -1
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const error_1 = __importDefault(require("@sprucelabs/error"));
|
|
7
7
|
class SpruceError extends error_1.default {
|
|
8
8
|
friendlyMessage() {
|
|
9
|
-
var _a, _b;
|
|
10
9
|
let message = super.friendlyMessage();
|
|
11
10
|
switch (this.options.code) {
|
|
12
11
|
case 'FAILED_TO_LOAD_PLUGIN':
|
|
@@ -17,7 +16,7 @@ class SpruceError extends error_1.default {
|
|
|
17
16
|
message = `"${this.options.suppliedCode}" is not a valid feature code. Valid codes are: ${this.options.validCodes.join(', ')}`;
|
|
18
17
|
break;
|
|
19
18
|
case 'SKILL_CRASHED':
|
|
20
|
-
message = `Shoot, your skill crashed. Here are some deets:\n\n${
|
|
19
|
+
message = `Shoot, your skill crashed. Here are some deets:\n\n${this.options.originalError?.message ?? 'UNKNOWN'}`;
|
|
21
20
|
break;
|
|
22
21
|
case 'INVALID_PACKAGE_JSON':
|
|
23
22
|
message = `I could not open the package.json for this skill. Error was: ${this.options.errorMessage}`;
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const locationRenderer = {
|
|
4
4
|
renderAddress(address) {
|
|
5
|
-
var _a, _b, _c, _d, _e, _f;
|
|
6
5
|
return `${address
|
|
7
|
-
? `${
|
|
6
|
+
? `${address.street1 ?? ''} ${address.street2 ?? ''} ${address.city ?? ''} ${address.province ?? ''} ${address.zip ?? ''} ${address.country ?? ''}`
|
|
8
7
|
: ``}`
|
|
9
8
|
.replace(/\s\s+/g, ' ')
|
|
10
9
|
.trim();
|
|
@@ -15,7 +15,6 @@ class AuthService {
|
|
|
15
15
|
this.pkg = pkgService;
|
|
16
16
|
}
|
|
17
17
|
static Auth(cwd) {
|
|
18
|
-
var _a;
|
|
19
18
|
if (!cwd) {
|
|
20
19
|
throw new schema_1.SchemaError({
|
|
21
20
|
code: 'MISSING_PARAMETERS',
|
|
@@ -31,7 +30,7 @@ class AuthService {
|
|
|
31
30
|
friendlyMessage: 'Could not find a package.json file!',
|
|
32
31
|
});
|
|
33
32
|
}
|
|
34
|
-
const auth = new (
|
|
33
|
+
const auth = new (this.Class ?? this)(envService, pkgService);
|
|
35
34
|
return auth;
|
|
36
35
|
}
|
|
37
36
|
getLoggedInPerson() {
|
|
@@ -55,11 +55,10 @@ class PkgService {
|
|
|
55
55
|
return path_1.default.join(this.cwd, 'package.json');
|
|
56
56
|
}
|
|
57
57
|
isInstalled(pkg) {
|
|
58
|
-
var _a, _b;
|
|
59
58
|
try {
|
|
60
59
|
const contents = this.readPackage();
|
|
61
|
-
return (!!
|
|
62
|
-
!!
|
|
60
|
+
return (!!contents.dependencies?.[pkg] ||
|
|
61
|
+
!!contents.devDependencies?.[pkg]);
|
|
63
62
|
}
|
|
64
63
|
catch (e) {
|
|
65
64
|
return false;
|
|
@@ -14,9 +14,8 @@ class SettingsService {
|
|
|
14
14
|
this.cwd = cwd;
|
|
15
15
|
}
|
|
16
16
|
isMarkedAsInstalled(code) {
|
|
17
|
-
var _a;
|
|
18
17
|
const settings = this.loadSettings();
|
|
19
|
-
return !!
|
|
18
|
+
return !!settings.installed?.find((c) => c === code);
|
|
20
19
|
}
|
|
21
20
|
markAsInstalled(code) {
|
|
22
21
|
if (!this.isMarkedAsInstalled(code)) {
|
|
@@ -44,9 +43,8 @@ class SettingsService {
|
|
|
44
43
|
}
|
|
45
44
|
}
|
|
46
45
|
isMarkedAsPermanentlySkipped(code) {
|
|
47
|
-
var _a;
|
|
48
46
|
const settings = this.loadSettings();
|
|
49
|
-
return !!
|
|
47
|
+
return !!settings.skipped?.find((c) => c === code);
|
|
50
48
|
}
|
|
51
49
|
get(key) {
|
|
52
50
|
return (0, get_1.default)(this.loadSettings(), key);
|
|
@@ -10,7 +10,7 @@ const addonUtil = {
|
|
|
10
10
|
const results = await (0, globby_1.default)(path_1.default.join(...path, '**', '*.addon.[t|j]s'));
|
|
11
11
|
const all = results.map((path) => {
|
|
12
12
|
const result = require(path);
|
|
13
|
-
if (typeof
|
|
13
|
+
if (typeof result?.default === 'function') {
|
|
14
14
|
return result.default(options);
|
|
15
15
|
}
|
|
16
16
|
});
|
|
@@ -21,7 +21,7 @@ const addonUtil = {
|
|
|
21
21
|
const results = globby_1.default.sync(path_1.default.join(...path, '**', '*.addon.[t|j]s'));
|
|
22
22
|
results.forEach((path) => {
|
|
23
23
|
const result = require(path);
|
|
24
|
-
if (typeof
|
|
24
|
+
if (typeof result?.default === 'function') {
|
|
25
25
|
result.default(options);
|
|
26
26
|
}
|
|
27
27
|
});
|
|
@@ -14,22 +14,20 @@ function getProcess() {
|
|
|
14
14
|
}
|
|
15
15
|
let lastLogTimeMs = Date.now();
|
|
16
16
|
const getMaxLogPrefixesLength = () => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
? +((_d = (_c = getProcess()) === null || _c === void 0 ? void 0 : _c.env) === null || _d === void 0 ? void 0 : _d.MAXIMUM_LOG_PREFIXES_LENGTH)
|
|
17
|
+
return typeof getProcess()?.env?.MAXIMUM_LOG_PREFIXES_LENGTH === 'string'
|
|
18
|
+
? +getProcess()?.env?.MAXIMUM_LOG_PREFIXES_LENGTH
|
|
20
19
|
: undefined;
|
|
21
20
|
};
|
|
22
21
|
function buildLog(prefix = undefined, options) {
|
|
23
|
-
|
|
24
|
-
const { colors = {}, log, useColors } = options !== null && options !== void 0 ? options : {};
|
|
22
|
+
const { colors = {}, log, useColors } = options ?? {};
|
|
25
23
|
const { info = 'yellow', error = 'red' } = colors;
|
|
26
|
-
const isInteractive =
|
|
24
|
+
const isInteractive = getProcess()?.stdout?.isTTY;
|
|
27
25
|
const shouldUseColors = useColors !== false && isInteractive;
|
|
28
26
|
const pre = prefix ? `${prefix} ::` : undefined;
|
|
29
27
|
const transports = {
|
|
30
|
-
ERROR:
|
|
31
|
-
INFO:
|
|
32
|
-
WARN:
|
|
28
|
+
ERROR: options?.transportsByLevel?.ERROR,
|
|
29
|
+
INFO: options?.transportsByLevel?.INFO,
|
|
30
|
+
WARN: options?.transportsByLevel?.WARN,
|
|
33
31
|
};
|
|
34
32
|
const logUtil = {
|
|
35
33
|
prefix,
|
|
@@ -59,8 +57,7 @@ function buildLog(prefix = undefined, options) {
|
|
|
59
57
|
return transports[level];
|
|
60
58
|
}
|
|
61
59
|
function write(chalkMethod, rawArgs, level) {
|
|
62
|
-
|
|
63
|
-
const args = rawArgs.map((a) => { var _a, _b; return (_b = (_a = a === null || a === void 0 ? void 0 : a.toString) === null || _a === void 0 ? void 0 : _a.call(a)) !== null && _b !== void 0 ? _b : 'undefined'; });
|
|
60
|
+
const args = rawArgs.map((a) => a?.toString?.() ?? 'undefined');
|
|
64
61
|
let chalkArgs = [...args];
|
|
65
62
|
let builtPrefix = pre;
|
|
66
63
|
if (pre) {
|
|
@@ -79,7 +76,7 @@ function buildLog(prefix = undefined, options) {
|
|
|
79
76
|
transport(...[prefix.trim(), ...args].filter((t) => t && t.length > 0));
|
|
80
77
|
return prefix;
|
|
81
78
|
}
|
|
82
|
-
const env =
|
|
79
|
+
const env = getProcess()?.env ?? {};
|
|
83
80
|
let logMethod = 'log';
|
|
84
81
|
switch (level) {
|
|
85
82
|
case 'ERROR':
|
|
@@ -93,12 +90,12 @@ function buildLog(prefix = undefined, options) {
|
|
|
93
90
|
break;
|
|
94
91
|
}
|
|
95
92
|
transport =
|
|
96
|
-
log
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
93
|
+
log ??
|
|
94
|
+
(level === 'ERROR' && getProcess()?.stderr?.write
|
|
95
|
+
? (...args) => {
|
|
96
|
+
getProcess()?.stderr.write(args.join(' ') + '\n');
|
|
97
|
+
}
|
|
98
|
+
: (console[logMethod] ?? console.log).bind(console));
|
|
102
99
|
let message = shouldUseColors === false
|
|
103
100
|
? `(${level})${prefix}`
|
|
104
101
|
: chalkMethod(...chalkArgs);
|
|
@@ -122,8 +119,7 @@ function buildLog(prefix = undefined, options) {
|
|
|
122
119
|
}
|
|
123
120
|
exports.testLog = buildLog('TEST', {
|
|
124
121
|
log: (...parts) => {
|
|
125
|
-
|
|
126
|
-
(_c = (_b = (_a = getProcess()) === null || _a === void 0 ? void 0 : _a.stderr) === null || _b === void 0 ? void 0 : _b.write) === null || _c === void 0 ? void 0 : _c.call(_b, parts.join(' ') + '\n');
|
|
122
|
+
getProcess()?.stderr?.write?.(parts.join(' ') + '\n');
|
|
127
123
|
},
|
|
128
124
|
});
|
|
129
125
|
exports.stubLog = buildLog('STUB', {
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "31.0.
|
|
6
|
+
"version": "31.0.546",
|
|
7
7
|
"skill": {
|
|
8
8
|
"namespace": "skill-utils",
|
|
9
9
|
"upgradeIgnoreList": [
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"lint.tsc": "tsc -p . --noEmit"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@sprucelabs/globby": "^2.0.
|
|
62
|
-
"@sprucelabs/schema": "^30.0.
|
|
61
|
+
"@sprucelabs/globby": "^2.0.439",
|
|
62
|
+
"@sprucelabs/schema": "^30.0.486",
|
|
63
63
|
"chalk": "^4.1.2",
|
|
64
64
|
"dotenv": "^16.4.5",
|
|
65
65
|
"fs-extra": "^11.2.0",
|
|
@@ -68,17 +68,17 @@
|
|
|
68
68
|
"uuid": "^10.0.0"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@sprucelabs/esm-postbuild": "^6.0.
|
|
72
|
-
"@sprucelabs/jest-json-reporter": "^8.0.
|
|
71
|
+
"@sprucelabs/esm-postbuild": "^6.0.461",
|
|
72
|
+
"@sprucelabs/jest-json-reporter": "^8.0.478",
|
|
73
73
|
"@sprucelabs/jest-sheets-reporter": "^3.0.155",
|
|
74
|
-
"@sprucelabs/resolve-path-aliases": "^2.0.
|
|
74
|
+
"@sprucelabs/resolve-path-aliases": "^2.0.456",
|
|
75
75
|
"@sprucelabs/semantic-release": "^5.0.2",
|
|
76
|
-
"@sprucelabs/test": "^9.0.
|
|
77
|
-
"@sprucelabs/test-utils": "^5.1.
|
|
76
|
+
"@sprucelabs/test": "^9.0.51",
|
|
77
|
+
"@sprucelabs/test-utils": "^5.1.430",
|
|
78
78
|
"@types/fs-extra": "^11.0.4",
|
|
79
79
|
"@types/inflection": "^1.13.2",
|
|
80
80
|
"@types/lodash": "^4.17.10",
|
|
81
|
-
"@types/node": "^22.7.
|
|
81
|
+
"@types/node": "^22.7.6",
|
|
82
82
|
"@types/uuid": "^10.0.0",
|
|
83
83
|
"chokidar-cli": "^3.0.0",
|
|
84
84
|
"eslint": "^9.12.0",
|