Add script to publish tarballs to npm (#86)
* Add script to publish tarballs * Add CI check for the release:npm script * Move release script first * Remove console.log * Create dist folder * Fix resolve in npm script * Cleanup dist after test publish * debug * git checkout * Test in separate job for simplicity * Fix deps * Publish npm in dry run mode * mkdir pkgs * Remove sha256 files from dist * Remove skip_existing * Remove --dry-runpull/6294/head
parent
46270509e9
commit
1414c011c0
@ -0,0 +1,29 @@
|
||||
import { readdirSync } from 'fs';
|
||||
|
||||
import { resolve } from 'path';
|
||||
|
||||
import { run } from '@jupyterlab/buildutils';
|
||||
|
||||
import commander from 'commander';
|
||||
|
||||
commander
|
||||
.description('Publish packages to npm')
|
||||
.option(
|
||||
'--dist <path>',
|
||||
'The path to the directory with the package tarballs'
|
||||
)
|
||||
.option('--dry-run', 'Run in dry-run mode')
|
||||
.action((options: any) => {
|
||||
const dryRun = options.dryRun ?? false;
|
||||
const distDir = resolve(options.dist);
|
||||
const files = readdirSync(distDir);
|
||||
files.forEach(file => {
|
||||
if (!file.endsWith('.tgz')) {
|
||||
return;
|
||||
}
|
||||
const tarball = resolve(distDir, file);
|
||||
run(`npm publish ${tarball} ${dryRun ? '--dry-run' : ''}`);
|
||||
});
|
||||
});
|
||||
|
||||
commander.parse(process.argv);
|
||||
Loading…
Reference in new issue