@storm-software/git-tools 2.88.1 → 2.88.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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-2.88.0-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-2.88.2-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 -->
@@ -56581,6 +56581,8 @@ var ColorConfigMapSchema = z.union([
56581
56581
  }),
56582
56582
  z.record(z.string(), ColorConfigSchema)
56583
56583
  ]);
56584
+ var ExtendsItemSchema = z.string().trim().describe("The path to a base config file to use as a configuration preset file. Documentation can be found at https://github.com/unjs/c12#extending-configuration.");
56585
+ var ExtendsSchema = ExtendsItemSchema.or(z.array(ExtendsItemSchema)).describe("The path to a base config file to use as a configuration preset file. Documentation can be found at https://github.com/unjs/c12#extending-configuration.");
56584
56586
  var WorkspaceBotConfigSchema = z.object({
56585
56587
  name: z.string().trim().default("Stormie-Bot").describe("The workspace bot user's name (this is the bot that will be used to perform various tasks)"),
56586
56588
  email: z.string().trim().email().default("bot@stormsoftware.com").describe("The email of the workspace bot")
@@ -56595,11 +56597,11 @@ var WorkspaceDirectoryConfigSchema = z.object({
56595
56597
  }).describe("Various directories used by the workspace to store data, cache, and configuration files");
56596
56598
  var StormConfigSchema = z.object({
56597
56599
  $schema: z.string().trim().default("https://cdn.jsdelivr.net/npm/@storm-software/config/schemas/storm.schema.json").optional().nullish().describe("The URL to the JSON schema file that describes the Storm configuration file"),
56598
- extends: z.string().trim().optional().describe("The path to a base JSON file to use as a configuration preset file"),
56600
+ extends: ExtendsSchema.optional(),
56599
56601
  name: z.string().trim().toLowerCase().optional().describe("The name of the service/package/scope using this configuration"),
56600
56602
  namespace: z.string().trim().toLowerCase().optional().describe("The namespace of the package"),
56601
56603
  organization: z.string().trim().default("storm-software").describe("The organization of the workspace"),
56602
- repository: z.string().trim().url().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
56604
+ repository: z.string().trim().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
56603
56605
  license: z.string().trim().default("Apache-2.0").describe("The license type of the package"),
56604
56606
  homepage: z.string().trim().url().default(STORM_DEFAULT_HOMEPAGE).describe("The homepage of the workspace"),
56605
56607
  docs: z.string().trim().url().default(STORM_DEFAULT_DOCS).describe("The base documentation site for the workspace"),
@@ -56663,12 +56665,10 @@ var COLOR_KEYS = [
56663
56665
  ];
56664
56666
 
56665
56667
  // ../config-tools/src/utilities/get-default-config.ts
56666
- import { existsSync as existsSync2, readFileSync } from "node:fs";
56668
+ import { existsSync as existsSync2 } from "node:fs";
56669
+ import { readFile } from "node:fs/promises";
56667
56670
  import { join as join3 } from "node:path";
56668
56671
 
56669
- // ../config-tools/src/utilities/find-workspace-root.ts
56670
- init_esm_shims();
56671
-
56672
56672
  // ../config-tools/src/utilities/correct-paths.ts
56673
56673
  init_esm_shims();
56674
56674
  var import_devkit = __toESM(require_devkit(), 1);
@@ -56688,6 +56688,9 @@ var joinPaths = /* @__PURE__ */ __name((...paths) => {
56688
56688
  return correctPaths((0, import_devkit.joinPathFragments)(...paths.map((path) => correctPaths(path))));
56689
56689
  }, "joinPaths");
56690
56690
 
56691
+ // ../config-tools/src/utilities/find-workspace-root.ts
56692
+ init_esm_shims();
56693
+
56691
56694
  // ../config-tools/src/utilities/find-up.ts
56692
56695
  init_esm_shims();
56693
56696
  import { existsSync } from "node:fs";
@@ -56790,17 +56793,15 @@ var DEFAULT_COLOR_CONFIG = {
56790
56793
  "negative": "#dc2626"
56791
56794
  }
56792
56795
  };
56793
- var getDefaultConfig = /* @__PURE__ */ __name((root) => {
56796
+ var getDefaultConfig = /* @__PURE__ */ __name(async (root) => {
56794
56797
  let license = STORM_DEFAULT_LICENSE;
56795
56798
  let homepage = STORM_DEFAULT_HOMEPAGE;
56796
- let name;
56797
- let namespace;
56798
- let repository;
56799
+ let name = void 0;
56800
+ let namespace = void 0;
56801
+ let repository = void 0;
56799
56802
  const workspaceRoot = findWorkspaceRoot(root);
56800
56803
  if (existsSync2(join3(workspaceRoot, "package.json"))) {
56801
- const file = readFileSync(join3(workspaceRoot, "package.json"), {
56802
- encoding: "utf8"
56803
- });
56804
+ const file = await readFile(joinPaths(workspaceRoot, "package.json"), "utf8");
56804
56805
  if (file) {
56805
56806
  const packageJson = JSON.parse(file);
56806
56807
  if (packageJson.name) {
@@ -56809,8 +56810,12 @@ var getDefaultConfig = /* @__PURE__ */ __name((root) => {
56809
56810
  if (packageJson.namespace) {
56810
56811
  namespace = packageJson.namespace;
56811
56812
  }
56812
- if (packageJson.repository?.url) {
56813
- repository = packageJson.repository?.url;
56813
+ if (packageJson.repository) {
56814
+ if (typeof packageJson.repository === "string") {
56815
+ repository = packageJson.repository;
56816
+ } else if (packageJson.repository.url) {
56817
+ repository = packageJson.repository.url;
56818
+ }
56814
56819
  }
56815
56820
  if (packageJson.license) {
56816
56821
  license = packageJson.license;
@@ -57026,7 +57031,6 @@ var writeInfo = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.IN
57026
57031
  var writeSuccess = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.SUCCESS, config)(message), "writeSuccess");
57027
57032
  var writeDebug = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.DEBUG, config)(message), "writeDebug");
57028
57033
  var writeTrace = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.TRACE, config)(message), "writeTrace");
57029
- var writeSystem = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.ALL, config)(message), "writeSystem");
57030
57034
  var MAX_DEPTH = 4;
57031
57035
  var formatLogMessage = /* @__PURE__ */ __name((message, options = {}, depth2 = 0) => {
57032
57036
  if (depth2 > MAX_DEPTH) {
@@ -57087,6 +57091,9 @@ Stacktrace: ${error.stack}`, config);
57087
57091
  });
57088
57092
  }, "handleProcess");
57089
57093
 
57094
+ // ../config-tools/src/get-config.ts
57095
+ init_esm_shims();
57096
+
57090
57097
  // ../config-tools/src/create-storm-config.ts
57091
57098
  init_esm_shims();
57092
57099
 
@@ -57099,7 +57106,7 @@ init_esm_shims();
57099
57106
  // ../../node_modules/.pnpm/c12@2.0.1/node_modules/c12/dist/shared/c12.B4fc1S0C.mjs
57100
57107
  init_esm_shims();
57101
57108
  import { existsSync as existsSync4, promises } from "node:fs";
57102
- import { rm, readFile } from "node:fs/promises";
57109
+ import { rm, readFile as readFile2 } from "node:fs/promises";
57103
57110
  import { homedir as homedir2 } from "node:os";
57104
57111
 
57105
57112
  // ../../node_modules/.pnpm/jiti@2.4.2/node_modules/jiti/lib/jiti.mjs
@@ -57126,7 +57133,7 @@ __name(createJiti, "createJiti");
57126
57133
 
57127
57134
  // ../../node_modules/.pnpm/rc9@2.1.2/node_modules/rc9/dist/index.mjs
57128
57135
  init_esm_shims();
57129
- import { existsSync as existsSync3, readFileSync as readFileSync2, writeFileSync } from "node:fs";
57136
+ import { existsSync as existsSync3, readFileSync, writeFileSync } from "node:fs";
57130
57137
  import { resolve as resolve2 } from "node:path";
57131
57138
  import { homedir } from "node:os";
57132
57139
 
@@ -57361,7 +57368,7 @@ function parseFile(path, options) {
57361
57368
  if (!existsSync3(path)) {
57362
57369
  return {};
57363
57370
  }
57364
- return parse(readFileSync2(path, "utf8"), options);
57371
+ return parse(readFileSync(path, "utf8"), options);
57365
57372
  }
57366
57373
  __name(parseFile, "parseFile");
57367
57374
  function read(options) {
@@ -58353,7 +58360,7 @@ async function resolveConfig(source, options, sourceOptions = {}) {
58353
58360
  const configFileExt = extname(res.configFile) || "";
58354
58361
  if (configFileExt in ASYNC_LOADERS) {
58355
58362
  const asyncLoader = await ASYNC_LOADERS[configFileExt]();
58356
- const contents = await readFile(res.configFile, "utf8");
58363
+ const contents = await readFile2(res.configFile, "utf8");
58357
58364
  res.config = asyncLoader(contents);
58358
58365
  } else {
58359
58366
  res.config = await options.jiti.import(res.configFile, {
@@ -58389,19 +58396,19 @@ var import_dotenv = __toESM(require_main(), 1);
58389
58396
  // ../config-tools/src/config-file/get-config-file.ts
58390
58397
  var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, options = {}) => {
58391
58398
  const workspacePath = filePath || findWorkspaceRoot(filePath);
58392
- let config = await loadConfig({
58393
- cwd: workspacePath,
58394
- packageJson: true,
58395
- name: fileName,
58396
- envName: fileName?.toUpperCase(),
58397
- jitiOptions: {
58398
- debug: false,
58399
- fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
58400
- },
58401
- ...options
58402
- });
58403
- if (!config || Object.keys(config).length === 0) {
58404
- config = await loadConfig({
58399
+ const configs = await Promise.all([
58400
+ loadConfig({
58401
+ cwd: workspacePath,
58402
+ packageJson: true,
58403
+ name: fileName,
58404
+ envName: fileName?.toUpperCase(),
58405
+ jitiOptions: {
58406
+ debug: false,
58407
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
58408
+ },
58409
+ ...options
58410
+ }),
58411
+ loadConfig({
58405
58412
  cwd: workspacePath,
58406
58413
  packageJson: true,
58407
58414
  name: fileName,
@@ -58412,9 +58419,9 @@ var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, opti
58412
58419
  },
58413
58420
  configFile: fileName,
58414
58421
  ...options
58415
- });
58416
- }
58417
- return config;
58422
+ })
58423
+ ]);
58424
+ return defu(configs[0] ?? {}, configs[1] ?? {});
58418
58425
  }, "getConfigFileByName");
58419
58426
  var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames = []) => {
58420
58427
  const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
@@ -58422,7 +58429,7 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
58422
58429
  let config = result.config;
58423
58430
  const configFile = result.configFile;
58424
58431
  if (config && configFile && Object.keys(config).length > 0) {
58425
- writeSystem(`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, {
58432
+ writeTrace(`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, {
58426
58433
  logLevel: "all"
58427
58434
  });
58428
58435
  }
@@ -58430,7 +58437,7 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
58430
58437
  const results = await Promise.all(additionalFileNames.map((fileName) => getConfigFileByName(fileName, workspacePath)));
58431
58438
  for (const result2 of results) {
58432
58439
  if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
58433
- writeSystem(`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`, {
58440
+ writeTrace(`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`, {
58434
58441
  logLevel: "all"
58435
58442
  });
58436
58443
  config = defu(result2.config ?? {}, config ?? {});
@@ -58446,6 +58453,16 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
58446
58453
 
58447
58454
  // ../config-tools/src/env/get-env.ts
58448
58455
  init_esm_shims();
58456
+ var getExtensionEnv = /* @__PURE__ */ __name((extensionName) => {
58457
+ const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
58458
+ return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
58459
+ const name = key.replace(prefix, "").split("_").map((i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : "").join("");
58460
+ if (name) {
58461
+ ret[name] = process.env[key];
58462
+ }
58463
+ return ret;
58464
+ }, {});
58465
+ }, "getExtensionEnv");
58449
58466
  var getConfigEnv = /* @__PURE__ */ __name(() => {
58450
58467
  const prefix = "STORM_";
58451
58468
  let config = {
@@ -58606,7 +58623,7 @@ var setExtensionEnv = /* @__PURE__ */ __name((extensionName, extension) => {
58606
58623
  var setConfigEnv = /* @__PURE__ */ __name((config) => {
58607
58624
  const prefix = "STORM_";
58608
58625
  if (config.extends) {
58609
- process.env[`${prefix}EXTENDS`] = config.extends;
58626
+ process.env[`${prefix}EXTENDS`] = Array.isArray(config.extends) ? JSON.stringify(config.extends) : config.extends;
58610
58627
  }
58611
58628
  if (config.name) {
58612
58629
  process.env[`${prefix}NAME`] = config.name;
@@ -58836,30 +58853,69 @@ var setBaseThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
58836
58853
  }, "setBaseThemeColorConfigEnv");
58837
58854
 
58838
58855
  // ../config-tools/src/create-storm-config.ts
58856
+ var _extension_cache = /* @__PURE__ */ new WeakMap();
58839
58857
  var _static_cache = void 0;
58840
- var loadStormConfig = /* @__PURE__ */ __name(async (workspaceRoot) => {
58841
- let config = {};
58842
- if (_static_cache?.data && _static_cache?.timestamp && _static_cache.timestamp >= Date.now() + 3e4) {
58843
- writeTrace(`Configuration cache hit - ${_static_cache.timestamp}`, _static_cache.data);
58844
- return _static_cache.data;
58845
- }
58846
- let _workspaceRoot = workspaceRoot;
58847
- if (!_workspaceRoot) {
58848
- _workspaceRoot = findWorkspaceRoot();
58849
- }
58850
- const configFile = await getConfigFile(_workspaceRoot);
58851
- if (!configFile) {
58852
- writeWarning("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", {
58853
- logLevel: "all"
58854
- });
58858
+ var createStormConfig = /* @__PURE__ */ __name(async (extensionName, schema, workspaceRoot, skipLogs = false) => {
58859
+ let result;
58860
+ if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
58861
+ let _workspaceRoot = workspaceRoot;
58862
+ if (!_workspaceRoot) {
58863
+ _workspaceRoot = findWorkspaceRoot();
58864
+ }
58865
+ const configEnv = getConfigEnv();
58866
+ const defaultConfig = await getDefaultConfig(_workspaceRoot);
58867
+ const configFile = await getConfigFile(_workspaceRoot);
58868
+ if (!configFile && !skipLogs) {
58869
+ writeWarning("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", {
58870
+ logLevel: "all"
58871
+ });
58872
+ }
58873
+ result = await StormConfigSchema.parseAsync(defu(configEnv, configFile, defaultConfig));
58874
+ result.workspaceRoot ??= _workspaceRoot;
58875
+ } else {
58876
+ result = _static_cache.data;
58855
58877
  }
58856
- config = defu(getConfigEnv(), configFile, getDefaultConfig(_workspaceRoot));
58878
+ if (schema && extensionName) {
58879
+ result.extensions = {
58880
+ ...result.extensions,
58881
+ [extensionName]: createConfigExtension(extensionName, schema)
58882
+ };
58883
+ }
58884
+ _static_cache = {
58885
+ timestamp: Date.now(),
58886
+ data: result
58887
+ };
58888
+ return result;
58889
+ }, "createStormConfig");
58890
+ var createConfigExtension = /* @__PURE__ */ __name((extensionName, schema) => {
58891
+ const extension_cache_key = {
58892
+ extensionName
58893
+ };
58894
+ if (_extension_cache.has(extension_cache_key)) {
58895
+ return _extension_cache.get(extension_cache_key);
58896
+ }
58897
+ let extension = getExtensionEnv(extensionName);
58898
+ if (schema) {
58899
+ extension = schema.parse(extension);
58900
+ }
58901
+ _extension_cache.set(extension_cache_key, extension);
58902
+ return extension;
58903
+ }, "createConfigExtension");
58904
+ var loadStormConfig = /* @__PURE__ */ __name(async (workspaceRoot, skipLogs = false) => {
58905
+ const config = await createStormConfig(void 0, void 0, workspaceRoot, skipLogs);
58857
58906
  setConfigEnv(config);
58858
- writeTrace(`\u2699\uFE0F Using Storm configuration:
58907
+ if (!skipLogs) {
58908
+ writeTrace(`\u2699\uFE0F Using Storm configuration:
58859
58909
  ${formatLogMessage(config)}`, config);
58910
+ }
58860
58911
  return config;
58861
58912
  }, "loadStormConfig");
58862
58913
 
58914
+ // ../config-tools/src/get-config.ts
58915
+ var getConfig = /* @__PURE__ */ __name((workspaceRoot, skipLogs = false) => {
58916
+ return loadStormConfig(workspaceRoot, skipLogs);
58917
+ }, "getConfig");
58918
+
58863
58919
  export {
58864
58920
  joinPaths,
58865
58921
  findWorkspaceRootSafe,
@@ -58876,7 +58932,7 @@ export {
58876
58932
  exitWithError,
58877
58933
  exitWithSuccess,
58878
58934
  handleProcess,
58879
- loadStormConfig
58935
+ getConfig
58880
58936
  };
58881
58937
  /*! Bundled license information:
58882
58938