@storm-software/config-tools 1.190.120 → 1.190.121

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 (156) hide show
  1. package/bin/config.cjs +1272 -105
  2. package/bin/config.mjs +1271 -0
  3. package/dist/_virtual/_rolldown/runtime.cjs +23 -0
  4. package/dist/config-file/get-config-file.cjs +63 -79
  5. package/dist/config-file/get-config-file.d.cts +5 -5
  6. package/dist/config-file/{get-config-file.d.ts → get-config-file.d.mts} +7 -5
  7. package/dist/config-file/get-config-file.mjs +66 -0
  8. package/dist/config-file/index.cjs +4 -1
  9. package/dist/config-file/index.d.cts +2 -3
  10. package/dist/config-file/index.d.mts +4 -0
  11. package/dist/config-file/index.mjs +5 -0
  12. package/dist/create-storm-config.cjs +105 -136
  13. package/dist/create-storm-config.d.cts +5 -5
  14. package/dist/{create-storm-config.d.ts → create-storm-config.d.mts} +7 -5
  15. package/dist/create-storm-config.mjs +113 -0
  16. package/dist/env/get-env.cjs +190 -214
  17. package/dist/env/get-env.d.cts +5 -5
  18. package/dist/env/{get-env.d.ts → get-env.d.mts} +7 -5
  19. package/dist/env/get-env.mjs +203 -0
  20. package/dist/env/index.cjs +7 -2
  21. package/dist/env/index.d.cts +3 -4
  22. package/dist/env/index.d.mts +5 -0
  23. package/dist/env/index.mjs +6 -0
  24. package/dist/env/set-env.cjs +218 -374
  25. package/dist/env/set-env.d.cts +8 -8
  26. package/dist/env/{set-env.d.ts → set-env.d.mts} +10 -8
  27. package/dist/env/set-env.mjs +231 -0
  28. package/dist/get-config.cjs +40 -29
  29. package/dist/get-config.d.cts +18 -18
  30. package/dist/{get-config.d.ts → get-config.d.mts} +20 -18
  31. package/dist/get-config.mjs +46 -0
  32. package/dist/index.cjs +98 -7
  33. package/dist/index.d.cts +27 -28
  34. package/dist/index.d.mts +29 -0
  35. package/dist/index.mjs +26 -0
  36. package/dist/logger/chalk.cjs +38 -29
  37. package/dist/logger/chalk.d.cts +18 -17
  38. package/dist/logger/chalk.d.mts +37 -0
  39. package/dist/logger/chalk.mjs +43 -0
  40. package/dist/logger/console-icons.cjs +15 -14
  41. package/dist/logger/console-icons.d.cts +5 -8
  42. package/dist/logger/console-icons.d.mts +7 -0
  43. package/dist/logger/console-icons.mjs +20 -0
  44. package/dist/logger/console.cjs +187 -183
  45. package/dist/logger/console.d.cts +25 -25
  46. package/dist/logger/{console.d.ts → console.d.mts} +27 -25
  47. package/dist/logger/console.mjs +185 -0
  48. package/dist/logger/create-logger.cjs +31 -24
  49. package/dist/logger/create-logger.d.cts +5 -6
  50. package/dist/logger/{create-logger.d.ts → create-logger.d.mts} +7 -6
  51. package/dist/logger/create-logger.mjs +34 -0
  52. package/dist/logger/format-timestamp.cjs +12 -4
  53. package/dist/logger/format-timestamp.d.cts +3 -2
  54. package/dist/logger/{format-timestamp.d.ts → format-timestamp.d.mts} +5 -2
  55. package/dist/logger/format-timestamp.mjs +16 -0
  56. package/dist/logger/get-log-level.cjs +50 -60
  57. package/dist/logger/get-log-level.d.cts +4 -5
  58. package/dist/logger/{get-log-level.d.ts → get-log-level.d.mts} +6 -5
  59. package/dist/logger/get-log-level.mjs +54 -0
  60. package/dist/logger/index.cjs +29 -7
  61. package/dist/logger/index.d.cts +8 -10
  62. package/dist/logger/index.d.mts +10 -0
  63. package/dist/logger/index.mjs +11 -0
  64. package/dist/logger/is-unicode-supported.cjs +6 -10
  65. package/dist/logger/is-unicode-supported.d.cts +3 -2
  66. package/dist/logger/is-unicode-supported.d.mts +6 -0
  67. package/dist/logger/is-unicode-supported.mjs +10 -0
  68. package/dist/types.cjs +26 -25
  69. package/dist/types.d.cts +39 -41
  70. package/dist/types.d.mts +53 -0
  71. package/dist/types.mjs +30 -0
  72. package/dist/utilities/apply-workspace-tokens.cjs +31 -70
  73. package/dist/utilities/apply-workspace-tokens.d.cts +4 -5
  74. package/dist/utilities/{apply-workspace-tokens.d.ts → apply-workspace-tokens.d.mts} +6 -5
  75. package/dist/utilities/apply-workspace-tokens.mjs +37 -0
  76. package/dist/utilities/colors.cjs +91 -74
  77. package/dist/utilities/colors.d.cts +4 -4
  78. package/dist/utilities/{colors.d.ts → colors.d.mts} +6 -4
  79. package/dist/utilities/colors.mjs +97 -0
  80. package/dist/utilities/correct-paths.cjs +166 -196
  81. package/dist/utilities/correct-paths.d.cts +4 -4
  82. package/dist/utilities/{correct-paths.d.ts → correct-paths.d.mts} +6 -4
  83. package/dist/utilities/correct-paths.mjs +190 -0
  84. package/dist/utilities/file-path-utils.cjs +42 -27
  85. package/dist/utilities/file-path-utils.d.cts +15 -14
  86. package/dist/utilities/{file-path-utils.d.ts → file-path-utils.d.mts} +17 -14
  87. package/dist/utilities/file-path-utils.mjs +48 -0
  88. package/dist/utilities/find-up.cjs +12 -18
  89. package/dist/utilities/find-up.d.cts +3 -2
  90. package/dist/utilities/{find-up.d.ts → find-up.d.mts} +5 -2
  91. package/dist/utilities/find-up.mjs +19 -0
  92. package/dist/utilities/find-workspace-root.cjs +64 -69
  93. package/dist/utilities/find-workspace-root.d.cts +3 -2
  94. package/dist/utilities/{find-workspace-root.d.ts → find-workspace-root.d.mts} +5 -2
  95. package/dist/utilities/find-workspace-root.mjs +73 -0
  96. package/dist/utilities/get-default-config.cjs +69 -91
  97. package/dist/utilities/get-default-config.d.cts +4 -4
  98. package/dist/utilities/{get-default-config.d.ts → get-default-config.d.mts} +6 -4
  99. package/dist/utilities/get-default-config.mjs +74 -0
  100. package/dist/utilities/index.cjs +49 -9
  101. package/dist/utilities/index.d.cts +10 -14
  102. package/dist/utilities/index.d.mts +12 -0
  103. package/dist/utilities/index.mjs +13 -0
  104. package/dist/utilities/process-handler.cjs +32 -47
  105. package/dist/utilities/process-handler.d.cts +4 -4
  106. package/dist/utilities/process-handler.d.mts +9 -0
  107. package/dist/utilities/process-handler.mjs +38 -0
  108. package/dist/utilities/run.cjs +62 -36
  109. package/dist/utilities/run.d.cts +5 -6
  110. package/dist/utilities/{run.d.ts → run.d.mts} +7 -6
  111. package/dist/utilities/run.mjs +64 -0
  112. package/dist/utilities/toml.cjs +27 -32
  113. package/dist/utilities/toml.d.cts +148 -147
  114. package/dist/utilities/toml.d.mts +192 -0
  115. package/dist/utilities/toml.mjs +33 -0
  116. package/package.json +105 -157
  117. package/bin/config.js +0 -108
  118. package/dist/config-file/get-config-file.js +0 -83
  119. package/dist/config-file/index.d.ts +0 -3
  120. package/dist/config-file/index.js +0 -1
  121. package/dist/create-storm-config.js +0 -147
  122. package/dist/env/get-env.js +0 -226
  123. package/dist/env/index.d.ts +0 -4
  124. package/dist/env/index.js +0 -2
  125. package/dist/env/set-env.js +0 -386
  126. package/dist/get-config.js +0 -35
  127. package/dist/index.d.ts +0 -28
  128. package/dist/index.js +0 -7
  129. package/dist/logger/chalk.d.ts +0 -34
  130. package/dist/logger/chalk.js +0 -34
  131. package/dist/logger/console-icons.d.ts +0 -8
  132. package/dist/logger/console-icons.js +0 -17
  133. package/dist/logger/console.js +0 -191
  134. package/dist/logger/create-logger.js +0 -27
  135. package/dist/logger/format-timestamp.js +0 -6
  136. package/dist/logger/get-log-level.js +0 -64
  137. package/dist/logger/index.d.ts +0 -10
  138. package/dist/logger/index.js +0 -7
  139. package/dist/logger/is-unicode-supported.d.ts +0 -3
  140. package/dist/logger/is-unicode-supported.js +0 -12
  141. package/dist/types.d.ts +0 -53
  142. package/dist/types.js +0 -28
  143. package/dist/utilities/apply-workspace-tokens.js +0 -76
  144. package/dist/utilities/colors.js +0 -81
  145. package/dist/utilities/correct-paths.js +0 -231
  146. package/dist/utilities/file-path-utils.js +0 -33
  147. package/dist/utilities/find-up.js +0 -23
  148. package/dist/utilities/find-workspace-root.js +0 -77
  149. package/dist/utilities/get-default-config.js +0 -95
  150. package/dist/utilities/index.d.ts +0 -14
  151. package/dist/utilities/index.js +0 -9
  152. package/dist/utilities/process-handler.d.ts +0 -7
  153. package/dist/utilities/process-handler.js +0 -53
  154. package/dist/utilities/run.js +0 -38
  155. package/dist/utilities/toml.d.ts +0 -189
  156. package/dist/utilities/toml.js +0 -42
