@storm-software/workspace-tools 1.43.0 → 1.43.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.
@@ -20174,14 +20174,14 @@ var require_templates = __commonJS({
20174
20174
  }
20175
20175
  return results;
20176
20176
  }
20177
- function buildStyle(chalk3, styles) {
20177
+ function buildStyle(chalk2, styles) {
20178
20178
  const enabled = {};
20179
20179
  for (const layer of styles) {
20180
20180
  for (const style of layer.styles) {
20181
20181
  enabled[style[0]] = layer.inverse ? null : style.slice(1);
20182
20182
  }
20183
20183
  }
20184
- let current = chalk3;
20184
+ let current = chalk2;
20185
20185
  for (const styleName of Object.keys(enabled)) {
20186
20186
  if (Array.isArray(enabled[styleName])) {
20187
20187
  if (!(styleName in current)) {
@@ -20196,7 +20196,7 @@ var require_templates = __commonJS({
20196
20196
  }
20197
20197
  return current;
20198
20198
  }
20199
- module2.exports = (chalk3, tmp) => {
20199
+ module2.exports = (chalk2, tmp) => {
20200
20200
  const styles = [];
20201
20201
  const chunks = [];
20202
20202
  let chunk = [];
@@ -20206,13 +20206,13 @@ var require_templates = __commonJS({
20206
20206
  } else if (style) {
20207
20207
  const str = chunk.join("");
20208
20208
  chunk = [];
20209
- chunks.push(styles.length === 0 ? str : buildStyle(chalk3, styles)(str));
20209
+ chunks.push(styles.length === 0 ? str : buildStyle(chalk2, styles)(str));
20210
20210
  styles.push({ inverse, styles: parseStyle(style) });
20211
20211
  } else if (close) {
20212
20212
  if (styles.length === 0) {
20213
20213
  throw new Error("Found extraneous } in Chalk template literal");
20214
20214
  }
20215
- chunks.push(buildStyle(chalk3, styles)(chunk.join("")));
20215
+ chunks.push(buildStyle(chalk2, styles)(chunk.join("")));
20216
20216
  chunk = [];
20217
20217
  styles.pop();
20218
20218
  } else {
@@ -20249,16 +20249,16 @@ var require_chalk = __commonJS({
20249
20249
  }
20250
20250
  function Chalk(options) {
20251
20251
  if (!this || !(this instanceof Chalk) || this.template) {
20252
- const chalk3 = {};
20253
- applyOptions(chalk3, options);
20254
- chalk3.template = function() {
20252
+ const chalk2 = {};
20253
+ applyOptions(chalk2, options);
20254
+ chalk2.template = function() {
20255
20255
  const args = [].slice.call(arguments);
20256
- return chalkTag.apply(null, [chalk3.template].concat(args));
20256
+ return chalkTag.apply(null, [chalk2.template].concat(args));
20257
20257
  };
20258
- Object.setPrototypeOf(chalk3, Chalk.prototype);
20259
- Object.setPrototypeOf(chalk3.template, chalk3);
20260
- chalk3.template.constructor = Chalk;
20261
- return chalk3.template;
20258
+ Object.setPrototypeOf(chalk2, Chalk.prototype);
20259
+ Object.setPrototypeOf(chalk2.template, chalk2);
20260
+ chalk2.template.constructor = Chalk;
20261
+ return chalk2.template;
20262
20262
  }
20263
20263
  applyOptions(this, options);
20264
20264
  }
@@ -20377,7 +20377,7 @@ var require_chalk = __commonJS({
20377
20377
  ansiStyles.dim.open = originalDim;
20378
20378
  return str;
20379
20379
  }
20380
- function chalkTag(chalk3, strings) {
20380
+ function chalkTag(chalk2, strings) {
20381
20381
  if (!Array.isArray(strings)) {
20382
20382
  return [].slice.call(arguments, 1).join(" ");
20383
20383
  }
@@ -20387,7 +20387,7 @@ var require_chalk = __commonJS({
20387
20387
  parts.push(String(args[i - 1]).replace(/[{}\\]/g, "\\$&"));
20388
20388
  parts.push(String(strings.raw[i]));
20389
20389
  }
20390
- return template(chalk3, parts.join(""));
20390
+ return template(chalk2, parts.join(""));
20391
20391
  }
20392
20392
  Object.defineProperties(Chalk.prototype, styles);
20393
20393
  module2.exports = Chalk();
@@ -20433,17 +20433,17 @@ var require_lib2 = __commonJS({
20433
20433
  return n.default = e, t && t.set(e, n), n;
20434
20434
  }
20435
20435
  var sometimesKeywords = /* @__PURE__ */ new Set(["as", "async", "from", "get", "of", "set"]);
20436
- function getDefs(chalk3) {
20436
+ function getDefs(chalk2) {
20437
20437
  return {
20438
- keyword: chalk3.cyan,
20439
- capitalized: chalk3.yellow,
20440
- jsxIdentifier: chalk3.yellow,
20441
- punctuator: chalk3.yellow,
20442
- number: chalk3.magenta,
20443
- string: chalk3.green,
20444
- regex: chalk3.magenta,
20445
- comment: chalk3.grey,
20446
- invalid: chalk3.white.bgRed.bold
20438
+ keyword: chalk2.cyan,
20439
+ capitalized: chalk2.yellow,
20440
+ jsxIdentifier: chalk2.yellow,
20441
+ punctuator: chalk2.yellow,
20442
+ number: chalk2.magenta,
20443
+ string: chalk2.green,
20444
+ regex: chalk2.magenta,
20445
+ comment: chalk2.grey,
20446
+ invalid: chalk2.white.bgRed.bold
20447
20447
  };
20448
20448
  }
20449
20449
  var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
@@ -20574,11 +20574,11 @@ var require_lib3 = __commonJS({
20574
20574
  return _chalk.default;
20575
20575
  }
20576
20576
  var deprecationWarningShown = false;
20577
- function getDefs(chalk3) {
20577
+ function getDefs(chalk2) {
20578
20578
  return {
20579
- gutter: chalk3.grey,
20580
- marker: chalk3.red.bold,
20581
- message: chalk3.red.bold
20579
+ gutter: chalk2.grey,
20580
+ marker: chalk2.red.bold,
20581
+ message: chalk2.red.bold
20582
20582
  };
20583
20583
  }
20584
20584
  var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
@@ -20640,8 +20640,8 @@ var require_lib3 = __commonJS({
20640
20640
  }
20641
20641
  function codeFrameColumns(rawLines, loc, opts = {}) {
20642
20642
  const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight.shouldHighlight)(opts);
20643
- const chalk3 = getChalk(opts.forceColor);
20644
- const defs = getDefs(chalk3);
20643
+ const chalk2 = getChalk(opts.forceColor);
20644
+ const defs = getDefs(chalk2);
20645
20645
  const maybeHighlight = (chalkFn, string) => {
20646
20646
  return highlighted ? chalkFn(string) : string;
20647
20647
  };
@@ -20680,7 +20680,7 @@ var require_lib3 = __commonJS({
20680
20680
  ${frame}`;
20681
20681
  }
20682
20682
  if (highlighted) {
20683
- return chalk3.reset(frame);
20683
+ return chalk2.reset(frame);
20684
20684
  } else {
20685
20685
  return frame;
20686
20686
  }
@@ -25994,14 +25994,14 @@ var require_templates2 = __commonJS({
25994
25994
  }
25995
25995
  return results;
25996
25996
  }
25997
- function buildStyle(chalk3, styles) {
25997
+ function buildStyle(chalk2, styles) {
25998
25998
  const enabled = {};
25999
25999
  for (const layer of styles) {
26000
26000
  for (const style of layer.styles) {
26001
26001
  enabled[style[0]] = layer.inverse ? null : style.slice(1);
26002
26002
  }
26003
26003
  }
26004
- let current = chalk3;
26004
+ let current = chalk2;
26005
26005
  for (const [styleName, styles2] of Object.entries(enabled)) {
26006
26006
  if (!Array.isArray(styles2)) {
26007
26007
  continue;
@@ -26013,7 +26013,7 @@ var require_templates2 = __commonJS({
26013
26013
  }
26014
26014
  return current;
26015
26015
  }
26016
- module2.exports = (chalk3, temporary) => {
26016
+ module2.exports = (chalk2, temporary) => {
26017
26017
  const styles = [];
26018
26018
  const chunks = [];
26019
26019
  let chunk = [];
@@ -26023,13 +26023,13 @@ var require_templates2 = __commonJS({
26023
26023
  } else if (style) {
26024
26024
  const string = chunk.join("");
26025
26025
  chunk = [];
26026
- chunks.push(styles.length === 0 ? string : buildStyle(chalk3, styles)(string));
26026
+ chunks.push(styles.length === 0 ? string : buildStyle(chalk2, styles)(string));
26027
26027
  styles.push({ inverse, styles: parseStyle(style) });
26028
26028
  } else if (close) {
26029
26029
  if (styles.length === 0) {
26030
26030
  throw new Error("Found extraneous } in Chalk template literal");
26031
26031
  }
26032
- chunks.push(buildStyle(chalk3, styles)(chunk.join("")));
26032
+ chunks.push(buildStyle(chalk2, styles)(chunk.join("")));
26033
26033
  chunk = [];
26034
26034
  styles.pop();
26035
26035
  } else {
@@ -26077,16 +26077,16 @@ var require_source = __commonJS({
26077
26077
  }
26078
26078
  };
26079
26079
  var chalkFactory = (options) => {
26080
- const chalk4 = {};
26081
- applyOptions(chalk4, options);
26082
- chalk4.template = (...arguments_) => chalkTag(chalk4.template, ...arguments_);
26083
- Object.setPrototypeOf(chalk4, Chalk.prototype);
26084
- Object.setPrototypeOf(chalk4.template, chalk4);
26085
- chalk4.template.constructor = () => {
26080
+ const chalk3 = {};
26081
+ applyOptions(chalk3, options);
26082
+ chalk3.template = (...arguments_) => chalkTag(chalk3.template, ...arguments_);
26083
+ Object.setPrototypeOf(chalk3, Chalk.prototype);
26084
+ Object.setPrototypeOf(chalk3.template, chalk3);
26085
+ chalk3.template.constructor = () => {
26086
26086
  throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.");
26087
26087
  };
26088
- chalk4.template.Instance = ChalkClass;
26089
- return chalk4.template;
26088
+ chalk3.template.Instance = ChalkClass;
26089
+ return chalk3.template;
26090
26090
  };
26091
26091
  function Chalk(options) {
26092
26092
  return chalkFactory(options);
@@ -26197,7 +26197,7 @@ var require_source = __commonJS({
26197
26197
  return openAll + string + closeAll;
26198
26198
  };
26199
26199
  var template;
26200
- var chalkTag = (chalk4, ...strings) => {
26200
+ var chalkTag = (chalk3, ...strings) => {
26201
26201
  const [firstString] = strings;
26202
26202
  if (!isArray(firstString) || !isArray(firstString.raw)) {
26203
26203
  return strings.join(" ");
@@ -26213,14 +26213,14 @@ var require_source = __commonJS({
26213
26213
  if (template === void 0) {
26214
26214
  template = require_templates2();
26215
26215
  }
26216
- return template(chalk4, parts.join(""));
26216
+ return template(chalk3, parts.join(""));
26217
26217
  };
26218
26218
  Object.defineProperties(Chalk.prototype, styles);
26219
- var chalk3 = Chalk();
26220
- chalk3.supportsColor = stdoutColor;
26221
- chalk3.stderr = Chalk({ level: stderrColor ? stderrColor.level : 0 });
26222
- chalk3.stderr.supportsColor = stderrColor;
26223
- module2.exports = chalk3;
26219
+ var chalk2 = Chalk();
26220
+ chalk2.supportsColor = stdoutColor;
26221
+ chalk2.stderr = Chalk({ level: stderrColor ? stderrColor.level : 0 });
26222
+ chalk2.stderr.supportsColor = stderrColor;
26223
+ module2.exports = chalk2;
26224
26224
  }
26225
26225
  });
26226
26226
 
@@ -31283,20 +31283,20 @@ var require_highlight = __commonJS({
31283
31283
  Object.defineProperty(exports, "__esModule", { value: true });
31284
31284
  exports.highlight = void 0;
31285
31285
  var jsTokens = require_js_tokens();
31286
- var chalk3 = require_source();
31286
+ var chalk2 = require_source();
31287
31287
  var identifiers_1 = require_identifiers2();
31288
- function getDefs(chalk4) {
31288
+ function getDefs(chalk3) {
31289
31289
  return {
31290
- keyword: chalk4.cyan,
31291
- capitalized: chalk4.yellow,
31292
- jsx_tag: chalk4.yellow,
31293
- punctuator: chalk4.yellow,
31290
+ keyword: chalk3.cyan,
31291
+ capitalized: chalk3.yellow,
31292
+ jsx_tag: chalk3.yellow,
31293
+ punctuator: chalk3.yellow,
31294
31294
  // bracket: intentionally omitted.
31295
- number: chalk4.magenta,
31296
- string: chalk4.green,
31297
- regex: chalk4.magenta,
31298
- comment: chalk4.grey,
31299
- invalid: chalk4.white.bgRed.bold
31295
+ number: chalk3.magenta,
31296
+ string: chalk3.green,
31297
+ regex: chalk3.magenta,
31298
+ comment: chalk3.grey,
31299
+ invalid: chalk3.white.bgRed.bold
31300
31300
  };
31301
31301
  }
31302
31302
  var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
@@ -31336,7 +31336,7 @@ var require_highlight = __commonJS({
31336
31336
  });
31337
31337
  }
31338
31338
  function highlight(code) {
31339
- const defs = getDefs(chalk3);
31339
+ const defs = getDefs(chalk2);
31340
31340
  return highlightTokens(defs, code);
31341
31341
  }
31342
31342
  exports.highlight = highlight;
@@ -31449,7 +31449,7 @@ var require_run_type_check = __commonJS({
31449
31449
  "use strict";
31450
31450
  Object.defineProperty(exports, "__esModule", { value: true });
31451
31451
  exports.getFormattedDiagnostic = exports.runTypeCheck = exports.runTypeCheckWatch = void 0;
31452
- var chalk3 = require_source();
31452
+ var chalk2 = require_source();
31453
31453
  var path = require("path");
31454
31454
  var code_frames_1 = require("nx/src/utils/code-frames");
31455
31455
  var highlight_1 = require_highlight();
@@ -31529,17 +31529,17 @@ var require_run_type_check = __commonJS({
31529
31529
  const category = diagnostic.category;
31530
31530
  switch (category) {
31531
31531
  case ts.DiagnosticCategory.Warning: {
31532
- message += `${chalk3.yellow.bold("warning")} ${chalk3.gray(`TS${diagnostic.code}`)}: `;
31532
+ message += `${chalk2.yellow.bold("warning")} ${chalk2.gray(`TS${diagnostic.code}`)}: `;
31533
31533
  break;
31534
31534
  }
31535
31535
  case ts.DiagnosticCategory.Error: {
31536
- message += `${chalk3.red.bold("error")} ${chalk3.gray(`TS${diagnostic.code}`)}: `;
31536
+ message += `${chalk2.red.bold("error")} ${chalk2.gray(`TS${diagnostic.code}`)}: `;
31537
31537
  break;
31538
31538
  }
31539
31539
  case ts.DiagnosticCategory.Suggestion:
31540
31540
  case ts.DiagnosticCategory.Message:
31541
31541
  default: {
31542
- message += `${chalk3.cyan.bold(category === 2 ? "suggestion" : "info")}: `;
31542
+ message += `${chalk2.cyan.bold(category === 2 ? "suggestion" : "info")}: `;
31543
31543
  break;
31544
31544
  }
31545
31545
  }
@@ -31549,7 +31549,7 @@ var require_run_type_check = __commonJS({
31549
31549
  const line = pos.line + 1;
31550
31550
  const column = pos.character + 1;
31551
31551
  const fileName = path.relative(workspaceRoot, diagnostic.file.fileName);
31552
- message = `${chalk3.underline.blue(`${fileName}:${line}:${column}`)} - ` + message;
31552
+ message = `${chalk2.underline.blue(`${fileName}:${line}:${column}`)} - ` + message;
31553
31553
  const code = diagnostic.file.getFullText(diagnostic.file.getSourceFile());
31554
31554
  message += "\n" + (0, code_frames_1.codeFrameColumns)(code, {
31555
31555
  start: { line, column }
@@ -47369,72 +47369,98 @@ var getLogLevelLabel = (logLevel) => {
47369
47369
 
47370
47370
  // packages/config-tools/src/utilities/logger.ts
47371
47371
  var chalk = __toESM(require_source(), 1);
47372
-
47373
- // packages/config-tools/src/env/get-env.ts
47374
- var getExtensionEnv = (extensionName) => {
47375
- const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
47376
- return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
47377
- const name = key.replace(prefix, "").split("_").map((i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : "").join("");
47378
- if (name) {
47379
- ret[name] = process.env[key];
47380
- }
47381
- return ret;
47382
- }, {});
47383
- };
47384
- var getConfigEnv = () => {
47385
- const prefix = "STORM_";
47386
- let config = {
47387
- name: process.env[`${prefix}NAME`],
47388
- namespace: process.env[`${prefix}NAMESPACE`],
47389
- owner: process.env[`${prefix}OWNER`],
47390
- worker: process.env[`${prefix}WORKER`],
47391
- organization: process.env[`${prefix}ORGANIZATION`],
47392
- packageManager: process.env[`${prefix}PACKAGE_MANAGER`],
47393
- license: process.env[`${prefix}LICENSE`],
47394
- homepage: process.env[`${prefix}HOMEPAGE`],
47395
- timezone: process.env[`${prefix}TIMEZONE`] ?? process.env.TZ,
47396
- locale: process.env[`${prefix}LOCALE`] ?? process.env.LOCALE,
47397
- configFile: process.env[`${prefix}CONFIG_FILE`],
47398
- workspaceRoot: process.env[`${prefix}WORKSPACE_ROOT`],
47399
- packageDirectory: process.env[`${prefix}PACKAGE_DIRECTORY`],
47400
- buildDirectory: process.env[`${prefix}BUILD_DIRECTORY`],
47401
- runtimeVersion: process.env[`${prefix}RUNTIME_VERSION`],
47402
- runtimeDirectory: process.env[`${prefix}RUNTIME_DIRECTORY`],
47403
- env: process.env[`${prefix}ENV`] ?? process.env.NODE_ENV ?? process.env.ENVIRONMENT,
47404
- ci: Boolean(process.env[`${prefix}CI`] ?? process.env.CI ?? process.env.CONTINUOUS_INTEGRATION),
47405
- colors: {
47406
- primary: process.env[`${prefix}COLOR_PRIMARY`],
47407
- background: process.env[`${prefix}COLOR_BACKGROUND`],
47408
- success: process.env[`${prefix}COLOR_SUCCESS`],
47409
- info: process.env[`${prefix}COLOR_INFO`],
47410
- warning: process.env[`${prefix}COLOR_WARNING`],
47411
- error: process.env[`${prefix}COLOR_ERROR`],
47412
- fatal: process.env[`${prefix}COLOR_FATAL`]
47413
- },
47414
- repository: process.env[`${prefix}REPOSITORY`],
47415
- branch: process.env[`${prefix}BRANCH`],
47416
- preMajor: Boolean(process.env[`${prefix}PRE_MAJOR`]),
47417
- logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? Number.isSafeInteger(Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) ? getLogLevelLabel(Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) : process.env[`${prefix}LOG_LEVEL`] : LogLevelLabel.INFO,
47418
- extensions: {}
47419
- };
47420
- const serializedConfig = process.env[`${prefix}CONFIG`];
47421
- if (serializedConfig) {
47422
- const parsed = JSON.parse(serializedConfig);
47423
- config = {
47424
- ...config,
47425
- ...parsed,
47426
- colors: { ...config.colors, ...parsed.colors },
47427
- extensions: { ...config.extensions, ...parsed.extensions }
47372
+ var getLogFn = (config = {}, logLevel = LogLevel.INFO) => {
47373
+ if (typeof logLevel === "number" && (logLevel >= getLogLevel(config.logLevel ?? process.env?.STORM_LOG_LEVEL) || logLevel <= LogLevel.SILENT) || typeof logLevel === "string" && getLogLevel(logLevel) >= getLogLevel(config.logLevel ?? process.env?.STORM_LOG_LEVEL)) {
47374
+ return (_) => {
47428
47375
  };
47429
47376
  }
47430
- const extensionPrefix = `${prefix}EXTENSION_`;
47431
- return Object.keys(process.env).filter((key) => key.startsWith(extensionPrefix)).reduce((ret, key) => {
47432
- const extensionName = key.substring(prefix.length, key.indexOf("_", prefix.length)).split("_").map((i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : "").join("");
47433
- if (extensionName) {
47434
- ret.extensions[extensionName] = getExtensionEnv(extensionName);
47435
- }
47436
- return ret;
47437
- }, config);
47377
+ if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel || typeof logLevel === "string" && LogLevel.FATAL >= getLogLevel(logLevel)) {
47378
+ return (message) => {
47379
+ console.error(
47380
+ ` ${chalk.bold.bgHex(config?.colors?.fatal ? config.colors.fatal : "#1fb2a6").inverse("\n\n \u{1F480} Fatal ")} ${chalk.reset.hex(
47381
+ config?.colors?.fatal ? config.colors.fatal : "#1fb2a6"
47382
+ )(message)}
47383
+ `
47384
+ );
47385
+ };
47386
+ }
47387
+ if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel || typeof logLevel === "string" && LogLevel.ERROR >= getLogLevel(logLevel)) {
47388
+ return (message) => {
47389
+ console.error(
47390
+ ` ${chalk.bold.bgHex(config?.colors?.error ? config.colors.error : "#7d1a1a").inverse("\n\n \u{1F6D1} Error ")} ${chalk.reset.hex(
47391
+ config?.colors?.error ? config.colors.error : "#7d1a1a"
47392
+ )(message)}
47393
+ `
47394
+ );
47395
+ };
47396
+ }
47397
+ if (typeof logLevel === "number" && LogLevel.WARN >= logLevel || typeof logLevel === "string" && LogLevel.WARN >= getLogLevel(logLevel)) {
47398
+ return (message) => {
47399
+ console.warn(
47400
+ ` ${chalk.bold.bgHex(config?.colors?.warning ? config.colors.warning : "#fcc419").inverse("\n\n \u26A0\uFE0F Warn ")} ${chalk.reset.hex(
47401
+ config?.colors?.warning ? config.colors.warning : "#fcc419"
47402
+ )(message)}
47403
+ `
47404
+ );
47405
+ };
47406
+ }
47407
+ if (typeof logLevel === "number" && LogLevel.INFO >= logLevel || typeof logLevel === "string" && LogLevel.INFO >= getLogLevel(logLevel)) {
47408
+ return (message) => {
47409
+ console.info(
47410
+ ` ${chalk.bold.bgHex(config?.colors?.info ? config.colors.info : "#0ea5e9").inverse("\n\n \u{1F4EC} Info ")} ${chalk.reset.hex(
47411
+ config?.colors?.info ? config.colors.info : "#0ea5e9"
47412
+ )(message)}
47413
+ `
47414
+ );
47415
+ };
47416
+ }
47417
+ if (typeof logLevel === "number" && LogLevel.INFO >= logLevel || typeof logLevel === "string" && LogLevel.INFO >= getLogLevel(logLevel)) {
47418
+ return (message) => {
47419
+ console.info(
47420
+ ` ${chalk.bold.bgHex(config?.colors?.success ? config.colors.success : "#087f5b").inverse("\n\n \u{1F389} Success ")} ${chalk.reset.hex(
47421
+ config?.colors?.success ? config.colors.success : "#087f5b"
47422
+ )(message)}
47423
+ `
47424
+ );
47425
+ };
47426
+ }
47427
+ if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel || typeof logLevel === "string" && LogLevel.DEBUG >= getLogLevel(logLevel)) {
47428
+ return (message) => {
47429
+ console.debug(
47430
+ ` ${chalk.bold.bgHex(config?.colors?.primary ? config.colors.primary : "#1fb2a6").inverse("\n\n \u{1F9EA} Debug ")} ${chalk.reset.hex(
47431
+ config?.colors?.primary ? config.colors.primary : "#1fb2a6"
47432
+ )(message)}
47433
+ `
47434
+ );
47435
+ };
47436
+ }
47437
+ return (message) => {
47438
+ console.log(
47439
+ ` ${chalk.bold.bgHex(config?.colors?.primary ? config.colors.primary : "#1fb2a6").inverse("\n\n \u{1F4E2} System ")} ${chalk.bold.hex(
47440
+ config?.colors?.primary ? config.colors.primary : "#1fb2a6"
47441
+ )(message)}
47442
+ `
47443
+ );
47444
+ };
47445
+ };
47446
+ var writeFatal = (config, message) => getLogFn(config, LogLevel.FATAL)(message);
47447
+ var writeError = (config, message) => getLogFn(config, LogLevel.ERROR)(message);
47448
+ var writeInfo = (config, message) => getLogFn(config, LogLevel.INFO)(message);
47449
+ var writeSuccess = (config, message) => getLogFn(config, LogLevel.SUCCESS)(message);
47450
+ var writeDebug = (config, message) => getLogFn(config, LogLevel.DEBUG)(message);
47451
+ var writeTrace = (config, message) => getLogFn(config, LogLevel.TRACE)(message);
47452
+ var getStopwatch = (name) => {
47453
+ const start = process.hrtime();
47454
+ return () => {
47455
+ const end = process.hrtime(start);
47456
+ console.info(
47457
+ chalk.dim(
47458
+ `\u23F1\uFE0F The${name ? ` ${name}` : ""} process took ${Math.round(
47459
+ end[0] * 1e3 + end[1] / 1e6
47460
+ )}ms to complete`
47461
+ )
47462
+ );
47463
+ };
47438
47464
  };
47439
47465
 
47440
47466
  // packages/config-tools/src/env/set-env.ts
@@ -47571,8 +47597,82 @@ var setConfigEnv = (config) => {
47571
47597
  }
47572
47598
  };
47573
47599
 
47574
- // packages/workspace-tools/src/base/base-generator.ts
47575
- var chalk2 = __toESM(require_source());
47600
+ // packages/config-tools/src/utilities/prepare-workspace.ts
47601
+ var prepareWorkspace = async () => {
47602
+ const _STORM_CONFIG = getDefaultConfig({
47603
+ ...await getConfigFile(),
47604
+ ...getConfigEnv()
47605
+ });
47606
+ setConfigEnv(_STORM_CONFIG);
47607
+ return _STORM_CONFIG;
47608
+ };
47609
+
47610
+ // packages/config-tools/src/env/get-env.ts
47611
+ var getExtensionEnv = (extensionName) => {
47612
+ const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
47613
+ return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
47614
+ const name = key.replace(prefix, "").split("_").map((i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : "").join("");
47615
+ if (name) {
47616
+ ret[name] = process.env[key];
47617
+ }
47618
+ return ret;
47619
+ }, {});
47620
+ };
47621
+ var getConfigEnv = () => {
47622
+ const prefix = "STORM_";
47623
+ let config = {
47624
+ name: process.env[`${prefix}NAME`],
47625
+ namespace: process.env[`${prefix}NAMESPACE`],
47626
+ owner: process.env[`${prefix}OWNER`],
47627
+ worker: process.env[`${prefix}WORKER`],
47628
+ organization: process.env[`${prefix}ORGANIZATION`],
47629
+ packageManager: process.env[`${prefix}PACKAGE_MANAGER`],
47630
+ license: process.env[`${prefix}LICENSE`],
47631
+ homepage: process.env[`${prefix}HOMEPAGE`],
47632
+ timezone: process.env[`${prefix}TIMEZONE`] ?? process.env.TZ,
47633
+ locale: process.env[`${prefix}LOCALE`] ?? process.env.LOCALE,
47634
+ configFile: process.env[`${prefix}CONFIG_FILE`],
47635
+ workspaceRoot: process.env[`${prefix}WORKSPACE_ROOT`],
47636
+ packageDirectory: process.env[`${prefix}PACKAGE_DIRECTORY`],
47637
+ buildDirectory: process.env[`${prefix}BUILD_DIRECTORY`],
47638
+ runtimeVersion: process.env[`${prefix}RUNTIME_VERSION`],
47639
+ runtimeDirectory: process.env[`${prefix}RUNTIME_DIRECTORY`],
47640
+ env: process.env[`${prefix}ENV`] ?? process.env.NODE_ENV ?? process.env.ENVIRONMENT,
47641
+ ci: Boolean(process.env[`${prefix}CI`] ?? process.env.CI ?? process.env.CONTINUOUS_INTEGRATION),
47642
+ colors: {
47643
+ primary: process.env[`${prefix}COLOR_PRIMARY`],
47644
+ background: process.env[`${prefix}COLOR_BACKGROUND`],
47645
+ success: process.env[`${prefix}COLOR_SUCCESS`],
47646
+ info: process.env[`${prefix}COLOR_INFO`],
47647
+ warning: process.env[`${prefix}COLOR_WARNING`],
47648
+ error: process.env[`${prefix}COLOR_ERROR`],
47649
+ fatal: process.env[`${prefix}COLOR_FATAL`]
47650
+ },
47651
+ repository: process.env[`${prefix}REPOSITORY`],
47652
+ branch: process.env[`${prefix}BRANCH`],
47653
+ preMajor: Boolean(process.env[`${prefix}PRE_MAJOR`]),
47654
+ logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? Number.isSafeInteger(Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) ? getLogLevelLabel(Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) : process.env[`${prefix}LOG_LEVEL`] : LogLevelLabel.INFO,
47655
+ extensions: {}
47656
+ };
47657
+ const serializedConfig = process.env[`${prefix}CONFIG`];
47658
+ if (serializedConfig) {
47659
+ const parsed = JSON.parse(serializedConfig);
47660
+ config = {
47661
+ ...config,
47662
+ ...parsed,
47663
+ colors: { ...config.colors, ...parsed.colors },
47664
+ extensions: { ...config.extensions, ...parsed.extensions }
47665
+ };
47666
+ }
47667
+ const extensionPrefix = `${prefix}EXTENSION_`;
47668
+ return Object.keys(process.env).filter((key) => key.startsWith(extensionPrefix)).reduce((ret, key) => {
47669
+ const extensionName = key.substring(prefix.length, key.indexOf("_", prefix.length)).split("_").map((i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : "").join("");
47670
+ if (extensionName) {
47671
+ ret.extensions[extensionName] = getExtensionEnv(extensionName);
47672
+ }
47673
+ return ret;
47674
+ }, config);
47675
+ };
47576
47676
 
47577
47677
  // packages/workspace-tools/src/utils/get-workspace-root.ts
47578
47678
  var import_find_workspace_root2 = require("nx/src/utils/find-workspace-root.js");
@@ -47640,43 +47740,48 @@ var applyWorkspaceTokens = (options, config, tokenizerFn) => {
47640
47740
  var withRunGenerator = (name, generatorFn, generatorOptions = {
47641
47741
  skipReadingConfig: false
47642
47742
  }) => async (tree, _options) => {
47643
- const startTime = Date.now();
47743
+ const stopwatch = getStopwatch(name);
47644
47744
  let options = _options;
47745
+ let config;
47645
47746
  try {
47646
- console.info(chalk2.bold.hex("#1fb2a6")(`\u26A1 Running the ${name} generator...
47747
+ writeInfo(config, `\u26A1 Running the ${name} generator...
47647
47748
 
47648
- `));
47649
- let config;
47749
+ `);
47750
+ const workspaceRoot = getWorkspaceRoot();
47650
47751
  if (!generatorOptions.skipReadingConfig) {
47651
- config = getDefaultConfig({
47652
- ...await getConfigFile(),
47653
- ...getConfigEnv()
47654
- });
47655
- setConfigEnv(config);
47656
- getLogLevel(config.logLevel) >= LogLevel.DEBUG && console.debug(
47657
- chalk2.dim(
47658
- `Loaded Storm config into env:
47659
- ${Object.keys(process.env).map((key) => ` - ${key}=${process.env[key]}`).join("\n")}`
47660
- )
47752
+ writeDebug(
47753
+ config,
47754
+ `Loading the Storm Config from environment variables and storm.config.js file...
47755
+ - workspaceRoot: ${workspaceRoot}`
47756
+ );
47757
+ config = await prepareWorkspace();
47758
+ writeTrace(
47759
+ config,
47760
+ `Loaded Storm config into env:
47761
+ ${Object.keys(process.env).map((key) => ` - ${key}=${JSON.stringify(process.env[key])}`).join("\n")}`
47661
47762
  );
47662
47763
  }
47663
47764
  if (generatorOptions?.hooks?.applyDefaultOptions) {
47664
- getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk2.dim("Running the applyDefaultOptions hook..."));
47765
+ writeDebug(config, "Running the applyDefaultOptions hook...");
47665
47766
  options = await Promise.resolve(
47666
47767
  generatorOptions.hooks.applyDefaultOptions(options, config)
47667
47768
  );
47668
- getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk2.dim("Completed the applyDefaultOptions hook..."));
47769
+ writeDebug(config, "Completed the applyDefaultOptions hook");
47669
47770
  }
47670
- getLogLevel(config.logLevel) >= LogLevel.INFO && console.info(chalk2.hex("#0ea5e9").italic("\n\n \u2699\uFE0F Generator schema options: \n"), options);
47771
+ writeTrace(
47772
+ config,
47773
+ `Generator schema options \u2699\uFE0F
47774
+ ${Object.keys(options).map((key) => ` - ${key}=${JSON.stringify(options[key])}`).join("\n")}`
47775
+ );
47671
47776
  const tokenized = applyWorkspaceTokens(
47672
47777
  options,
47673
47778
  { workspaceRoot: tree.root, config },
47674
47779
  applyWorkspaceGeneratorTokens
47675
47780
  );
47676
47781
  if (generatorOptions?.hooks?.preProcess) {
47677
- getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk2.dim("Running the preProcess hook..."));
47678
- await Promise.resolve(generatorOptions.hooks.preProcess(options, config));
47679
- getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk2.dim("Completed the preProcess hook..."));
47782
+ writeDebug(config, "Running the preProcess hook...");
47783
+ await Promise.resolve(generatorOptions.hooks.preProcess(tokenized, config));
47784
+ writeDebug(config, "Completed the preProcess hook");
47680
47785
  }
47681
47786
  const result = await Promise.resolve(generatorFn(tree, tokenized, config));
47682
47787
  if (result && (!result.success || result.error && result?.error?.message && typeof result?.error?.message === "string" && result?.error?.name && typeof result?.error?.name === "string")) {
@@ -47685,33 +47790,31 @@ ${Object.keys(process.env).map((key) => ` - ${key}=${process.env[key]}`).join("\
47685
47790
  });
47686
47791
  }
47687
47792
  if (generatorOptions?.hooks?.postProcess) {
47688
- getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk2.dim("Running the postProcess hook..."));
47793
+ writeDebug(config, "Running the postProcess hook...");
47689
47794
  await Promise.resolve(generatorOptions.hooks.postProcess(config));
47690
- getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk2.dim("Completed the postProcess hook..."));
47795
+ writeDebug(config, "Completed the postProcess hook");
47691
47796
  }
47692
- console.info(
47693
- chalk2.bold.hex("#087f5b")(`
47694
-
47695
- \u{1F389} Successfully completed running the ${name} generator!`)
47696
- );
47797
+ writeSuccess(config, `Completed running the ${name} task executor!
47798
+ `);
47697
47799
  return {
47698
47800
  success: true
47699
47801
  };
47700
47802
  } catch (error) {
47701
- console.error(
47702
- chalk2.bold.hex("#7d1a1a")("\u274C An error occurred while running the generator\n\n"),
47703
- error
47803
+ writeFatal(
47804
+ config,
47805
+ "A fatal error occurred while running the generator - the process was forced to terminate"
47806
+ );
47807
+ writeError(
47808
+ config,
47809
+ `An exception was thrown in the generator's process
47810
+ - Details: ${error.message}
47811
+ - Stacktrace: ${error.stack}`
47704
47812
  );
47705
- console.error(error);
47706
47813
  return {
47707
47814
  success: false
47708
47815
  };
47709
47816
  } finally {
47710
- console.info(
47711
- chalk2.hex("#0ea5e9").italic(
47712
- `\u23F1\uFE0F The${name ? ` ${name}` : ""} generator took ${Date.now() - startTime}ms to complete`
47713
- )
47714
- );
47817
+ stopwatch();
47715
47818
  }
47716
47819
  };
47717
47820
 
@@ -47766,14 +47869,14 @@ async function typeScriptLibraryGeneratorFn(tree, schema) {
47766
47869
  defaultConfiguration: "production",
47767
47870
  assets: [
47768
47871
  {
47769
- "input": options.projectRoot,
47770
- "glob": "*.md",
47771
- "output": "/"
47872
+ input: options.projectRoot,
47873
+ glob: "*.md",
47874
+ output: "/"
47772
47875
  },
47773
47876
  {
47774
- "input": "",
47775
- "glob": "LICENSE",
47776
- "output": "/"
47877
+ input: "",
47878
+ glob: "LICENSE",
47879
+ output: "/"
47777
47880
  }
47778
47881
  ]
47779
47882
  },
@@ -47792,7 +47895,9 @@ async function typeScriptLibraryGeneratorFn(tree, schema) {
47792
47895
  test: {}
47793
47896
  }
47794
47897
  };
47795
- schema.platform && (projectConfig.targets.build.options.platform = schema.platform);
47898
+ if (schema.platform) {
47899
+ projectConfig.targets.build.options.platform = schema.platform;
47900
+ }
47796
47901
  createProjectTsConfigJson(tree, options);
47797
47902
  (0, import_devkit.addProjectConfiguration)(tree, options.name, projectConfig);
47798
47903
  let repository = {
@@ -47802,19 +47907,20 @@ async function typeScriptLibraryGeneratorFn(tree, schema) {
47802
47907
  let description = schema.description ?? "\u26A1 A Storm package used to create modern, scalable web applications.";
47803
47908
  if (tree.exists("package.json")) {
47804
47909
  const packageJson = (0, import_devkit.readJson)(tree, "package.json");
47805
- packageJson?.repository && (repository = packageJson.repository);
47806
- packageJson?.description && (description = packageJson.description);
47910
+ if (packageJson?.repository) {
47911
+ repository = packageJson.repository;
47912
+ }
47913
+ if (packageJson?.description) {
47914
+ description = packageJson.description;
47915
+ }
47807
47916
  }
47808
- const packageJsonPath = (0, import_devkit.joinPathFragments)(
47809
- options.projectRoot,
47810
- "package.json"
47811
- );
47917
+ const packageJsonPath = (0, import_devkit.joinPathFragments)(options.projectRoot, "package.json");
47812
47918
  if (tree.exists(packageJsonPath)) {
47813
47919
  (0, import_devkit.updateJson)(tree, packageJsonPath, (json) => {
47814
47920
  json.name = options.importPath;
47815
47921
  json.version = "0.0.1";
47816
47922
  if (json.private && (options.publishable || options.rootProject)) {
47817
- delete json.private;
47923
+ json.private = void 0;
47818
47924
  }
47819
47925
  return {
47820
47926
  ...json,
@@ -47862,19 +47968,19 @@ async function typeScriptLibraryGeneratorFn(tree, schema) {
47862
47968
  }));
47863
47969
  }
47864
47970
  (0, import_js.addTsConfigPath)(tree, options.importPath, [
47865
- (0, import_devkit.joinPathFragments)(
47866
- options.projectRoot,
47867
- "./src",
47868
- "index." + (options.js ? "js" : "ts")
47869
- )
47971
+ (0, import_devkit.joinPathFragments)(options.projectRoot, "./src", `index.${options.js ? "js" : "ts"}`)
47870
47972
  ]);
47871
47973
  (0, import_js.addTsConfigPath)(tree, (0, import_devkit.joinPathFragments)(options.importPath, "/*"), [
47872
47974
  (0, import_devkit.joinPathFragments)(options.projectRoot, "./src", "/*")
47873
47975
  ]);
47874
47976
  if (tree.exists("package.json")) {
47875
47977
  const packageJson = (0, import_devkit.readJson)(tree, "package.json");
47876
- packageJson?.repository && (repository = packageJson.repository);
47877
- packageJson?.description && (description = packageJson.description);
47978
+ if (packageJson?.repository) {
47979
+ repository = packageJson.repository;
47980
+ }
47981
+ if (packageJson?.description) {
47982
+ description = packageJson.description;
47983
+ }
47878
47984
  }
47879
47985
  const tsconfigPath = (0, import_devkit.joinPathFragments)(options.projectRoot, "tsconfig.json");
47880
47986
  if (tree.exists(tsconfigPath)) {
@@ -47913,11 +48019,7 @@ async function addLint(tree, options) {
47913
48019
  tsConfigPaths: [(0, import_devkit.joinPathFragments)(options.projectRoot, "tsconfig.json")],
47914
48020
  unitTestRunner: options.unitTestRunner,
47915
48021
  eslintFilePatterns: [
47916
- mapLintPattern(
47917
- options.projectRoot,
47918
- options.js ? "js" : "ts",
47919
- options.rootProject
47920
- )
48022
+ mapLintPattern(options.projectRoot, options.js ? "js" : "ts", options.rootProject)
47921
48023
  ],
47922
48024
  setParserOptionsProject: options.setParserOptionsProject,
47923
48025
  rootProject: options.rootProject
@@ -47963,9 +48065,7 @@ async function addLint(tree, options) {
47963
48065
  ruleOptions = {};
47964
48066
  }
47965
48067
  if (options.bundler === "esbuild") {
47966
- ruleOptions.ignoredFiles = [
47967
- "{projectRoot}/esbuild.config.{js,ts,mjs,mts}"
47968
- ];
48068
+ ruleOptions.ignoredFiles = ["{projectRoot}/esbuild.config.{js,ts,mjs,mts}"];
47969
48069
  o.rules["@nx/dependency-checks"] = [ruleSeverity, ruleOptions];
47970
48070
  }
47971
48071
  return o;
@@ -47989,10 +48089,7 @@ function createProjectTsConfigJson(tree, options) {
47989
48089
  ...options?.tsConfigOptions ?? {},
47990
48090
  compilerOptions: {
47991
48091
  ...options.rootProject ? import_js.tsConfigBaseOptions : {},
47992
- outDir: (0, import_devkit.joinPathFragments)(
47993
- (0, import_devkit.offsetFromRoot)(options.projectRoot),
47994
- "dist/out-tsc"
47995
- ),
48092
+ outDir: (0, import_devkit.joinPathFragments)((0, import_devkit.offsetFromRoot)(options.projectRoot), "dist/out-tsc"),
47996
48093
  noEmit: true,
47997
48094
  ...options?.tsConfigOptions?.compilerOptions ?? {}
47998
48095
  },
@@ -48010,11 +48107,7 @@ function createProjectTsConfigJson(tree, options) {
48010
48107
  "src/**/*.test.ts"
48011
48108
  ]
48012
48109
  };
48013
- (0, import_devkit.writeJson)(
48014
- tree,
48015
- (0, import_devkit.joinPathFragments)(options.projectRoot, "tsconfig.json"),
48016
- tsconfig
48017
- );
48110
+ (0, import_devkit.writeJson)(tree, (0, import_devkit.joinPathFragments)(options.projectRoot, "tsconfig.json"), tsconfig);
48018
48111
  }
48019
48112
  async function normalizeOptions(tree, options) {
48020
48113
  if (options.publishable) {