From ca7422e3644232b0bd9393e017f2e1e085053954 Mon Sep 17 00:00:00 2001 From: Kelly Selden Date: Fri, 27 May 2022 11:38:31 -0700 Subject: [PATCH] feat!: remove deprecated `--resolve-conflicts` --- README.md | 2 +- bin/commands/default.js | 14 -------------- bin/commands/init.js | 15 --------------- bin/commands/reset.js | 14 -------------- src/args.js | 5 ----- src/command.js | 13 ------------- src/index.js | 15 +++------------ src/init.js | 13 ++----------- src/reset.js | 6 ++---- test/acceptance/ember-addon-test.js | 3 +-- test/acceptance/ember-cli-update-test.js | 3 +-- 11 files changed, 10 insertions(+), 93 deletions(-) diff --git a/README.md b/README.md index 01cfd6e13..80b1401eb 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ This will update your app or addon to the latest Ember CLI version. It does this This is different from the existing `ember init` command. That command tries to reset your project back to a brand new project. It removes all your changes and additions. -You will probably encounter merge conflicts, in which the default behavior is to let you resolve conflicts on your own. You can supply the `--resolve-conflicts` option to run your system's git merge tool if any conflicts are found. +You will probably encounter merge conflicts, in which the default behavior is to let you resolve conflicts on your own. If any conflicts are found, you can run your system's git merge tool via `git mergetool`. This tool can also run codemods for you. The option `--run-codemods` will figure out what codemods apply to your current version of Ember.js, and download and run them for you. diff --git a/bin/commands/default.js b/bin/commands/default.js index a298de504..df5f5c02b 100644 --- a/bin/commands/default.js +++ b/bin/commands/default.js @@ -32,24 +32,10 @@ module.exports.handler = async function handler(argv) { result = await emberCliUpdate(argv); } - let ps = result.resolveConflictsProcess; - if (ps) { - process.stdin.pipe(ps.stdin); - ps.stdout.pipe(process.stdout); - ps.stderr.pipe(process.stderr); - } - let message = await result.promise; if (message) { console.log(message); } - - // since we are piping, not inheriting, the child process - // doesn't have the power to close its parent - if (ps) { - // eslint-disable-next-line no-process-exit - process.exit(); - } } catch (err) { console.error(err); } diff --git a/bin/commands/init.js b/bin/commands/init.js index 9d0561e5e..878b0c4fb 100644 --- a/bin/commands/init.js +++ b/bin/commands/init.js @@ -10,7 +10,6 @@ module.exports.describe = 'initialize a blueprint'; module.exports.builder = { blueprint: args['blueprint'], to: args['to'], - resolveConflicts: args['resolve-conflicts'], outputRepo: args['output-repo'], codemodsSource: args['codemods-source'] }; @@ -22,24 +21,10 @@ module.exports.handler = async function handler(argv) { blueprintOptions: argv._.slice(1) }); - let ps = result.resolveConflictsProcess; - if (ps) { - process.stdin.pipe(ps.stdin); - ps.stdout.pipe(process.stdout); - ps.stderr.pipe(process.stderr); - } - let message = await result.promise; if (message) { console.log(message); } - - // since we are piping, not inheriting, the child process - // doesn't have the power to close its parent - if (ps) { - // eslint-disable-next-line no-process-exit - process.exit(); - } } catch (err) { console.error(err); } diff --git a/bin/commands/reset.js b/bin/commands/reset.js index 1e8f387dd..a5f0f3b02 100644 --- a/bin/commands/reset.js +++ b/bin/commands/reset.js @@ -17,24 +17,10 @@ module.exports.handler = async function handler(argv) { try { let result = await reset(argv); - let ps = result.resolveConflictsProcess; - if (ps) { - process.stdin.pipe(ps.stdin); - ps.stdout.pipe(process.stdout); - ps.stderr.pipe(process.stderr); - } - let message = await result.promise; if (message) { console.log(message); } - - // since we are piping, not inheriting, the child process - // doesn't have the power to close its parent - if (ps) { - // eslint-disable-next-line no-process-exit - process.exit(); - } } catch (err) { console.error(err); } diff --git a/src/args.js b/src/args.js index 702382f5b..a8a8c1aa2 100644 --- a/src/args.js +++ b/src/args.js @@ -19,11 +19,6 @@ module.exports = { type: 'string', description: 'Update to a version that isn\'t latest ("2.14.1", "~2.15", "latest", "beta")' }, - 'resolve-conflicts': { - type: 'boolean', - default: false, - description: 'Automatically run git mergetool if conflicts found' - }, 'run-codemods': { type: 'boolean', default: false, diff --git a/src/command.js b/src/command.js index 7c8610f08..fd65c889a 100644 --- a/src/command.js +++ b/src/command.js @@ -36,12 +36,6 @@ module.exports = { type: String, default: args['to'].default }, - { - name: 'resolve-conflicts', - description: args['resolve-conflicts'].description, - type: Boolean, - default: args['resolve-conflicts'].default - }, { name: 'run-codemods', description: args['run-codemods'].description, @@ -105,13 +99,6 @@ module.exports = { result = await emberCliUpdate(options); } - let ps = result.resolveConflictsProcess; - if (ps) { - process.stdin.pipe(ps.stdin); - ps.stdout.pipe(process.stdout); - ps.stderr.pipe(process.stderr); - } - await result.promise; } }; diff --git a/src/index.js b/src/index.js index b1bf1dceb..7c74369a3 100644 --- a/src/index.js +++ b/src/index.js @@ -60,8 +60,7 @@ module.exports = async function emberCliUpdate({ packageName, blueprint: _blueprint, from, - to, - resolveConflicts + to } = {}) { // A custom config location in package.json may be reset/init away, // so we can no longer look it up on the fly after the run. @@ -177,16 +176,10 @@ module.exports = async function emberCliUpdate({ to = defaultTo; } - if (resolveConflicts) { - // eslint-disable-next-line no-console - console.warn('`--resolve-conflicts` is deprecated. Please run `git mergetool` manually.'); - } - let endBlueprint; let { - promise, - resolveConflictsProcess + promise } = await boilerplateUpdate({ cwd, projectOptions: ({ packageJson }) => getProjectOptions(packageJson, blueprint), @@ -223,7 +216,6 @@ module.exports = async function emberCliUpdate({ customDiffOptions }; }, - resolveConflicts, createCustomDiff: true, ignoredFiles: [await getBlueprintRelativeFilePath(cwd)] }); @@ -243,7 +235,6 @@ module.exports = async function emberCliUpdate({ }); return result; - })(), - resolveConflictsProcess + })() }; }; diff --git a/src/init.js b/src/init.js index 83266c523..d1e6c5817 100644 --- a/src/init.js +++ b/src/init.js @@ -22,7 +22,6 @@ module.exports = async function init({ packageName, blueprint: _blueprint, to = defaultTo, - resolveConflicts, outputRepo, codemodsSource, blueprintOptions = [] @@ -127,18 +126,11 @@ module.exports = async function init({ init = true; } - if (resolveConflicts) { - // eslint-disable-next-line no-console - console.warn('`--resolve-conflicts` is deprecated. Please run `git mergetool` manually.'); - } - let { - promise, - resolveConflictsProcess + promise } = await boilerplateUpdate({ cwd, endVersion: blueprint.version, - resolveConflicts, init, createCustomDiff: true, customDiffOptions: ({ @@ -168,7 +160,6 @@ module.exports = async function init({ } return result; - })(), - resolveConflictsProcess + })() }; }; diff --git a/src/reset.js b/src/reset.js index e8c7504f6..901e8a750 100644 --- a/src/reset.js +++ b/src/reset.js @@ -88,8 +88,7 @@ module.exports = async function reset({ } let { - promise, - resolveConflictsProcess + promise } = await boilerplateUpdate({ cwd, endVersion: blueprint.version, @@ -115,8 +114,7 @@ module.exports = async function reset({ }); return result; - })(), - resolveConflictsProcess + })() }; } catch (err) { return { promise: Promise.reject(err) }; diff --git a/test/acceptance/ember-addon-test.js b/test/acceptance/ember-addon-test.js index 0081bbbd9..031fa6116 100644 --- a/test/acceptance/ember-addon-test.js +++ b/test/acceptance/ember-addon-test.js @@ -39,8 +39,7 @@ describe(function() { bin: 'ember', args: [ 'update', - `--to=${to}`, - '--resolve-conflicts' + `--to=${to}` ], cwd: tmpPath, commitMessage, diff --git a/test/acceptance/ember-cli-update-test.js b/test/acceptance/ember-cli-update-test.js index 6e0e31c7c..8ed7146a7 100644 --- a/test/acceptance/ember-cli-update-test.js +++ b/test/acceptance/ember-cli-update-test.js @@ -55,8 +55,7 @@ describe(function() { await beforeMerge(); let args = [ - ...to ? [`--to=${to}`] : [], - '--resolve-conflicts' + ...to ? [`--to=${to}`] : [] ]; if (listCodemods || runCodemods) { args = [