@@ -0,0 +1,192 @@
1
+ import __tsdown_shims_path from 'node:path';
2
+ import __tsdown_shims_url from 'node:url';
3
+ //#region src/utilities/toml.d.ts
4
+ interface CargoToml {
5
+ workspace?: {
6
+ members: string[];
7
+ };
8
+ package: any;
9
+ dependencies?: Record<string, string | {
10
+ version: string;
11
+ features?: string[];
12
+ optional?: boolean;
13
+ }>;
14
+ "dev-dependencies"?: Record<string, string | {
15
+ version: string;
16
+ features: string[];
17
+ }>;
18
+ [key: string]: any;
19
+ }
20
+ interface CargoMetadata {
21
+ packages: Package[];
22
+ workspace_members: string[];
23
+ resolve: Resolve;
24
+ target_directory: string;
25
+ version: number;
26
+ workspace_root: string;
27
+ metadata: Metadata2;
28
+ }
29
+ interface Package {
30
+ name: string;
31
+ version: string;
32
+ id: string;
33
+ license: string;
34
+ license_file: string;
35
+ description: string;
36
+ source: any;
37
+ dependencies: Dependency[];
38
+ targets: Target[];
39
+ features: Features;
40
+ manifest_path: string;
41
+ metadata: Metadata;
42
+ /**
43
+ * From the docs:
44
+ * "List of registries to which this package may be published.
45
+ * Publishing is unrestricted if null, and forbidden if an empty array."
46
+ *
47
+ * Additional observation:
48
+ * false can be used by the end user but it will be converted to an empty
49
+ * array in the cargo metadata output.
50
+ */
51
+ publish?: string[] | boolean | null;
52
+ authors: string[];
53
+ categories: string[];
54
+ default_run: any;
55
+ rust_version: string;
56
+ keywords: string[];
57
+ readme: string;
58
+ repository: string;
59
+ homepage: string;
60
+ documentation: string;
61
+ edition: string;
62
+ links: any;
63
+ }
64
+ interface Dependency {
65
+ name: string;
66
+ source: string;
67
+ req: string;
68
+ kind: any;
69
+ rename: any;
70
+ optional: boolean;
71
+ uses_default_features: boolean;
72
+ features: any[];
73
+ target: string;
74
+ path: string;
75
+ registry: any;
76
+ workspace: boolean;
77
+ }
78
+ interface Target {
79
+ kind: string[];
80
+ crate_types: string[];
81
+ name: string;
82
+ src_path: string;
83
+ edition: string;
84
+ "required-features": string[];
85
+ doc: boolean;
86
+ doctest: boolean;
87
+ test: boolean;
88
+ }
89
+ interface Features {
90
+ default: string[];
91
+ feat1: any[];
92
+ feat2: any[];
93
+ }
94
+ interface Metadata {
95
+ docs: Docs;
96
+ }
97
+ interface Docs {
98
+ rs: Rs;
99
+ }
100
+ interface Rs {
101
+ "all-features": boolean;
102
+ }
103
+ interface Resolve {
104
+ nodes: Node[];
105
+ root: string;
106
+ }
107
+ interface Node {
108
+ id: string;
109
+ dependencies: string[];
110
+ deps: Dep[];
111
+ features: string[];
112
+ }
113
+ interface Dep {
114
+ name: string;
115
+ pkg: string;
116
+ dep_kinds: DepKind[];
117
+ }
118
+ interface DepKind {
119
+ kind: any;
120
+ target: string;
121
+ }
122
+ interface Metadata2 {
123
+ docs: Docs2;
124
+ }
125
+ interface Docs2 {
126
+ rs: Rs2;
127
+ }
128
+ interface Rs2 {
129
+ "all-features": boolean;
130
+ }
131
+ /**
132
+ * Virtual file system tree.
133
+ */
134
+ interface Tree {
135
+ /**
136
+ * Root of the workspace. All paths are relative to this.
137
+ */
138
+ root: string;
139
+ /**
140
+ * Read the contents of a file.
141
+ * @param filePath A path to a file.
142
+ */
143
+ read(filePath: string): Buffer | null;
144
+ /**
145
+ * Read the contents of a file as string.
146
+ * @param filePath A path to a file.
147
+ * @param encoding the encoding for the result
148
+ */
149
+ read(filePath: string, encoding: BufferEncoding): string | null;
150
+ /**
151
+ * Update the contents of a file or create a new file.
152
+ */
153
+ write(filePath: string, content: Buffer | string, options?: any): void;
154
+ /**
155
+ * Check if a file exists.
156
+ */
157
+ exists(filePath: string): boolean;
158
+ /**
159
+ * Delete the file.
160
+ */
161
+ delete(filePath: string): void;
162
+ /**
163
+ * Rename the file or the folder.
164
+ */
165
+ rename(from: string, to: string): void;
166
+ /**
167
+ * Check if this is a file or not.
168
+ */
169
+ isFile(filePath: string): boolean;
170
+ /**
171
+ * Returns the list of children of a folder.
172
+ */
173
+ children(dirPath: string): string[];
174
+ /**
175
+ * Returns the list of currently recorded changes.
176
+ */
177
+ listChanges(): any[];
178
+ /**
179
+ * Changes permissions of a file.
180
+ * @param filePath A path to a file.
181
+ * @param mode The permission to be granted on the file, given as a string (e.g `755`) or octal integer (e.g `0o755`).
182
+ * See https://nodejs.org/api/fs.html#fs_file_modes.
183
+ */
184
+ changePermissions(filePath: string, mode: string): void;
185
+ }
186
+ declare function parseCargoTomlWithTree(tree: Tree, projectRoot: string, projectName: string): CargoToml;
187
+ declare function parseCargoToml(cargoString?: string): CargoToml;
188
+ declare function stringifyCargoToml(cargoToml: CargoToml): string;
189
+ declare function modifyCargoTable(toml: CargoToml, section: string, key: string, value: string | object | any[] | (() => any)): void;
190
+ declare function modifyCargoNestedTable(toml: CargoToml, section: string, key: string, value: object): void;
191
+ //#endregion
192
+ export { CargoMetadata, CargoToml, Dep, DepKind, Dependency, Docs, Docs2, Features, Metadata, Metadata2, Node, Package, Resolve, Rs, Rs2, Target, Tree, modifyCargoNestedTable, modifyCargoTable, parseCargoToml, parseCargoTomlWithTree, stringifyCargoToml };
@@ -0,0 +1,33 @@
1
+ import "node:path";
2
+ import "node:url";
3
+ import.meta.url;
4
+ import { writeError } from "../logger/console.mjs";
5
+ import TOML from "@ltd/j-toml";
6
+ //#region src/utilities/toml.ts
7
+ function parseCargoTomlWithTree(tree, projectRoot, projectName) {
8
+ const cargoTomlString = tree.read(`${projectRoot}/Cargo.toml`)?.toString();
9
+ if (!cargoTomlString) {
10
+ writeError(`Cannot find a Cargo.toml file in the ${projectName}`);
11
+ throw new Error();
12
+ }
13
+ return parseCargoToml(cargoTomlString);
14
+ }
15
+ function parseCargoToml(cargoString) {
16
+ if (!cargoString) throw new Error("Cargo.toml is empty");
17
+ return TOML.parse(cargoString, { x: { comment: true } });
18
+ }
19
+ function stringifyCargoToml(cargoToml) {
20
+ const tomlString = TOML.stringify(cargoToml, { newlineAround: "section" });
21
+ if (Array.isArray(tomlString)) return tomlString.join("\n");
22
+ return tomlString;
23
+ }
24
+ function modifyCargoTable(toml, section, key, value) {
25
+ toml[section] ??= TOML.Section({});
26
+ toml[section][key] = typeof value === "object" && !Array.isArray(value) ? TOML.inline(value) : typeof value === "function" ? value() : value;
27
+ }
28
+ function modifyCargoNestedTable(toml, section, key, value) {
29
+ toml[section] ??= {};
30
+ toml[section][key] = TOML.Section(value);
31
+ }
32
+ //#endregion
33
+ export { modifyCargoNestedTable, modifyCargoTable, parseCargoToml, parseCargoTomlWithTree, stringifyCargoToml };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/config-tools",
3
- "version": "1.190.120",
3
+ "version": "1.190.121",
4
4
  "private": false,
