@sentry/craft 2.26.0 → 2.26.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.
Files changed (2) hide show
  1. package/dist/craft +175 -27
  2. package/package.json +1 -1
package/dist/craft CHANGED
@@ -123206,10 +123206,10 @@ var init_ignore = __esm({
123206
123206
  ignored(p5) {
123207
123207
  const fullpath = p5.fullpath();
123208
123208
  const fullpaths = `${fullpath}/`;
123209
- const relative5 = p5.relative() || ".";
123210
- const relatives = `${relative5}/`;
123209
+ const relative6 = p5.relative() || ".";
123210
+ const relatives = `${relative6}/`;
123211
123211
  for (const m6 of this.relative) {
123212
- if (m6.match(relative5) || m6.match(relatives))
123212
+ if (m6.match(relative6) || m6.match(relatives))
123213
123213
  return true;
123214
123214
  }
123215
123215
  for (const m6 of this.absolute) {
@@ -123220,9 +123220,9 @@ var init_ignore = __esm({
123220
123220
  }
123221
123221
  childrenIgnored(p5) {
123222
123222
  const fullpath = p5.fullpath() + "/";
123223
- const relative5 = (p5.relative() || ".") + "/";
123223
+ const relative6 = (p5.relative() || ".") + "/";
123224
123224
  for (const m6 of this.relativeChildren) {
123225
- if (m6.match(relative5))
123225
+ if (m6.match(relative6))
123226
123226
  return true;
123227
123227
  }
123228
123228
  for (const m6 of this.absoluteChildren) {
@@ -124380,6 +124380,7 @@ var init_npm = __esm({
124380
124380
  import_fs13 = require("fs");
124381
124381
  import_path12 = require("path");
124382
124382
  import_prompts2 = __toESM(require_prompts3());
124383
+ init_dryRun();
124383
124384
  init_errors2();
124384
124385
  init_filters();
124385
124386
  init_helpers();
@@ -124542,16 +124543,31 @@ var init_npm = __esm({
124542
124543
  );
124543
124544
  try {
124544
124545
  await spawnProcess(bin, workspaceArgs, { cwd: rootDir });
124545
- } catch {
124546
- logger.debug(
124547
- "npm --workspaces failed, falling back to individual package bumping"
124548
- );
124549
- await _NpmTarget.bumpWorkspacePackagesIndividually(
124550
- bin,
124546
+ } catch (err) {
124547
+ if (isDryRun()) {
124548
+ logger.debug("npm --workspaces failed in dry-run mode, skipping");
124549
+ } else if (_NpmTarget.allWorkspacePackageJsonsMatch(
124550
+ rootDir,
124551
124551
  workspaces.packages,
124552
- newVersion,
124553
- baseArgs
124554
- );
124552
+ newVersion
124553
+ )) {
124554
+ logger.warn(
124555
+ `npm version --workspaces exited non-zero but every workspace package.json was successfully bumped to the target version. This is likely caused by "workspace:*" dependency protocols tripping npm's URL validator \u2014 see https://github.com/npm/cli/issues/8845. Treating the bump as successful.`
124556
+ );
124557
+ logger.debug(
124558
+ `npm --workspaces error (ignored): ${err?.message ?? err}`
124559
+ );
124560
+ } else {
124561
+ logger.debug(
124562
+ "npm --workspaces failed, falling back to individual package bumping"
124563
+ );
124564
+ await _NpmTarget.bumpWorkspacePackagesIndividually(
124565
+ bin,
124566
+ workspaces.packages,
124567
+ newVersion,
124568
+ baseArgs
124569
+ );
124570
+ }
124555
124571
  }
124556
124572
  } else {
124557
124573
  await _NpmTarget.bumpWorkspacePackagesIndividually(
@@ -124564,13 +124580,56 @@ var init_npm = __esm({
124564
124580
  logger.info(
124565
124581
  `Bumped version in root and ${workspaces.packages.length} workspace packages`
124566
124582
  );
124583
+ _NpmTarget.patchBunLock(rootDir, workspaces.packages, newVersion);
124567
124584
  }
124568
124585
  return true;
124569
124586
  }
124570
124587
  /**
124571
- * Bump version in each workspace package individually
124588
+ * Read the `version` field from a package.json file.
124589
+ * Returns undefined if the file is missing, unreadable, or malformed.
124590
+ */
124591
+ static readPackageJsonVersion(packageJsonPath) {
124592
+ try {
124593
+ const parsed = JSON.parse((0, import_fs13.readFileSync)(packageJsonPath, "utf-8"));
124594
+ return typeof parsed.version === "string" ? parsed.version : void 0;
124595
+ } catch {
124596
+ return void 0;
124597
+ }
124598
+ }
124599
+ /**
124600
+ * Check whether every package.json file (root + each workspace package that
124601
+ * exists on disk and is not private) has the expected version string.
124602
+ *
124603
+ * Used to detect the npm/cli#8845 case where `npm version --workspaces`
124604
+ * successfully writes every version field but then exits non-zero.
124572
124605
  */
124573
- static async bumpWorkspacePackagesIndividually(bin, packages, _newVersion, baseArgs) {
124606
+ static allWorkspacePackageJsonsMatch(rootDir, packages, expectedVersion) {
124607
+ const rootVersion = _NpmTarget.readPackageJsonVersion(
124608
+ (0, import_path12.join)(rootDir, "package.json")
124609
+ );
124610
+ if (rootVersion !== expectedVersion) {
124611
+ return false;
124612
+ }
124613
+ for (const pkg of packages) {
124614
+ const pkgJsonPath = (0, import_path12.join)(pkg.location, "package.json");
124615
+ if (!(0, import_fs13.existsSync)(pkgJsonPath)) {
124616
+ continue;
124617
+ }
124618
+ if (_NpmTarget.readPackageJsonVersion(pkgJsonPath) !== expectedVersion) {
124619
+ return false;
124620
+ }
124621
+ }
124622
+ return true;
124623
+ }
124624
+ /**
124625
+ * Bump version in each workspace package individually.
124626
+ *
124627
+ * Applies the same post-check as the --workspaces path: if a per-package
124628
+ * `npm version` spawn fails but the file on disk already has the target
124629
+ * version (npm/cli#8845), treat it as success and continue. Otherwise
124630
+ * rethrow so the caller fails loudly.
124631
+ */
124632
+ static async bumpWorkspacePackagesIndividually(bin, packages, newVersion, baseArgs) {
124574
124633
  for (const pkg of packages) {
124575
124634
  const pkgJsonPath = (0, import_path12.join)(pkg.location, "package.json");
124576
124635
  if (!(0, import_fs13.existsSync)(pkgJsonPath)) {
@@ -124587,9 +124646,94 @@ var init_npm = __esm({
124587
124646
  continue;
124588
124647
  }
124589
124648
  logger.debug(`Bumping version for workspace package: ${pkg.name}`);
124590
- await spawnProcess(bin, baseArgs, { cwd: pkg.location });
124649
+ try {
124650
+ await spawnProcess(bin, baseArgs, { cwd: pkg.location });
124651
+ } catch (err) {
124652
+ if (isDryRun()) {
124653
+ continue;
124654
+ }
124655
+ const actualVersion = _NpmTarget.readPackageJsonVersion(pkgJsonPath);
124656
+ if (actualVersion === newVersion) {
124657
+ logger.warn(
124658
+ `npm version for ${pkg.name} exited non-zero but package.json was successfully bumped to ${newVersion}. Likely caused by "workspace:*" dependency protocols \u2014 see https://github.com/npm/cli/issues/8845. Continuing.`
124659
+ );
124660
+ logger.debug(
124661
+ `npm version error for ${pkg.name} (ignored): ${err?.message ?? err}`
124662
+ );
124663
+ } else {
124664
+ throw err;
124665
+ }
124666
+ }
124591
124667
  }
124592
124668
  }
124669
+ /**
124670
+ * Patch workspace `version` entries in `bun.lock` if the file exists.
124671
+ *
124672
+ * `bun pm pack` rewrites `workspace:*` dependency specifiers to concrete
124673
+ * versions at pack time, reading those versions FROM `bun.lock` — not from
124674
+ * the workspace `package.json`. Neither `npm version` nor `bun install`
124675
+ * updates those lockfile entries, so after a version bump the lockfile
124676
+ * still records the old workspace version, and published tarballs ship
124677
+ * with stale `dependencies` that fail to install.
124678
+ *
124679
+ * We patch the lockfile in-place with a per-workspace regex that matches
124680
+ * the workspace's path-relative key ("packages/foo": {) and replaces the
124681
+ * first subsequent `"version": "..."` line. This leaves nested dependency
124682
+ * version pins inside the same block untouched.
124683
+ *
124684
+ * Writes go through `safeFs.writeFileSync` so dry-run mode is respected.
124685
+ *
124686
+ * No-op if bun.lock is absent or no workspace entries match (logged).
124687
+ *
124688
+ * See https://github.com/getsentry/craft/issues/804
124689
+ */
124690
+ static patchBunLock(rootDir, packages, newVersion) {
124691
+ const bunLockPath = (0, import_path12.join)(rootDir, "bun.lock");
124692
+ if (!(0, import_fs13.existsSync)(bunLockPath)) {
124693
+ return;
124694
+ }
124695
+ let content;
124696
+ try {
124697
+ content = (0, import_fs13.readFileSync)(bunLockPath, "utf-8");
124698
+ } catch (err) {
124699
+ logger.warn(
124700
+ `Could not read bun.lock: ${err?.message ?? err}. Skipping lockfile patch.`
124701
+ );
124702
+ return;
124703
+ }
124704
+ let patchedCount = 0;
124705
+ for (const pkg of packages) {
124706
+ const relPath = (0, import_path12.relative)(rootDir, pkg.location).split(import_path12.sep).join("/");
124707
+ if (!relPath || relPath.startsWith("..")) {
124708
+ continue;
124709
+ }
124710
+ const escapedPath = escapeRegex(relPath);
124711
+ const pattern = new RegExp(
124712
+ `("${escapedPath}":\\s*\\{[^{}]*?)"version":\\s*"[^"]*"`
124713
+ );
124714
+ const replaced = content.replace(
124715
+ pattern,
124716
+ (_m3, prefix) => `${prefix}"version": "${newVersion}"`
124717
+ );
124718
+ if (replaced !== content) {
124719
+ content = replaced;
124720
+ patchedCount += 1;
124721
+ logger.debug(
124722
+ `Patched bun.lock workspace version for ${pkg.name} (${relPath})`
124723
+ );
124724
+ }
124725
+ }
124726
+ if (patchedCount === 0) {
124727
+ logger.warn(
124728
+ "bun.lock exists but no workspace entries matched the discovered packages; leaving it untouched. Your lockfile may be out of sync with package.json workspaces."
124729
+ );
124730
+ return;
124731
+ }
124732
+ safeFs.writeFileSync(bunLockPath, content);
124733
+ logger.info(
124734
+ `Patched ${patchedCount} workspace version entr${patchedCount === 1 ? "y" : "ies"} in bun.lock`
124735
+ );
124736
+ }
124593
124737
  constructor(config3, artifactProvider) {
124594
124738
  super(config3, artifactProvider);
124595
124739
  this.checkRequirements();
@@ -142742,12 +142886,12 @@ var require_fromHttp = __commonJS({
142742
142886
  var fromHttp = (options = {}) => {
142743
142887
  options.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");
142744
142888
  let host;
142745
- const relative5 = options.awsContainerCredentialsRelativeUri ?? process.env[AWS_CONTAINER_CREDENTIALS_RELATIVE_URI];
142889
+ const relative6 = options.awsContainerCredentialsRelativeUri ?? process.env[AWS_CONTAINER_CREDENTIALS_RELATIVE_URI];
142746
142890
  const full = options.awsContainerCredentialsFullUri ?? process.env[AWS_CONTAINER_CREDENTIALS_FULL_URI];
142747
142891
  const token = options.awsContainerAuthorizationToken ?? process.env[AWS_CONTAINER_AUTHORIZATION_TOKEN];
142748
142892
  const tokenFile = options.awsContainerAuthorizationTokenFile ?? process.env[AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE];
142749
142893
  const warn2 = options.logger?.constructor?.name === "NoOpLogger" || !options.logger?.warn ? console.warn : options.logger.warn.bind(options.logger);
142750
- if (relative5 && full) {
142894
+ if (relative6 && full) {
142751
142895
  warn2("@aws-sdk/credential-provider-http: you have set both awsContainerCredentialsRelativeUri and awsContainerCredentialsFullUri.");
142752
142896
  warn2("awsContainerCredentialsFullUri will take precedence.");
142753
142897
  }
@@ -142757,8 +142901,8 @@ var require_fromHttp = __commonJS({
142757
142901
  }
142758
142902
  if (full) {
142759
142903
  host = full;
142760
- } else if (relative5) {
142761
- host = `${DEFAULT_LINK_LOCAL_HOST}${relative5}`;
142904
+ } else if (relative6) {
142905
+ host = `${DEFAULT_LINK_LOCAL_HOST}${relative6}`;
142762
142906
  } else {
142763
142907
  throw new property_provider_1.CredentialsProviderError(`No HTTP credential provider host provided.
142764
142908
  Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI.`, { logger: options.logger });
@@ -158743,7 +158887,7 @@ var require_package6 = __commonJS({
158743
158887
  "package.json"(exports2, module2) {
158744
158888
  module2.exports = {
158745
158889
  name: "@sentry/craft",
158746
- version: "2.26.0",
158890
+ version: "2.26.1",
158747
158891
  description: "The universal sentry workflow CLI",
158748
158892
  main: "dist/craft",
158749
158893
  repository: "https://github.com/getsentry/craft",
@@ -158914,7 +159058,7 @@ function getPackage() {
158914
159058
  }
158915
159059
  function getPackageVersion() {
158916
159060
  const { version: version2 } = getPackage();
158917
- const buildInfo = "2d78918ece86d970404ccaa029735cb5dce1901b";
159061
+ const buildInfo = "c248b38be4dbcdb95ba538f39a2336d7dd12b9f7";
158918
159062
  return buildInfo ? `${version2} (${buildInfo})` : version2;
158919
159063
  }
158920
159064
  function semVerToString(s6) {
@@ -166927,20 +167071,24 @@ init_system();
166927
167071
  // src/utils/releaseCommandEnv.ts
166928
167072
  init_import_meta_url();
166929
167073
  var ALLOWED_ENV_VARS = [
167074
+ "PATH",
166930
167075
  "HOME",
166931
167076
  "USER",
166932
167077
  "GIT_COMMITTER_NAME",
166933
167078
  "GIT_AUTHOR_NAME",
166934
167079
  "EMAIL"
166935
167080
  ];
167081
+ var ALLOWED_ENV_VAR_PREFIXES = ["GITHUB_", "RUNNER_"];
166936
167082
  function buildReleaseCommandEnv(extras = {}) {
166937
- const env2 = {
166938
- PATH: process.env.PATH,
166939
- GITHUB_TOKEN: process.env.GITHUB_TOKEN
166940
- };
167083
+ const env2 = {};
166941
167084
  for (const key of ALLOWED_ENV_VARS) {
166942
167085
  env2[key] = process.env[key];
166943
167086
  }
167087
+ for (const key of Object.keys(process.env)) {
167088
+ if (ALLOWED_ENV_VAR_PREFIXES.some((prefix) => key.startsWith(prefix))) {
167089
+ env2[key] = process.env[key];
167090
+ }
167091
+ }
166944
167092
  return { ...env2, ...extras };
166945
167093
  }
166946
167094
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/craft",
3
- "version": "2.26.0",
3
+ "version": "2.26.1",
4
4
  "description": "The universal sentry workflow CLI",
5
5
  "main": "dist/craft",
6
6
  "repository": "https://github.com/getsentry/craft",