mirror of https://github.com/embarklabs/embark.git
refactor findImports
This commit is contained in:
parent
db61e355c1
commit
e0ab9cbde4
|
@ -4,15 +4,13 @@ let fs = require('fs-extra');
|
||||||
let path = require('path');
|
let path = require('path');
|
||||||
|
|
||||||
function findImports(filename) {
|
function findImports(filename) {
|
||||||
console.dir(filename);
|
if (fs.existsSync(filename)) {
|
||||||
if (!fs.existsSync(filename)) {
|
return {contents: fs.readFileSync(filename).toString()};
|
||||||
if (fs.existsSync(path.join('./node_modules/', filename))) {
|
|
||||||
return {contents: fs.readFileSync(path.join('./node_modules/', filename)).toString()};
|
|
||||||
} else {
|
|
||||||
return {error: 'File not found'};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return {contents: fs.readFileSync(filename).toString()};
|
if (fs.existsSync(path.join('./node_modules/', filename))) {
|
||||||
|
return {contents: fs.readFileSync(path.join('./node_modules/', filename)).toString()};
|
||||||
|
}
|
||||||
|
return {error: 'File not found'};
|
||||||
}
|
}
|
||||||
|
|
||||||
process.on('message', function (msg) {
|
process.on('message', function (msg) {
|
||||||
|
|
Loading…
Reference in New Issue