@storm-software/config-tools 1.169.7 → 1.170.0

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 (78) hide show
  1. package/README.md +1 -1
  2. package/bin/config.cjs +50 -11
  3. package/bin/config.js +56 -17
  4. package/dist/{chunk-WITKEKZ5.js → chunk-26BPJW3I.js} +12 -9
  5. package/dist/{chunk-BYLFGW3E.cjs → chunk-26LV7S6Z.cjs} +9 -9
  6. package/dist/{chunk-BJ2W75ZO.cjs → chunk-2CVNUZFW.cjs} +22 -19
  7. package/dist/{chunk-XBNXWUW3.cjs → chunk-2IEYYP2I.cjs} +2 -2
  8. package/dist/{chunk-JX5NLB4S.js → chunk-4KZ3BMNG.js} +44 -10
  9. package/dist/{chunk-GIXUQACB.cjs → chunk-4PAEA5KV.cjs} +44 -10
  10. package/dist/{chunk-J2LCTMCI.cjs → chunk-4VJPNKRP.cjs} +9 -9
  11. package/dist/{chunk-D2H6Y42I.cjs → chunk-5XVUNKW6.cjs} +3 -0
  12. package/dist/{chunk-QXXXAJVP.cjs → chunk-6LO4SCE6.cjs} +3 -2
  13. package/dist/{chunk-BAWQ37NK.js → chunk-6YK3KZIF.js} +1 -1
  14. package/dist/{chunk-3TLEBPG2.cjs → chunk-7BVMJTE2.cjs} +9 -9
  15. package/dist/{chunk-QDJMKPQQ.js → chunk-7OSBTSCE.js} +1 -1
  16. package/dist/{chunk-7V5ZWT3O.js → chunk-BKQBZMGO.js} +1 -0
  17. package/dist/{chunk-7HCUD67D.cjs → chunk-BMDGKEGP.cjs} +3 -3
  18. package/dist/{chunk-7SIKKF62.cjs → chunk-DX767CQS.cjs} +2 -2
  19. package/dist/{chunk-56NGBR4S.cjs → chunk-E5XT5FVB.cjs} +3 -2
  20. package/dist/{chunk-H425P7G5.cjs → chunk-F7MZXFL2.cjs} +3 -0
  21. package/dist/{chunk-G6IQUR2B.js → chunk-FRM3M54F.js} +1 -1
  22. package/dist/{chunk-PORZT4W3.js → chunk-JRKB77S5.js} +1 -1
  23. package/dist/{chunk-H2GU4JMJ.cjs → chunk-KX7CIRN3.cjs} +3 -3
  24. package/dist/{chunk-MU2JW35A.js → chunk-MN6CU3TR.js} +14 -11
  25. package/dist/{chunk-JYKZS46U.cjs → chunk-MNLUPWAB.cjs} +5 -5
  26. package/dist/{chunk-IYQC7ESZ.js → chunk-NUOCEMFW.js} +1 -1
  27. package/dist/{chunk-FCWF3I34.cjs → chunk-OD7DEEL5.cjs} +9 -9
  28. package/dist/{chunk-SA3JCBON.js → chunk-OUYYXBZX.js} +4 -4
  29. package/dist/{chunk-LEJKESBR.cjs → chunk-QWVC3UD5.cjs} +3 -3
  30. package/dist/{chunk-LDDYJHK5.cjs → chunk-RJVVMUQK.cjs} +22 -19
  31. package/dist/{chunk-GMHWE7ZI.js → chunk-STYJJA3M.js} +1 -1
  32. package/dist/{chunk-XS7LVKAI.js → chunk-TCSDVRRN.js} +6 -3
  33. package/dist/{chunk-BISNOW2V.cjs → chunk-TGDG6POD.cjs} +2 -2
  34. package/dist/{chunk-5ZIDRDGG.js → chunk-TRI5HQQN.js} +6 -3
  35. package/dist/{chunk-ELNIDXR5.js → chunk-U74E4EM6.js} +1 -1
  36. package/dist/{chunk-Q6MCB3G2.cjs → chunk-UPV2R6VP.cjs} +3 -3
  37. package/dist/{chunk-4DF7JJF3.js → chunk-VSPBZRTR.js} +1 -1
  38. package/dist/{chunk-YGCYQLTS.js → chunk-WT2BVWII.js} +1 -1
  39. package/dist/{chunk-XO6ICAFH.js → chunk-XT2XO7TR.js} +1 -1
  40. package/dist/{chunk-QJUAU656.js → chunk-YPBNOKK2.js} +3 -3
  41. package/dist/{chunk-RSKVXFI5.js → chunk-Z3RQ7QQH.js} +1 -0
  42. package/dist/config-file/get-config-file.cjs +7 -7
  43. package/dist/config-file/get-config-file.js +6 -6
  44. package/dist/config-file/index.cjs +7 -7
  45. package/dist/config-file/index.js +6 -6
  46. package/dist/create-storm-config.cjs +10 -10
  47. package/dist/create-storm-config.js +9 -9
  48. package/dist/env/get-env.cjs +2 -2
  49. package/dist/env/get-env.js +1 -1
  50. package/dist/env/index.cjs +3 -3
  51. package/dist/env/index.js +2 -2
  52. package/dist/env/set-env.cjs +2 -2
  53. package/dist/env/set-env.js +1 -1
  54. package/dist/get-config.cjs +11 -11
  55. package/dist/get-config.js +10 -10
  56. package/dist/index.cjs +13 -11
  57. package/dist/index.d.cts +1 -1
  58. package/dist/index.d.ts +1 -1
  59. package/dist/index.js +14 -12
  60. package/dist/logger/console.cjs +3 -3
  61. package/dist/logger/console.js +2 -2
  62. package/dist/logger/create-logger.cjs +4 -4
  63. package/dist/logger/create-logger.js +3 -3
  64. package/dist/logger/index.cjs +4 -4
  65. package/dist/logger/index.js +3 -3
  66. package/dist/utilities/get-default-config.cjs +4 -2
  67. package/dist/utilities/get-default-config.d.cts +9 -4
  68. package/dist/utilities/get-default-config.d.ts +9 -4
  69. package/dist/utilities/get-default-config.js +5 -3
  70. package/dist/utilities/index.cjs +8 -6
  71. package/dist/utilities/index.d.cts +1 -1
  72. package/dist/utilities/index.d.ts +1 -1
  73. package/dist/utilities/index.js +9 -7
  74. package/dist/utilities/process-handler.cjs +4 -4
  75. package/dist/utilities/process-handler.js +3 -3
  76. package/dist/utilities/toml.cjs +5 -5
  77. package/dist/utilities/toml.js +4 -4
  78. package/package.json +2 -2
