(appDir, options)
| 9 | const INSTALL_JOB_MESSAGE = "installing npm dependencies"; |
| 10 | |
| 11 | export 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 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…