Skip to content

Commit 2fa6096

Browse files
authored
Merge pull request #31 from jtpio/npm-install
Properly install NPM Packages
2 parents f027ee6 + 1e2355f commit 2fa6096

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

jupyter_releaser/lib.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,9 +478,20 @@ def prep_git(ref, branch, repo, auth, username, url, install=True):
478478
else:
479479
util.run(checkout_cmd)
480480

481-
# Install the package with test deps
482-
if util.SETUP_PY.exists() and install:
483-
util.run('pip install ".[test]"')
481+
# Install the package
482+
if install:
483+
# install python package with test deps
484+
if util.SETUP_PY.exists():
485+
util.run('pip install ".[test]"')
486+
487+
# prefer yarn if yarn lock exists
488+
elif util.YARN_LOCK.exists():
489+
util.run("npm install -g yarn")
490+
util.run("yarn")
491+
492+
# npm install otherwise
493+
elif util.PACKAGE_JSON.exists():
494+
util.run("npm install")
484495

485496
os.chdir(orig_dir)
486497

jupyter_releaser/util.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
SETUP_PY = Path("setup.py")
2323
SETUP_CFG = Path("setup.cfg")
2424
PACKAGE_JSON = Path("package.json")
25+
YARN_LOCK = Path("yarn.lock")
2526
jupyter_releaser_CONFIG = Path(".jupyter-releaser.toml")
2627

2728
BUF_SIZE = 65536

0 commit comments

Comments
 (0)