package/README.md CHANGED
@@ -21,7 +21,7 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
21
21
 
22
22
  <h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
23
23
 
24
- [![Version](https://img.shields.io/badge/version-1.169.6-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
24
+ [![Version](https://img.shields.io/badge/version-1.169.8-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
25
25
 
26
26
  <!-- prettier-ignore-start -->
27
27
  <!-- markdownlint-disable -->
package/bin/config.cjs CHANGED
@@ -323,9 +323,10 @@ var DEFAULT_COLOR_CONFIG = {
323
323
  negative: "#dc2626"
324
324
  }
325
325
  };
326
- var getDefaultConfig = async (root) => {
326
+ async function getPackageJsonConfig(root) {
327
327
  let license = import_config.STORM_DEFAULT_LICENSE;
328
- let homepage = import_config.STORM_DEFAULT_HOMEPAGE;
328
+ let homepage = void 0;
329
+ let support = void 0;
329
330
  let name = void 0;
330
331
  let namespace = void 0;
331
332
  let repository = void 0;
@@ -356,6 +357,13 @@ var getDefaultConfig = async (root) => {
356
357
  if (packageJson.homepage) {
357
358
  homepage = packageJson.homepage;
358
359
  }
360
+ if (packageJson.bugs) {
361
+ if (typeof packageJson.bugs === "string") {
362
+ support = packageJson.bugs;
363
+ } else if (packageJson.bugs.url) {
364
+ support = packageJson.bugs.url;
365
+ }
366
+ }
359
367
  }
360
368
  }
361
369
  return {
@@ -365,13 +373,38 @@ var getDefaultConfig = async (root) => {
365
373
  repository,
366
374
  license,
367
375
  homepage,
368
- docs: `${homepage || import_config.STORM_DEFAULT_HOMEPAGE}/docs`,
369
- licensing: `${homepage || import_config.STORM_DEFAULT_HOMEPAGE}/license`,
370
- error: {
371
- url: `${homepage || import_config.STORM_DEFAULT_HOMEPAGE}/errors`
372
- }
376
+ support
373
377
  };
374
- };
378
+ }
379
+ function applyDefaultConfig(config) {
380
+ if (!config.support && config.contact) {
381
+ config.support = config.contact;
382
+ }
383
+ if (!config.contact && config.support) {
384
+ config.contact = config.support;
385
+ }
386
+ if (config.homepage) {
387
+ if (!config.docs) {
388
+ config.docs = `${config.homepage}/docs`;
389
+ }
390
+ if (!config.license) {
391
+ config.license = `${config.homepage}/license`;
392
+ }
393
+ if (!config.support) {
394
+ config.support = `${config.homepage}/support`;
395
+ }
396
+ if (!config.contact) {
397
+ config.contact = `${config.homepage}/contact`;
398
+ }
399
+ if (!config.error?.codesFile || !config?.error?.url) {
400
+ config.error ??= { codesFile: import_config.STORM_DEFAULT_ERROR_CODES_FILE };
401
+ if (config.homepage) {
402
+ config.error.url ??= `${config.homepage}/errors`;
403
+ }
404
+ }
405
+ }
406
+ return config;
407
+ }
375
408
 
376
409
  // src/logger/chalk.ts
377
410
  var import_chalk = __toESM(require("chalk"), 1);
@@ -760,6 +793,7 @@ var getConfigEnv = () => {
760
793
  docs: process.env[`${prefix}DOCS`] || void 0,
761
794
  licensing: process.env[`${prefix}LICENSING`] || void 0,
762
795
  contact: process.env[`${prefix}CONTACT`] || void 0,
796
+ support: process.env[`${prefix}SUPPORT`] || void 0,
763
797
  timezone: process.env[`${prefix}TIMEZONE`] || process.env.TZ || void 0,
764
798
  locale: process.env[`${prefix}LOCALE`] || process.env.LOCALE || void 0,
765
799
  configFile: process.env[`${prefix}CONFIG_FILE`] ? correctPaths(process.env[`${prefix}CONFIG_FILE`]) : void 0,
@@ -978,6 +1012,9 @@ var setConfigEnv = (config) => {
978
1012
  if (config.contact) {
979
1013
  process.env[`${prefix}CONTACT`] = config.contact;
980
1014
  }
1015
+ if (config.support) {
1016
+ process.env[`${prefix}SUPPORT`] = config.support;
1017
+ }
981
1018
  if (config.timezone) {
982
1019
  process.env[`${prefix}TIMEZONE`] = config.timezone;
983
1020
  process.env.TZ = config.timezone;
@@ -1227,9 +1264,11 @@ var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, sk
1227
1264
  return void 0;
1228
1265
  }
1229
1266
  }
1230
- const defaultConfig = await getDefaultConfig(_workspaceRoot);
1231
- result = await import_schema.stormWorkspaceConfigSchema.parseAsync(
1232
- (0, import_defu2.default)(configEnv, configFile, defaultConfig)
1267
+ const defaultConfig = await getPackageJsonConfig(_workspaceRoot);
1268
+ result = applyDefaultConfig(
1269
+ await import_schema.stormWorkspaceConfigSchema.parseAsync(
1270
+ (0, import_defu2.default)(configEnv, configFile, defaultConfig)
1271
+ )
1233
1272
  );
1234
1273
  result.workspaceRoot ??= _workspaceRoot;
1235
1274
  } else {
package/bin/config.js CHANGED
@@ -37,7 +37,7 @@ var LogLevelLabel = {
37
37
 
38
38
  // src/utilities/get-default-config.ts
39
39
  import {
40
- STORM_DEFAULT_HOMEPAGE,
40
+ STORM_DEFAULT_ERROR_CODES_FILE,
41
41
  STORM_DEFAULT_LICENSE
42
42
  } from "@storm-software/config";
43
43
  import { existsSync as existsSync2 } from "node:fs";
@@ -293,9 +293,10 @@ var DEFAULT_COLOR_CONFIG = {
293
293
  negative: "#dc2626"
294
294
  }
295
295
  };
296
- var getDefaultConfig = async (root) => {
296
+ async function getPackageJsonConfig(root) {
297
297
  let license = STORM_DEFAULT_LICENSE;
298
- let homepage = STORM_DEFAULT_HOMEPAGE;
298
+ let homepage = void 0;
299
+ let support = void 0;
299
300
  let name = void 0;
300
301
  let namespace = void 0;
301
302
  let repository = void 0;
@@ -326,6 +327,13 @@ var getDefaultConfig = async (root) => {
326
327
  if (packageJson.homepage) {
327
328
  homepage = packageJson.homepage;
328
329
  }
330
+ if (packageJson.bugs) {
331
+ if (typeof packageJson.bugs === "string") {
332
+ support = packageJson.bugs;
333
+ } else if (packageJson.bugs.url) {
334
+ support = packageJson.bugs.url;
335
+ }
336
+ }
329
337
  }
330
338
  }
331
339
  return {
@@ -335,13 +343,38 @@ var getDefaultConfig = async (root) => {
335
343
  repository,
336
344
  license,
337
345
  homepage,
338
- docs: `${homepage || STORM_DEFAULT_HOMEPAGE}/docs`,
339
- licensing: `${homepage || STORM_DEFAULT_HOMEPAGE}/license`,
340
- error: {
341
- url: `${homepage || STORM_DEFAULT_HOMEPAGE}/errors`
342
- }
346
+ support
343
347
  };
344
- };
348
+ }
349
+ function applyDefaultConfig(config) {
350
+ if (!config.support && config.contact) {
351
+ config.support = config.contact;
352
+ }
353
+ if (!config.contact && config.support) {
354
+ config.contact = config.support;
355
+ }
356
+ if (config.homepage) {
357
+ if (!config.docs) {
358
+ config.docs = `${config.homepage}/docs`;
359
+ }
360
+ if (!config.license) {
361
+ config.license = `${config.homepage}/license`;
362
+ }
363
+ if (!config.support) {
364
+ config.support = `${config.homepage}/support`;
365
+ }
366
+ if (!config.contact) {
367
+ config.contact = `${config.homepage}/contact`;
368
+ }
369
+ if (!config.error?.codesFile || !config?.error?.url) {
370
+ config.error ??= { codesFile: STORM_DEFAULT_ERROR_CODES_FILE };
371
+ if (config.homepage) {
372
+ config.error.url ??= `${config.homepage}/errors`;
373
+ }
374
+ }
375
+ }
376
+ return config;
377
+ }
345
378
 
346
379
  // src/logger/chalk.ts
347
380
  import chalk from "chalk";
@@ -685,7 +718,7 @@ var getConfigFile = async (filePath, additionalFileNames = []) => {
685
718
  import {
686
719
  COLOR_KEYS,
687
720
  STORM_DEFAULT_DOCS,
688
- STORM_DEFAULT_HOMEPAGE as STORM_DEFAULT_HOMEPAGE2,
721
+ STORM_DEFAULT_HOMEPAGE,
689
722
  STORM_DEFAULT_LICENSING
690
723
  } from "@storm-software/config";
691
724
  var getExtensionEnv = (extensionName) => {
@@ -735,6 +768,7 @@ var getConfigEnv = () => {
735
768
  docs: process.env[`${prefix}DOCS`] || void 0,
736
769
  licensing: process.env[`${prefix}LICENSING`] || void 0,
737
770
  contact: process.env[`${prefix}CONTACT`] || void 0,
771
+ support: process.env[`${prefix}SUPPORT`] || void 0,
738
772
  timezone: process.env[`${prefix}TIMEZONE`] || process.env.TZ || void 0,
739
773
  locale: process.env[`${prefix}LOCALE`] || process.env.LOCALE || void 0,
740
774
  configFile: process.env[`${prefix}CONFIG_FILE`] ? correctPaths(process.env[`${prefix}CONFIG_FILE`]) : void 0,
@@ -788,15 +822,15 @@ var getConfigEnv = () => {
788
822
  {}
789
823
  ) : getThemeColorConfigEnv(prefix);
790
824
  if (config.docs === STORM_DEFAULT_DOCS) {
791
- if (config.homepage === STORM_DEFAULT_HOMEPAGE2) {
792
- config.docs = `${STORM_DEFAULT_HOMEPAGE2}/projects/${config.name}/docs`;
825
+ if (config.homepage === STORM_DEFAULT_HOMEPAGE) {
826
+ config.docs = `${STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/docs`;
793
827
  } else {
794
828
  config.docs = `${config.homepage}/docs`;
795
829
  }
796
830
  }
797
831
  if (config.licensing === STORM_DEFAULT_LICENSING) {
798
- if (config.homepage === STORM_DEFAULT_HOMEPAGE2) {
799
- config.licensing = `${STORM_DEFAULT_HOMEPAGE2}/projects/${config.name}/licensing`;
832
+ if (config.homepage === STORM_DEFAULT_HOMEPAGE) {
833
+ config.licensing = `${STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/licensing`;
800
834
  } else {
801
835
  config.licensing = `${config.homepage}/docs`;
802
836
  }
@@ -953,6 +987,9 @@ var setConfigEnv = (config) => {
953
987
  if (config.contact) {
954
988
  process.env[`${prefix}CONTACT`] = config.contact;
955
989
  }
990
+ if (config.support) {
991
+ process.env[`${prefix}SUPPORT`] = config.support;
992
+ }
956
993
  if (config.timezone) {
957
994
  process.env[`${prefix}TIMEZONE`] = config.timezone;
958
995
  process.env.TZ = config.timezone;
@@ -1202,9 +1239,11 @@ var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, sk
1202
1239
  return void 0;
1203
1240
  }
1204
1241
  }
1205
- const defaultConfig = await getDefaultConfig(_workspaceRoot);
1206
- result = await stormWorkspaceConfigSchema.parseAsync(
1207
- defu2(configEnv, configFile, defaultConfig)
1242
+ const defaultConfig = await getPackageJsonConfig(_workspaceRoot);
1243
+ result = applyDefaultConfig(
1244
+ await stormWorkspaceConfigSchema.parseAsync(
1245
+ defu2(configEnv, configFile, defaultConfig)
1246
+ )
1208
1247
  );
1209
1248
  result.workspaceRoot ??= _workspaceRoot;
1210
1249
  } else {
@@ -1,24 +1,25 @@
1
1
  import {
2
2
  getConfigFile
3
- } from "./chunk-XO6ICAFH.js";
3
+ } from "./chunk-XT2XO7TR.js";
4
4
  import {
5
5
  formatLogMessage,
6
6
  writeTrace,
7
7
  writeWarning
8
- } from "./chunk-QJUAU656.js";
8
+ } from "./chunk-OUYYXBZX.js";
9
9
  import {
10
- getDefaultConfig
11
- } from "./chunk-JX5NLB4S.js";
10
+ applyDefaultConfig,
11
+ getPackageJsonConfig
12
+ } from "./chunk-4KZ3BMNG.js";
12
13
  import {
13
14
  findWorkspaceRoot
14
15
  } from "./chunk-VLWSWYG7.js";
15
16
  import {
16
17
  setConfigEnv
17
- } from "./chunk-XS7LVKAI.js";
18
+ } from "./chunk-TRI5HQQN.js";
18
19
  import {
19
20
  getConfigEnv,
20
21
  getExtensionEnv
21
- } from "./chunk-RSKVXFI5.js";
22
+ } from "./chunk-Z3RQ7QQH.js";
22
23
 
23
24
  // src/create-storm-config.ts
24
25
  import { stormWorkspaceConfigSchema } from "@storm-software/config/schema";
@@ -45,9 +46,11 @@ var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, sk
45
46
  return void 0;
46
47
  }
47
48
  }
48
- const defaultConfig = await getDefaultConfig(_workspaceRoot);
49
- result = await stormWorkspaceConfigSchema.parseAsync(
50
- defu(configEnv, configFile, defaultConfig)
49
+ const defaultConfig = await getPackageJsonConfig(_workspaceRoot);
50
+ result = applyDefaultConfig(
51
+ await stormWorkspaceConfigSchema.parseAsync(
52
+ defu(configEnv, configFile, defaultConfig)
53
+ )
51
54
  );
52
55
  result.workspaceRoot ??= _workspaceRoot;
53
56
  } else {
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
2
 
3
3
 
4
- var _chunkJYKZS46Ucjs = require('./chunk-JYKZS46U.cjs');
4
+ var _chunkDX767CQScjs = require('./chunk-DX767CQS.cjs');
5
5
 
6
6
 
7
7
  var _chunkAEZINHEAcjs = require('./chunk-AEZINHEA.cjs');
@@ -16,13 +16,13 @@ async function createLogger(config) {
16
16
  if (!workspaceRoot) {
17
17
  throw new Error("Cannot find workspace root");
18
18
  }
19
- const writeFatal = _chunkJYKZS46Ucjs.getLogFn.call(void 0, _chunkC5OTFOQBcjs.LogLevel.FATAL, config, _chalk2.default);
20
- const writeError = _chunkJYKZS46Ucjs.getLogFn.call(void 0, _chunkC5OTFOQBcjs.LogLevel.ERROR, config, _chalk2.default);
21
- const writeWarning = _chunkJYKZS46Ucjs.getLogFn.call(void 0, _chunkC5OTFOQBcjs.LogLevel.WARN, config, _chalk2.default);
22
- const writeInfo = _chunkJYKZS46Ucjs.getLogFn.call(void 0, _chunkC5OTFOQBcjs.LogLevel.INFO, config, _chalk2.default);
23
- const writeSuccess = _chunkJYKZS46Ucjs.getLogFn.call(void 0, _chunkC5OTFOQBcjs.LogLevel.SUCCESS, config, _chalk2.default);
24
- const writeDebug = _chunkJYKZS46Ucjs.getLogFn.call(void 0, _chunkC5OTFOQBcjs.LogLevel.DEBUG, config, _chalk2.default);
25
- const writeTrace = _chunkJYKZS46Ucjs.getLogFn.call(void 0, _chunkC5OTFOQBcjs.LogLevel.DEBUG, config, _chalk2.default);
19
+ const writeFatal = _chunkDX767CQScjs.getLogFn.call(void 0, _chunkC5OTFOQBcjs.LogLevel.FATAL, config, _chalk2.default);
20
+ const writeError = _chunkDX767CQScjs.getLogFn.call(void 0, _chunkC5OTFOQBcjs.LogLevel.ERROR, config, _chalk2.default);
21
+ const writeWarning = _chunkDX767CQScjs.getLogFn.call(void 0, _chunkC5OTFOQBcjs.LogLevel.WARN, config, _chalk2.default);
22
+ const writeInfo = _chunkDX767CQScjs.getLogFn.call(void 0, _chunkC5OTFOQBcjs.LogLevel.INFO, config, _chalk2.default);
23
+ const writeSuccess = _chunkDX767CQScjs.getLogFn.call(void 0, _chunkC5OTFOQBcjs.LogLevel.SUCCESS, config, _chalk2.default);
24
+ const writeDebug = _chunkDX767CQScjs.getLogFn.call(void 0, _chunkC5OTFOQBcjs.LogLevel.DEBUG, config, _chalk2.default);
25
+ const writeTrace = _chunkDX767CQScjs.getLogFn.call(void 0, _chunkC5OTFOQBcjs.LogLevel.DEBUG, config, _chalk2.default);
26
26
  return {
27
27
  fatal: writeFatal,
28
28
  error: writeError,
@@ -31,7 +31,7 @@ async function createLogger(config) {
31
31
  success: writeSuccess,
32
32
  debug: writeDebug,
33
33
  trace: writeTrace,
34
- getStopwatch: _chunkJYKZS46Ucjs.getStopwatch
34
+ getStopwatch: _chunkDX767CQScjs.getStopwatch
35
35
  };
36
36
  }
37
37
 
@@ -1,24 +1,25 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunk7HCUD67Dcjs = require('./chunk-7HCUD67D.cjs');
3
+ var _chunkBMDGKEGPcjs = require('./chunk-BMDGKEGP.cjs');
4
4
 
5
5
 
6
6
 
7
7
 
8
- var _chunk7SIKKF62cjs = require('./chunk-7SIKKF62.cjs');
8
+ var _chunkDX767CQScjs = require('./chunk-DX767CQS.cjs');
9
9
 
10
10
 
11
- var _chunkGIXUQACBcjs = require('./chunk-GIXUQACB.cjs');
11
+
12
+ var _chunk4PAEA5KVcjs = require('./chunk-4PAEA5KV.cjs');
12
13
 
13
14
 
14
15
  var _chunkAEZINHEAcjs = require('./chunk-AEZINHEA.cjs');
15
16
 
16
17
 
17
- var _chunkH425P7G5cjs = require('./chunk-H425P7G5.cjs');
18
+ var _chunkF7MZXFL2cjs = require('./chunk-F7MZXFL2.cjs');
18
19
 
19
20
 
20
21
 
21
- var _chunk56NGBR4Scjs = require('./chunk-56NGBR4S.cjs');
22
+ var _chunk6LO4SCE6cjs = require('./chunk-6LO4SCE6.cjs');
22
23
 
23
24
  // src/create-storm-config.ts
24
25
  var _schema = require('@storm-software/config/schema');
@@ -32,11 +33,11 @@ var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, sk
32
33
  if (!_workspaceRoot) {
33
34
  _workspaceRoot = _chunkAEZINHEAcjs.findWorkspaceRoot.call(void 0, );
34
35
  }
35
- const configEnv = _chunk56NGBR4Scjs.getConfigEnv.call(void 0, );
36
- const configFile = await _chunk7HCUD67Dcjs.getConfigFile.call(void 0, _workspaceRoot);
36
+ const configEnv = _chunk6LO4SCE6cjs.getConfigEnv.call(void 0, );
37
+ const configFile = await _chunkBMDGKEGPcjs.getConfigFile.call(void 0, _workspaceRoot);
37
38
  if (!configFile) {
38
39
  if (!skipLogs) {
39
- _chunk7SIKKF62cjs.writeWarning.call(void 0,
40
+ _chunkDX767CQScjs.writeWarning.call(void 0,
40
41
  "No Storm Workspace configuration file found in the current repository. Please ensure this is the expected behavior - you can add a `storm-workspace.json` file to the root of your workspace if it is not.\n",
41
42
  { logLevel: "all" }
42
43
  );
@@ -45,9 +46,11 @@ var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, sk
45
46
  return void 0;
46
47
  }
47
48
  }
48
- const defaultConfig = await _chunkGIXUQACBcjs.getDefaultConfig.call(void 0, _workspaceRoot);
49
- result = await _schema.stormWorkspaceConfigSchema.parseAsync(
50
- _defu2.default.call(void 0, configEnv, configFile, defaultConfig)
49
+ const defaultConfig = await _chunk4PAEA5KVcjs.getPackageJsonConfig.call(void 0, _workspaceRoot);
50
+ result = _chunk4PAEA5KVcjs.applyDefaultConfig.call(void 0,
51
+ await _schema.stormWorkspaceConfigSchema.parseAsync(
52
+ _defu2.default.call(void 0, configEnv, configFile, defaultConfig)
53
+ )
51
54
  );
52
55
  result.workspaceRoot ??= _workspaceRoot;
53
56
  } else {
@@ -70,7 +73,7 @@ var createConfigExtension = (extensionName, schema) => {
70
73
  if (_extension_cache.has(extension_cache_key)) {
71
74
  return _extension_cache.get(extension_cache_key);
72
75
  }
73
- let extension = _chunk56NGBR4Scjs.getExtensionEnv.call(void 0, extensionName);
76
+ let extension = _chunk6LO4SCE6cjs.getExtensionEnv.call(void 0, extensionName);
74
77
  if (schema) {
75
78
  extension = schema.parse(extension);
76
79
  }
@@ -85,11 +88,11 @@ var loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
85
88
  skipLogs,
86
89
  true
87
90
  );
88
- _chunkH425P7G5cjs.setConfigEnv.call(void 0, config);
91
+ _chunkF7MZXFL2cjs.setConfigEnv.call(void 0, config);
89
92
  if (!skipLogs && !config.skipConfigLogging) {
90
- _chunk7SIKKF62cjs.writeTrace.call(void 0,
93
+ _chunkDX767CQScjs.writeTrace.call(void 0,
91
94
  `\u2699\uFE0F Using Storm Workspace configuration:
92
- ${_chunk7SIKKF62cjs.formatLogMessage.call(void 0, config)}`,
95
+ ${_chunkDX767CQScjs.formatLogMessage.call(void 0, config)}`,
93
96
  config
94
97
  );
95
98
  }
@@ -107,18 +110,18 @@ var tryLoadStormWorkspaceConfig = async (workspaceRoot, skipLogs = true, useDefa
107
110
  if (!config) {
108
111
  return void 0;
109
112
  }
110
- _chunkH425P7G5cjs.setConfigEnv.call(void 0, config);
113
+ _chunkF7MZXFL2cjs.setConfigEnv.call(void 0, config);
111
114
  if (!skipLogs && !config.skipConfigLogging) {
112
- _chunk7SIKKF62cjs.writeTrace.call(void 0,
115
+ _chunkDX767CQScjs.writeTrace.call(void 0,
113
116
  `\u2699\uFE0F Using Storm Workspace configuration:
114
- ${_chunk7SIKKF62cjs.formatLogMessage.call(void 0, config)}`,
117
+ ${_chunkDX767CQScjs.formatLogMessage.call(void 0, config)}`,
115
118
  config
116
119
  );
117
120
  }
118
121
  return config;
119
122
  } catch (error) {
120
123
  if (!skipLogs) {
121
- _chunk7SIKKF62cjs.writeWarning.call(void 0,
124
+ _chunkDX767CQScjs.writeWarning.call(void 0,
122
125
  `\u26A0\uFE0F Failed to load Storm Workspace configuration: ${error}`,
123
126
  { logLevel: "all" }
124
127
  );
@@ -1,13 +1,13 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunk7SIKKF62cjs = require('./chunk-7SIKKF62.cjs');
3
+ var _chunkMNLUPWABcjs = require('./chunk-MNLUPWAB.cjs');
4
4
 
5
5
  // src/utilities/toml.ts
6
6
  var _jtoml = require('@ltd/j-toml'); var _jtoml2 = _interopRequireDefault(_jtoml);
7
7
  function parseCargoTomlWithTree(tree, projectRoot, projectName) {
8
8
  const cargoTomlString = _optionalChain([tree, 'access', _ => _.read, 'call', _2 => _2(`${projectRoot}/Cargo.toml`), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]);
9
9
  if (!cargoTomlString) {
10
- _chunk7SIKKF62cjs.writeError.call(void 0, `Cannot find a Cargo.toml file in the ${projectName}`);
10
+ _chunkMNLUPWABcjs.writeError.call(void 0, `Cannot find a Cargo.toml file in the ${projectName}`);
11
11
  throw new Error();
12
12
  }
13
13
  return parseCargoToml(cargoTomlString);
@@ -7,7 +7,7 @@ import {
7
7
 
8
8
  // src/utilities/get-default-config.ts
9
9
  import {
10
- STORM_DEFAULT_HOMEPAGE,
10
+ STORM_DEFAULT_ERROR_CODES_FILE,
11
11
  STORM_DEFAULT_LICENSE
12
12
  } from "@storm-software/config";
13
13
  import { existsSync } from "node:fs";
@@ -41,9 +41,10 @@ var DEFAULT_COLOR_CONFIG = {
41
41
  negative: "#dc2626"
42
42
  }
43
43
  };
44
- var getDefaultConfig = async (root) => {
44
+ async function getPackageJsonConfig(root) {
45
45
  let license = STORM_DEFAULT_LICENSE;
46
- let homepage = STORM_DEFAULT_HOMEPAGE;
46
+ let homepage = void 0;
47
+ let support = void 0;
47
48
  let name = void 0;
48
49
  let namespace = void 0;
49
50
  let repository = void 0;
@@ -74,6 +75,13 @@ var getDefaultConfig = async (root) => {
74
75
  if (packageJson.homepage) {
75
76
  homepage = packageJson.homepage;
76
77
  }
78
+ if (packageJson.bugs) {
79
+ if (typeof packageJson.bugs === "string") {
80
+ support = packageJson.bugs;
81
+ } else if (packageJson.bugs.url) {
82
+ support = packageJson.bugs.url;
83
+ }
84
+ }
77
85
  }
78
86
  }
79
87
  return {
@@ -83,15 +91,41 @@ var getDefaultConfig = async (root) => {
83
91
  repository,
84
92
  license,
85
93
  homepage,
86
- docs: `${homepage || STORM_DEFAULT_HOMEPAGE}/docs`,
87
- licensing: `${homepage || STORM_DEFAULT_HOMEPAGE}/license`,
88
- error: {
89
- url: `${homepage || STORM_DEFAULT_HOMEPAGE}/errors`
90
- }
94
+ support
91
95
  };
92
- };
96
+ }
97
+ function applyDefaultConfig(config) {
98
+ if (!config.support && config.contact) {
99
+ config.support = config.contact;
100
+ }
101
+ if (!config.contact && config.support) {
102
+ config.contact = config.support;
103
+ }
104
+ if (config.homepage) {
105
+ if (!config.docs) {
106
+ config.docs = `${config.homepage}/docs`;
107
+ }
108
+ if (!config.license) {
109
+ config.license = `${config.homepage}/license`;
110
+ }
111
+ if (!config.support) {
112
+ config.support = `${config.homepage}/support`;
113
+ }
114
+ if (!config.contact) {
115
+ config.contact = `${config.homepage}/contact`;
116
+ }
117
+ if (!config.error?.codesFile || !config?.error?.url) {
118
+ config.error ??= { codesFile: STORM_DEFAULT_ERROR_CODES_FILE };
119
+ if (config.homepage) {
120
+ config.error.url ??= `${config.homepage}/errors`;
121
+ }
122
+ }
123
+ }
124
+ return config;
125
+ }
93
126
 
94
127
  export {
95
128
  DEFAULT_COLOR_CONFIG,
96
- getDefaultConfig
129
+ getPackageJsonConfig,
130
+ applyDefaultConfig
97
131
  };
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
3
  var _chunkAEZINHEAcjs = require('./chunk-AEZINHEA.cjs');
4
4
 
@@ -41,9 +41,10 @@ var DEFAULT_COLOR_CONFIG = {
41
41
  negative: "#dc2626"
42
42
  }
43
43
  };
44
- var getDefaultConfig = async (root) => {
44
+ async function getPackageJsonConfig(root) {
45
45
  let license = _config.STORM_DEFAULT_LICENSE;
46
- let homepage = _config.STORM_DEFAULT_HOMEPAGE;
46
+ let homepage = void 0;
47
+ let support = void 0;
47
48
  let name = void 0;
48
49
  let namespace = void 0;
49
50
  let repository = void 0;
@@ -74,6 +75,13 @@ var getDefaultConfig = async (root) => {
74
75
  if (packageJson.homepage) {
75
76
  homepage = packageJson.homepage;
76
77
  }
78
+ if (packageJson.bugs) {
79
+ if (typeof packageJson.bugs === "string") {
80
+ support = packageJson.bugs;
81
+ } else if (packageJson.bugs.url) {
82
+ support = packageJson.bugs.url;
83
+ }
84
+ }
77
85
  }
78
86
  }
79
87
  return {
@@ -83,15 +91,41 @@ var getDefaultConfig = async (root) => {
83
91
  repository,
84
92
  license,
85
93
  homepage,
86
- docs: `${homepage || _config.STORM_DEFAULT_HOMEPAGE}/docs`,
87
- licensing: `${homepage || _config.STORM_DEFAULT_HOMEPAGE}/license`,
88
- error: {
89
- url: `${homepage || _config.STORM_DEFAULT_HOMEPAGE}/errors`
90
- }
94
+ support
91
95
  };
92
- };
96
+ }
97
+ function applyDefaultConfig(config) {
98
+ if (!config.support && config.contact) {
99
+ config.support = config.contact;
100
+ }
101
+ if (!config.contact && config.support) {
102
+ config.contact = config.support;
103
+ }
104
+ if (config.homepage) {
105
+ if (!config.docs) {
106
+ config.docs = `${config.homepage}/docs`;
107
+ }
108
+ if (!config.license) {
109
+ config.license = `${config.homepage}/license`;
110
+ }
111
+ if (!config.support) {
112
+ config.support = `${config.homepage}/support`;
113
+ }
114
+ if (!config.contact) {
115
+ config.contact = `${config.homepage}/contact`;
116
+ }
117
+ if (!_optionalChain([config, 'access', _ => _.error, 'optionalAccess', _2 => _2.codesFile]) || !_optionalChain([config, 'optionalAccess', _3 => _3.error, 'optionalAccess', _4 => _4.url])) {
118
+ config.error ??= { codesFile: _config.STORM_DEFAULT_ERROR_CODES_FILE };
119
+ if (config.homepage) {
120
+ config.error.url ??= `${config.homepage}/errors`;
121
+ }
122
+ }
123
+ }
124
+ return config;
125
+ }
126
+
93
127
 
94
128
 
95
129
 
96
130
 
97
- exports.DEFAULT_COLOR_CONFIG = DEFAULT_COLOR_CONFIG; exports.getDefaultConfig = getDefaultConfig;
131
+ exports.DEFAULT_COLOR_CONFIG = DEFAULT_COLOR_CONFIG; exports.getPackageJsonConfig = getPackageJsonConfig; exports.applyDefaultConfig = applyDefaultConfig;