Skip to content

Commit a170a62

Browse files
committed
Use additional npm / Yarn options to speed up installation
The node_modules installation should be as fast and deterministic as possible, as it's taking place internally within a Python package build. Routine developer-facing information should be omitted, as this is expected to be handled as part of the direct Javascript development process. See: https://docs.npmjs.com/cli/v7/commands/npm-install#configuration https://yarnpkg.com/cli/install#options
1 parent eac55d9 commit a170a62

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

hatch_jupyter_builder/utils.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,25 +94,27 @@ def npm_builder(
9494
if isinstance(npm, str):
9595
npm = [npm]
9696

97+
is_yarn = (abs_path / "yarn.lock").exists()
98+
9799
# Find a suitable default for the npm command.
98100
if npm is None:
99-
is_yarn = (abs_path / "yarn.lock").exists()
100101
if is_yarn and not which("yarn"):
101102
log.warning("yarn not found, ignoring yarn.lock file")
102103
is_yarn = False
103-
104104
npm = ["yarn"] if is_yarn else ["npm"]
105105

106106
npm_cmd = normalize_cmd(npm)
107107

108+
install_cmd = ["install", "--immutable"] if is_yarn else ["install", "--no-audit", "--no-fund"]
109+
108110
if build_dir and source_dir and not force:
109111
should_build = is_stale(build_dir, source_dir)
110112
else:
111113
should_build = True
112114

113115
if should_build:
114116
log.info("Installing build dependencies with npm. This may take a while...")
115-
run([*npm_cmd, "install"], cwd=str(abs_path))
117+
run([*npm_cmd, *install_cmd], cwd=str(abs_path))
116118
if build_cmd:
117119
run([*npm_cmd, "run", build_cmd], cwd=str(abs_path))
118120
else:

0 commit comments

Comments
 (0)