From 44434fba5d78456b42e579482a9b3ac6915634be Mon Sep 17 00:00:00 2001 From: Sebastien Colladon Date: Fri, 25 Feb 2022 15:17:04 +0100 Subject: [PATCH 1/2] refactor: decommissionate sgd --- README.md | 2 +- __tests__/integration/cli.test.js | 16 --------- bin/cli | 59 ------------------------------- package.json | 3 -- 4 files changed, 1 insertion(+), 79 deletions(-) delete mode 100644 __tests__/integration/cli.test.js delete mode 100644 bin/cli diff --git a/README.md b/README.md index d415333f..0da2419e 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ Because this plugin is not signed, you will get a warning saying that "This plug If you run your CI/CD jobs inside a Docker image, you can add the plugin to your image. Here is an example of a Dockerfile including the SGD plugin: https://github.com/mehdisfdc/sfdx-cli-gitlab -⚠️ The Salesforce CLI plugin is now the only supported way to install SGD. There used to be another way to install it directly through yarn or npm. The legacy `sgd` command is now deprecated and will be decommissioned soon. +⚠️ The Salesforce CLI plugin is now the only supported way to install SGD. There used to be another way to install it directly through yarn or npm. The legacy `sgd` command is now deprecated and decommissioned. ### Prerequisites diff --git a/__tests__/integration/cli.test.js b/__tests__/integration/cli.test.js deleted file mode 100644 index f731f746..00000000 --- a/__tests__/integration/cli.test.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict' -const path = require('path') -const cp = require('child_process') -const gc = require('../../src/utils/gitConstants') - -const cli = (args, cwd) => { - return cp.execSync(`node ${path.normalize('./bin/cli')} ${args.join(' ')}`, { - cwd, - encoding: gc.UTF8_ENCODING, - }) -} - -test('cli-help', () => { - const result = cli(['-h'], '.') - expect(result).toBeDefined() -}) diff --git a/bin/cli b/bin/cli deleted file mode 100644 index afb4da59..00000000 --- a/bin/cli +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env node -'use strict' - -const program = require('commander') -const orchestrator = require('../lib/main') -const messages = require('../messages/delta') -const pjson = require('../package.json') -const CliHelper = require('../lib/utils/cliHelper') - -const options = program - .description(messages.command) - .version(pjson.version) - .option('-t, --to [sha]', messages.toFlag, CliHelper.TO_DEFAULT_VALUE) - .option('-f, --from [sha]', messages.fromFlag) - .option( - '-o, --output [dir]', - messages.outputFlag, - CliHelper.OUTPUT_DEFAULT_VALUE - ) - .option( - '-s, --source [dir]', - messages.sourceFlag, - CliHelper.SOURCE_DEFAULT_VALUE - ) - .option('-W, --ignore-whitespace', messages.ignoreWhitespaceFlag) - .option('-i, --ignore [file]', messages.ignoreFlag) - .option('-D, --ignore-destructive [file]', messages.ignoreDestructiveFlag) - .option( - '-a, --api-version [version]', - messages.apiVersionFlag, - pjson.sfdc.latestApiVersion - ) - .option('-r, --repo [dir]', messages.repoFlag, CliHelper.REPO_DEFAULT_VALUE) - .option('-d, --generate-delta', messages.deltaFlag) - .option('-n, --include', messages.includeFlag) - .option('-N, --include-destructive', messages.includeDestructiveFlag) - .parse(process.argv) - .opts() - -options.ignore = - options.ignore === true ? CliHelper.IGNORE_DEFAULT_VALUE : options.ignore - -const output = { - error: null, - output: options.output, - success: true, - warnings: [], -} -;(async () => { - try { - const jobResult = await orchestrator(options) - output.warnings = jobResult?.warnings?.map(warning => warning.message) - } catch (err) { - output.success = false - output.error = err.message - process.exitCode = 1 - } - console.log(JSON.stringify(output, null, 2)) -})() diff --git a/package.json b/package.json index fc98974b..593e4f67 100644 --- a/package.json +++ b/package.json @@ -20,9 +20,6 @@ "/oclif.manifest.json" ], "main": "lib/main.js", - "bin": { - "sgd": "./bin/cli" - }, "repository": { "type": "git", "url": "git+https://github.com/scolladon/sfdx-git-delta.git" From a803b6169b702bd0df7b0e0741e03310873ea35d Mon Sep 17 00:00:00 2001 From: Sebastien Colladon Date: Sat, 19 Feb 2022 00:43:40 +0100 Subject: [PATCH 2/2] fix: remove commander dependency --- README.md | 1 - package.json | 1 - yarn.lock | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 0da2419e..ea3bc176 100644 --- a/README.md +++ b/README.md @@ -393,7 +393,6 @@ console.log(JSON.stringify(work)) ## Built With -- [commander](https://github.com/tj/commander.js/) - The complete solution for node.js command-line interfaces, inspired by Ruby's commander. - [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) - Validate XML, Parse XML to JS/JSON and vise versa, or parse XML to Nimn rapidly without C/C++ based libraries and no callback - [fs-extra](https://github.com/jprichardson/node-fs-extra) - Node.js: extra methods for the fs object like copy(), remove(), mkdirs(). - [ignore](https://github.com/kaelzhang/node-ignore#readme) - is a manager, filter and parser which implemented in pure JavaScript according to the .gitignore spec 2.22.1. diff --git a/package.json b/package.json index 593e4f67..fe1c64c2 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,6 @@ "@oclif/errors": "^1.3.5", "@salesforce/command": "^4.1.3", "@salesforce/core": "^2.28.1", - "commander": "^8.2.0", "fast-xml-parser": "^4", "fs-extra": "^10.0.0", "ignore": "^5.1.8", diff --git a/yarn.lock b/yarn.lock index 003936ce..a7ca36cf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2199,7 +2199,7 @@ commander@^2.9.0: resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== -commander@^8.2.0, commander@^8.3.0: +commander@^8.3.0: version "8.3.0" resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66" integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==