Skip to content

Commit 3913754

Browse files
authored
test: Avoid publishing old tarballs for E2E tests (#16784)
I noticed that locally I sometimes have old tarballs lying around, which are all published for E2E tests. This is unnecessary, and can also make it a bit unreliable which version is used for tests (as we generally have the dependencies as `*` which could be anything). This changes it so we only publish the current version.
1 parent 8601855 commit 3913754

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

dev-packages/e2e-tests/publish-packages.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
11
import * as childProcess from 'child_process';
2+
import { readFileSync } from 'fs';
23
import * as glob from 'glob';
34
import * as path from 'path';
45

56
const repositoryRoot = path.resolve(__dirname, '../..');
67

8+
const version = (JSON.parse(readFileSync(path.join(__dirname, './package.json'), 'utf8')) as { version: string })
9+
.version;
10+
711
// Get absolute paths of all the packages we want to publish to the fake registry
8-
const packageTarballPaths = glob.sync('packages/*/sentry-*.tgz', {
12+
// Only include the current versions, to avoid getting old tarballs published as well
13+
const packageTarballPaths = glob.sync(`packages/*/sentry-*-${version}.tgz`, {
914
cwd: repositoryRoot,
1015
absolute: true,
1116
});
1217

18+
if (packageTarballPaths.length === 0) {
19+
// eslint-disable-next-line no-console
20+
console.log(`No packages to publish for version ${version}, did you run "yarn build:tarballs"?`);
21+
process.exit(1);
22+
}
23+
1324
// Publish built packages to the fake registry
1425
packageTarballPaths.forEach(tarballPath => {
1526
// eslint-disable-next-line no-console

0 commit comments

Comments
 (0)