Skip to content

Commit

Permalink
fix(cli): use appName as package.json name on electron project (#2741)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike S authored Apr 10, 2020
1 parent 4c13fe0 commit d6fc2d8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cli/src/electron/add.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import { exec } from 'child_process';
import { Config } from '../config';
import { copyTemplate, hasYarn, installDeps, runTask } from '../common';
import { writeFileSync } from '../util/fs';
import { join } from 'path';

export async function addElectron(config: Config) {

await runTask(`Adding Electron project in: ${config.electron.platformDir}`, async () => {
return copyTemplate(config.electron.assets.templateDir, config.electron.platformDir);
const copyReturn = await copyTemplate(config.electron.assets.templateDir, config.electron.platformDir);
const capConfigName = require(join(config.app.rootDir, 'capacitor.config.json')).appName;
const packageJSONParse = require(join(config.electron.platformDir, 'package.json'));
packageJSONParse.name = capConfigName;
writeFileSync(join(config.electron.platformDir, 'package.json'), JSON.stringify(packageJSONParse));
return copyReturn;
});

await runTask(`Installing NPM Dependencies`, async () => {
Expand Down

0 comments on commit d6fc2d8

Please sign in to comment.