From 364993bfcdaaa28e0913c37100eceb30cf05a49a Mon Sep 17 00:00:00 2001 From: Jia Hao Date: Tue, 19 Jan 2016 21:19:09 +0800 Subject: [PATCH] Make app `package.json` name to be kebab cased for robustness --- package.json | 1 + src/buildApp.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 79996a1..aabcab0 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "cheerio": "^0.19.0", "commander": "^2.9.0", "electron-packager": "^5.2.1", + "lodash": "^4.0.0", "ncp": "^2.0.0", "request": "^2.67.0", "tmp": "0.0.28", diff --git a/src/buildApp.js b/src/buildApp.js index 47dbffe..e2e1712 100644 --- a/src/buildApp.js +++ b/src/buildApp.js @@ -5,6 +5,7 @@ import packager from 'electron-packager'; import tmp from 'tmp'; import ncp from 'ncp'; import async from 'async'; +import _ from 'lodash'; const copy = ncp.ncp; @@ -85,7 +86,7 @@ function copyPlaceholderApp(srcAppDir, tempDir, name, targetURL, badge, width, h // change name of packageJson so that temporary files will not be shared across different app instances const packageJsonPath = path.join(tempDir, '/package.json'); const packageJson = JSON.parse(fs.readFileSync(packageJsonPath)); - packageJson.name = appArgs.name + '-nativefier'; + packageJson.name = _.kebabCase(appArgs.name + '-nativefier'); fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson)); callback(null, tempDir);