Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli(entry): quotes sanitization #337

Merged
merged 7 commits into from
Apr 17, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
cli(entry): multiple entries quotes sanitization
  • Loading branch information
dhruvdutt committed Apr 15, 2018
commit da851a08f744d1684a43f3ec463263ebae535241
4 changes: 2 additions & 2 deletions lib/generators/utils/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module.exports = (self, answer) => {
!n[val].includes("path") &&
!n[val].includes("process")
) {
n[val] = `"'${n[val]}.js'"`;
n[val] = `\'${n[val].replace(/"|'/g,"").concat(".js")}\'`;
}
webpackEntryPoint[val] = n[val];
});
Expand Down Expand Up @@ -68,7 +68,7 @@ module.exports = (self, answer) => {
!entryPropAnswer[val].includes("path") &&
!entryPropAnswer[val].includes("process")
) {
entryPropAnswer[val] = `"'${entryPropAnswer[val]}.js'"`;
entryPropAnswer[val] = `\'${entryPropAnswer[val].replace(/"|'/g,"").concat(".js")}\'`;
Copy link
Member Author

@dhruvdutt dhruvdutt Mar 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The quote sanitization won't affect function as entries as we have a check for it.

if (
propAns[val].charAt(0) !== "(" &&
propAns[val].charAt(0) !== "[" &&
propAns[val].indexOf("function") < 0 &&
propAns[val].indexOf("path") < 0 &&
propAns[val].indexOf("process") < 0
) {
propAns[val] = `"${propAns[val]}.js"`;
}

}
webpackEntryPoint[val] = entryPropAnswer[val];
});
Expand Down