forked from meteor/meteor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move default npm deps install function into own module.
This extraction was necessary because importing tools/cli/commands.js is not entirely side-effect-free, and was interfering with older tests.
- Loading branch information
Ben Newman
committed
Nov 2, 2016
1 parent
4bf6940
commit 643a9f1
Showing
4 changed files
with
42 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import buildmessage from "../utils/buildmessage.js"; | ||
import { | ||
pathJoin, | ||
statOrNull, | ||
writeFile, | ||
} from "../fs/files.js"; | ||
|
||
const INSTALL_JOB_MESSAGE = "installing dependencies from package.json"; | ||
|
||
export function install(appDir) { | ||
const testAppPkgJsonPath = pathJoin(appDir, "package.json"); | ||
|
||
if (! statOrNull(testAppPkgJsonPath)) { | ||
const { dependencies } = require("../static-assets/skel/package.json"); | ||
|
||
// Write a minimial package.json with the same dependencies as the | ||
// default new-app package.json file. | ||
writeFile( | ||
testAppPkgJsonPath, | ||
JSON.stringify({ dependencies }, null, 2) + "\n", | ||
"utf8", | ||
); | ||
} | ||
|
||
return buildmessage.enterJob(INSTALL_JOB_MESSAGE, function () { | ||
const { runNpmCommand } = require("../isobuild/meteor-npm.js"); | ||
|
||
const installResult = runNpmCommand(["install"], appDir); | ||
if (! installResult.success) { | ||
buildmessage.error( | ||
"Could not install npm dependencies for test-packages: " + | ||
installResult.error); | ||
|
||
return false; | ||
} | ||
|
||
return true; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters