const cypress = require('cypress');
const { start } = require('neutrino');
const airbnb = require('@neutrinojs/airbnb-base');
const library = require('@neutrinojs/library');
const imageLoader = require('@neutrinojs/image-loader');
const styleLoader = require('@neutrinojs/style-loader');
const devServer = require('@neutrinojs/dev-server');

module.exports = neutrino => {
  neutrino.use(airbnb, { eslint: {
    rules: {
      'class-methods-use-this': 'off'
    }
  } });
  neutrino.use(library, {
    name: 'ole',
    babel: {
      presets: [
        ['babel-preset-env', {
          targets: {
            browsers: ["last 2 versions", "ie >= 10"]
          }
        }]
      ],
      plugins: [
        'transform-es2015-destructuring',
        'transform-object-assign',
        'transform-object-rest-spread',
      ]
    }
  });
  neutrino.use(imageLoader);
  neutrino.use(styleLoader, { extract: false });
  neutrino.use(devServer);

  // neutrino.config.plugins.delete('babel-minify').end();
  neutrino.config.externals(['jsts', 'ol']);

  neutrino.on('test', () => new Promise((resolve, reject) =>
    start(neutrino.config.toConfig(), neutrino).fork(
      errors => errors.forEach(err => console.error(err)),
      compiler => cypress.run().then(() => resolve()).catch(() => reject())
    )
  ));
};

@@ -387,18 +387,17 @@
 e(airbnb
-, 
+(
 %7B eslint
@@ -460,18 +460,18 @@
    %7D%0A  %7D
- 
 %7D
+)
 );%0A  neu
@@ -487,18 +487,17 @@
 (library
-, 
+(
 %7B%0A    na
@@ -827,16 +827,17 @@
   %7D%0A  %7D)
+)
 ;%0A  neut
@@ -856,16 +856,18 @@
 geLoader
+()
 );%0A  neu
@@ -887,18 +887,17 @@
 leLoader
-, 
+(
 %7B extrac
@@ -907,16 +907,17 @@
 false %7D)
+)
 ;%0A  neut
@@ -934,16 +934,18 @@
 evServer
+()
 );%0A%0A  //

update neutrino.rc