Skip to content

Commit

Permalink
feat(importer): ensure the user is aware of any script changes we make
Browse files Browse the repository at this point in the history
  • Loading branch information
MarshallOfSound authored and malept committed Jan 10, 2017
1 parent 272d9b1 commit cbb73e7
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/api/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit cbb73e7

Please sign in to comment.