Skip to content
Browse files

feat(importer): move babel config in existing project to .compilerc

  • Loading branch information
MarshallOfSound authored and malept committed Dec 13, 2016
1 parent fbf691c commit b09fc3d6427360b1c92832e47bdc848094f97a4e
Showing with 30 additions and 0 deletions.
  1. +30 −0 src/electron-forge-import.js
@@ -147,6 +147,36 @@ const main = async () => {

let babelConfig = packageJSON.babel;
const babelPath = path.resolve(dir, '.babelrc');
if (!babelConfig && await fs.exists(babelPath)) {
babelConfig = JSON.parse(await fs.readFile(babelPath, 'utf8'));

if (babelConfig) {
const babelSpinner = ora.ora('Porting original babel config').start();

let compileConfig = {};
const compilePath = path.resolve(dir, '.compilerc');
if (await fs.exists(compilePath)) {
compileConfig = JSON.parse(await fs.readFile(compilePath, 'utf8'));

await fs.writeFile(compilePath, JSON.stringify(Object.assign(compileConfig, {
'application/javascript': babelConfig,
}, null, 2)));

babelSpinner.succeed();'NOTE: You might be able to remove your `.compilerc` file completely if you are only using the `es2015` and `react` presets'.yellow);
/* eslint-disable prefer-template */'\n\nWe have ATTEMPTED to convert your app to be in a format that electron-forge understands.\nNothing much will have changed but we added the' +
' "electron-prebuilt-compile" '.cyan +
'dependency. This is the dependency you must version bump to get newer versions of Electron.\n\n' +
'We also tried to import any build tooling you already had but we can\'t get everything. You might need to convert any CLI/gulp/grunt tasks yourself.\n\n' +
'Also please note if you are using `preload` scripts you need to follow the steps outlined at\'preload\'-scripts\n\n' +
'Thanks for using ' + 'electron-forge'.green + '!!!');


0 comments on commit b09fc3d

Please sign in to comment.
You can’t perform that action at this time.