-
-
Notifications
You must be signed in to change notification settings - Fork 54
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
base: master
Are you sure you want to change the base?
Conversation
- rename paths to babelRC - create `writeBabelRCJS` for overwriting `.babelrc.js`
8b46edf
to
c1d0001
Compare
c1d0001
to
2896706
Compare
@@ -118,6 +119,17 @@ async function writeBabelRC(configPath, options) { | |||
} | |||
} | |||
|
|||
async function writeBabelRCJS(configPath) { | |||
try { | |||
const rawFile = (await pify(fs.readFile)(configPath)).toString('utf8'); |
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.
Is there any advantage to doing fs.readFile
over fs.readFileSync
?
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.
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'); |
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.
this is fine but I had wanted to use https://github.com/square/babel-codemod for this.
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 |
@hzoo That’s true. I agree with you:) Ok, we'll merge only this PR and let's do another task:smile: |
probably related #49 |
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