@storm-software/cloudflare-tools 0.6.0 → 0.6.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 0.6.1 (2024-06-03)
2
+
3
+
4
+ ### 🩹 Fixes
5
+
6
+ - **deps:** update patch prod dependencies ([072b4763](https://github.com/storm-software/storm-ops/commit/072b4763))
7
+
8
+ - **deps:** update dependencies-non-major ([#181](https://github.com/storm-software/storm-ops/pull/181))
9
+
1
10
  ## 0.6.0 (2024-06-02)
2
11
 
3
12
 
package/index.js CHANGED
@@ -66601,7 +66601,7 @@ var init_lib = __esm({
66601
66601
  });
66602
66602
 
66603
66603
  // packages/config/src/schema.ts
66604
- var DarkColorSchema, LightColorSchema, BrandColorSchema, AccentColorSchema, HelpColorSchema, SuccessColorSchema, InfoColorSchema, WarningColorSchema, ErrorColorSchema, FatalColorSchema, DarkThemeColorConfigSchema, LightThemeColorConfigSchema, MultiThemeColorConfigSchema, SingleThemeColorConfigSchema, ColorConfigSchema, ColorConfigMapSchema, StormConfigSchema;
66604
+ var DarkColorSchema, LightColorSchema, BrandColorSchema, AccentColorSchema, HelpColorSchema, SuccessColorSchema, InfoColorSchema, WarningColorSchema, ErrorColorSchema, FatalColorSchema, DarkThemeColorConfigSchema, LightThemeColorConfigSchema, MultiThemeColorConfigSchema, SingleThemeColorConfigSchema, RegistryUrlConfigSchema, RegistryConfigSchema, ColorConfigSchema, ColorConfigMapSchema, StormConfigSchema;
66605
66605
  var init_schema = __esm({
66606
66606
  "packages/config/src/schema.ts"() {
66607
66607
  init_lib();
@@ -66655,6 +66655,13 @@ var init_schema = __esm({
66655
66655
  error: ErrorColorSchema,
66656
66656
  fatal: FatalColorSchema
66657
66657
  });
66658
+ RegistryUrlConfigSchema = z2.string().trim().toLowerCase().url().optional().describe("A remote registry URL used to publish distributable packages");
66659
+ RegistryConfigSchema = z2.object({
66660
+ github: RegistryUrlConfigSchema,
66661
+ npm: RegistryUrlConfigSchema,
66662
+ cargo: RegistryUrlConfigSchema,
66663
+ cyclone: RegistryUrlConfigSchema
66664
+ }).describe("A list of remote registry URLs used by Storm Software");
66658
66665
  ColorConfigSchema = SingleThemeColorConfigSchema.or(
66659
66666
  MultiThemeColorConfigSchema
66660
66667
  ).describe("Colors used for various workspace elements");
@@ -66710,6 +66717,7 @@ var init_schema = __esm({
66710
66717
  "The log level used to filter out lower priority log messages. If not provided, this is defaulted using the `environment` config value (if `environment` is set to `production` then `level` is `error`, else `level` is `debug`)."
66711
66718
  ),
66712
66719
  cloudflareAccountId: z2.string().trim().toLowerCase().length(32).regex(/^([0-9a-fA-F]{32})$/i).nullable().default(null).describe("The default Cloudflare account ID of the workspace"),
66720
+ registry: RegistryConfigSchema,
66713
66721
  configFile: z2.string().trim().nullable().default(null).describe(
66714
66722
  "The filepath of the Storm config. When this field is null, no config file was found in the current workspace."
66715
66723
  ),
@@ -68966,6 +68974,12 @@ var init_get_env = __esm({
68966
68974
  preid: process.env[`${prefix}PRE_ID`],
68967
68975
  externalPackagePatterns: process.env[`${prefix}EXTERNAL_PACKAGE_PATTERNS`] ? JSON.parse(process.env[`${prefix}EXTERNAL_PACKAGE_PATTERNS`]) : [],
68968
68976
  cloudflareAccountId: process.env[`${prefix}CLOUDFLARE_ACCOUNT_ID`] ? process.env[`${prefix}CLOUDFLARE_ACCOUNT_ID`] : process.env.CLOUDFLARE_ACCOUNT_ID ? process.env.CLOUDFLARE_ACCOUNT_ID : process.env.STORM_BOT_CLOUDFLARE_ACCOUNT,
68977
+ registry: {
68978
+ github: process.env[`${prefix}REGISTRY_GITHUB`],
68979
+ npm: process.env[`${prefix}REGISTRY_NPM`],
68980
+ cargo: process.env[`${prefix}REGISTRY_CARGO`],
68981
+ cyclone: process.env[`${prefix}REGISTRY_CYCLONE`]
68982
+ },
68969
68983
  logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(
68970
68984
  Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
68971
68985
  ) ? getLogLevelLabel(
@@ -69189,6 +69203,22 @@ var init_set_env = __esm({
69189
69203
  config.cloudflareAccountId
69190
69204
  );
69191
69205
  }
69206
+ if (config.registry) {
69207
+ if (config.registry.github) {
69208
+ process.env[`${prefix}REGISTRY_GITHUB`] = String(config.registry.github);
69209
+ }
69210
+ if (config.registry.npm) {
69211
+ process.env[`${prefix}REGISTRY_NPM`] = String(config.registry.npm);
69212
+ }
69213
+ if (config.registry.cargo) {
69214
+ process.env[`${prefix}REGISTRY_CARGO`] = String(config.registry.cargo);
69215
+ }
69216
+ if (config.registry.cyclone) {
69217
+ process.env[`${prefix}REGISTRY_CYCLONE`] = String(
69218
+ config.registry.cyclone
69219
+ );
69220
+ }
69221
+ }
69192
69222
  if (config.logLevel) {
69193
69223
  process.env[`${prefix}LOG_LEVEL`] = String(config.logLevel);
69194
69224
  process.env.LOG_LEVEL = String(config.logLevel);
@@ -400859,7 +400889,7 @@ var require_package8 = __commonJS({
400859
400889
  "packages/cloudflare-tools/package.json"(exports2, module2) {
400860
400890
  module2.exports = {
400861
400891
  name: "@storm-software/cloudflare-tools",
400862
- version: "0.6.0",
400892
+ version: "0.6.1",
400863
400893
  private: false,
400864
400894
  description: "\u26A1The Storm-Ops monorepo contains utility applications, tools, and various libraries to create modern and scalable web applications.",
400865
400895
  keywords: [
@@ -552745,13 +552775,14 @@ To fix this you will either need to add a package.json or Cargo.toml file at tha
552745
552775
  switch (options.currentVersionResolver) {
552746
552776
  case "registry": {
552747
552777
  const metadata = options.currentVersionResolverMetadata;
552748
- const registry = metadata?.registry ?? await getNpmRegistry() ?? "https://registry.npmjs.org";
552778
+ const npmRegistry = metadata?.registry ?? await getNpmRegistry();
552779
+ const githubRegistry = metadata?.registry ?? await getGitHubRegistry();
552749
552780
  const tag = metadata?.tag ?? "latest";
552750
552781
  if (options.releaseGroup.projectsRelationship === "independent") {
552751
552782
  try {
552752
552783
  currentVersion = await new Promise((resolve3, reject) => {
552753
552784
  (0, import_node_child_process6.exec)(
552754
- `npm view ${packageName} version --registry=${registry} --tag=${tag}`,
552785
+ `npm view ${packageName} version --registry=${npmRegistry} --tag=${tag}`,
552755
552786
  (error, stdout, stderr) => {
552756
552787
  if (error) {
552757
552788
  return reject(error);
@@ -552764,19 +552795,39 @@ To fix this you will either need to add a package.json or Cargo.toml file at tha
552764
552795
  );
552765
552796
  });
552766
552797
  log(
552767
- `\u{1F4C4} Resolved the current version as ${currentVersion} for tag "${tag}" from registry ${registry}`
552798
+ `\u{1F4C4} Resolved the current version as ${currentVersion} for tag "${tag}" from registry ${npmRegistry}`
552768
552799
  );
552769
552800
  } catch (_6) {
552770
- if (options.fallbackCurrentVersionResolver === "disk") {
552801
+ try {
552802
+ currentVersion = await new Promise((resolve3, reject) => {
552803
+ (0, import_node_child_process6.exec)(
552804
+ `npm view ${packageName} version --registry=${githubRegistry} --tag=${tag}`,
552805
+ (error, stdout, stderr) => {
552806
+ if (error) {
552807
+ return reject(error);
552808
+ }
552809
+ if (stderr) {
552810
+ return reject(stderr);
552811
+ }
552812
+ return resolve3(stdout.trim());
552813
+ }
552814
+ );
552815
+ });
552771
552816
  log(
552772
- `\u{1F4C4} Unable to resolve the current version from the registry ${registry}. Falling back to the version on disk of ${currentVersionFromDisk}`
552773
- );
552774
- currentVersion = currentVersionFromDisk;
552775
- currentVersionResolvedFromFallback = true;
552776
- } else {
552777
- throw new Error(
552778
- `Unable to resolve the current version from the registry ${registry}. Please ensure that the package exists in the registry in order to use the "registry" currentVersionResolver. Alternatively, you can use the --first-release option or set "release.version.generatorOptions.fallbackCurrentVersionResolver" to "disk" in order to fallback to the version on disk when the registry lookup fails.`
552817
+ `\u{1F4C4} Resolved the current version as ${currentVersion} for tag "${tag}" from registry ${githubRegistry}`
552779
552818
  );
552819
+ } catch (_7) {
552820
+ if (options.fallbackCurrentVersionResolver === "disk") {
552821
+ log(
552822
+ `\u{1F4C4} Unable to resolve the current version from the registry ${npmRegistry}${githubRegistry ? ` or ${githubRegistry}` : ""}. Falling back to the version on disk of ${currentVersionFromDisk}`
552823
+ );
552824
+ currentVersion = currentVersionFromDisk;
552825
+ currentVersionResolvedFromFallback = true;
552826
+ } else {
552827
+ throw new Error(
552828
+ `Unable to resolve the current version from the registry ${npmRegistry}${githubRegistry ? ` or ${githubRegistry}` : ""}. Please ensure that the package exists in the registry in order to use the "registry" currentVersionResolver. Alternatively, you can use the --first-release option or set "release.version.generatorOptions.fallbackCurrentVersionResolver" to "disk" in order to fallback to the version on disk when the registry lookup fails.`
552829
+ );
552830
+ }
552780
552831
  }
552781
552832
  }
552782
552833
  } else {
@@ -552786,7 +552837,7 @@ To fix this you will either need to add a package.json or Cargo.toml file at tha
552786
552837
  );
552787
552838
  } else {
552788
552839
  log(
552789
- `\u{1F4C4} Using the current version ${currentVersion} already resolved from the registry ${registry}`
552840
+ `\u{1F4C4} Using the current version ${currentVersion} already resolved from the registry ${npmRegistry ?? githubRegistry}`
552790
552841
  );
552791
552842
  }
552792
552843
  }
@@ -552811,17 +552862,18 @@ To fix this you will either need to add a package.json or Cargo.toml file at tha
552811
552862
  }
552812
552863
  );
552813
552864
  if (!latestMatchingGitTag) {
552814
- if (options.fallbackCurrentVersionResolver === "disk") {
552865
+ if (currentVersionFromDisk) {
552815
552866
  log(
552816
552867
  `\u{1F4C4} Unable to resolve the current version from git tag using pattern "${releaseTagPattern}". Falling back to the version on disk of ${currentVersionFromDisk}`
552817
552868
  );
552818
552869
  currentVersion = currentVersionFromDisk;
552819
- currentVersionResolvedFromFallback = true;
552820
552870
  } else {
552821
- throw new Error(
552822
- `No git tags matching pattern "${releaseTagPattern}" for project "${project.name}" were found. You will need to create an initial matching tag to use as a base for determining the next version. Alternatively, you can use the --first-release option or set "release.version.generatorOptions.fallbackCurrentVersionResolver" to "disk" in order to fallback to the version on disk when no matching git tags are found.`
552871
+ log(
552872
+ `No git tags matching pattern "${releaseTagPattern}" for project "${project.name}" were found. This process also could not determine the version by checking the package files on disk, so we will attempt to use the default version value: "0.0.1".`
552823
552873
  );
552874
+ currentVersion = "0.0.1";
552824
552875
  }
552876
+ currentVersionResolvedFromFallback = true;
552825
552877
  } else {
552826
552878
  currentVersion = latestMatchingGitTag.extractedVersion;
552827
552879
  log(
@@ -552859,13 +552911,14 @@ To fix this you will either need to add a package.json or Cargo.toml file at tha
552859
552911
  );
552860
552912
  }
552861
552913
  const affectedProjects = options.releaseGroup.projectsRelationship === "independent" ? [projectName] : projects.map((p2) => p2.name);
552862
- const previousVersionRef = latestMatchingGitTag ? latestMatchingGitTag.tag : options.fallbackCurrentVersionResolver === "disk" ? await (0, import_git.getFirstGitCommit)() : void 0;
552914
+ let previousVersionRef = latestMatchingGitTag?.tag ? latestMatchingGitTag.tag : await (0, import_git.getFirstGitCommit)();
552863
552915
  if (!previousVersionRef) {
552864
- throw new Error(
552916
+ log(
552865
552917
  `Unable to determine previous version ref for the projects ${affectedProjects.join(
552866
552918
  ", "
552867
- )}. This is likely a bug in Nx.`
552919
+ )}. This is likely a bug in Storm's Release Versioning. We will attempt to use the default version value "0.0.1" and continue with the process.`
552868
552920
  );
552921
+ previousVersionRef = "0.0.1";
552869
552922
  }
552870
552923
  specifier = await (0, import_resolve_semver_specifier.resolveSemverSpecifierFromConventionalCommits)(
552871
552924
  previousVersionRef,
@@ -553116,7 +553169,10 @@ var generator_default4 = withRunGenerator(
553116
553169
  releaseVersionGeneratorFn
553117
553170
  );
553118
553171
  async function getNpmRegistry() {
553119
- return await new Promise((resolve3, reject) => {
553172
+ if (process.env.STORM_REGISTRY_NPM) {
553173
+ return process.env.STORM_REGISTRY_NPM;
553174
+ }
553175
+ const registry = await new Promise((resolve3, reject) => {
553120
553176
  (0, import_node_child_process6.exec)("npm config get registry", (error, stdout, stderr) => {
553121
553177
  if (error) {
553122
553178
  return reject(error);
@@ -553127,6 +553183,13 @@ async function getNpmRegistry() {
553127
553183
  return resolve3(stdout.trim());
553128
553184
  });
553129
553185
  });
553186
+ return registry ? registry : "https://registry.npmjs.org";
553187
+ }
553188
+ function getGitHubRegistry() {
553189
+ if (process.env.STORM_REGISTRY_GITHUB) {
553190
+ return process.env.STORM_REGISTRY_GITHUB;
553191
+ }
553192
+ return "https://npm.pkg.github.com";
553130
553193
  }
553131
553194
  function hasGitDiff(filePath) {
553132
553195
  try {