@regardio/dev 1.7.0 → 1.9.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.
- package/dist/bin/flow-changeset.d.ts +3 -0
- package/dist/bin/flow-changeset.d.ts.map +1 -0
- package/dist/bin/flow-changeset.js +18 -0
- package/dist/bin/flow-release.js +31 -3
- package/package.json +4 -2
- package/src/bin/flow-changeset.ts +23 -0
- package/src/bin/flow-release.ts +32 -3
- package/src/markdownlint/markdownlint-cli2.jsonc +7 -0
- package/src/templates/release.yml +8 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow-changeset.d.ts","sourceRoot":"","sources":["../../src/bin/flow-changeset.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawn } from 'node:child_process';
|
|
3
|
+
import { createRequire } from 'node:module';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
const require = createRequire(import.meta.url);
|
|
6
|
+
const pkgPath = require.resolve('@changesets/cli/package.json');
|
|
7
|
+
const pkg = require(pkgPath);
|
|
8
|
+
let binRel = typeof pkg.bin === 'string' ? pkg.bin : pkg.bin?.changeset;
|
|
9
|
+
if (!binRel) {
|
|
10
|
+
console.error('Unable to locate changeset binary from package.json bin field');
|
|
11
|
+
process.exit(1);
|
|
12
|
+
}
|
|
13
|
+
if (binRel.startsWith('./'))
|
|
14
|
+
binRel = binRel.slice(2);
|
|
15
|
+
const bin = path.join(path.dirname(pkgPath), binRel);
|
|
16
|
+
const args = process.argv.slice(2);
|
|
17
|
+
const child = spawn(process.execPath, [bin, ...args], { stdio: 'inherit' });
|
|
18
|
+
child.on('exit', (code) => process.exit(code ?? 0));
|
package/dist/bin/flow-release.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { execSync } from 'node:child_process';
|
|
2
|
+
import { execSync, spawn } from 'node:child_process';
|
|
3
3
|
import { existsSync, mkdirSync, readdirSync, readFileSync, unlinkSync, writeFileSync, } from 'node:fs';
|
|
4
|
-
import {
|
|
4
|
+
import { createRequire } from 'node:module';
|
|
5
|
+
import path, { join } from 'node:path';
|
|
5
6
|
const args = process.argv.slice(2);
|
|
6
7
|
const bumpType = args[0];
|
|
7
8
|
const message = args.slice(1).join(' ') || 'Release update';
|
|
@@ -63,9 +64,36 @@ ${message}
|
|
|
63
64
|
`;
|
|
64
65
|
writeFileSync(changesetFile, changesetContent);
|
|
65
66
|
console.log(`Created changeset: .changeset/${changesetId}.md`);
|
|
66
|
-
|
|
67
|
+
const require = createRequire(import.meta.url);
|
|
68
|
+
const changesetPkgPath = require.resolve('@changesets/cli/package.json');
|
|
69
|
+
const changesetPkg = require(changesetPkgPath);
|
|
70
|
+
let changesetBinRel = typeof changesetPkg.bin === 'string' ? changesetPkg.bin : changesetPkg.bin?.changeset;
|
|
71
|
+
if (!changesetBinRel) {
|
|
72
|
+
console.error('Unable to locate changeset binary');
|
|
73
|
+
process.exit(1);
|
|
74
|
+
}
|
|
75
|
+
if (changesetBinRel.startsWith('./'))
|
|
76
|
+
changesetBinRel = changesetBinRel.slice(2);
|
|
77
|
+
const changesetBin = path.join(path.dirname(changesetPkgPath), changesetBinRel);
|
|
78
|
+
const changesetChild = spawn(process.execPath, [changesetBin, 'version'], {
|
|
79
|
+
stdio: 'inherit',
|
|
80
|
+
});
|
|
81
|
+
await new Promise((resolve, reject) => {
|
|
82
|
+
changesetChild.on('exit', (code) => {
|
|
83
|
+
if (code === 0)
|
|
84
|
+
resolve();
|
|
85
|
+
else
|
|
86
|
+
reject(new Error(`changeset version failed with code ${code}`));
|
|
87
|
+
});
|
|
88
|
+
});
|
|
67
89
|
console.log('Updating lockfile...');
|
|
68
90
|
run('pnpm install --ignore-workspace');
|
|
91
|
+
console.log('Fixing formatting...');
|
|
92
|
+
try {
|
|
93
|
+
run('pnpm fix');
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
}
|
|
69
97
|
run('git add -A');
|
|
70
98
|
const updatedPackageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
|
|
71
99
|
const { version } = updatedPackageJson;
|
package/package.json
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"exec-s": "dist/bin/exec-s.js",
|
|
9
9
|
"exec-ts": "dist/bin/exec-ts.js",
|
|
10
10
|
"exec-tsc": "dist/bin/exec-tsc.js",
|
|
11
|
+
"flow-changeset": "dist/bin/flow-changeset.js",
|
|
11
12
|
"flow-release": "dist/bin/flow-release.js",
|
|
12
13
|
"lint-biome": "dist/bin/lint-biome.js",
|
|
13
14
|
"lint-commit": "dist/bin/lint-commit.js",
|
|
@@ -46,6 +47,7 @@
|
|
|
46
47
|
"./biome": "./src/biome/preset.json",
|
|
47
48
|
"./commitlint": "./src/commitlint/commitlint.cjs",
|
|
48
49
|
"./markdownlint": "./src/markdownlint/markdownlint.json",
|
|
50
|
+
"./markdownlint-cli2": "./src/markdownlint/markdownlint-cli2.jsonc",
|
|
49
51
|
"./playwright": {
|
|
50
52
|
"default": "./dist/playwright/index.js",
|
|
51
53
|
"types": "./dist/playwright/index.d.ts"
|
|
@@ -106,9 +108,9 @@
|
|
|
106
108
|
"release": "pnpm exec tsx src/bin/flow-release.ts",
|
|
107
109
|
"test": "run-p test:*",
|
|
108
110
|
"test:unit": "vitest run",
|
|
109
|
-
"version": "
|
|
111
|
+
"version": "flow-changeset version"
|
|
110
112
|
},
|
|
111
113
|
"sideEffects": false,
|
|
112
114
|
"type": "module",
|
|
113
|
-
"version": "1.
|
|
115
|
+
"version": "1.9.1"
|
|
114
116
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* flow-changeset: Run @changesets/cli commands.
|
|
4
|
+
* Usage: flow-changeset [changeset args...]
|
|
5
|
+
*/
|
|
6
|
+
import { spawn } from 'node:child_process';
|
|
7
|
+
import { createRequire } from 'node:module';
|
|
8
|
+
import path from 'node:path';
|
|
9
|
+
|
|
10
|
+
const require = createRequire(import.meta.url);
|
|
11
|
+
const pkgPath = require.resolve('@changesets/cli/package.json');
|
|
12
|
+
const pkg = require(pkgPath);
|
|
13
|
+
let binRel = typeof pkg.bin === 'string' ? pkg.bin : pkg.bin?.changeset;
|
|
14
|
+
if (!binRel) {
|
|
15
|
+
console.error('Unable to locate changeset binary from package.json bin field');
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
if (binRel.startsWith('./')) binRel = binRel.slice(2);
|
|
19
|
+
const bin = path.join(path.dirname(pkgPath), binRel);
|
|
20
|
+
|
|
21
|
+
const args = process.argv.slice(2);
|
|
22
|
+
const child = spawn(process.execPath, [bin, ...args], { stdio: 'inherit' });
|
|
23
|
+
child.on('exit', (code) => process.exit(code ?? 0));
|
package/src/bin/flow-release.ts
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* - Add .github/workflows/release.yml (see template in dev docs)
|
|
21
21
|
* - Add "release": "flow-release" to package.json scripts
|
|
22
22
|
*/
|
|
23
|
-
import { execSync } from 'node:child_process';
|
|
23
|
+
import { execSync, spawn } from 'node:child_process';
|
|
24
24
|
import {
|
|
25
25
|
existsSync,
|
|
26
26
|
mkdirSync,
|
|
@@ -29,7 +29,8 @@ import {
|
|
|
29
29
|
unlinkSync,
|
|
30
30
|
writeFileSync,
|
|
31
31
|
} from 'node:fs';
|
|
32
|
-
import {
|
|
32
|
+
import { createRequire } from 'node:module';
|
|
33
|
+
import path, { join } from 'node:path';
|
|
33
34
|
|
|
34
35
|
const args = process.argv.slice(2);
|
|
35
36
|
const bumpType = args[0];
|
|
@@ -117,13 +118,41 @@ writeFileSync(changesetFile, changesetContent);
|
|
|
117
118
|
console.log(`Created changeset: .changeset/${changesetId}.md`);
|
|
118
119
|
|
|
119
120
|
// Run changeset version to apply the bump
|
|
120
|
-
|
|
121
|
+
// Resolve changeset bin directly to avoid dependency on flow-changeset being in PATH
|
|
122
|
+
const require = createRequire(import.meta.url);
|
|
123
|
+
const changesetPkgPath = require.resolve('@changesets/cli/package.json');
|
|
124
|
+
const changesetPkg = require(changesetPkgPath);
|
|
125
|
+
let changesetBinRel =
|
|
126
|
+
typeof changesetPkg.bin === 'string' ? changesetPkg.bin : changesetPkg.bin?.changeset;
|
|
127
|
+
if (!changesetBinRel) {
|
|
128
|
+
console.error('Unable to locate changeset binary');
|
|
129
|
+
process.exit(1);
|
|
130
|
+
}
|
|
131
|
+
if (changesetBinRel.startsWith('./')) changesetBinRel = changesetBinRel.slice(2);
|
|
132
|
+
const changesetBin = path.join(path.dirname(changesetPkgPath), changesetBinRel);
|
|
133
|
+
const changesetChild = spawn(process.execPath, [changesetBin, 'version'], {
|
|
134
|
+
stdio: 'inherit',
|
|
135
|
+
});
|
|
136
|
+
await new Promise<void>((resolve, reject) => {
|
|
137
|
+
changesetChild.on('exit', (code) => {
|
|
138
|
+
if (code === 0) resolve();
|
|
139
|
+
else reject(new Error(`changeset version failed with code ${code}`));
|
|
140
|
+
});
|
|
141
|
+
});
|
|
121
142
|
|
|
122
143
|
// Update lockfile to ensure it matches package.json
|
|
123
144
|
// Use --ignore-workspace to update this package's lockfile independently
|
|
124
145
|
console.log('Updating lockfile...');
|
|
125
146
|
run('pnpm install --ignore-workspace');
|
|
126
147
|
|
|
148
|
+
// Run fix to ensure package.json formatting is correct after changeset version
|
|
149
|
+
console.log('Fixing formatting...');
|
|
150
|
+
try {
|
|
151
|
+
run('pnpm fix');
|
|
152
|
+
} catch {
|
|
153
|
+
// fix may not exist in all packages, ignore errors
|
|
154
|
+
}
|
|
155
|
+
|
|
127
156
|
// Stage all changes
|
|
128
157
|
run('git add -A');
|
|
129
158
|
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
# Required setup:
|
|
5
5
|
# 1. Create .changeset/config.json (see changeset-config.json template)
|
|
6
6
|
# 2. Add "release": "flow-release" to package.json scripts
|
|
7
|
-
# 3.
|
|
8
|
-
# OR use npm provenance with OIDC (recommended, no secret needed)
|
|
7
|
+
# 3. First publish must be done locally (see docs/toolchain/changesets.md)
|
|
9
8
|
#
|
|
10
9
|
# Usage:
|
|
11
10
|
# - Run `pnpm release patch|minor|major "message"` locally
|
|
@@ -42,14 +41,13 @@ jobs:
|
|
|
42
41
|
uses: actions/setup-node@v4
|
|
43
42
|
with:
|
|
44
43
|
node-version: 22
|
|
45
|
-
cache: pnpm
|
|
46
44
|
registry-url: https://registry.npmjs.org
|
|
47
45
|
|
|
48
46
|
- name: Update npm for OIDC support
|
|
49
47
|
run: npm install -g npm@latest
|
|
50
48
|
|
|
51
49
|
- name: Install dependencies
|
|
52
|
-
run: pnpm install --frozen-lockfile
|
|
50
|
+
run: pnpm install --no-frozen-lockfile
|
|
53
51
|
|
|
54
52
|
- name: Build
|
|
55
53
|
run: pnpm build
|
|
@@ -59,10 +57,14 @@ jobs:
|
|
|
59
57
|
run: |
|
|
60
58
|
PACKAGE_NAME=$(node -p "require('./package.json').name")
|
|
61
59
|
CURRENT_VERSION=$(node -p "require('./package.json').version")
|
|
62
|
-
PUBLISHED_VERSION=$(npm view "$PACKAGE_NAME" version 2>/dev/null || echo '
|
|
60
|
+
PUBLISHED_VERSION=$(npm view "$PACKAGE_NAME" version 2>/dev/null || echo 'NOT_FOUND')
|
|
63
61
|
echo "package_name=$PACKAGE_NAME" >> $GITHUB_OUTPUT
|
|
64
62
|
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
|
|
65
|
-
if [ "$PUBLISHED_VERSION"
|
|
63
|
+
if [ "$PUBLISHED_VERSION" = "NOT_FOUND" ]; then
|
|
64
|
+
echo "::error::Package $PACKAGE_NAME not found on npm. First publish must be done locally."
|
|
65
|
+
echo "::error::Run: pnpm build && npm publish --access public"
|
|
66
|
+
exit 1
|
|
67
|
+
elif [ "$PUBLISHED_VERSION" != "$CURRENT_VERSION" ]; then
|
|
66
68
|
echo "Publishing $PACKAGE_NAME@$CURRENT_VERSION (npm has v$PUBLISHED_VERSION)"
|
|
67
69
|
npm publish --access public --provenance
|
|
68
70
|
echo "published=true" >> $GITHUB_OUTPUT
|