Skip to content

Commit

Permalink
fixed spread issue in pathsExistProm
Browse files Browse the repository at this point in the history
  • Loading branch information
alechp committed Jul 10, 2019
1 parent 8b84400 commit c115e02
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
26 changes: 17 additions & 9 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,27 @@ import path from "path";
import { getWatcherConfig } from "./parser";
import { initWatcher } from "./watcher";
import { printLine, printMirror } from "tacker";
import { pathsExistProm } from "./utilities";

export function init(cwd = process.env.configRootDir || process.cwd()) {
let protatoPath = path.join(cwd, ".protato.js");
let { config } = require(protatoPath);
pathsExistProm([protatoPath], ".protato.js config not found")
.then(resp => {
printMirror({ resp }, "magenta", "grey");
let { config } = require(protatoPath);

printLine("blue");
printMirror({ protatoPath }, "blue", "grey");
printMirror({ config }, "blue", "grey");
printLine("blue");
printLine("blue");
printMirror({ protatoPath }, "blue", "grey");
printMirror({ config }, "blue", "grey");
printLine("blue");

let oWC = getWatcherConfig(config);
let hWatcher = initWatcher(oWC);
hWatcher.getDirectories();
let oWC = getWatcherConfig(config);
let hWatcher = initWatcher(oWC);
hWatcher.getDirectories();
})
.catch(err => {
log(`init failed\n ${err}`);
});
}

// init();
init();
3 changes: 2 additions & 1 deletion src/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ export function pathsExistProm(arrPathsObj, szPreErrorMessage) {
arrPathsObj.map(async pathToCheck => {
await fs.access(pathToCheck);
});
resolve([true, ...arrPathsObj]);
} else {
await fs.access(arrPathsObj);
resolve([true, arrPathsObj]);
}
resolve([true, ...arrPathsObj]);
} catch (err) {
reject(`${chalk.red(szPreErrorMessage)}: \n ${chalk.grey(err)}`);
}
Expand Down

0 comments on commit c115e02

Please sign in to comment.