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

Remove prettier as a dependency #1261

Closed
nicojs opened this issue Nov 30, 2018 · 2 comments · Fixed by #1552
Closed

Remove prettier as a dependency #1261

nicojs opened this issue Nov 30, 2018 · 2 comments · Fixed by #1552
Assignees
Labels
🚀 Feature request New feature request 👶 Good first issue Good for newcomers
Milestone

Comments

@nicojs
Copy link
Member

nicojs commented Nov 30, 2018

We now use prettier as a dependency of Stryker. The only reason it is there is to format the js file after stryker init. This is madness. Every release of prettier results in a larger package, as they support more and more languages. This fine for their use case, namely to be used as a dev-tool. This is not fine for production usage.

However, I don't want to drop support for code formatting all together, as it is unprofessional (and an eye sour) to look at raw JSON in a *.js file.

Possible: solutions

  1. Support stryker.conf.json (next to stryker.conf.js). If we support a json file, we can just use JSON.stringify(config, null, 2). The problem with that approach is that JSON doesn't support comments. We could register a json parser that does support it. Needs more investigation.
  2. Create a very simple version of JSON.stringify that outputs respectable JavaScript, or find an NPM package that does exactly that.
@nicojs nicojs added 🚀 Feature request New feature request 👶 Good first issue Good for newcomers labels Nov 30, 2018
@bartekleon
Copy link
Member

can't it be done using some configurations? I think you can force people via some linter / vsconfig etc. And typescript also should have some option to make indent 2 etc.

@nicojs
Copy link
Member Author

nicojs commented Dec 22, 2018

@kmdrGroch I don't know exactly what you're talking about here. We don't have a Linter or parser in our core Stryker package and it should have one.

I actually thought of a simple solution. We can just call npx prettier --write stryker.conf.js. if the user has prettier installed, it will use that version, if not it will download, run and remove it again. It will even use the custom prettier configuration of the user (if exists).

@stryker-mutator/contributors what do you think of that approach. Pretty straightforward I think...

@simondel simondel mentioned this issue Apr 18, 2019
9 tasks
@simondel simondel added this to the 2.0 release milestone May 16, 2019
nicojs added a commit that referenced this issue May 17, 2019
After `stryker init` was succesful, run prettier from the command line using `npx prettier --write stryker.conf.js` in order to format the resulting configuration file, rather than having prettier as a dependency directly.
Prettier became pretty expensive, sitting at 1.2 MB.

Fixes #1261
nicojs added a commit that referenced this issue May 17, 2019
After `stryker init` was succesful, run prettier from the command line using `npx prettier --write stryker.conf.js` in order to format the resulting configuration file, rather than having prettier as a dependency directly.
Prettier became pretty expensive, sitting at 1.2 MB.

Fixes #1261
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚀 Feature request New feature request 👶 Good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants