Skip to content

Commit

Permalink
Backport PR jupyterlab#10621: More automated release fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 authored and meeseeksmachine committed Jul 15, 2021
1 parent 41d82c7 commit ee6e5aa
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
19 changes: 19 additions & 0 deletions buildutils/src/local-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as crypto from 'crypto';
import * as path from 'path';
import * as os from 'os';
import * as ps from 'process';
import glob from 'glob';

import { Command } from 'commander';

Expand Down Expand Up @@ -210,6 +211,17 @@ function fixLinks(package_dir: string) {
fs.writeFileSync(lock_file, new_content, 'utf8');
}

/**
* Publish the npm tar files in a given directory
*/
function publishPackages(dist_dir: string) {
const paths = glob.sync(path.join(dist_dir, '*.tgz'));
paths.forEach(package_path => {
const name = path.basename(package_path);
utils.run(`npm publish ${name}`, { cwd: dist_dir });
});
}

const program = new Command();

program
Expand All @@ -236,6 +248,13 @@ program
fixLinks(options.path || process.cwd());
});

program
.command('publish-dists')
.option('--path <path>', 'Path to the directory with npm tar balls')
.action((options: any) => {
publishPackages(options.path || process.cwd());
});

if (require.main === module) {
program.parse(process.argv);
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"analyze": "jlpm run analyze:dev",
"analyze:dev": "cd dev_mode && jlpm run build --analyze",
"analyze:prod": "cd dev_mode && jlpm run build:prod --analyze",
"before:build:python": "node buildutils/lib/publish --yes --skip-tags && node buildutils/lib/update-core-mode.js",
"before:build:python": "node buildutils/lib/local-repository.js publish-dists --path ./dist && node buildutils/lib/update-core-mode.js",
"build": "jlpm run build:dev",
"build:builder": "cd builder && jlpm run build",
"build:core": "cd jupyterlab/staging && jlpm && (jlpm deduplicate || jlpm) && jlpm run build",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ npm-install-options = "--legacy-peer-deps"
[tool.jupyter-releaser.hooks]
before-bump-version = ["git checkout .", "pip install bump2version"]
before-build-npm = ["git commit -am 'Bump version'", "jlpm", "jlpm run build:utils", "jlpm run build:src"]
before-build-python = ["node buildutils/lib/local-repository start", "jlpm run before:build:python", "ls -ltr jupyterlab/staging", "node buildutils/lib/local-repository stop", "node buildutils/lib/local-repository fix-links --path jupyterlab/staging"]
before-build-python = ["node buildutils/lib/local-repository start", "jlpm run before:build:python", "node buildutils/lib/local-repository stop", "node buildutils/lib/local-repository fix-links --path jupyterlab/staging"]
after-publish-assets = "jlpm run after:publish:assets"

0 comments on commit ee6e5aa

Please sign in to comment.