Skip to content
Permalink
Browse files

feat(importer): ensure the user is aware of any script changes we make

  • Loading branch information
MarshallOfSound authored and malept committed Jan 10, 2017
1 parent 272d9b1 commit cbb73e7ed741f1538185ccf21b69f5a883566f87
Showing with 13 additions and 3 deletions.
  1. +13 −3 src/api/import.js
@@ -111,9 +111,19 @@ export default async (providedOptions = {}) => {
packageJSON.scripts = packageJSON.scripts || {};
d('reading current scripts object:', packageJSON.scripts);

packageJSON.scripts.start = 'electron-forge start';
packageJSON.scripts.package = 'electron-forge package';
packageJSON.scripts.make = 'electron-forge make';
const updatePackageScript = async (scriptName, newValue) => {
if (packageJSON.scripts[scriptName] !== newValue) {
// eslint-disable-next-line max-len
const shouldUpdate = await confirmIfInteractive(interactive, `Do you want us to update the "${scriptName}" script to instead call the electron-forge task "${newValue}"`);
if (shouldUpdate) {
packageJSON.scripts[scriptName] = newValue;
}
}
};

await updatePackageScript('start', 'electron-forge start');
await updatePackageScript('package', 'electron-forge package');
await updatePackageScript('make', 'electron-forge make');

d('forgified scripts object:', packageJSON.scripts);

0 comments on commit cbb73e7

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