Skip to content

Commit

Permalink
fix(add): apply suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
rishabh3112 committed Mar 26, 2019
1 parent 2299848 commit ccf0dce
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/generators/add-generator.ts
Expand Up @@ -116,7 +116,7 @@ export default class AddGenerator extends Generator {
.then((mergeFileAnswer: {
mergeFile: string;
}) => {
const resolvedPath = resolve(process.env.PWD, mergeFileAnswer.mergeFile);
const resolvedPath = resolve(process.cwd(), mergeFileAnswer.mergeFile);
const mergeConfig = require(resolvedPath);
this.configuration.config.merge = mergeConfig;
});
Expand Down
5 changes: 2 additions & 3 deletions packages/utils/generators/add/questions/index.ts
Expand Up @@ -45,16 +45,15 @@ export const topScopeQuestion = Input(
const mergeFileQuestionFunction = () => {
const question = "What is the location of webpack configuration with which you want to merge current configuration?";
const validator = (path: string) => {
const resolvedPath = resolve(process.env.PWD, path);
const resolvedPath = resolve(process.cwd(), path);
if (existsSync(resolvedPath)) {
if (/\.js$/.test(path)) {
if (typeof require(resolvedPath) !== "object") {
return "Given file doesn't export an Object";
}
return true;
} else {
return "Path doesn't corresponds to a javascript file";
}
return "Path doesn't corresponds to a javascript file";
}
return "Invalid path provided";
};
Expand Down

0 comments on commit ccf0dce

Please sign in to comment.