Skip to content
Permalink
Browse files

fix(initializer): set electron version to be float in init step

  • Loading branch information
MarshallOfSound committed Apr 2, 2017
1 parent 5aaf871 commit 710129b75f3d66140849239faa21ca791677d8e2
Showing with 8 additions and 1 deletion.
  1. +3 −1 src/init/init-npm.js
  2. +5 −0 test/slow/api_spec_slow.js
@@ -73,7 +73,9 @@ export default async (dir, lintStyle) => {

for (const profile of ['development', 'production']) {
const envTarget = content.env[profile]['application/javascript'].presets.find(x => x[0] === 'env');
envTarget[1].targets.electron = electronPrebuilt.version;
// parseFloat strips the patch version
// parseFloat('1.3.2') === 1.3
envTarget[1].targets.electron = parseFloat(electronPrebuilt.version);
}

await fs.writeFile(path.join(dir, '.compilerc'), JSON.stringify(content, null, 2), 'utf8');
@@ -45,6 +45,11 @@ describe(`electron-forge API (with installer=${installer.substr(12)})`, () => {
expect(await fs.exists(path.resolve(dir, 'node_modules/babel-core')), 'babel-core should exist').to.equal(true);
});

it('should have set the .compilerc electron version to be a float', async () => {
const compilerc = JSON.parse(await fs.readFile(path.resolve(dir, '.compilerc')));
expect(compilerc.env.development['application/javascript'].presets[0][1].targets.electron).to.be.a('number');
});

describe('lint', () => {
it('should initially pass the linting process', () => forge.lint({ dir }));
});

0 comments on commit 710129b

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