@webpieces/pr-gate 0.3.214 → 0.3.216
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webpieces/pr-gate",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.216",
|
|
4
4
|
"description": "Gated PR system: 3-point squash-merge, merge validation gate, and red/yellow/green PR dashboard. Standalone scripts, no Nx dependency required.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"directory": "packages/tooling/pr-gate"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@webpieces/rules-config": "0.3.
|
|
27
|
+
"@webpieces/rules-config": "0.3.216"
|
|
28
28
|
},
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"access": "public"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/** Stable base identity (remote / PR / feature-name slug source): trailing `Squash` and the
|
|
2
|
-
* generation
|
|
2
|
+
* generation marker stripped. `base` → `base`, `basewp2` → `base`, `basewp2Squash` → `base`. */
|
|
3
3
|
export declare function baseBranchName(branch: string): string;
|
|
4
|
-
/** The local branch you land on after this merge: base + (gen + 1). `base` → `
|
|
5
|
-
* `
|
|
4
|
+
/** The local branch you land on after this merge: base + `wp` + (gen + 1). `base` → `basewp2`,
|
|
5
|
+
* `basewp2` → `basewp3`. */
|
|
6
6
|
export declare function nextBranchName(branch: string): string;
|
|
7
7
|
/** Pre-merge safety snapshot of the given (current) branch. One overwritable slot per branch. */
|
|
8
8
|
export declare function preMergeBackupName(branch: string): string;
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Branch-naming for the numbered-generation squash-merge scheme.
|
|
3
3
|
//
|
|
4
|
-
// A feature branch has a stable *base* identity plus a
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
4
|
+
// A feature branch has a stable *base* identity plus a *generation* marker that bumps every time we
|
|
5
|
+
// re-sync from main: base → basewp2 → basewp3 … (gen 1 carries no marker). The remote branch — and
|
|
6
|
+
// therefore the single PR — always lives on `base`; only the LOCAL branch numbers up, so you can see
|
|
7
|
+
// at a glance how many times you've re-merged main. The pre-merge safety snapshot is
|
|
8
|
+
// `<currentBranch>PreMerge` (one overwritable slot per generation), replacing the old ever-accumulating
|
|
9
|
+
// `<branch>Backup1/Backup2/…`.
|
|
10
10
|
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
11
|
+
// The generation marker is `wp<N>` (a literal `wp` prefix, NOT a bare number) so it is unambiguous
|
|
12
|
+
// against branch names that naturally end in digits — most importantly version-upgrade branches like
|
|
13
|
+
// `deanhiller/upgrade-webpieces-0.3.213`, which an earlier bare-digit scheme mangled by stripping the
|
|
14
|
+
// `213`. Parsing keys off the `wp` marker: strip a trailing `Squash` (the internal temp-branch suffix),
|
|
15
|
+
// then a trailing `wp<digits>`. The branch-creation-guard rejects human branches ending in `wp<digits>`
|
|
16
|
+
// so the marker stays reserved for this tool.
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.baseBranchName = baseBranchName;
|
|
19
19
|
exports.nextBranchName = nextBranchName;
|
|
20
20
|
exports.preMergeBackupName = preMergeBackupName;
|
|
21
|
+
const GENERATION_RE = /^(.*)wp(\d+)$/;
|
|
21
22
|
class Generation {
|
|
22
23
|
base;
|
|
23
24
|
gen;
|
|
@@ -28,22 +29,22 @@ class Generation {
|
|
|
28
29
|
}
|
|
29
30
|
function parseGeneration(branch) {
|
|
30
31
|
const withoutSquash = branch.replace(/Squash$/, '');
|
|
31
|
-
const match = withoutSquash.match(
|
|
32
|
+
const match = withoutSquash.match(GENERATION_RE);
|
|
32
33
|
if (match && match[1] !== '') {
|
|
33
34
|
return new Generation(match[1], parseInt(match[2], 10));
|
|
34
35
|
}
|
|
35
36
|
return new Generation(withoutSquash, 1);
|
|
36
37
|
}
|
|
37
38
|
/** Stable base identity (remote / PR / feature-name slug source): trailing `Squash` and the
|
|
38
|
-
* generation
|
|
39
|
+
* generation marker stripped. `base` → `base`, `basewp2` → `base`, `basewp2Squash` → `base`. */
|
|
39
40
|
function baseBranchName(branch) {
|
|
40
41
|
return parseGeneration(branch).base;
|
|
41
42
|
}
|
|
42
|
-
/** The local branch you land on after this merge: base + (gen + 1). `base` → `
|
|
43
|
-
* `
|
|
43
|
+
/** The local branch you land on after this merge: base + `wp` + (gen + 1). `base` → `basewp2`,
|
|
44
|
+
* `basewp2` → `basewp3`. */
|
|
44
45
|
function nextBranchName(branch) {
|
|
45
46
|
const generation = parseGeneration(branch);
|
|
46
|
-
return `${generation.base}${generation.gen + 1}`;
|
|
47
|
+
return `${generation.base}wp${generation.gen + 1}`;
|
|
47
48
|
}
|
|
48
49
|
/** Pre-merge safety snapshot of the given (current) branch. One overwritable slot per branch. */
|
|
49
50
|
function preMergeBackupName(branch) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"branch-naming.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/workflow/branch-naming.ts"],"names":[],"mappings":";AAAA,iEAAiE;AACjE,EAAE;AACF,
|
|
1
|
+
{"version":3,"file":"branch-naming.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/workflow/branch-naming.ts"],"names":[],"mappings":";AAAA,iEAAiE;AACjE,EAAE;AACF,oGAAoG;AACpG,qGAAqG;AACrG,qGAAqG;AACrG,qFAAqF;AACrF,wGAAwG;AACxG,+BAA+B;AAC/B,EAAE;AACF,mGAAmG;AACnG,qGAAqG;AACrG,sGAAsG;AACtG,wGAAwG;AACxG,wGAAwG;AACxG,8CAA8C;;AAyB9C,wCAEC;AAID,wCAGC;AAGD,gDAEC;AArCD,MAAM,aAAa,GAAG,eAAe,CAAC;AAEtC,MAAM,UAAU;IACZ,IAAI,CAAS;IACb,GAAG,CAAS;IAEZ,YAAY,IAAY,EAAE,GAAW;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACnB,CAAC;CACJ;AAED,SAAS,eAAe,CAAC,MAAc;IACnC,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IACpD,MAAM,KAAK,GAAG,aAAa,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IACjD,IAAI,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC;QAC3B,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,IAAI,UAAU,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;AAC5C,CAAC;AAED;iGACiG;AACjG,SAAgB,cAAc,CAAC,MAAc;IACzC,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;AACxC,CAAC;AAED;6BAC6B;AAC7B,SAAgB,cAAc,CAAC,MAAc;IACzC,MAAM,UAAU,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IAC3C,OAAO,GAAG,UAAU,CAAC,IAAI,KAAK,UAAU,CAAC,GAAG,GAAG,CAAC,EAAE,CAAC;AACvD,CAAC;AAED,iGAAiG;AACjG,SAAgB,kBAAkB,CAAC,MAAc;IAC7C,OAAO,GAAG,MAAM,UAAU,CAAC;AAC/B,CAAC","sourcesContent":["// Branch-naming for the numbered-generation squash-merge scheme.\n//\n// A feature branch has a stable *base* identity plus a *generation* marker that bumps every time we\n// re-sync from main: base → basewp2 → basewp3 … (gen 1 carries no marker). The remote branch — and\n// therefore the single PR — always lives on `base`; only the LOCAL branch numbers up, so you can see\n// at a glance how many times you've re-merged main. The pre-merge safety snapshot is\n// `<currentBranch>PreMerge` (one overwritable slot per generation), replacing the old ever-accumulating\n// `<branch>Backup1/Backup2/…`.\n//\n// The generation marker is `wp<N>` (a literal `wp` prefix, NOT a bare number) so it is unambiguous\n// against branch names that naturally end in digits — most importantly version-upgrade branches like\n// `deanhiller/upgrade-webpieces-0.3.213`, which an earlier bare-digit scheme mangled by stripping the\n// `213`. Parsing keys off the `wp` marker: strip a trailing `Squash` (the internal temp-branch suffix),\n// then a trailing `wp<digits>`. The branch-creation-guard rejects human branches ending in `wp<digits>`\n// so the marker stays reserved for this tool.\n\nconst GENERATION_RE = /^(.*)wp(\\d+)$/;\n\nclass Generation {\n base: string;\n gen: number;\n\n constructor(base: string, gen: number) {\n this.base = base;\n this.gen = gen;\n }\n}\n\nfunction parseGeneration(branch: string): Generation {\n const withoutSquash = branch.replace(/Squash$/, '');\n const match = withoutSquash.match(GENERATION_RE);\n if (match && match[1] !== '') {\n return new Generation(match[1], parseInt(match[2], 10));\n }\n return new Generation(withoutSquash, 1);\n}\n\n/** Stable base identity (remote / PR / feature-name slug source): trailing `Squash` and the\n * generation marker stripped. `base` → `base`, `basewp2` → `base`, `basewp2Squash` → `base`. */\nexport function baseBranchName(branch: string): string {\n return parseGeneration(branch).base;\n}\n\n/** The local branch you land on after this merge: base + `wp` + (gen + 1). `base` → `basewp2`,\n * `basewp2` → `basewp3`. */\nexport function nextBranchName(branch: string): string {\n const generation = parseGeneration(branch);\n return `${generation.base}wp${generation.gen + 1}`;\n}\n\n/** Pre-merge safety snapshot of the given (current) branch. One overwritable slot per branch. */\nexport function preMergeBackupName(branch: string): string {\n return `${branch}PreMerge`;\n}\n"]}
|