@docupace/pipeline 1.1.6 → 1.1.8
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.
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
---
|
|
2
|
+
'@docupace/pipeline': patch
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Fix changeset validation failing with "No changeset found" on pull-request builds. Validation ran `./node_modules/.bin/changeset status` (since 1.1.6), but the validate step has no install, so the binary did not exist (exit 127). It now reads the release plan in-process with `@changesets/get-release-plan`, which needs neither the repo's `node_modules` nor a `changeset-output.json` file.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @docupace/pipeline
|
|
2
2
|
|
|
3
|
+
## 1.1.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 82e71f0: Run the changeset binary installed by the CLI directly instead of via `pnpm changeset`, so pnpm cannot re-sync node_modules to the repo lockfile and swap the changelog hook to an older pinned @docupace/pipeline.
|
|
8
|
+
|
|
9
|
+
Log the @docupace/pipeline version (to stderr) before every command of every dp-\*-cli, and log the CLI and changelog hook versions during changeset versioning.
|
|
10
|
+
|
|
3
11
|
## 1.1.4
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docupace/pipeline",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@aws-sdk/client-secrets-manager": "^3.600.0",
|
|
27
27
|
"@changesets/cli": "2.27.12",
|
|
28
|
+
"@changesets/get-release-plan": "^4.0.16",
|
|
28
29
|
"@docupace/core-client": "^1.0.1",
|
|
29
30
|
"@jest/globals": "^30.1.2",
|
|
30
31
|
"auth0-deploy-cli": "^8.8.0",
|
|
@@ -5,7 +5,7 @@ import { $ } from 'zx';
|
|
|
5
5
|
|
|
6
6
|
import { setGitInfo } from '../next/util.js';
|
|
7
7
|
import { getPackageNames } from './package-util.js';
|
|
8
|
-
import
|
|
8
|
+
import getReleasePlan from '@changesets/get-release-plan';
|
|
9
9
|
|
|
10
10
|
const PACKAGE_ROOT = path.resolve(
|
|
11
11
|
path.dirname(fileURLToPath(import.meta.url)),
|
|
@@ -16,6 +16,17 @@ const PACKAGE_VERSION = JSON.parse(
|
|
|
16
16
|
fs.readFileSync(path.join(PACKAGE_ROOT, 'package.json'), 'utf8'),
|
|
17
17
|
).version;
|
|
18
18
|
|
|
19
|
+
// Reads the release plan in-process with the changesets library instead of
|
|
20
|
+
// running `changeset status`, so validation needs neither the repo's
|
|
21
|
+
// node_modules (no install step runs before validate) nor an output file.
|
|
22
|
+
export async function getValidationReleases(sinceBranch) {
|
|
23
|
+
const releasePlan = await getReleasePlan(process.cwd(), sinceBranch);
|
|
24
|
+
if (releasePlan.changesets.length === 0) {
|
|
25
|
+
throw new Error(`No changesets found since ${sinceBranch}`);
|
|
26
|
+
}
|
|
27
|
+
return releasePlan.releases;
|
|
28
|
+
}
|
|
29
|
+
|
|
19
30
|
export async function validateChangesets() {
|
|
20
31
|
console.log(
|
|
21
32
|
`validateChangesets: @docupace/pipeline version = ${PACKAGE_VERSION}`,
|
|
@@ -32,7 +43,7 @@ export async function validateChangesets() {
|
|
|
32
43
|
|
|
33
44
|
try {
|
|
34
45
|
console.log('🔍 Validating changesets...');
|
|
35
|
-
releases = await
|
|
46
|
+
releases = await getValidationReleases(destBranch);
|
|
36
47
|
} catch (e) {
|
|
37
48
|
console.error(
|
|
38
49
|
'❌ No changeset found. Please add a changeset to this PR. Please see more information at https://docupacellc.atlassian.net/wiki/spaces/PM/pages/1350893571/Creating+changesets+for+Docupace+Next',
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, test } from '@jest/globals';
|
|
2
|
+
import { execFileSync } from 'child_process';
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
import os from 'os';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
import { getValidationReleases } from './validate.js';
|
|
7
|
+
|
|
8
|
+
const git = (cwd, ...args) =>
|
|
9
|
+
execFileSync('git', args, { cwd, stdio: 'pipe' }).toString();
|
|
10
|
+
|
|
11
|
+
// A real repo with no node_modules, like the pipeline's validate step.
|
|
12
|
+
function makeRepo() {
|
|
13
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'validate-changeset-'));
|
|
14
|
+
git(dir, 'init', '-q', '-b', 'master');
|
|
15
|
+
git(dir, 'config', 'user.email', 't@example.com');
|
|
16
|
+
git(dir, 'config', 'user.name', 'test');
|
|
17
|
+
fs.writeFileSync(
|
|
18
|
+
path.join(dir, 'package.json'),
|
|
19
|
+
JSON.stringify({ name: 'sample', version: '1.0.0' }),
|
|
20
|
+
);
|
|
21
|
+
fs.mkdirSync(path.join(dir, '.changeset'));
|
|
22
|
+
fs.writeFileSync(
|
|
23
|
+
path.join(dir, '.changeset', 'config.json'),
|
|
24
|
+
JSON.stringify({
|
|
25
|
+
changelog: false,
|
|
26
|
+
baseBranch: 'master',
|
|
27
|
+
access: 'restricted',
|
|
28
|
+
}),
|
|
29
|
+
);
|
|
30
|
+
git(dir, 'add', '-A');
|
|
31
|
+
git(dir, 'commit', '-q', '-m', 'base');
|
|
32
|
+
git(dir, 'checkout', '-q', '-b', 'feature');
|
|
33
|
+
fs.writeFileSync(path.join(dir, 'file.txt'), 'change');
|
|
34
|
+
return dir;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
describe('getValidationReleases', () => {
|
|
38
|
+
let dir;
|
|
39
|
+
let originalCwd;
|
|
40
|
+
|
|
41
|
+
beforeEach(() => {
|
|
42
|
+
originalCwd = process.cwd();
|
|
43
|
+
dir = makeRepo();
|
|
44
|
+
process.chdir(dir);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
afterEach(() => {
|
|
48
|
+
process.chdir(originalCwd);
|
|
49
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test('returns the releases when the branch adds a changeset', async () => {
|
|
53
|
+
fs.writeFileSync(
|
|
54
|
+
path.join(dir, '.changeset', 'DC-1.md'),
|
|
55
|
+
"---\n'sample': patch\n---\n\nA change\n",
|
|
56
|
+
);
|
|
57
|
+
git(dir, 'add', '-A');
|
|
58
|
+
git(dir, 'commit', '-q', '-m', 'feature');
|
|
59
|
+
|
|
60
|
+
const releases = await getValidationReleases('master');
|
|
61
|
+
|
|
62
|
+
expect(releases).toEqual([
|
|
63
|
+
expect.objectContaining({
|
|
64
|
+
name: 'sample',
|
|
65
|
+
type: 'patch',
|
|
66
|
+
newVersion: '1.0.1',
|
|
67
|
+
}),
|
|
68
|
+
]);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
test('throws when the branch has no changeset', async () => {
|
|
72
|
+
git(dir, 'add', '-A');
|
|
73
|
+
git(dir, 'commit', '-q', '-m', 'feature');
|
|
74
|
+
|
|
75
|
+
await expect(getValidationReleases('master')).rejects.toThrow(
|
|
76
|
+
'No changesets found since master',
|
|
77
|
+
);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
'@docupace/pipeline': patch
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
Run the changeset binary installed by the CLI directly instead of via `pnpm changeset`, so pnpm cannot re-sync node_modules to the repo lockfile and swap the changelog hook to an older pinned @docupace/pipeline.
|
|
6
|
-
|
|
7
|
-
Log the @docupace/pipeline version (to stderr) before every command of every dp-*-cli, and log the CLI and changelog hook versions during changeset versioning.
|