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

[First Step] implement transform function for .babelrc.js #43

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

hiroppy
Copy link
Member

@hiroppy hiroppy commented Feb 28, 2018

This is the first step for replacing .babelrc.js:)

Currently, it is possible to replace arrays without nests.
Next, we have to deal with the following

  presets: [['babel-preset-env', {
    "browsers": ["last 2 versions", "safari >= 7"]
  }]]

@hiroppy hiroppy added the enhancement New feature or request label Feb 28, 2018
- rename paths to babelRC
- create `writeBabelRCJS` for overwriting `.babelrc.js`
@@ -118,6 +119,17 @@ async function writeBabelRC(configPath, options) {
}
}

async function writeBabelRCJS(configPath) {
try {
const rawFile = (await pify(fs.readFile)(configPath)).toString('utf8');
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any advantage to doing fs.readFile over fs.readFileSync ?

Copy link
Member

Choose a reason for hiding this comment

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

The only advantage i can see is that it lets the event loop continue during the i/o rather than blocking it.

@@ -0,0 +1,31 @@
const jscodeshift = require('jscodeshift');
Copy link
Member

Choose a reason for hiding this comment

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

this is fine but I had wanted to use https://github.com/square/babel-codemod for this.

@hzoo
Copy link
Member

hzoo commented Feb 28, 2018

Nice start!

However I don't think replacing .babelrc.js is much of a priority for us (at least for Babel v7, it will be plenty useful in the future). You can only use that file in v7 alpha so this would only be useful for people changing from alpha to beta, and most people will be upgrading their .babelrc

@hiroppy
Copy link
Member Author

hiroppy commented Feb 28, 2018

@hzoo That’s true. I agree with you:) Ok, we'll merge only this PR and let's do another task:smile:

@hiroppy
Copy link
Member Author

hiroppy commented Mar 7, 2018

probably related #49

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

Successfully merging this pull request may close these issues.

4 participants