Skip to content

Commit

Permalink
Adjusted package version and replaced helper function.
Browse files Browse the repository at this point in the history
  • Loading branch information
benthepoet authored and devongovett committed Sep 24, 2018
1 parent 100ffda commit a588ea8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 26 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"codecov": "^3.0.0",
"coffeescript": "^2.0.3",
"cross-env": "^5.1.1",
"elm": "^0.19.0-bugfix2",
"elm": "^0.19.0",
"eslint": "^4.13.0",
"find-elm-dependencies": "^2.0.0",
"glslify-bundle": "^5.0.0",
Expand Down
27 changes: 2 additions & 25 deletions src/assets/ElmAsset.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
const path = require('path');
const process = require('process');
const Asset = require('../Asset');
const fs = require('../utils/fs');
const localRequire = require('../utils/localRequire');
const {minify} = require('terser');

Expand All @@ -17,34 +15,13 @@ class ElmAsset extends Asset {
'find-elm-dependencies',
this.name
);
const dependencies = await findAllDependencies(this.name);
const packageFile = await findPackageFile(path.dirname(this.name));

if (packageFile) {
dependencies.push(packageFile);
}
await this.getConfig(['elm.json'], {load: false});
const dependencies = await findAllDependencies(this.name);

dependencies.forEach(dependency => {
this.addDependency(dependency, {includedInParent: true});
});

// Recursively search for a package file
async function findPackageFile(baseDir) {
const parsedPath = path.parse(baseDir);
const elmPackagePath = path.join(parsedPath.dir, 'elm.json');

if (await fs.exists(elmPackagePath)) {
return elmPackagePath;
}

// Stop if we've reached the file system root
if (parsedPath.root === parsedPath.dir) {
return undefined;
}

// Continue searching
return await findPackageFile(path.dirname(baseDir));
}
}

async parse() {
Expand Down

0 comments on commit a588ea8

Please sign in to comment.