Skip to content

Commit

Permalink
Merge pull request #8 from Punie/0.19
Browse files Browse the repository at this point in the history
Support Elm 0.19
  • Loading branch information
Richard Feldman authored Aug 28, 2018
2 parents ae1c1bf + f6c758c commit b852160
Show file tree
Hide file tree
Showing 11 changed files with 78 additions and 53 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ function findAllDependencies(file, knownDependencies, sourceDirectories, knownFi
}

// Given a source directory (containing top-level Elm modules), locate the
// elm-package.json file that includes it and get all its source directories.
// elm.json file that includes it and get all its source directories.
function getElmPackageSourceDirectories(baseDir, currentDir) {
if (typeof currentDir === "undefined") {
baseDir = path.resolve(baseDir);
currentDir = baseDir;
}

var elmPackagePath = path.join(currentDir, 'elm-package.json');
var elmPackagePath = path.join(currentDir, 'elm.json');
if (fs.existsSync(elmPackagePath)) {
var sourceDirectories = getSourceDirectories(elmPackagePath);
if (_.includes(sourceDirectories, baseDir)) {
Expand Down
10 changes: 5 additions & 5 deletions test/dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,22 @@ describe("#findAllDependencies", function() {
});
});

it("ignores an elm-package.json file that does not list the module's source directory", function() {
it("ignores an elm.json file that does not list the module's source directory", function() {
return findAllDependencies(prependFixturesDir("other-src/OtherParent.elm")).then(function(results) {
expect(results).to.deep.equal(
[ "Test/ChildA.elm" ].map(prependFixturesDir)
);
});
});

it("ignores an elm-package.json file missing the source-directories key", function() {
return findAllDependencies(prependFixturesDir("no-source-directories-elm-package-json/Main.elm")).then(function(results) {
it("ignores an elm.json file missing the source-directories key", function() {
return findAllDependencies(prependFixturesDir("no-source-directories-elm-json/Main.elm")).then(function(results) {
expect(results).to.deep.equal([]);
});
});

it("gracefully ignores malformed elm-package.json files", function() {
return findAllDependencies(prependFixturesDir("malformed-elm-package-json/Main.elm")).then(function(results) {
it("gracefully ignores malformed elm.json files", function() {
return findAllDependencies(prependFixturesDir("malformed-elm-json/Main.elm")).then(function(results) {
expect(results).to.deep.equal([]);
})
});
Expand Down
17 changes: 0 additions & 17 deletions test/fixtures/elm-package.json

This file was deleted.

25 changes: 25 additions & 0 deletions test/fixtures/elm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"type": "application",
"source-directories": [
".",
"other-src"
],
"elm-version": "0.19.0",
"dependencies": {
"direct": {
"elm/browser": "1.0.0",
"elm/core": "1.0.0",
"elm/html": "1.0.0",
"elm/json": "1.0.0"
},
"indirect": {
"elm/time": "1.0.0",
"elm/url": "1.0.0",
"elm/virtual-dom": "1.0.0"
}
},
"test-dependencies": {
"direct": {},
"indirect": {}
}
}
File renamed without changes.
File renamed without changes.
22 changes: 22 additions & 0 deletions test/fixtures/no-source-directories-elm-json/elm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"type": "application",
"source-directories": [],
"elm-version": "0.19.0",
"dependencies": {
"direct": {
"elm/browser": "1.0.0",
"elm/core": "1.0.0",
"elm/html": "1.0.0",
"elm/json": "1.0.0"
},
"indirect": {
"elm/time": "1.0.0",
"elm/url": "1.0.0",
"elm/virtual-dom": "1.0.0"
}
},
"test-dependencies": {
"direct": {},
"indirect": {}
}
}

This file was deleted.

16 changes: 0 additions & 16 deletions test/fixtures/other-src/elm-package.json

This file was deleted.

24 changes: 24 additions & 0 deletions test/fixtures/other-src/elm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"type": "application",
"source-directories": [
"bad-directory-does-not-exist"
],
"elm-version": "0.19.0",
"dependencies": {
"direct": {
"elm/browser": "1.0.0",
"elm/core": "1.0.0",
"elm/html": "1.0.0",
"elm/json": "1.0.0"
},
"indirect": {
"elm/time": "1.0.0",
"elm/url": "1.0.0",
"elm/virtual-dom": "1.0.0"
}
},
"test-dependencies": {
"direct": {},
"indirect": {}
}
}

0 comments on commit b852160

Please sign in to comment.