5
5
  "description": "A package containing various utilities to support custom workspace configurations and environment management for Storm Software projects, including configuration file handling, environment variable management, and logging utilities.",
6
6
  "keywords": [
@@ -41,178 +41,126 @@
41
41
  "sideEffects": false,
42
42
  "type": "module",
43
43
  "exports": {
44
- "./package.json": "./package.json",
45
- "./types": {
46
- "import": { "types": "./dist/types.d.ts", "default": "./dist/types.js" },
47
- "require": {
48
- "types": "./dist/types.d.cts",
49
- "default": "./dist/types.cjs"
50
- },
51
- "default": { "types": "./dist/types.d.ts", "default": "./dist/types.js" }
52
- },
53
- "./index": {
54
- "import": { "types": "./dist/index.d.ts", "default": "./dist/index.js" },
55
- "require": {
56
- "types": "./dist/index.d.cts",
57
- "default": "./dist/index.cjs"
58
- },
59
- "default": { "types": "./dist/index.d.ts", "default": "./dist/index.js" }
60
- },
61
- ".": {
62
- "import": { "types": "./dist/index.d.ts", "default": "./dist/index.js" },
63
- "require": {
64
- "types": "./dist/index.d.cts",
65
- "default": "./dist/index.cjs"
66
- },
67
- "default": { "types": "./dist/index.d.ts", "default": "./dist/index.js" }
44
+ ".": { "import": "./dist/index.mjs", "require": "./dist/index.cjs" },
45
+ "./config-file": {
46
+ "import": "./dist/config-file/index.mjs",
47
+ "require": "./dist/config-file/index.cjs"
48
+ },
49
+ "./config-file/get-config-file": {
50
+ "import": "./dist/config-file/get-config-file.mjs",
51
+ "require": "./dist/config-file/get-config-file.cjs"
68
52
  },
69
53
  "./create-storm-config": {
70
- "import": {
71
- "types": "./dist/create-storm-config.d.ts",
72
- "default": "./dist/create-storm-config.js"
73
- },
74
- "require": {
75
- "types": "./dist/create-storm-config.d.cts",
76
- "default": "./dist/create-storm-config.cjs"
77
- },
78
- "default": {
79
- "types": "./dist/create-storm-config.d.ts",
80
- "default": "./dist/create-storm-config.js"
81
- }
54
+ "import": "./dist/create-storm-config.mjs",
55
+ "require": "./dist/create-storm-config.cjs"
82
56
  },
83
- "./get-config": {
84
- "import": {
85
- "types": "./dist/get-config.d.ts",
86
- "default": "./dist/get-config.js"
87
- },
88
- "require": {
89
- "types": "./dist/get-config.d.cts",
90
- "default": "./dist/get-config.cjs"
91
- },
92
- "default": {
93
- "types": "./dist/get-config.d.ts",
94
- "default": "./dist/get-config.js"
95
- }
57
+ "./env": {
58
+ "import": "./dist/env/index.mjs",
59
+ "require": "./dist/env/index.cjs"
96
60
  },
97
- "./config-file": {
98
- "import": {
99
- "types": "./dist/config-file/index.d.ts",
100
- "default": "./dist/config-file/index.js"
101
- },
102
- "require": {
103
- "types": "./dist/config-file/index.d.cts",
104
- "default": "./dist/config-file/index.cjs"
105
- },
106
- "default": {
107
- "types": "./dist/config-file/index.d.ts",
108
- "default": "./dist/config-file/index.js"
109
- }
110
- },
111
- "./config-file/*": {
112
- "import": {
113
- "types": "./dist/config-file/*.d.ts",
114
- "default": "./dist/config-file/*.js"
115
- },
116
- "require": {
117
- "types": "./dist/config-file/*.d.cts",
118
- "default": "./dist/config-file/*.cjs"
119
- },
120
- "default": {
121
- "types": "./dist/config-file/*.d.ts",
122
- "default": "./dist/config-file/*.js"
123
- }
61
+ "./env/get-env": {
62
+ "import": "./dist/env/get-env.mjs",
63
+ "require": "./dist/env/get-env.cjs"
124
64
  },
125
- "./env": {
126
- "import": {
127
- "types": "./dist/env/index.d.ts",
128
- "default": "./dist/env/index.js"
129
- },
130
- "require": {
131
- "types": "./dist/env/index.d.cts",
132
- "default": "./dist/env/index.cjs"
133
- },
134
- "default": {
135
- "types": "./dist/env/index.d.ts",
136
- "default": "./dist/env/index.js"
137
- }
138
- },
139
- "./env/*": {
140
- "import": { "types": "./dist/env/*.d.ts", "default": "./dist/env/*.js" },
141
- "require": {
142
- "types": "./dist/env/*.d.cts",
143
- "default": "./dist/env/*.cjs"
144
- },
145
- "default": { "types": "./dist/env/*.d.ts", "default": "./dist/env/*.js" }
65
+ "./env/set-env": {
66
+ "import": "./dist/env/set-env.mjs",
67
+ "require": "./dist/env/set-env.cjs"
68
+ },
69
+ "./get-config": {
70
+ "import": "./dist/get-config.mjs",
71
+ "require": "./dist/get-config.cjs"
146
72
  },
147
73
  "./logger": {
148
- "import": {
149
- "types": "./dist/logger/index.d.ts",
150
- "default": "./dist/logger/index.js"
151
- },
152
- "require": {
153
- "types": "./dist/logger/index.d.cts",
154
- "default": "./dist/logger/index.cjs"
155
- },
156
- "default": {
157
- "types": "./dist/logger/index.d.ts",
158
- "default": "./dist/logger/index.js"
159
- }
160
- },
161
- "./logger/*": {
162
- "import": {
163
- "types": "./dist/logger/*.d.ts",
164
- "default": "./dist/logger/*.js"
165
- },
166
- "require": {
167
- "types": "./dist/logger/*.d.cts",
168
- "default": "./dist/logger/*.cjs"
169
- },
170
- "default": {
171
- "types": "./dist/logger/*.d.ts",
172
- "default": "./dist/logger/*.js"
173
- }
74
+ "import": "./dist/logger/index.mjs",
75
+ "require": "./dist/logger/index.cjs"
76
+ },
77
+ "./logger/chalk": {
78
+ "import": "./dist/logger/chalk.mjs",
79
+ "require": "./dist/logger/chalk.cjs"
80
+ },
81
+ "./logger/console": {
82
+ "import": "./dist/logger/console.mjs",
83
+ "require": "./dist/logger/console.cjs"
84
+ },
85
+ "./logger/console-icons": {
86
+ "import": "./dist/logger/console-icons.mjs",
87
+ "require": "./dist/logger/console-icons.cjs"
88
+ },
89
+ "./logger/create-logger": {
90
+ "import": "./dist/logger/create-logger.mjs",
91
+ "require": "./dist/logger/create-logger.cjs"
92
+ },
93
+ "./logger/format-timestamp": {
94
+ "import": "./dist/logger/format-timestamp.mjs",
95
+ "require": "./dist/logger/format-timestamp.cjs"
96
+ },
97
+ "./logger/get-log-level": {
98
+ "import": "./dist/logger/get-log-level.mjs",
99
+ "require": "./dist/logger/get-log-level.cjs"
174
100
  },
101
+ "./logger/is-unicode-supported": {
102
+ "import": "./dist/logger/is-unicode-supported.mjs",
103
+ "require": "./dist/logger/is-unicode-supported.cjs"
104
+ },
105
+ "./types": { "import": "./dist/types.mjs", "require": "./dist/types.cjs" },
175
106
  "./utilities": {
176
- "import": {
177
- "types": "./dist/utilities/index.d.ts",
178
- "default": "./dist/utilities/index.js"
179
- },
180
- "require": {
181
- "types": "./dist/utilities/index.d.cts",
182
- "default": "./dist/utilities/index.cjs"
183
- },
184
- "default": {
185
- "types": "./dist/utilities/index.d.ts",
186
- "default": "./dist/utilities/index.js"
187
- }
188
- },
189
- "./utilities/*": {
190
- "import": {
191
- "types": "./dist/utilities/*.d.ts",
192
- "default": "./dist/utilities/*.js"
193
- },
194
- "require": {
195
- "types": "./dist/utilities/*.d.cts",
196
- "default": "./dist/utilities/*.cjs"
197
- },
198
- "default": {
199
- "types": "./dist/utilities/*.d.ts",
200
- "default": "./dist/utilities/*.js"
201
- }
202
- }
107
+ "import": "./dist/utilities/index.mjs",
108
+ "require": "./dist/utilities/index.cjs"
109
+ },
110
+ "./utilities/apply-workspace-tokens": {
111
+ "import": "./dist/utilities/apply-workspace-tokens.mjs",
112
+ "require": "./dist/utilities/apply-workspace-tokens.cjs"
113
+ },
114
+ "./utilities/colors": {
115
+ "import": "./dist/utilities/colors.mjs",
116
+ "require": "./dist/utilities/colors.cjs"
117
+ },
118
+ "./utilities/correct-paths": {
119
+ "import": "./dist/utilities/correct-paths.mjs",
120
+ "require": "./dist/utilities/correct-paths.cjs"
121
+ },
122
+ "./utilities/file-path-utils": {
123
+ "import": "./dist/utilities/file-path-utils.mjs",
124
+ "require": "./dist/utilities/file-path-utils.cjs"
125
+ },
126
+ "./utilities/find-up": {
127
+ "import": "./dist/utilities/find-up.mjs",
128
+ "require": "./dist/utilities/find-up.cjs"
129
+ },
130
+ "./utilities/find-workspace-root": {
131
+ "import": "./dist/utilities/find-workspace-root.mjs",
132
+ "require": "./dist/utilities/find-workspace-root.cjs"
133
+ },
134
+ "./utilities/get-default-config": {
135
+ "import": "./dist/utilities/get-default-config.mjs",
136
+ "require": "./dist/utilities/get-default-config.cjs"
137
+ },
138
+ "./utilities/process-handler": {
139
+ "import": "./dist/utilities/process-handler.mjs",
140
+ "require": "./dist/utilities/process-handler.cjs"
141
+ },
142
+ "./utilities/run": {
143
+ "import": "./dist/utilities/run.mjs",
144
+ "require": "./dist/utilities/run.cjs"
145
+ },
146
+ "./utilities/toml": {
147
+ "import": "./dist/utilities/toml.mjs",
148
+ "require": "./dist/utilities/toml.cjs"
149
+ },
150
+ "./*": "./*"
203
151
  },
204
152
  "main": "./dist/index.cjs",
205
- "module": "./dist/index.js",
206
- "types": "./dist/index.d.ts",
153
+ "module": "./dist/index.mjs",
154
+ "types": "./dist/index.d.cts",
207
155
  "bin": {
208
156
  "storm-config": "./bin/config.cjs",
209
157
  "storm-config-cjs": "./bin/config.cjs",
210
- "storm-config-esm": "./bin/config.js"
158
+ "storm-config-esm": "./bin/config.mjs"
211
159
  },
212
160
  "files": ["dist"],
213
161
  "dependencies": {
214
162
  "@ltd/j-toml": "1.38.0",
215
- "@storm-software/config": "1.138.57",
163
+ "@storm-software/config": "1.138.58",
216
164
  "c12": "^2.0.4",
217
165
  "chalk": "^4.1.2",
218
166
  "commander": "^12.1.0",
@@ -224,11 +172,11 @@
224
172
  },
225
173
  "devDependencies": {
226
174
  "@types/node": "^25.9.5",
227
- "tsup": "8.4.0",
175
+ "tsdown": "^0.22.14",
228
176
  "zod": "^4.4.3"
229
177
  },
230
178
  "peerDependencies": { "zod": "^3.25.0 || ^4.0.0" },
231
179
  "peerDependenciesMeta": { "zod": { "optional": false } },
232
180
  "publishConfig": { "access": "public" },
233
- "gitHead": "dce519750140dbed032b5cc68e4c35edca8cb846"
181
+ "gitHead": "427dab3aa828075ceac234260988d77c59cc363e"
234
182
  }
package/bin/config.js DELETED
@@ -1,108 +0,0 @@
1
- #!/usr/bin/env node
2
- import chalk from "chalk";
3
- import { Command } from "commander";
4
- import { getConfig } from "../src/get-config";
5
- import {
6
- brandIcon,
7
- formatLogMessage,
8
- writeError,
9
- writeFatal,
10
- writeInfo,
11
- writeSuccess
12
- } from "../src/logger/console";
13
- import {
14
- exitWithError,
15
- exitWithSuccess,
16
- findWorkspaceRootSafe,
17
- handleProcess
18
- } from "../src/utilities";
19
- function createProgram() {
20
- writeInfo(`${brandIcon()} Running Storm Configuration Tools`, {
21
- logLevel: "all"
22
- });
23
- const root = findWorkspaceRootSafe(process.cwd());
24
- process.env.STORM_WORKSPACE_ROOT ??= root;
25
- process.env.NX_WORKSPACE_ROOT_PATH ??= root;
26
- if (root) {
27
- process.chdir(root);
28
- }
29
- const program = new Command("storm-config");
30
- program.version("1.0.0", "-v --version", "display CLI version");
31
- program.command("view", { isDefault: true }).description("View the current Storm configuration for the workspace.").option(
32
- "-d --dir <path>",
33
- "A directory that exists inside the workspace root",
34
- process.cwd()
35
- ).action(viewAction);
36
- return program;
37
- }
38
- async function viewAction({ dir }) {
39
- writeInfo(
40
- `\u{1F50D} Searching for Storm configuration for the workspace at "${dir}"...`,
41
- {
42
- logLevel: "all"
43
- }
44
- );
45
- const config = await getConfig(findWorkspaceRootSafe(dir), true);
46
- if (config) {
47
- writeSuccess(
48
- `The following Storm configuration values have been found for this repository:
49
-
50
- ${formatLogMessage({ ...config, colors: void 0 })}
51
-
52
- ${typeof config.colors.light === "string" ? formatSingleThemeColors(config.colors) : formatMultiThemeColors(config.colors)}
53
- `,
54
- { ...config, logLevel: "all" }
55
- );
56
- } else {
57
- writeError(
58
- "No Storm config file found in the current workspace. Please ensure this is the expected behavior - you can add a `storm.json` file to the root of your workspace if it is not.\n",
59
- { logLevel: "all" }
60
- );
61
- }
62
- }
63
- void (async () => {
64
- try {
65
- handleProcess();
66
- const program = createProgram();
67
- await program.parseAsync(process.argv);
68
- exitWithSuccess();
69
- } catch (error) {
70
- writeFatal(
71
- `A fatal error occurred while running the Storm Git tool:
72
- ${error?.message ? error.message : JSON.stringify(error)}${error?.stack ? `
73
- Stack Trace: ${error.stack}` : ""}`,
74
- { logLevel: "all" }
75
- );
76
- exitWithError();
77
- process.exit(1);
78
- }
79
- })();
80
- const formatSingleThemeColors = (config) => {
81
- return `---- Theme Colors ----
82
- ${Object.entries(config).filter(
83
- ([key, value]) => key !== "gradient" && typeof value === "string" && value.length > 0
84
- ).map(
85
- ([key, value]) => chalk.hex(String(value))(`${key}: ${chalk.bold(value)}`)
86
- ).join(" \n")}
87
- `;
88
- };
89
- const formatMultiThemeColors = (config) => {
90
- return ` ---- Light Theme Colors ----
91
- ${Object.entries(config.light).filter(
92
- ([key, value]) => key !== "gradient" && typeof value === "string" && value.length > 0
93
- ).map(
94
- ([key, value]) => chalk.hex(String(value))(`${key}: ${chalk.bold(value)}`)
95
- ).join(" \n")}
96
-
97
- ---- Dark Theme Colors ----
98
- ${Object.entries(config.dark).filter(
99
- ([key, value]) => key !== "gradient" && typeof value === "string" && value.length > 0
100
- ).map(
101
- ([key, value]) => chalk.hex(String(value))(`${key}: ${chalk.bold(value)}`)
102
- ).join(" \n")}
103
- `;
104
- };
105
- export {
106
- createProgram,
107
- viewAction
108
- };