From d6fc2d8da6208aa9fb12d45ec2364382d815a8ef Mon Sep 17 00:00:00 2001 From: Mike S <13892112+Mike-Summ@users.noreply.github.com> Date: Fri, 10 Apr 2020 13:25:22 -0400 Subject: [PATCH] fix(cli): use appName as package.json name on electron project (#2741) --- cli/src/electron/add.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cli/src/electron/add.ts b/cli/src/electron/add.ts index 5a5e67a2b3..2c0a68832c 100644 --- a/cli/src/electron/add.ts +++ b/cli/src/electron/add.ts @@ -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 () => {