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

feat(cli): allow local .json files for presets (#1068) #1201

Merged
merged 2 commits into from
May 3, 2018

Conversation

dhensche
Copy link
Contributor

I wasn't sure how to write a test for this (didn't see any for testing the remote preset fetching either), so I didn't write one...

@@ -238,6 +239,8 @@ module.exports = class Creator {
error(`Failed fetching remote preset ${chalk.cyan(name)}:`)
throw e
}
} else if (name.endsWith('.json')) {
preset = await readLocalPreset(this.context, name)
Copy link
Member

Choose a reason for hiding this comment

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

Can directly use fs-extra here so it's just JSON.parse(await fs.readFile()) here, I don't think it's necessary to split into a separate file.

Copy link
Member

Choose a reason for hiding this comment

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

It could even just be preset = await fs.readJson(path.join(this.context, name))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sounds good. I just followed the pattern for reading remote presets, even though it felt like overkill at the time. Will update PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants