@regardio/dev 1.7.0 → 1.7.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 +25 -3
- package/package.json +3 -2
- package/src/bin/flow-changeset.ts +23 -0
- package/src/bin/flow-release.ts +24 -3
- 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,7 +64,28 @@ ${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');
|
|
69
91
|
run('git add -A');
|
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",
|
|
@@ -106,9 +107,9 @@
|
|
|
106
107
|
"release": "pnpm exec tsx src/bin/flow-release.ts",
|
|
107
108
|
"test": "run-p test:*",
|
|
108
109
|
"test:unit": "vitest run",
|
|
109
|
-
"version": "
|
|
110
|
+
"version": "flow-changeset version"
|
|
110
111
|
},
|
|
111
112
|
"sideEffects": false,
|
|
112
113
|
"type": "module",
|
|
113
|
-
"version": "1.7.
|
|
114
|
+
"version": "1.7.1"
|
|
114
115
|
}
|
|
@@ -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,7 +118,27 @@ 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
|
|
@@ -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
|