@sentry/craft 2.21.2 → 2.21.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/dist/craft +108 -7
- package/package.json +1 -1
package/dist/craft
CHANGED
|
@@ -71284,10 +71284,29 @@ function stringToRegexp(str2) {
|
|
|
71284
71284
|
function escapeRegex(str2) {
|
|
71285
71285
|
return str2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
71286
71286
|
}
|
|
71287
|
+
function hasGlobChars(str2) {
|
|
71288
|
+
return /[*?]/.test(str2);
|
|
71289
|
+
}
|
|
71290
|
+
function globToRegex(pattern) {
|
|
71291
|
+
let result = "";
|
|
71292
|
+
for (const char of pattern) {
|
|
71293
|
+
if (char === "*") {
|
|
71294
|
+
result += ".*";
|
|
71295
|
+
} else if (char === "?") {
|
|
71296
|
+
result += ".";
|
|
71297
|
+
} else {
|
|
71298
|
+
result += escapeRegex(char);
|
|
71299
|
+
}
|
|
71300
|
+
}
|
|
71301
|
+
return result;
|
|
71302
|
+
}
|
|
71287
71303
|
function patternToRegexp(pattern) {
|
|
71288
71304
|
if (pattern.startsWith("/") && pattern.lastIndexOf("/") > 0) {
|
|
71289
71305
|
return stringToRegexp(pattern);
|
|
71290
71306
|
}
|
|
71307
|
+
if (hasGlobChars(pattern)) {
|
|
71308
|
+
return new RegExp(`^${globToRegex(pattern)}$`);
|
|
71309
|
+
}
|
|
71291
71310
|
return new RegExp(`^${escapeRegex(pattern)}$`);
|
|
71292
71311
|
}
|
|
71293
71312
|
var init_filters = __esm({
|
|
@@ -80397,10 +80416,14 @@ function normalizeArtifactsConfig(config3) {
|
|
|
80397
80416
|
return [];
|
|
80398
80417
|
}
|
|
80399
80418
|
if (typeof config3 === "string") {
|
|
80400
|
-
return [
|
|
80419
|
+
return [
|
|
80420
|
+
{ workflow: void 0, artifacts: normalizeArtifactPatterns(config3) }
|
|
80421
|
+
];
|
|
80401
80422
|
}
|
|
80402
80423
|
if (Array.isArray(config3)) {
|
|
80403
|
-
return [
|
|
80424
|
+
return [
|
|
80425
|
+
{ workflow: void 0, artifacts: normalizeArtifactPatterns(config3) }
|
|
80426
|
+
];
|
|
80404
80427
|
}
|
|
80405
80428
|
const filters = [];
|
|
80406
80429
|
for (const [workflowPattern, artifactPatterns] of Object.entries(config3)) {
|
|
@@ -80741,10 +80764,15 @@ var init_github = __esm({
|
|
|
80741
80764
|
try {
|
|
80742
80765
|
if (fs14.existsSync(tempFile)) {
|
|
80743
80766
|
fs14.unlinkSync(tempFile);
|
|
80744
|
-
this.logger.debug(
|
|
80767
|
+
this.logger.debug(
|
|
80768
|
+
`Cleaned up temp file after failed unpack: ${tempFile}`
|
|
80769
|
+
);
|
|
80745
80770
|
}
|
|
80746
80771
|
} catch (cleanupError) {
|
|
80747
|
-
this.logger.warn(
|
|
80772
|
+
this.logger.warn(
|
|
80773
|
+
`Failed to clean up temp file ${tempFile}:`,
|
|
80774
|
+
cleanupError
|
|
80775
|
+
);
|
|
80748
80776
|
}
|
|
80749
80777
|
}
|
|
80750
80778
|
}
|
|
@@ -80756,6 +80784,49 @@ var init_github = __esm({
|
|
|
80756
80784
|
}
|
|
80757
80785
|
return allArtifacts;
|
|
80758
80786
|
}
|
|
80787
|
+
/**
|
|
80788
|
+
* Validates that every configured workflow pattern matched at least one
|
|
80789
|
+
* workflow run, and every artifact pattern matched at least one artifact.
|
|
80790
|
+
*
|
|
80791
|
+
* This catches configuration issues early with clear error messages instead
|
|
80792
|
+
* of letting them surface as confusing per-target failures later.
|
|
80793
|
+
*
|
|
80794
|
+
* @param filters Normalized artifact filters from config
|
|
80795
|
+
* @param allRuns All workflow runs found for the commit
|
|
80796
|
+
* @param matchingArtifacts Artifacts that matched at least one pattern
|
|
80797
|
+
*/
|
|
80798
|
+
validateAllPatternsMatched(filters, allRuns, matchingArtifacts) {
|
|
80799
|
+
const errors = [];
|
|
80800
|
+
for (const filter3 of filters) {
|
|
80801
|
+
if (filter3.workflow) {
|
|
80802
|
+
const hasMatchingRun = allRuns.some(
|
|
80803
|
+
(run) => filter3.workflow.test(run.name ?? "")
|
|
80804
|
+
);
|
|
80805
|
+
if (!hasMatchingRun) {
|
|
80806
|
+
const availableNames = allRuns.map((r4) => r4.name ?? "(unnamed)").join(", ");
|
|
80807
|
+
errors.push(
|
|
80808
|
+
`Workflow pattern ${filter3.workflow} did not match any workflow runs. Available workflows: ${availableNames || "(none)"}`
|
|
80809
|
+
);
|
|
80810
|
+
continue;
|
|
80811
|
+
}
|
|
80812
|
+
}
|
|
80813
|
+
const scopedArtifacts = filter3.workflow ? matchingArtifacts.filter((a4) => {
|
|
80814
|
+
const runName = allRuns.find((r4) => r4.id === a4.workflow_run?.id)?.name ?? "";
|
|
80815
|
+
return filter3.workflow.test(runName);
|
|
80816
|
+
}) : matchingArtifacts;
|
|
80817
|
+
for (const artifactPattern of filter3.artifacts) {
|
|
80818
|
+
const matched = scopedArtifacts.some((a4) => artifactPattern.test(a4.name));
|
|
80819
|
+
if (!matched) {
|
|
80820
|
+
const availableNames = scopedArtifacts.map((a4) => a4.name).join(", ");
|
|
80821
|
+
const workflowDesc = filter3.workflow ? ` (from workflow ${filter3.workflow})` : "";
|
|
80822
|
+
errors.push(
|
|
80823
|
+
`Artifact pattern ${artifactPattern}${workflowDesc} did not match any artifacts. Available artifact names: ${availableNames || "(none)"}`
|
|
80824
|
+
);
|
|
80825
|
+
}
|
|
80826
|
+
}
|
|
80827
|
+
}
|
|
80828
|
+
return errors;
|
|
80829
|
+
}
|
|
80759
80830
|
/**
|
|
80760
80831
|
* Fetches artifacts using the new workflow-based approach
|
|
80761
80832
|
*
|
|
@@ -80803,6 +80874,25 @@ var init_github = __esm({
|
|
|
80803
80874
|
`No artifacts matching filters found for revision "${revision}" (tries: ${MAX_TRIES})`
|
|
80804
80875
|
);
|
|
80805
80876
|
}
|
|
80877
|
+
const validationErrors = this.validateAllPatternsMatched(
|
|
80878
|
+
filters,
|
|
80879
|
+
allRuns,
|
|
80880
|
+
matchingArtifacts
|
|
80881
|
+
);
|
|
80882
|
+
if (validationErrors.length > 0) {
|
|
80883
|
+
if (tries + 1 < MAX_TRIES) {
|
|
80884
|
+
this.logger.info(
|
|
80885
|
+
`Not all patterns matched yet (${validationErrors.length} unmatched). Waiting ${ARTIFACTS_POLLING_INTERVAL / MILLISECONDS} seconds before retrying...`
|
|
80886
|
+
);
|
|
80887
|
+
await sleep(ARTIFACTS_POLLING_INTERVAL);
|
|
80888
|
+
continue;
|
|
80889
|
+
}
|
|
80890
|
+
throw new Error(
|
|
80891
|
+
`Not all configured artifact patterns were satisfied:
|
|
80892
|
+
- ${validationErrors.join("\n - ")}
|
|
80893
|
+
Check that your workflow names and artifact names in .craft.yml match what your CI actually produces.`
|
|
80894
|
+
);
|
|
80895
|
+
}
|
|
80806
80896
|
this.logger.debug(
|
|
80807
80897
|
`Downloading ${matchingArtifacts.length} artifacts in parallel...`
|
|
80808
80898
|
);
|
|
@@ -162346,7 +162436,7 @@ var require_package6 = __commonJS({
|
|
|
162346
162436
|
"package.json"(exports2, module2) {
|
|
162347
162437
|
module2.exports = {
|
|
162348
162438
|
name: "@sentry/craft",
|
|
162349
|
-
version: "2.21.
|
|
162439
|
+
version: "2.21.3",
|
|
162350
162440
|
description: "The universal sentry workflow CLI",
|
|
162351
162441
|
main: "dist/craft",
|
|
162352
162442
|
repository: "https://github.com/getsentry/craft",
|
|
@@ -162515,7 +162605,7 @@ function getPackage() {
|
|
|
162515
162605
|
}
|
|
162516
162606
|
function getPackageVersion() {
|
|
162517
162607
|
const { version: version2 } = getPackage();
|
|
162518
|
-
const buildInfo = "
|
|
162608
|
+
const buildInfo = "5d154a7facb096e38889be2c6caf2fd23649aa92";
|
|
162519
162609
|
return buildInfo ? `${version2} (${buildInfo})` : version2;
|
|
162520
162610
|
}
|
|
162521
162611
|
function semVerToString(s4) {
|
|
@@ -171678,6 +171768,7 @@ __export(changelog_exports, {
|
|
|
171678
171768
|
});
|
|
171679
171769
|
init_import_meta_url();
|
|
171680
171770
|
init_logger2();
|
|
171771
|
+
init_config2();
|
|
171681
171772
|
init_git();
|
|
171682
171773
|
init_changelog();
|
|
171683
171774
|
init_errors2();
|
|
@@ -171705,14 +171796,24 @@ async function changelogMain(argv) {
|
|
|
171705
171796
|
if (since) {
|
|
171706
171797
|
logger.debug(`Using latest tag as base revision: ${since}`);
|
|
171707
171798
|
} else {
|
|
171708
|
-
logger.debug(
|
|
171799
|
+
logger.debug(
|
|
171800
|
+
"No tags found, generating changelog from beginning of history"
|
|
171801
|
+
);
|
|
171709
171802
|
}
|
|
171710
171803
|
}
|
|
171711
171804
|
const result = argv.pr ? await generateChangelogWithHighlight(git, since, argv.pr) : await generateChangesetFromGit(git, since);
|
|
171712
171805
|
if (argv.format === "json") {
|
|
171806
|
+
let versioningPolicy = "auto";
|
|
171807
|
+
try {
|
|
171808
|
+
if (findConfigFile()) {
|
|
171809
|
+
versioningPolicy = getVersioningPolicy();
|
|
171810
|
+
}
|
|
171811
|
+
} catch {
|
|
171812
|
+
}
|
|
171713
171813
|
const output = {
|
|
171714
171814
|
changelog: result.changelog || "",
|
|
171715
171815
|
bumpType: result.bumpType,
|
|
171816
|
+
versioningPolicy,
|
|
171716
171817
|
totalCommits: result.totalCommits,
|
|
171717
171818
|
matchedCommitsWithSemver: result.matchedCommitsWithSemver,
|
|
171718
171819
|
prSkipped: result.prSkipped ?? false
|