Skip to content

Commit

Permalink
fix(initializer): set electron version to be float in init step
Browse files Browse the repository at this point in the history
  • Loading branch information
MarshallOfSound committed Apr 2, 2017
1 parent 5aaf871 commit 710129b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/init/init-npm.js
Expand Up @@ -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');
Expand Down
5 changes: 5 additions & 0 deletions test/slow/api_spec_slow.js
Expand Up @@ -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 }));
});
Expand Down

0 comments on commit 710129b

Please sign in to comment.