-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Leverage
elm-json solve
(updated) (#451)
Fixes #328, fixes #277, fixes #273, fixes #323, fixes #374 zwilias recently released [`elm-json`](https://github.com/zwilias/elm-json), a tool for interacting with `elm.json` files. One of the available subcommands is `solve`: Given an elm.json file (for a package or application), it tries to generate a single set of direct and indirect dependencies that satisfy all constraints. It has 2 flags that make it useful for `node-test-runner`: - `--test` => Includes the `test-dependencies` and promotes them to direct dependencies - `--extra` => Allows providing an extra set of packages that need to be direct dependencies of the final result Since `elm-json` can be installed through `npm` and has binaries available for OS X, Windows and Linux (statically linked), it seems like a fine candidate to use in `node-test-runner` for calculating the final set of dependencies needed for the generated application.
- Loading branch information
Showing
10 changed files
with
46 additions
and
240 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
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,31 @@ | ||
const spawn = require('cross-spawn'); | ||
|
||
function get_dependencies(pathToElmJson) { | ||
var result = spawn.sync( | ||
'elm-json', | ||
[ | ||
'solve', | ||
'--test', | ||
'--extra', | ||
'elm/core', | ||
'elm/json', | ||
'elm/time', | ||
'elm/random', | ||
'--', | ||
pathToElmJson, | ||
], | ||
{ | ||
silent: true, | ||
env: process.env, | ||
} | ||
); | ||
|
||
if (result.status != 0) { | ||
console.error(result.stderr.toString()); | ||
process.exit(1); | ||
} | ||
|
||
return JSON.parse(result.stdout.toString()); | ||
} | ||
|
||
module.exports = { get_dependencies }; |
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.