-
Notifications
You must be signed in to change notification settings - Fork 1
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
Reorganized utilities and handled multiline comments in JSON #10
Conversation
@@ -49,6 +49,7 @@ | |||
"@babel/eslint-parser": "^7.19.1", | |||
"glob": "^8.1.0", | |||
"lodash.template": "^4.5.0", | |||
"strip-json-comments": "^5.0.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove this dependency if we can find another (simple) way to partially update tsconfig.json
.
"concurrently": "<%= context.projectRoot.devDependencies['concurrently'] %>", | ||
"prettier": "<%= context.projectRoot.devDependencies['prettier'] %>" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed a technical risk (hard-coded latest versions).
export function processTemplate(file, data) { | ||
const settings = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I renamed the variables so that the words context
and options
don't carry more than one meaning.
test('utils | blueprints | process-template > escape', function () { | ||
const blueprintFile = '<%- context.htmlCode %>'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the moment, none of the blueprints make use of the escape
feature from lodash.template
.
Description
Refactors
I reorganized the utility functions so that their purpose and relation to one another is more clear. In addition, I wrote unit tests that had been missing.
Bug fix
Prior to this pull request,
sanitizeJson()
didn't remove multiline comments in a JSON file, soJSON.parse()
would have resulted in a runtime error. (This case isn't likely ifember-cli-typescript
had createdtsconfig.json
.)I installed
strip-json-comments
to remove the inline and multiline comments fromtsconfig.json
. In the future, I may look at whether there's an easy way to preserve comments and partially update a JSON.