|
6 | 6 | // pnpm m ls --json --depth=-1 | node -e "const path = require('path'); console.log(JSON.parse(require('fs').readFileSync('/dev/stdin', 'utf-8')).map((m) => path.relative(__dirname, m.path)).filter(Boolean))"
|
7 | 7 | const workspacePackagesInfoRaw = execSync('pnpm m ls --json --depth=-1');
|
8 | 8 | const workspacePackagesInfo = JSON.parse(workspacePackagesInfoRaw);
|
9 |
| - console.log(workspacePackagesInfo); |
| 9 | + // console.log(workspacePackagesInfo); |
10 | 10 |
|
11 | 11 | // generate sumamry of changed (publishable) modules according to changesets
|
12 | 12 | // only has option to output to a file
|
13 | 13 | execSync('pnpm exec changeset status --output=changesets-summary.json');
|
14 | 14 |
|
15 | 15 | const changeSetsSummaryRaw = fs.readFileSync('./changesets-summary.json', 'utf8');
|
16 | 16 | const changeSetsSummary = JSON.parse(changeSetsSummaryRaw);
|
17 |
| - console.log(changeSetsSummary); |
| 17 | + // console.log(changeSetsSummary); |
18 | 18 |
|
19 | 19 | const releasePackagePaths = changeSetsSummary.releases
|
20 | 20 | .filter((r) => r.newVersion !== r.oldVersion)
|
21 | 21 | .map((r) => workspacePackagesInfo.find((p) => p.name === r.name))
|
22 | 22 | .map((p) => p.path);
|
23 |
| - console.log(releasePackagePaths); |
| 23 | + // console.log(releasePackagePaths); |
| 24 | + |
| 25 | + const publishResult = execSync(`pnpm dlx pkg-pr-new publish --compact ${releasePackagePaths.join(' ')}`); |
| 26 | + console.log('published preview packages!') |
| 27 | + console.log(publishResult); |
24 | 28 |
|
25 |
| - execSync(`pnpm dlx pkg-pr-new publish --compact ${releasePackagePaths.join(' ')}`); |
26 | 29 | } catch (_err) {
|
27 | 30 | err = _err;
|
28 | 31 | console.error('preview release failed');
|
29 | 32 | console.error(_err);
|
30 | 33 | }
|
31 |
| -console.log(`CWD = ${process.cwd()}`); |
32 | 34 | fs.unlinkSync('./changesets-summary.json');
|
33 | 35 | process.exit(err ? 1 : 0);
|
0 commit comments