MCPcopy
hub / github.com/meteor/meteor / install

Function install

tools/cli/default-npm-deps.js:11–52  ·  view source on GitHub ↗
(appDir, options)

Source from the content-addressed store, hash-verified

9const INSTALL_JOB_MESSAGE = "installing npm dependencies";
10
11export function install(appDir, options) {
12 const packageJsonPath = pathJoin(appDir, "package.json");
13 const needTempPackageJson = ! statOrNull(packageJsonPath);
14
15 if (needTempPackageJson) {
16 const { dependencies } = require("../static-assets/skel/package.json");
17
18 // Write a minimial package.json with the same dependencies as the
19 // default new-app package.json file.
20 writeFile(
21 packageJsonPath,
22 JSON.stringify({ dependencies }, null, 2) + "\n",
23 "utf8",
24 );
25 }
26
27 const ok = buildmessage.enterJob(INSTALL_JOB_MESSAGE, function () {
28 const npmCommand = ["install"];
29 if (options && options.includeDevDependencies) {
30 npmCommand.push("--production=false");
31 }
32
33 const { runNpmCommand } = require("../isobuild/meteor-npm.js");
34 const installResult = runNpmCommand(npmCommand, appDir);
35 if (! installResult.success) {
36 buildmessage.error(
37 "Could not install npm dependencies for test-packages: " +
38 installResult.error);
39
40 return false;
41 }
42
43 return true;
44 });
45
46 if (needTempPackageJson) {
47 // Clean up the temporary package.json file created above.
48 unlink(packageJsonPath);
49 }
50
51 return ok;
52}

Callers

nothing calls this directly

Calls 3

statOrNullFunction · 0.90
pathJoinFunction · 0.85
errorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…