From 3bcf0a7000c1bc0c72053f30795a7a5808dc3200 Mon Sep 17 00:00:00 2001 From: Matheus Marchini Date: Fri, 26 Jun 2020 20:37:25 -0700 Subject: [PATCH] land: optional deprecations update node-core-utils is also used on other repositories across the Node.js Org where deprecations are not logged into a file. Making it opt-out allows node-core-utils to still be used on those repositories. --- lib/landing_session.js | 25 ++++++++++++++----------- lib/session.js | 5 +++++ 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/lib/landing_session.js b/lib/landing_session.js index 0b7e191b..3ea1e9a4 100644 --- a/lib/landing_session.js +++ b/lib/landing_session.js @@ -88,17 +88,20 @@ class LandingSession extends Session { } // Check for and maybe assign any unmarked deprecations in the codebase. - const unmarkedDeprecations = await getUnmarkedDeprecations(); - const unmarkedDepCount = unmarkedDeprecations.length; - if (unmarkedDepCount > 0) { - cli.startSpinner('Assigning deprecation numbers to DEPOXXX items'); - - // Update items then stage files and amend the last commit. - await updateDeprecations(unmarkedDeprecations); - await runAsync('git', ['add', 'doc', 'lib', 'src', 'test']); - await runAsync('git', ['commit', '--amend', '--no-edit']); - - cli.stopSpinner(`Updated ${unmarkedDepCount} DEPOXXX items in codebase`); + if (this.updateDeprecations !== 'yes') { + const unmarkedDeprecations = await getUnmarkedDeprecations(); + const unmarkedDepCount = unmarkedDeprecations.length; + if (unmarkedDepCount > 0) { + cli.startSpinner('Assigning deprecation numbers to DEPOXXX items'); + + // Update items then stage files and amend the last commit. + await updateDeprecations(unmarkedDeprecations); + await runAsync('git', ['add', 'doc', 'lib', 'src', 'test']); + await runAsync('git', ['commit', '--amend', '--no-edit']); + + cli + .stopSpinner(`Updated ${unmarkedDepCount} DEPOXXX items in codebase`); + } } cli.ok('Patches applied'); diff --git a/lib/session.js b/lib/session.js index 4e107d84..4db0e3d9 100644 --- a/lib/session.js +++ b/lib/session.js @@ -60,6 +60,7 @@ class Session { readme: this.readme, waitTimeSingleApproval: this.waitTimeSingleApproval, waitTimeMultiApproval: this.waitTimeMultiApproval, + updateDeprecations: this.updateDeprecations, ciType: this.ciType, prid: this.prid }; @@ -109,6 +110,10 @@ class Session { return path.join(this.ncuDir, `${this.prid}`); } + get updateDeprecations() { + return this.config.updateDeprecations || 'yes'; + } + startLanding() { writeJson(this.sessionPath, { state: STARTED,