@storm-software/config-tools 1.35.4 → 1.35.6
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/CHANGELOG.md +24 -0
- package/declarations.d.ts +26 -0
- package/package.json +1 -1
- package/project.json +5 -10
- package/src/utilities/chalk.ts +53 -0
- package/src/utilities/index.ts +1 -0
- package/src/utilities/logger.ts +6 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
## 1.35.6 (2024-04-08)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### 🩹 Fixes
|
|
5
|
+
|
|
6
|
+
- **config-tools:** Export `getChalk` function so that it can be used in other packages ([2ca2241a](https://github.com/storm-software/storm-ops/commit/2ca2241a))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### ❤️ Thank You
|
|
10
|
+
|
|
11
|
+
- Patrick Sullivan
|
|
12
|
+
|
|
13
|
+
## 1.35.5 (2024-04-08)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### 🩹 Fixes
|
|
17
|
+
|
|
18
|
+
- **build-tools:** Resolve issue with Nx file imports ([e86eff43](https://github.com/storm-software/storm-ops/commit/e86eff43))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### ❤️ Thank You
|
|
22
|
+
|
|
23
|
+
- Patrick Sullivan
|
|
24
|
+
|
|
1
25
|
## 1.35.4 (2024-04-08)
|
|
2
26
|
|
|
3
27
|
|
package/declarations.d.ts
CHANGED
|
@@ -267,3 +267,29 @@ declare function applyWorkspaceTokens<
|
|
|
267
267
|
tokenizerFn: (option: string, config: TConfig) => string | Promise<string>
|
|
268
268
|
): Promise<Record<string, any>>;
|
|
269
269
|
export { applyWorkspaceTokens };
|
|
270
|
+
|
|
271
|
+
export type GetChalkReturn = {
|
|
272
|
+
hex: (_: string) => (message?: string) => string | undefined;
|
|
273
|
+
bgHex: (_: string) => {
|
|
274
|
+
whiteBright: (message?: string) => string | undefined;
|
|
275
|
+
};
|
|
276
|
+
whiteBright: (message?: string) => string | undefined;
|
|
277
|
+
bold: {
|
|
278
|
+
hex: (_: string) => (message?: string) => string | undefined;
|
|
279
|
+
bgHex: (_: string) => {
|
|
280
|
+
whiteBright: (message?: string) => string | undefined;
|
|
281
|
+
};
|
|
282
|
+
whiteBright: (message?: string) => string | undefined;
|
|
283
|
+
};
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Get the chalk instance
|
|
288
|
+
*
|
|
289
|
+
* @remarks
|
|
290
|
+
* Annoying polyfill to temporarily fix the issue with the `chalk` import
|
|
291
|
+
*
|
|
292
|
+
* @returns The chalk instance
|
|
293
|
+
*/
|
|
294
|
+
declare function getChalk(): GetChalkReturn;
|
|
295
|
+
export { getChalk };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storm-software/config-tools",
|
|
3
|
-
"version": "1.35.
|
|
3
|
+
"version": "1.35.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "⚡The Storm-Ops monorepo contains utility applications, tools, and various libraries to create modern and scalable web applications.",
|
|
6
6
|
"repository": {
|
package/project.json
CHANGED
|
@@ -6,13 +6,12 @@
|
|
|
6
6
|
"targets": {
|
|
7
7
|
"build": {
|
|
8
8
|
"executor": "@nx/esbuild:esbuild",
|
|
9
|
-
"outputs": [
|
|
10
|
-
"{options.outputPath}"
|
|
11
|
-
],
|
|
9
|
+
"outputs": ["{options.outputPath}"],
|
|
12
10
|
"options": {
|
|
13
11
|
"main": "packages/config-tools/src/index.ts",
|
|
14
12
|
"additionalEntryPoints": [
|
|
15
13
|
"packages/config-tools/src/utilities/find-workspace-root.ts",
|
|
14
|
+
"packages/config-tools/src/utilities/chalk.ts",
|
|
16
15
|
"packages/config-tools/src/utilities/logger.ts"
|
|
17
16
|
],
|
|
18
17
|
"outputPath": "dist/packages/config-tools",
|
|
@@ -26,9 +25,7 @@
|
|
|
26
25
|
"skipTypeCheck": false,
|
|
27
26
|
"metafile": true,
|
|
28
27
|
"minify": false,
|
|
29
|
-
"format": [
|
|
30
|
-
"cjs"
|
|
31
|
-
],
|
|
28
|
+
"format": ["cjs"],
|
|
32
29
|
"esbuildOptions": {
|
|
33
30
|
"outExtension": {
|
|
34
31
|
".js": ".js"
|
|
@@ -65,8 +62,6 @@
|
|
|
65
62
|
"nx-release-publish": {
|
|
66
63
|
"executor": "@storm-software/workspace-tools:npm-publish"
|
|
67
64
|
}
|
|
68
|
-
}
|
|
69
|
-
"lint": {},
|
|
70
|
-
"test": {}
|
|
65
|
+
}
|
|
71
66
|
}
|
|
72
|
-
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
|
|
3
|
+
export type GetChalkReturn = {
|
|
4
|
+
hex: (_: string) => (message?: string) => string | undefined;
|
|
5
|
+
bgHex: (_: string) => {
|
|
6
|
+
whiteBright: (message?: string) => string | undefined;
|
|
7
|
+
};
|
|
8
|
+
whiteBright: (message?: string) => string | undefined;
|
|
9
|
+
bold: {
|
|
10
|
+
hex: (_: string) => (message?: string) => string | undefined;
|
|
11
|
+
bgHex: (_: string) => {
|
|
12
|
+
whiteBright: (message?: string) => string | undefined;
|
|
13
|
+
};
|
|
14
|
+
whiteBright: (message?: string) => string | undefined;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const chalkDefault: GetChalkReturn = {
|
|
19
|
+
hex: (_: string) => (message?: string) => message,
|
|
20
|
+
bgHex: (_: string) => ({
|
|
21
|
+
whiteBright: (message?: string) => message
|
|
22
|
+
}),
|
|
23
|
+
whiteBright: (message?: string) => message,
|
|
24
|
+
bold: {
|
|
25
|
+
hex: (_: string) => (message?: string) => message,
|
|
26
|
+
bgHex: (_: string) => ({
|
|
27
|
+
whiteBright: (message?: string) => message
|
|
28
|
+
}),
|
|
29
|
+
whiteBright: (message?: string) => message
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Get the chalk instance
|
|
35
|
+
*
|
|
36
|
+
* @remarks
|
|
37
|
+
* Annoying polyfill to temporarily fix the issue with the `chalk` import
|
|
38
|
+
*
|
|
39
|
+
* @returns The chalk instance
|
|
40
|
+
*/
|
|
41
|
+
export const getChalk = (): GetChalkReturn => {
|
|
42
|
+
let _chalk = chalk as GetChalkReturn;
|
|
43
|
+
if (
|
|
44
|
+
!_chalk?.hex ||
|
|
45
|
+
!_chalk?.bold?.hex ||
|
|
46
|
+
!_chalk?.bgHex ||
|
|
47
|
+
!_chalk?.whiteBright
|
|
48
|
+
) {
|
|
49
|
+
_chalk = chalkDefault;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return _chalk;
|
|
53
|
+
};
|
package/src/utilities/index.ts
CHANGED
package/src/utilities/logger.ts
CHANGED
|
@@ -1,24 +1,7 @@
|
|
|
1
1
|
import { LogLevel, LogLevelLabel } from "../types";
|
|
2
2
|
import type { StormConfig } from "@storm-software/config";
|
|
3
3
|
import { getLogLevel } from "./get-log-level";
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
// Annoying chalk polyfill to temporarily fix the issue with the `chalk` import
|
|
7
|
-
const chalkDefault = {
|
|
8
|
-
hex: (_: string) => (message?: string) => message,
|
|
9
|
-
bgHex: (_: string) => ({
|
|
10
|
-
whiteBright: (message?: string) => message
|
|
11
|
-
}),
|
|
12
|
-
whiteBright: (message?: string) => message,
|
|
13
|
-
bold: {
|
|
14
|
-
hex: (_: string) => (message?: string) => message,
|
|
15
|
-
bgHex: (_: string) => ({
|
|
16
|
-
whiteBright: (message?: string) => message
|
|
17
|
-
}),
|
|
18
|
-
whiteBright: (message?: string) => message
|
|
19
|
-
}
|
|
20
|
-
} as any;
|
|
21
|
-
// const chalk = chalkDefault;
|
|
4
|
+
import { getChalk } from "./chalk";
|
|
22
5
|
|
|
23
6
|
/**
|
|
24
7
|
* Get the log function for a log level
|
|
@@ -31,10 +14,7 @@ export const getLogFn = (
|
|
|
31
14
|
config: Partial<StormConfig> = {},
|
|
32
15
|
logLevel: number | LogLevel = LogLevel.INFO
|
|
33
16
|
): ((message?: string) => void) => {
|
|
34
|
-
let _chalk =
|
|
35
|
-
if (!_chalk?.hex || !_chalk?.bold?.hex || !_chalk?.bgHex || !_chalk?.whiteBright) {
|
|
36
|
-
_chalk = chalkDefault;
|
|
37
|
-
}
|
|
17
|
+
let _chalk = getChalk();
|
|
38
18
|
|
|
39
19
|
const configLogLevel = (config.logLevel ??
|
|
40
20
|
process.env?.STORM_LOG_LEVEL ??
|
|
@@ -42,8 +22,10 @@ export const getLogFn = (
|
|
|
42
22
|
|
|
43
23
|
if (
|
|
44
24
|
(typeof logLevel === "number" &&
|
|
45
|
-
(logLevel >= getLogLevel(configLogLevel) ||
|
|
46
|
-
|
|
25
|
+
(logLevel >= getLogLevel(configLogLevel) ||
|
|
26
|
+
logLevel <= LogLevel.SILENT)) ||
|
|
27
|
+
(typeof logLevel === "string" &&
|
|
28
|
+
getLogLevel(logLevel) >= getLogLevel(configLogLevel))
|
|
47
29
|
) {
|
|
48
30
|
return (_: string) => {
|
|
49
31
|
/* noop */
|