@sentry/craft 2.25.0 → 2.25.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 +145 -57
  2. package/package.json +3 -1
package/dist/craft CHANGED
@@ -114423,7 +114423,11 @@ var init_docker = __esm({
114423
114423
  init_base5();
114424
114424
  DEFAULT_DOCKER_BIN = "docker";
114425
114425
  DOCKER_BIN = process.env.DOCKER_BIN || DEFAULT_DOCKER_BIN;
114426
- DOCKER_HUB_REGISTRIES = ["docker.io", "index.docker.io", "registry-1.docker.io"];
114426
+ DOCKER_HUB_REGISTRIES = [
114427
+ "docker.io",
114428
+ "index.docker.io",
114429
+ "registry-1.docker.io"
114430
+ ];
114427
114431
  GCR_REGISTRY_PATTERNS = [
114428
114432
  /^gcr\.io$/,
114429
114433
  /^[a-z]+-gcr\.io$/,
@@ -114614,17 +114618,28 @@ Please use ${registryHint}DOCKER_USERNAME and DOCKER_PASSWORD environment variab
114614
114618
  return false;
114615
114619
  }
114616
114620
  if (!hasGcloudCredentials()) {
114617
- this.logger.debug("No gcloud credentials detected, skipping gcloud auth configure-docker");
114621
+ this.logger.debug(
114622
+ "No gcloud credentials detected, skipping gcloud auth configure-docker"
114623
+ );
114618
114624
  return false;
114619
114625
  }
114620
114626
  if (!await isGcloudAvailable()) {
114621
- this.logger.debug("gcloud CLI not available, skipping gcloud auth configure-docker");
114627
+ this.logger.debug(
114628
+ "gcloud CLI not available, skipping gcloud auth configure-docker"
114629
+ );
114622
114630
  return false;
114623
114631
  }
114624
114632
  const registryList = registries.join(",");
114625
- this.logger.debug(`Configuring Docker for Google Cloud registries: ${registryList}`);
114633
+ this.logger.debug(
114634
+ `Configuring Docker for Google Cloud registries: ${registryList}`
114635
+ );
114626
114636
  try {
114627
- await spawnProcess("gcloud", ["auth", "configure-docker", registryList, "--quiet"], {}, {});
114637
+ await spawnProcess(
114638
+ "gcloud",
114639
+ ["auth", "configure-docker", registryList, "--quiet"],
114640
+ {},
114641
+ {}
114642
+ );
114628
114643
  this.logger.info(`Configured Docker authentication for: ${registryList}`);
114629
114644
  return true;
114630
114645
  } catch (error3) {
@@ -114665,7 +114680,9 @@ Please use ${registryHint}DOCKER_USERNAME and DOCKER_PASSWORD environment variab
114665
114680
  await this.loginToRegistry(source.credentials);
114666
114681
  } else if (sourceRegistry && !source.skipLogin && !gcrConfiguredRegistries.has(sourceRegistry) && // Don't warn if source and target share the same registry - target login will cover it
114667
114682
  sourceRegistry !== targetRegistry) {
114668
- this.logger.debug(`No credentials for source registry ${sourceRegistry}, assuming public`);
114683
+ this.logger.debug(
114684
+ `No credentials for source registry ${sourceRegistry}, assuming public`
114685
+ );
114669
114686
  }
114670
114687
  if (target.credentials) {
114671
114688
  await this.loginToRegistry(target.credentials);
@@ -125210,24 +125227,22 @@ function castChecksums(checksums) {
125210
125227
  'Invalid type of "checksums": should be an array'
125211
125228
  );
125212
125229
  }
125213
- return checksums.map(
125214
- (item) => {
125215
- if (typeof item !== "object" || !item.algorithm || !item.format) {
125216
- throw new ConfigurationError(
125217
- `Invalid checksum type: ${JSON.stringify(item)}`
125218
- );
125219
- }
125220
- if (!Object.values(HashAlgorithm).includes(item.algorithm) || !Object.values(HashOutputFormat).includes(item.format)) {
125221
- throw new ConfigurationError(
125222
- `Invalid checksum type: ${JSON.stringify(item)}`
125223
- );
125224
- }
125225
- return {
125226
- algorithm: item.algorithm,
125227
- format: item.format
125228
- };
125230
+ return checksums.map((item) => {
125231
+ if (typeof item !== "object" || !item.algorithm || !item.format) {
125232
+ throw new ConfigurationError(
125233
+ `Invalid checksum type: ${JSON.stringify(item)}`
125234
+ );
125229
125235
  }
125230
- );
125236
+ if (!Object.values(HashAlgorithm).includes(item.algorithm) || !Object.values(HashOutputFormat).includes(item.format)) {
125237
+ throw new ConfigurationError(
125238
+ `Invalid checksum type: ${JSON.stringify(item)}`
125239
+ );
125240
+ }
125241
+ return {
125242
+ algorithm: item.algorithm,
125243
+ format: item.format
125244
+ };
125245
+ });
125231
125246
  }
125232
125247
  async function getArtifactChecksums(checksums, artifact, artifactProvider) {
125233
125248
  const fileChecksums = {};
@@ -156223,7 +156238,9 @@ async function getRegionsFromAws() {
156223
156238
  path: "/?Action=DescribeRegions&Version=2013-10-15"
156224
156239
  });
156225
156240
  const url2 = `https://${hostname3}${path19}`;
156226
- const response = await (0, import_node_fetch4.default)(url2, { headers });
156241
+ const response = await (0, import_node_fetch4.default)(url2, {
156242
+ headers
156243
+ });
156227
156244
  if (!response.ok) {
156228
156245
  throw new Error(
156229
156246
  `Unexpected HTTP response from ${url2}: ${response.status} (${response.statusText})`
@@ -159052,7 +159069,7 @@ var require_package6 = __commonJS({
159052
159069
  "package.json"(exports2, module2) {
159053
159070
  module2.exports = {
159054
159071
  name: "@sentry/craft",
159055
- version: "2.25.0",
159072
+ version: "2.25.1",
159056
159073
  description: "The universal sentry workflow CLI",
159057
159074
  main: "dist/craft",
159058
159075
  repository: "https://github.com/getsentry/craft",
@@ -159134,6 +159151,8 @@ var require_package6 = __commonJS({
159134
159151
  clean: "rm -rf dist coverage",
159135
159152
  lint: "eslint --cache --cache-strategy content",
159136
159153
  fix: "pnpm lint --fix",
159154
+ format: "prettier --write .",
159155
+ "format:check": "prettier --check .",
159137
159156
  test: "vitest run",
159138
159157
  "test:watch": "vitest",
159139
159158
  typecheck: "tsc --noEmit",
@@ -159221,7 +159240,7 @@ function getPackage() {
159221
159240
  }
159222
159241
  function getPackageVersion() {
159223
159242
  const { version: version2 } = getPackage();
159224
- const buildInfo = "f4889d04564e47311038ecb6b910fef6b6cf1363";
159243
+ const buildInfo = "14aca37e23aa6d8239a4013cae86d3bae4b4e0cd";
159225
159244
  return buildInfo ? `${version2} (${buildInfo})` : version2;
159226
159245
  }
159227
159246
  function semVerToString(s6) {
@@ -167200,7 +167219,9 @@ async function calculateCalVer(git, config3) {
167200
167219
  const date2 = /* @__PURE__ */ new Date();
167201
167220
  date2.setDate(date2.getDate() - config3.offset);
167202
167221
  const datePart = formatCalVerDate(date2, config3.format);
167203
- logger.debug(`CalVer: using date ${date2.toISOString()}, date part: ${datePart}`);
167222
+ logger.debug(
167223
+ `CalVer: using date ${date2.toISOString()}, date part: ${datePart}`
167224
+ );
167204
167225
  const gitTagPrefix = getGitTagPrefix();
167205
167226
  const searchPrefix = `${gitTagPrefix}${datePart}.`;
167206
167227
  logger.debug(`CalVer: searching for tags with prefix: ${searchPrefix}`);
@@ -167897,15 +167918,30 @@ async function pushReleaseBranch(git, branchName, remoteName, pushFlag = true) {
167897
167918
  );
167898
167919
  }
167899
167920
  }
167900
- async function commitNewVersion(git, newVersion) {
167921
+ async function commitChanges(git, newVersion, preReleaseCommandRan) {
167901
167922
  const message = `release: ${newVersion}`;
167923
+ if (preReleaseCommandRan) {
167924
+ const repoStatus2 = await git.status();
167925
+ if (!(repoStatus2.created.length || repoStatus2.modified.length || repoStatus2.staged.length)) {
167926
+ reportError(
167927
+ "Nothing to commit: has the pre-release command done its job?"
167928
+ );
167929
+ }
167930
+ logger.debug("Committing the release changes...");
167931
+ logger.trace(`Commit message: "${message}"`);
167932
+ await git.commit(message, ["--all"]);
167933
+ return;
167934
+ }
167902
167935
  const repoStatus = await git.status();
167903
- if (!(repoStatus.created.length || repoStatus.modified.length)) {
167904
- reportError("Nothing to commit: has the pre-release command done its job?");
167936
+ if (!(repoStatus.staged.length || repoStatus.created.length)) {
167937
+ logger.debug(
167938
+ "Nothing to commit: no changelog changes and no version bumping occurred."
167939
+ );
167940
+ return;
167905
167941
  }
167906
167942
  logger.debug("Committing the release changes...");
167907
167943
  logger.trace(`Commit message: "${message}"`);
167908
- await git.commit(message, ["--all"]);
167944
+ await git.commit(message);
167909
167945
  }
167910
167946
  async function runPreReleaseCommand(options) {
167911
167947
  const { oldVersion, newVersion, preReleaseCommand, targets, rootDir } = options;
@@ -167914,7 +167950,11 @@ async function runPreReleaseCommand(options) {
167914
167950
  return false;
167915
167951
  }
167916
167952
  if (preReleaseCommand) {
167917
- return runCustomPreReleaseCommand(oldVersion, newVersion, preReleaseCommand);
167953
+ return runCustomPreReleaseCommand(
167954
+ oldVersion,
167955
+ newVersion,
167956
+ preReleaseCommand
167957
+ );
167918
167958
  }
167919
167959
  if (requiresMinVersion(AUTO_BUMP_MIN_VERSION) && targets && targets.length > 0) {
167920
167960
  logger.info("Running automatic version bumping from targets...");
@@ -167959,10 +167999,15 @@ function checkGitStatus(repoStatus, rev) {
167959
167999
  logger.info("Checking the local repository status...");
167960
168000
  logger.debug("Repository status:", formatJson(repoStatus));
167961
168001
  if (isRepoDirty(repoStatus)) {
167962
- reportError("Your repository is in a dirty state. Please stash or commit the pending changes.", logger);
168002
+ reportError(
168003
+ "Your repository is in a dirty state. Please stash or commit the pending changes.",
168004
+ logger
168005
+ );
167963
168006
  }
167964
168007
  if (repoStatus.current !== rev) {
167965
- logger.warn(`You are releasing from '${rev}', not '${repoStatus.current}' which you are currently on.`);
168008
+ logger.warn(
168009
+ `You are releasing from '${rev}', not '${repoStatus.current}' which you are currently on.`
168010
+ );
167966
168011
  }
167967
168012
  }
167968
168013
  async function execPublish(remote, newVersion, noGitChecks) {
@@ -167976,7 +168021,9 @@ async function execPublish(remote, newVersion, noGitChecks) {
167976
168021
  noStatusCheck: false,
167977
168022
  noGitChecks
167978
168023
  };
167979
- logger.info(`Sleeping for ${SLEEP_BEFORE_PUBLISH_SECONDS} seconds before publishing...`);
168024
+ logger.info(
168025
+ `Sleeping for ${SLEEP_BEFORE_PUBLISH_SECONDS} seconds before publishing...`
168026
+ );
167980
168027
  if (!isDryRun()) {
167981
168028
  await sleep(SLEEP_BEFORE_PUBLISH_SECONDS * 1e3);
167982
168029
  } else {
@@ -167996,11 +168043,15 @@ async function execPublish(remote, newVersion, noGitChecks) {
167996
168043
  }
167997
168044
  async function prepareChangelog(git, oldVersion, newVersion, changelogPolicy = "none" /* None */, changelogPath = DEFAULT_CHANGELOG_PATH) {
167998
168045
  if (changelogPolicy === "none" /* None */) {
167999
- logger.debug(`Changelog policy is set to "${changelogPolicy}", nothing to do.`);
168046
+ logger.debug(
168047
+ `Changelog policy is set to "${changelogPolicy}", nothing to do.`
168048
+ );
168000
168049
  return void 0;
168001
168050
  }
168002
168051
  if (changelogPolicy !== "auto" /* Auto */ && changelogPolicy !== "simple" /* Simple */) {
168003
- throw new ConfigurationError(`Invalid changelog policy: "${changelogPolicy}"`);
168052
+ throw new ConfigurationError(
168053
+ `Invalid changelog policy: "${changelogPolicy}"`
168054
+ );
168004
168055
  }
168005
168056
  logger.info("Checking the changelog...");
168006
168057
  logger.debug(`Changelog policy: "${changelogPolicy}".`);
@@ -168014,11 +168065,17 @@ async function prepareChangelog(git, oldVersion, newVersion, changelogPolicy = "
168014
168065
  logger.info(`Creating changelog file: ${relativePath}`);
168015
168066
  await safeFs.writeFile(relativePath, "# Changelog\n");
168016
168067
  } else {
168017
- throw new ConfigurationError(`Changelog does not exist: "${changelogPath}"`);
168068
+ throw new ConfigurationError(
168069
+ `Changelog does not exist: "${changelogPath}"`
168070
+ );
168018
168071
  }
168019
168072
  }
168020
168073
  let changelogString = (await import_fs30.promises.readFile(relativePath)).toString();
168021
- let changeset = findChangeset(changelogString, newVersion, changelogPolicy === "auto" /* Auto */);
168074
+ let changeset = findChangeset(
168075
+ changelogString,
168076
+ newVersion,
168077
+ changelogPolicy === "auto" /* Auto */
168078
+ );
168022
168079
  switch (changelogPolicy) {
168023
168080
  case "auto" /* Auto */:
168024
168081
  let replaceSection;
@@ -168034,7 +168091,9 @@ async function prepareChangelog(git, oldVersion, newVersion, changelogPolicy = "
168034
168091
  replaceSection = changeset.name;
168035
168092
  changeset.name = newVersion;
168036
168093
  }
168037
- logger.debug(`Updating the changelog file for the new version: ${newVersion}`);
168094
+ logger.debug(
168095
+ `Updating the changelog file for the new version: ${newVersion}`
168096
+ );
168038
168097
  if (replaceSection) {
168039
168098
  changelogString = removeChangeset(changelogString, replaceSection);
168040
168099
  changelogString = prependChangeset(changelogString, changeset);
@@ -168043,7 +168102,9 @@ async function prepareChangelog(git, oldVersion, newVersion, changelogPolicy = "
168043
168102
  break;
168044
168103
  default:
168045
168104
  if (!changeset?.body) {
168046
- throw new ConfigurationError(`No changelog entry found for version "${newVersion}"`);
168105
+ throw new ConfigurationError(
168106
+ `No changelog entry found for version "${newVersion}"`
168107
+ );
168047
168108
  }
168048
168109
  }
168049
168110
  logger.debug("Changelog entry found:", changeset.name);
@@ -168054,7 +168115,9 @@ async function getChangelogLineRange(git, changelogPath, version2) {
168054
168115
  try {
168055
168116
  const content = await git.show([`HEAD:${changelogPath}`]);
168056
168117
  const lines = content.split("\n");
168057
- const startIdx = lines.findIndex((l4) => l4.trimEnd() === `## ${version2}` || l4.trimEnd() === version2);
168118
+ const startIdx = lines.findIndex(
168119
+ (l4) => l4.trimEnd() === `## ${version2}` || l4.trimEnd() === version2
168120
+ );
168058
168121
  if (startIdx < 0) {
168059
168122
  return "";
168060
168123
  }
@@ -168132,7 +168195,9 @@ async function resolveVersion(git, options) {
168132
168195
  }
168133
168196
  const currentVersion = latestTag && getVersion(latestTag) || "0.0.0";
168134
168197
  const newVersion = calculateNextVersion(currentVersion, bumpType);
168135
- logger.info(`Version bump: ${currentVersion} -> ${newVersion} (${bumpType} bump)`);
168198
+ logger.info(
168199
+ `Version bump: ${currentVersion} -> ${newVersion} (${bumpType} bump)`
168200
+ );
168136
168201
  return newVersion;
168137
168202
  }
168138
168203
  return version2;
@@ -168143,7 +168208,9 @@ async function prepareMain(argv) {
168143
168208
  logger.info(`Loading configuration from remote branch: ${argv.configFrom}`);
168144
168209
  try {
168145
168210
  await git.fetch([argv.remote, argv.configFrom]);
168146
- const configContent = await git.show([`${argv.remote}/${argv.configFrom}:${CONFIG_FILE_NAME}`]);
168211
+ const configContent = await git.show([
168212
+ `${argv.remote}/${argv.configFrom}:${CONFIG_FILE_NAME}`
168213
+ ]);
168147
168214
  loadConfigurationFromString(configContent);
168148
168215
  } catch (error3) {
168149
168216
  throw new ConfigurationError(
@@ -168176,7 +168243,13 @@ async function prepareMain(argv) {
168176
168243
  const isolation = await createDryRunIsolation(git, rev);
168177
168244
  git = isolation.git;
168178
168245
  try {
168179
- const branchName = await createReleaseBranch(git, rev, newVersion, argv.remote, config3.releaseBranchPrefix);
168246
+ const branchName = await createReleaseBranch(
168247
+ git,
168248
+ rev,
168249
+ newVersion,
168250
+ argv.remote,
168251
+ config3.releaseBranchPrefix
168252
+ );
168180
168253
  const oldVersion = await getLatestTag(git);
168181
168254
  const changelogPath = typeof config3.changelog === "string" ? config3.changelog : config3.changelog?.filePath;
168182
168255
  const changelogPolicy = typeof config3.changelog === "object" && config3.changelog?.policy ? config3.changelog.policy : config3.changelogPolicy;
@@ -168187,6 +168260,13 @@ async function prepareMain(argv) {
168187
168260
  argv.noChangelog ? "none" /* None */ : changelogPolicy,
168188
168261
  changelogPath
168189
168262
  );
168263
+ if (changelogBody) {
168264
+ const resolvedChangelogPath = (0, import_path28.relative)(
168265
+ "",
168266
+ changelogPath || DEFAULT_CHANGELOG_PATH
168267
+ );
168268
+ await git.add(resolvedChangelogPath);
168269
+ }
168190
168270
  const rootDir = getConfigFileDir() || process.cwd();
168191
168271
  const preReleaseCommandRan = await runPreReleaseCommand({
168192
168272
  oldVersion,
@@ -168195,11 +168275,7 @@ async function prepareMain(argv) {
168195
168275
  targets: config3.targets,
168196
168276
  rootDir
168197
168277
  });
168198
- if (preReleaseCommandRan) {
168199
- await commitNewVersion(git, newVersion);
168200
- } else {
168201
- logger.debug("Not committing anything since preReleaseCommand is empty.");
168202
- }
168278
+ await commitChanges(git, newVersion, preReleaseCommandRan);
168203
168279
  await isolation.showDiff();
168204
168280
  await pushReleaseBranch(git, branchName, argv.remote, !argv.noPush);
168205
168281
  const releaseSha = await git.revparse(["HEAD"]);
@@ -168211,11 +168287,20 @@ async function prepareMain(argv) {
168211
168287
  const issueChangelog = isCalVer ? disableChangelogMentions(changelogBody) : changelogBody;
168212
168288
  writeGitHubActionsFile("changelog", issueChangelog);
168213
168289
  const resolvedChangelogPath = changelogPath || DEFAULT_CHANGELOG_PATH;
168214
- const lineRange = await getChangelogLineRange(git, resolvedChangelogPath, newVersion);
168290
+ const lineRange = await getChangelogLineRange(
168291
+ git,
168292
+ resolvedChangelogPath,
168293
+ newVersion
168294
+ );
168215
168295
  const changelogFileUrl = `https://github.com/${githubConfig.owner}/${githubConfig.repo}/blob/${branchName}/${resolvedChangelogPath}` + lineRange;
168216
- setGitHubActionsOutput("changelog", truncateForOutput(issueChangelog, changelogFileUrl));
168296
+ setGitHubActionsOutput(
168297
+ "changelog",
168298
+ truncateForOutput(issueChangelog, changelogFileUrl)
168299
+ );
168217
168300
  }
168218
- logger.info(`View diff at: https://github.com/${githubConfig.owner}/${githubConfig.repo}/compare/${branchName}`);
168301
+ logger.info(
168302
+ `View diff at: https://github.com/${githubConfig.owner}/${githubConfig.repo}/compare/${branchName}`
168303
+ );
168219
168304
  if (argv.publish) {
168220
168305
  if (isolation.isIsolated) {
168221
168306
  logger.info(`[dry-run] Would run: craft publish ${newVersion}`);
@@ -168372,10 +168457,13 @@ async function handlerMain(argv) {
168372
168457
  return void 0;
168373
168458
  }
168374
168459
  const filesToDownload = argv.all ? artifacts.map((ar2) => ar2.filename) : argv.names;
168375
- const nameToArtifact = artifacts.reduce((dict, artifact) => {
168376
- dict[artifact.filename] = artifact;
168377
- return dict;
168378
- }, {});
168460
+ const nameToArtifact = artifacts.reduce(
168461
+ (dict, artifact) => {
168462
+ dict[artifact.filename] = artifact;
168463
+ return dict;
168464
+ },
168465
+ {}
168466
+ );
168379
168467
  logger.info(`Fetching artifacts for revision: ${revision}`);
168380
168468
  for (const name of filesToDownload) {
168381
168469
  logger.info(`Artifact to fetch: "${name}"`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/craft",
3
- "version": "2.25.0",
3
+ "version": "2.25.1",
4
4
  "description": "The universal sentry workflow CLI",
5
5
  "main": "dist/craft",
6
6
  "repository": "https://github.com/getsentry/craft",
@@ -82,6 +82,8 @@
82
82
  "clean": "rm -rf dist coverage",
83
83
  "lint": "eslint --cache --cache-strategy content",
84
84
  "fix": "pnpm lint --fix",
85
+ "format": "prettier --write .",
86
+ "format:check": "prettier --check .",
85
87
  "test": "vitest run",
86
88
  "test:watch": "vitest",
87
89
  "typecheck": "tsc --noEmit",