Skip to content

Commit

Permalink
feat(importer): allow the implementer to decide whether to override s…
Browse files Browse the repository at this point in the history
…cripts or not

Fixes #112
  • Loading branch information
MarshallOfSound authored and malept committed Feb 1, 2017
1 parent c8b12fb commit f85e194
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/api/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const d = debug('electron-forge:import');
* @typedef {Object} ImportOptions
* @property {string} [dir=process.cwd()] The path to the app to be imported
* @property {boolean} [interactive=false] Whether to use sensible defaults or prompt the user visually
* @property {boolean} [updateScripts=true] Whether to update the modules package.json scripts to be electron-forge commands
*/

/**
Expand All @@ -31,9 +32,10 @@ const d = debug('electron-forge:import');
* @return {Promise} Will resolve when the import process is complete
*/
export default async (providedOptions = {}) => {
const { dir, interactive } = Object.assign({
const { dir, interactive, updateScripts } = Object.assign({
dir: process.cwd(),
interactive: false,
updateScripts: true,
}, providedOptions);
asyncOra.interactive = interactive;

Expand Down Expand Up @@ -98,7 +100,7 @@ export default async (providedOptions = {}) => {
} else if (buildToolPackages[key]) {
const explanation = buildToolPackages[key];
// eslint-disable-next-line max-len
const shouldRemoveDependency = await confirmIfInteractive(interactive, `Do you want us to remove the "${key}" dependency in package.json? Electron Forge ${explanation}.`);
const shouldRemoveDependency = await confirmIfInteractive(interactive, `Do you want us to remove the "${key}" dependency in package.json? Electron Forge ${explanation}.`, updateScripts);

if (shouldRemoveDependency) {
delete packageJSON.dependencies[key];
Expand Down

0 comments on commit f85e194

Please sign in to comment.