Skip to content

Commit b806c66

Browse files
committed
"publish: stash of uncommitted changes by release script"
1 parent f586b00 commit b806c66

File tree

3 files changed

+36
-11
lines changed

3 files changed

+36
-11
lines changed

.github/workflows/compat-tests.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,13 @@ jobs:
8585
run: pnpm test
8686

8787
packageManagers:
88-
name: Smoke test w/ ${{ matrix.packageManager }}
88+
name: Smoke test w/ ${{ matrix.packageManager }} & ${{ matrix.kind }}
8989
timeout-minutes: 10
9090
runs-on: ubuntu-latest
9191
strategy:
9292
matrix:
9393
packageManager: [npm, yarn, pnpm]
94+
kind: [alpha, beta, stable]
9495

9596
steps:
9697
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
@@ -99,7 +100,9 @@ jobs:
99100
restore-broccoli-cache: true
100101
install: true
101102
repo-token: ${{ secrets.GITHUB_TOKEN }}
102-
- name: "Run a basic smoke test with npm"
103-
- run: node ./scripts/test-package-manager.mjs "${{ matrix.packageManager }}"
103+
- name: "Run a basic smoke test with ${{ matrix.packageManager }} and ${{ matrix.kind }} tagging"
104+
run: |
105+
node ./scripts/test-package-manager.mjs \
106+
"${{ matrix.packageManager }}" "${{ matrix.kind}}"
104107
105108

release/core/publish/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ export async function executePublish(args: string[]) {
3535
// get packages present on our current branch
3636
const packages = await gatherPackages(strategy.config);
3737

38+
console.log(packages);
39+
console.log(strategy.config);
40+
3841
// get packages present in the git tag version
3942
const fromVersion = config.full.get('from') as SEMVER_VERSION | undefined;
4043
const fromTag = `v${fromVersion}` as GIT_TAG;

scripts/test-package-manager.mjs

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import assert from 'node:assert';
22
import { readFileSync, writeFileSync } from 'node:fs';
33
import { tmpdir } from 'node:os';
4-
import { mkdtemp, copyFile, cp } from 'node:fs/promises';
4+
import { mkdtemp, copyFile, cp, rm } from 'node:fs/promises';
55
import { join, basename } from 'node:path';
66
import { $ } from 'execa';
77
import { globby } from 'globby';
@@ -34,14 +34,28 @@ async function publicPackages() {
3434
return publicPaths;
3535
}
3636

37-
async function buildAll() {
37+
async function buildAll(tag) {
3838
let publicPaths = await publicPackages();
39+
40+
if (!tag) {
41+
return await Promise.all(
42+
publicPaths.map((pkgPath) => {
43+
return $({ preferLocal: true, shell: true, cwd: pkgPath })(`pnpm pack`);
44+
})
45+
);
46+
}
47+
}
48+
49+
async function deleteTars() {
50+
let tars = await globby('packages/**/*.tgz', { ignore: ['**/node_modules', '**/dist'] });
51+
3952
await Promise.all(
40-
publicPaths.map((pkgPath) => {
41-
return $({ preferLocal: true, shell: true, cwd: pkgPath })(`pnpm pack`);
53+
tars.map((tar) => {
54+
return rm(tar);
4255
})
4356
);
4457
}
58+
4559
async function copyTars(toDir) {
4660
let tars = await globby('packages/**/*.tgz', { ignore: ['**/node_modules', '**/dist'] });
4761

@@ -183,17 +197,22 @@ function banner(text) {
183197
`);
184198
}
185199

186-
async function main() {
187-
const [, , packageManager] = process.argv;
200+
const SUPPORTED = new Set(['npm', 'yarn', 'pnpm']);
201+
const TAGS = new Set(['alpha', 'beta', 'stable']);
188202

189-
const SUPPORTED = new Set(['npm', 'yarn', 'pnpm']);
203+
async function main() {
204+
const [, , packageManager, tag] = process.argv;
190205

191206
assert(
192207
SUPPORTED.has(packageManager),
193208
`Expected passed arg, the packageManager (${packageManager}), to be one of ${[...SUPPORTED.values()].join(', ')}`
194209
);
195210

196-
await buildAll();
211+
assert(TAGS.has(tag), `Expected passed arg, the tag (${tag}), to be one of ${[...TAGS.values()].join(', ')}`);
212+
213+
await deleteTars();
214+
await buildAll(tag);
215+
197216
let tmpDir = await createTempFolder();
198217
let projectDir = await copyProject(tmpDir);
199218

0 commit comments

Comments
 (0)