Skip to content

Commit 083fff2

Browse files
author
Steven Silvester
authored
Merge pull request #128 from blink1073/npm-pkg-cleanup
Clean up NPM Package Handling
2 parents 903fd1e + e1c724e commit 083fff2

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

jupyter_releaser/npm.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,8 @@ def build_dist(package, dist_dir):
2323
os.remove(pkg)
2424

2525
if osp.isdir(package):
26-
basedir = package
2726
tarball = osp.join(package, util.run("npm pack", cwd=package).split("\n")[-1])
2827
else:
29-
basedir = osp.dirname(package)
3028
tarball = package
3129

3230
data = extract_package(tarball)
@@ -41,22 +39,15 @@ def build_dist(package, dist_dir):
4139
return
4240

4341
if "workspaces" in data:
44-
all_data = dict()
42+
paths = []
4543
for path in _get_workspace_packages(data):
4644
package_json = path / "package.json"
4745
data = json.loads(package_json.read_text(encoding="utf-8"))
4846
if data.get("private", False):
4947
continue
50-
data["__path__"] = path
51-
all_data[data["name"]] = data
48+
paths.append(str(osp.abspath(path)).replace(os.sep, "/"))
5249

53-
i = 0
54-
for (name, data) in sorted(all_data.items()):
55-
i += 1
56-
path = data["__path__"]
57-
util.log(f'({i}/{len(all_data)}) Packing {data["name"]}...')
58-
tarball = path / util.run("npm pack", cwd=path, quiet=True)
59-
shutil.move(str(tarball), str(dest))
50+
util.run(f"npm pack {' '.join(paths)}", cwd=dest, quiet=True)
6051

6152

6253
def extract_dist(dist_dir, target):
@@ -171,7 +162,7 @@ def tag_workspace_packages():
171162
return
172163

173164
data = json.loads(PACKAGE_JSON.read_text(encoding="utf-8"))
174-
tags = util.run("git tag").splitlines()
165+
tags = util.run("git tag", quiet=True).splitlines()
175166
if "workspaces" not in data:
176167
return
177168

0 commit comments

Comments
 (0)