From 6edeaa94b0e217779ffa73a5b82059e1b7398b7c Mon Sep 17 00:00:00 2001 From: Brian Goad Date: Thu, 18 Nov 2021 13:45:29 -0500 Subject: [PATCH 1/4] feat: add support for defining an --include file My team has a use case for always requiring certain files to be included in the package.xml (these include a generated class file and test). And these files change based off of values (i.e. CI build numbers, etc) with each job run. We don't want to be submitting a new commit with each job build, but we need to include these files in the package.xml for `source:deploy`. Using this solution, we can ensure that the generated files are always included (along with `git add -f`). --- README.md | 38 +++++- __mocks__/.forceinclude | 1 + __mocks__/fs.js | 3 + __tests__/integration/main.test.js | 3 + __tests__/unit/lib/utils/repoGitDiff.test.js | 125 ++++++++++++++++--- bin/cli | 2 + messages/delta.js | 8 +- package.json | 3 + src/commands/sgd/source/delta.ts | 10 ++ src/main.js | 4 +- src/utils/cliHelper.js | 15 ++- src/utils/repoGitDiff.js | 51 ++++++-- yarn.lock | 46 ++++++- 13 files changed, 274 insertions(+), 35 deletions(-) create mode 100644 __mocks__/.forceinclude diff --git a/README.md b/README.md index 9c8d622e..42daa8a7 100644 --- a/README.md +++ b/README.md @@ -91,20 +91,27 @@ If you encounter this issue while having installed the correct version of node o ## How to use it? -* [`sfdx sgd:source:delta -f [-t ] [-r ] [-i ] [-D ] [-s ] [-W] [-o ] [-a ] [-d] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-sgdsourcedelta--f-string--t-string--r-filepath--i-filepath--d-filepath--s-filepath--w--o-filepath--a-number--d---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) +* [`sfdx sgd:source:delta -f [-t ] [-r ] [-i ] [-D ] [-s ] [-W] [-o ] [-a ] [-d] [-I ] [-N ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-sgdsourcedelta--f-string--t-string--r-filepath--i-filepath--d-filepath--s-filepath--w--o-filepath--a-number--d--i-filepath--n-filepath---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) -## `sfdx sgd:source:delta -f [-t ] [-r ] [-i ] [-D ] [-s ] [-W] [-o ] [-a ] [-d] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` +## `sfdx sgd:source:delta -f [-t ] [-r ] [-i ] [-D ] [-s ] [-W] [-o ] [-a ] [-d] [-I ] [-N ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` Generate the sfdx content in source format and destructive change from two git commits ``` USAGE $ sfdx sgd:source:delta -f [-t ] [-r ] [-i ] [-D ] [-s ] [-W] - [-o ] [-a ] [-d] [--json] [--loglevel + [-o ] [-a ] [-d] [-I ] [-N ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS - -D, --ignore-destructive=ignore-destructive ignore file to use + -D, --ignore-destructive=ignore-destructive file listing paths to explicitly + ignore for any destructive actions + + -I, --include=include file listing paths to explicitly + include for any diff actions + + -N, --include-destructive=include-destructive file listing paths to explicitly + include for any destructive actions -W, --ignore-whitespace ignore git diff whitespace (space, tab, eol) changes @@ -118,7 +125,8 @@ OPTIONS diff is done [git rev-list --max-parents=0 HEAD] - -i, --ignore=ignore ignore file to use + -i, --ignore=ignore file listing paths to explicitly + ignore for any diff actions -o, --output=output [default: ./output] source package specific output @@ -286,7 +294,7 @@ and will not be used to add member in `package.xml` nor `destructiveChanges.xml` But, sometimes you may need to have two different ignore policies for generating the `package.xml` and `destructiveChanges.xml` files. This is where the `--ignore-destructive [-D]` option comes handy! -Use the `--ignore-destructive` parameter to specify a dedicated ignore file to handle deletions (resulting in metadata listed in the `destructiveChanges.xml` output). In orther words, this will override the `--ignore [-i]` parameter for deleted items. +Use the `--ignore-destructive` parameter to specify a dedicated ignore file to handle deletions (resulting in metadata listed in the `destructiveChanges.xml` output). In other words, this will override the `--ignore [-i]` parameter for deleted items. For example, consider a repository containing multiple sub-folders (force-app/main,force-app/sample, etc) and a commit deleting the Custom\_\_c object from one folder and modifying the Custom\_\_c object from another folder. This event will be treated has a Modification and a Deletion. By default, the Custom\_\_c object would appear in the `package.xml` and in `destructiveChanges.xml`, which could be a little bit inconsistent and can break the CI/CD build. This is a situation where your may want to use the `--ignore-destructive [-D]` parameter! Add the Custom\_\_c object pattern in an ignore file and pass it in the CLI parameter: @@ -300,6 +308,24 @@ $ sfdx sgd:source:delta --from commit --ignore-destructive destructiveignore Note that in a situation where only the `--ignore [-i]` parameter is specified (and `--ignore-destructive [-D]` is not specified), then the plugin will ignore items matching `--ignore [-i]` parameter in all situations: Addition, Modification and Deletion. +### Explicitly including specific files for inclusion or destruction regardless of diff: + +The `--include [-I]` parameter allows you to specify a file based on [micromatch glob matching](https://github.com/micromatch/micromatch) used to explicitly include the specific files, regardless whether they have diffed or not. Similar to the `--ignore` flag, this file defines a list of glob file matchers to indicate which `git` aware files should always be included in the `package.xml` package. Every matching the pattern from the include file specified in the `--include [-I]` will be included by SGD. + +As with `--ignore`, sometimes you may need to have two different include policies for generating the `package.xml` and `destructiveChanges.xml` files. This is where the `--include-destructive [-N]` option comes handy! + +Use the `--include-destructive` parameter to specify a dedicated include file to handle deletions (resulting in metadata listed in the `destructiveChanges.xml` output). Here, you will indicate which files explicitly should be included in the `destructiveChanges.xml`. + +For example, consider a repository containing multiple sub-folders (force-app/main,force-app/sample, etc) and the CI/CD platform generates a new file `force-app/generated/foo` that should not be included in the `source:deploy` command. You can create a file with a line matching this new file and specify this file using the `--include-destructive [-N]` parameter. + +```sh +# destructiveinclude +*generated/foo + +$ sfdx sgd:source:delta --from commit --include-destructive destructiveinclude + +``` + ### Scoping delta generation to a specific folder The `--source [-s]`parameter allows you to specify a folder to focus on, making any other folder ignored. diff --git a/__mocks__/.forceinclude b/__mocks__/.forceinclude new file mode 100644 index 00000000..4d6e3c0f --- /dev/null +++ b/__mocks__/.forceinclude @@ -0,0 +1 @@ +**/jsconfig.json \ No newline at end of file diff --git a/__mocks__/fs.js b/__mocks__/fs.js index ea534ecf..481f341b 100644 --- a/__mocks__/fs.js +++ b/__mocks__/fs.js @@ -27,6 +27,9 @@ fs.statSync = elem => ({ isDirectory() { return elem !== 'file' }, + isFile() { + return filePathList.has(elem) + }, }) fs.readFileSync = path => { diff --git a/__tests__/integration/main.test.js b/__tests__/integration/main.test.js index 13946647..46157711 100644 --- a/__tests__/integration/main.test.js +++ b/__tests__/integration/main.test.js @@ -27,6 +27,8 @@ describe(`test if the appli`, () => { fsMocked.__setMockFiles({ output: '', '.': '', + '.forceignore': '', + '.forceinclude': '', }) child_process.spawnSync.mockImplementation(() => ({ stdout: '' })) }) @@ -53,6 +55,7 @@ describe(`test if the appli`, () => { ...testConfig, ignore: '.forceignore', ignoreDestructive: '.forceignore', + include: '.forceinclude', }) ).toHaveProperty('warnings', []) }) diff --git a/__tests__/unit/lib/utils/repoGitDiff.test.js b/__tests__/unit/lib/utils/repoGitDiff.test.js index 9b4a4b87..95447de6 100644 --- a/__tests__/unit/lib/utils/repoGitDiff.test.js +++ b/__tests__/unit/lib/utils/repoGitDiff.test.js @@ -6,6 +6,7 @@ jest.mock('child_process', () => ({ spawnSync: jest.fn() })) jest.mock('fs-extra') const FORCEIGNORE_MOCK_PATH = '__mocks__/.forceignore' +const FORCEINCLUDE_MOCK_PATH = '__mocks__/.forceinclude' describe(`test if repoGitDiff`, () => { test('can parse git correctly', () => { @@ -18,7 +19,7 @@ describe(`test if repoGitDiff`, () => { // eslint-disable-next-line no-undef globalMetadata ) - const work = repoGitDiff.getDiff() + const work = repoGitDiff.getFilteredDiff() expect(work).toStrictEqual(output) }) @@ -37,7 +38,7 @@ describe(`test if repoGitDiff`, () => { // eslint-disable-next-line no-undef globalMetadata ) - const work = repoGitDiff.getDiff() + const work = repoGitDiff.getFilteredDiff() expect(work).toStrictEqual(output) }) @@ -53,7 +54,7 @@ describe(`test if repoGitDiff`, () => { // eslint-disable-next-line no-undef globalMetadata ) - const work = repoGitDiff.getDiff() + const work = repoGitDiff.getFilteredDiff() expect(work).toMatchObject(output) }) @@ -69,7 +70,7 @@ describe(`test if repoGitDiff`, () => { // eslint-disable-next-line no-undef globalMetadata ) - const work = repoGitDiff.getDiff() + const work = repoGitDiff.getFilteredDiff() expect(work).toStrictEqual(output) }) @@ -85,7 +86,7 @@ describe(`test if repoGitDiff`, () => { // eslint-disable-next-line no-undef globalMetadata ) - const work = repoGitDiff.getDiff() + const work = repoGitDiff.getFilteredDiff() expect(work).toStrictEqual(output) }) @@ -99,7 +100,7 @@ describe(`test if repoGitDiff`, () => { // eslint-disable-next-line no-undef globalMetadata ) - const work = repoGitDiff.getDiff() + const work = repoGitDiff.getFilteredDiff() //should be empty const expected = [] expect(work).toStrictEqual(expected) @@ -115,7 +116,7 @@ describe(`test if repoGitDiff`, () => { // eslint-disable-next-line no-undef globalMetadata ) - const work = repoGitDiff.getDiff() + const work = repoGitDiff.getFilteredDiff() //should be empty const expected = [] expect(work).toStrictEqual(expected) @@ -139,7 +140,7 @@ describe(`test if repoGitDiff`, () => { // eslint-disable-next-line no-undef globalMetadata ) - const work = repoGitDiff.getDiff() + const work = repoGitDiff.getFilteredDiff() //should be empty const expected = [] expect(work).toStrictEqual(expected) @@ -155,7 +156,7 @@ describe(`test if repoGitDiff`, () => { // eslint-disable-next-line no-undef globalMetadata ) - const work = repoGitDiff.getDiff() + const work = repoGitDiff.getFilteredDiff() //should be empty const expected = [] expect(work).toStrictEqual(expected) @@ -171,7 +172,7 @@ describe(`test if repoGitDiff`, () => { // eslint-disable-next-line no-undef globalMetadata ) - const work = repoGitDiff.getDiff() + const work = repoGitDiff.getFilteredDiff() expect(work).toStrictEqual(output) }) @@ -185,7 +186,7 @@ describe(`test if repoGitDiff`, () => { // eslint-disable-next-line no-undef globalMetadata ) - const work = repoGitDiff.getDiff() + const work = repoGitDiff.getFilteredDiff() //should be empty const expected = [] expect(work).toStrictEqual(expected) @@ -204,7 +205,7 @@ describe(`test if repoGitDiff`, () => { // eslint-disable-next-line no-undef globalMetadata ) - const work = repoGitDiff.getDiff() + const work = repoGitDiff.getFilteredDiff() const expected = [output[1]] expect(work).toStrictEqual(expected) }) @@ -222,7 +223,7 @@ describe(`test if repoGitDiff`, () => { // eslint-disable-next-line no-undef globalMetadata ) - const work = repoGitDiff.getDiff() + const work = repoGitDiff.getFilteredDiff() const expected = [output[1]] expect(work).toStrictEqual(expected) }) @@ -240,7 +241,7 @@ describe(`test if repoGitDiff`, () => { // eslint-disable-next-line no-undef globalMetadata ) - const work = repoGitDiff.getDiff() + const work = repoGitDiff.getFilteredDiff() expect(work).toStrictEqual(output) }) @@ -257,10 +258,102 @@ describe(`test if repoGitDiff`, () => { // eslint-disable-next-line no-undef globalMetadata ) - const work = repoGitDiff.getDiff() + const work = repoGitDiff.getFilteredDiff() expect(work).toStrictEqual(output) }) + test('can explicitly include files', () => { + const output = ['force-app/main/default/lwc/jsconfig.json'] + child_process.spawnSync.mockImplementation(() => ({ + stdout: output[0], + })) + const repoGitDiff = new RepoGitDiff( + { + output: '', + repo: '', + include: FORCEINCLUDE_MOCK_PATH, + }, + // eslint-disable-next-line no-undef + globalMetadata + ) + const work = repoGitDiff.getIncludedFiles() + //should be empty + const expected = ['A force-app/main/default/lwc/jsconfig.json'] + expect(work).toStrictEqual(expected) + }) + + test('can explicitly include destructive files', () => { + const output = ['force-app/main/default/lwc/jsconfig.json'] + child_process.spawnSync.mockImplementation(() => ({ + stdout: output[0], + })) + const repoGitDiff = new RepoGitDiff( + { + output: '', + repo: '', + includeDestructive: FORCEINCLUDE_MOCK_PATH, + }, + // eslint-disable-next-line no-undef + globalMetadata + ) + const work = repoGitDiff.getIncludedFiles() + //should be empty + const expected = ['D force-app/main/default/lwc/jsconfig.json'] + expect(work).toStrictEqual(expected) + }) + + test('can explicitly include multiple files', () => { + const output = [ + 'force-app/main/default/lwc/jsconfig.json', + 'force-app/main/default/staticresources/jsconfig.json', + ] + child_process.spawnSync.mockImplementation(() => ({ + stdout: output.join(os.EOL), + })) + const repoGitDiff = new RepoGitDiff( + { + output: '', + repo: '', + include: FORCEINCLUDE_MOCK_PATH, + }, + // eslint-disable-next-line no-undef + globalMetadata + ) + const work = repoGitDiff.getIncludedFiles() + //should be empty + const expected = [ + 'A force-app/main/default/lwc/jsconfig.json', + 'A force-app/main/default/staticresources/jsconfig.json', + ] + expect(work).toStrictEqual(expected) + }) + + test('can explicitly include destructive multiple files', () => { + const output = [ + 'force-app/main/default/lwc/jsconfig.json', + 'force-app/main/default/staticresources/jsconfig.json', + ] + child_process.spawnSync.mockImplementation(() => ({ + stdout: output.join(os.EOL), + })) + const repoGitDiff = new RepoGitDiff( + { + output: '', + repo: '', + includeDestructive: FORCEINCLUDE_MOCK_PATH, + }, + // eslint-disable-next-line no-undef + globalMetadata + ) + const work = repoGitDiff.getIncludedFiles() + //should be empty + const expected = [ + 'D force-app/main/default/lwc/jsconfig.json', + 'D force-app/main/default/staticresources/jsconfig.json', + ] + expect(work).toStrictEqual(expected) + }) + test('can reject in case of error', () => { const expected = new Error('Test Error') child_process.spawnSync.mockImplementation(() => { @@ -268,7 +361,7 @@ describe(`test if repoGitDiff`, () => { }) try { const repoGitDiff = new RepoGitDiff({ output: '', repo: '' }, null) - repoGitDiff.getDiff() + repoGitDiff.getFilteredDiff() } catch (e) { expect(e).toBe(expected) } diff --git a/bin/cli b/bin/cli index 14112aec..fe5a2987 100644 --- a/bin/cli +++ b/bin/cli @@ -32,6 +32,8 @@ const options = program ) .option('-r, --repo [dir]', messages.repoFlag, CliHelper.REPO_DEFAULT_VALUE) .option('-d, --generate-delta', messages.deltaFlag) + .option('-I, --include', messages.includeFlag) + .option('-N, --include-destructive', messages.includeDestructiveFlag) .parse(process.argv) .opts() diff --git a/messages/delta.js b/messages/delta.js index 31b2402c..a5d82abf 100644 --- a/messages/delta.js +++ b/messages/delta.js @@ -7,9 +7,13 @@ module.exports = { repoFlag: 'git repository location', outputFlag: 'source package specific output', sourceFlag: 'source folder focus location related to --repo', - ignoreFlag: 'ignore file to use', - ignoreDestructiveFlag: 'ignore file to use', + ignoreFlag: 'file listing paths to explicitly ignore for any diff actions', + ignoreDestructiveFlag: + 'file listing paths to explicitly ignore for any destructive actions', apiVersionFlag: 'salesforce API version', deltaFlag: 'generate delta files in [--output] folder', ignoreWhitespaceFlag: 'ignore git diff whitespace (space, tab, eol) changes', + includeFlag: 'file listing paths to explicitly include for any diff actions', + includeDestructiveFlag: + 'file listing paths to explicitly include for any destructive actions', } diff --git a/package.json b/package.json index 256a99a9..dee5be53 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "fs-extra": "^10.0.0", "git-state": "^4.1.0", "ignore": "^5.1.8", + "micromatch": "^4.0.4", "tslib": "^2.3.1", "xmlbuilder": "^15.1.1" }, @@ -79,6 +80,8 @@ "@types/node": "^16.10.3", "@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/parser": "^4.33.0", + "chai": "^4.3.4", + "codeclimate": "^0.0.32", "conventional-github-releaser": "^3.1.5", "eslint": "^8.0.0", "eslint-config-prettier": "^8.3.0", diff --git a/src/commands/sgd/source/delta.ts b/src/commands/sgd/source/delta.ts index bc0c7e4f..efe6799c 100644 --- a/src/commands/sgd/source/delta.ts +++ b/src/commands/sgd/source/delta.ts @@ -63,6 +63,14 @@ export default class SourceDeltaGenerate extends SfdxCommand { char: 'd', description: messages.getMessage('deltaFlag'), }), + include: flags.filepath({ + char: 'I', + description: messages.getMessage('includeFlag'), + }), + 'include-destructive': flags.filepath({ + char: 'N', + description: messages.getMessage('includeDestructiveFlag'), + }), } public async run(): Promise { @@ -84,6 +92,8 @@ export default class SourceDeltaGenerate extends SfdxCommand { repo: this.flags.repo, ignoreWhitespace: this.flags['ignore-whitespace'], generateDelta: this.flags['generate-delta'], + include: this.flags['include'], + includeDestructive: this.flags['include-destructive'], }) output.warnings = jobResult?.warnings?.map(warning => warning.message) } catch (err) { diff --git a/src/main.js b/src/main.js index f82038a0..705d74fd 100644 --- a/src/main.js +++ b/src/main.js @@ -22,7 +22,9 @@ module.exports = config => { ) const repoGitDiffHelper = new RepoGitDiff(config, metadata) - const lines = repoGitDiffHelper.getDiff(config, metadata) + let filteredLines = repoGitDiffHelper.getFilteredDiff(config, metadata) + let includedLines = repoGitDiffHelper.getIncludedFiles() + const lines = [...filteredLines, ...includedLines] const work = treatDiff(config, lines, metadata) treatPackages(work.diffs, config, metadata) return work diff --git a/src/utils/cliHelper.js b/src/utils/cliHelper.js index f3c62115..cb2f9a62 100644 --- a/src/utils/cliHelper.js +++ b/src/utils/cliHelper.js @@ -6,6 +6,7 @@ const fs = require('fs') const git = require('git-state') const dirExist = dir => fs.existsSync(dir) && fs.statSync(dir).isDirectory() +const fileExist = file => fs.statSync(file).isFile() class CLIHelper { constructor(config) { @@ -25,6 +26,14 @@ class CLIHelper { ;[this.config.output, this.config.source] .filter(dir => !dirExist(dir)) .forEach(dir => errors.push(`${dir} folder does not exist`)) + ;[ + this.config.ignore, + this.config.ignoreDestructive, + this.config.include, + this.config.includeDestructive, + ] + .filter(file => file && !fileExist(file)) + .forEach(file => errors.push(`${file} file does not exist`)) if (!git.isGitSync(this.config.repo)) { errors.push(`${this.config.repo} is not a git repository`) @@ -37,7 +46,7 @@ class CLIHelper { } if (errors.length > 0) { - throw new Error(errors) + throw new Error(errors.join(', ')) } this.repoSetup.repoConfiguration() @@ -51,6 +60,10 @@ class CLIHelper { this.config.ignore = sanitizePath(this.config.ignore) this.config.ignoreDestructive = sanitizePath(this.config.ignoreDestructive) this.config.from = this.repoSetup.computeFromRef() + this.config.include = sanitizePath(this.config.include) + this.config.includeDestructive = sanitizePath( + this.config.includeDestructive + ) } static TO_DEFAULT_VALUE = 'HEAD' diff --git a/src/utils/repoGitDiff.js b/src/utils/repoGitDiff.js index 697afb40..cf813a6c 100644 --- a/src/utils/repoGitDiff.js +++ b/src/utils/repoGitDiff.js @@ -8,10 +8,13 @@ const gc = require('./gitConstants') const childProcess = require('child_process') const fs = require('fs') const ignore = require('ignore') +const micromatch = require('micromatch') + const os = require('os') const path = require('path') const fullDiffParams = ['--no-pager', 'diff', '--name-status', '--no-renames'] +const allFilesParams = ['ls-files'] const lcSensitivity = { sensitivity: 'accent', } @@ -27,7 +30,15 @@ class RepoGitDiff { this.metadata = metadata } - getDiff() { + getIncludedFiles() { + const { stdout: ls } = childProcess.spawnSync('git', [...allFilesParams], { + cwd: this.config.repo, + encoding: gc.UTF8_ENCODING, + }) + return this._addIncludes(cpUtils.treatDataFromSpawn(ls)) + } + + getFilteredDiff() { const ignoreWhitespaceParams = this.config.ignoreWhitespace ? gc.IGNORE_WHITESPACE_PARAMS : [] @@ -76,12 +87,36 @@ class RepoGitDiff { ) } + _addIncludes(lines) { + let includes = this.config.include + ? micromatch( + lines.split(os.EOL), + fs + .readFileSync(this.config.include) + .toString() + .split(os.EOL) + .filter(i => i) + ).map(include => `A ${include}`) + : [] + let includeDestructives = this.config.includeDestructive + ? micromatch( + lines.split(os.EOL), + fs + .readFileSync(this.config.includeDestructive) + .toString() + .split(os.EOL) + .filter(i => i) + ).map(includeD => `D ${includeD}`) + : [] + return [...includes, ...includeDestructives] + } + _filterIgnore(line) { - const ig = ignore() - const dig = ignore() + const fileIgnorer = ignore() + const fileDestIgnorer = ignore() ;[ - { ignore: this.config.ignore, helper: ig }, - { ignore: this.config.ignoreDestructive, helper: dig }, + { ignore: this.config.ignore, helper: fileIgnorer }, + { ignore: this.config.ignoreDestructive, helper: fileDestIgnorer }, ].forEach( ign => ign.ignore && @@ -90,9 +125,9 @@ class RepoGitDiff { ) return this.config.ignoreDestructive ? line.startsWith(gc.DELETION) - ? !dig.ignores(line.replace(gc.GIT_DIFF_TYPE_REGEX, '')) - : !ig.ignores(line.replace(gc.GIT_DIFF_TYPE_REGEX, '')) - : !ig.ignores(line.replace(gc.GIT_DIFF_TYPE_REGEX, '')) + ? !fileDestIgnorer.ignores(line.replace(gc.GIT_DIFF_TYPE_REGEX, '')) + : !fileIgnorer.ignores(line.replace(gc.GIT_DIFF_TYPE_REGEX, '')) + : !fileIgnorer.ignores(line.replace(gc.GIT_DIFF_TYPE_REGEX, '')) } _extractComparisonName(line) { diff --git a/yarn.lock b/yarn.lock index 3a52cc43..12294a4d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1544,6 +1544,11 @@ assert-plus@1.0.0, assert-plus@^1.0.0: resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" integrity sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU= +assertion-error@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b" + integrity sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw== + astral-regex@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" @@ -1829,6 +1834,18 @@ caseless@~0.12.0: resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= +chai@^4.3.4: + version "4.3.4" + resolved "https://registry.yarnpkg.com/chai/-/chai-4.3.4.tgz#b55e655b31e1eac7099be4c08c21964fce2e6c49" + integrity sha512-yS5H68VYOCtN1cjfwumDSuzn/9c+yza4f3reKXlE5rUg7SFcCEy90gJvydNgOYtblyf4Zi6jIWRnXOgErta0KA== + dependencies: + assertion-error "^1.1.0" + check-error "^1.0.2" + deep-eql "^3.0.1" + get-func-name "^2.0.0" + pathval "^1.1.1" + type-detect "^4.0.5" + chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" @@ -1862,6 +1879,11 @@ char-regex@^1.0.2: resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" integrity sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw== +check-error@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82" + integrity sha1-V00xLt2Iu13YkS6Sht1sCu1KrII= + chownr@^1.1.1: version "1.1.4" resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b" @@ -2025,6 +2047,11 @@ code-point-at@^1.0.0: resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= +codeclimate@^0.0.32: + version "0.0.32" + resolved "https://registry.yarnpkg.com/codeclimate/-/codeclimate-0.0.32.tgz#3e8fab6e59debb64c71bb899fceff7f1a829cb8a" + integrity sha1-Po+rblneu2THG7iZ/O/38agpy4o= + coffeescript@^1.10.0: version "1.12.7" resolved "https://registry.yarnpkg.com/coffeescript/-/coffeescript-1.12.7.tgz#e57ee4c4867cf7f606bfc4a0f2d550c0981ddd27" @@ -2601,6 +2628,13 @@ dedent@^0.7.0: resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" integrity sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw= +deep-eql@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-3.0.1.tgz#dfc9404400ad1c8fe023e7da1df1c147c4b444df" + integrity sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw== + dependencies: + type-detect "^4.0.0" + deep-is@^0.1.3, deep-is@~0.1.3: version "0.1.4" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" @@ -3495,6 +3529,11 @@ get-caller-file@^2.0.1, get-caller-file@^2.0.5: resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== +get-func-name@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.0.tgz#ead774abee72e20409433a066366023dd6887a41" + integrity sha1-6td0q+5y4gQJQzoGY2YCPdaIekE= + get-intrinsic@^1.0.2, get-intrinsic@^1.1.0, get-intrinsic@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.1.1.tgz#15f59f376f855c446963948f0d24cd3637b4abc6" @@ -5998,6 +6037,11 @@ path-type@^4.0.0: resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== +pathval@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.1.tgz#8534e77a77ce7ac5a2512ea21e0fdb8fcf6c3d8d" + integrity sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ== + performance-now@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" @@ -7341,7 +7385,7 @@ type-check@~0.3.2: dependencies: prelude-ls "~1.1.2" -type-detect@4.0.8: +type-detect@4.0.8, type-detect@^4.0.0, type-detect@^4.0.5: version "4.0.8" resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== From c945276ec9c1067c87abab9f43742497610b5208 Mon Sep 17 00:00:00 2001 From: Brian Goad Date: Thu, 18 Nov 2021 15:41:20 -0500 Subject: [PATCH 2/4] fix: address codeclimate issues --- __tests__/unit/lib/utils/repoGitDiff.test.js | 6 ++-- src/utils/repoGitDiff.js | 36 ++++++++------------ 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/__tests__/unit/lib/utils/repoGitDiff.test.js b/__tests__/unit/lib/utils/repoGitDiff.test.js index 95447de6..d69dc567 100644 --- a/__tests__/unit/lib/utils/repoGitDiff.test.js +++ b/__tests__/unit/lib/utils/repoGitDiff.test.js @@ -298,7 +298,7 @@ describe(`test if repoGitDiff`, () => { ) const work = repoGitDiff.getIncludedFiles() //should be empty - const expected = ['D force-app/main/default/lwc/jsconfig.json'] + const expected = ['D force-app/main/default/lwc/jsconfig.json'] expect(work).toStrictEqual(expected) }) @@ -348,8 +348,8 @@ describe(`test if repoGitDiff`, () => { const work = repoGitDiff.getIncludedFiles() //should be empty const expected = [ - 'D force-app/main/default/lwc/jsconfig.json', - 'D force-app/main/default/staticresources/jsconfig.json', + 'D force-app/main/default/lwc/jsconfig.json', + 'D force-app/main/default/staticresources/jsconfig.json', ] expect(work).toStrictEqual(expected) }) diff --git a/src/utils/repoGitDiff.js b/src/utils/repoGitDiff.js index cf813a6c..701ea573 100644 --- a/src/utils/repoGitDiff.js +++ b/src/utils/repoGitDiff.js @@ -88,27 +88,21 @@ class RepoGitDiff { } _addIncludes(lines) { - let includes = this.config.include - ? micromatch( - lines.split(os.EOL), - fs - .readFileSync(this.config.include) - .toString() - .split(os.EOL) - .filter(i => i) - ).map(include => `A ${include}`) - : [] - let includeDestructives = this.config.includeDestructive - ? micromatch( - lines.split(os.EOL), - fs - .readFileSync(this.config.includeDestructive) - .toString() - .split(os.EOL) - .filter(i => i) - ).map(includeD => `D ${includeD}`) - : [] - return [...includes, ...includeDestructives] + return [ + { include: this.config.include, prefix: 'A' }, + { include: this.config.includeDestructive, prefix: 'D' }, + ].flatMap(obj => { + return obj.include + ? micromatch( + lines.split(os.EOL), + fs + .readFileSync(obj.include) + .toString() + .split(os.EOL) + .filter(i => i) + ).map(include => `${obj.prefix} ${include}`) + : [] + }) } _filterIgnore(line) { From ff7099eae5a9595cc3f65290f3af103866bd34d0 Mon Sep 17 00:00:00 2001 From: Brian Goad Date: Fri, 19 Nov 2021 16:21:42 -0500 Subject: [PATCH 3/4] fix: address PR review items --- README.md | 19 +++++----- __tests__/unit/lib/utils/cliHelper.test.js | 40 +++++++++++++++++++++ bin/cli | 2 +- package.json | 1 - src/commands/sgd/source/delta.ts | 4 +-- src/main.js | 4 +-- yarn.lock | 41 +--------------------- 7 files changed, 57 insertions(+), 54 deletions(-) diff --git a/README.md b/README.md index 42daa8a7..66b458ac 100644 --- a/README.md +++ b/README.md @@ -91,25 +91,23 @@ If you encounter this issue while having installed the correct version of node o ## How to use it? -* [`sfdx sgd:source:delta -f [-t ] [-r ] [-i ] [-D ] [-s ] [-W] [-o ] [-a ] [-d] [-I ] [-N ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-sgdsourcedelta--f-string--t-string--r-filepath--i-filepath--d-filepath--s-filepath--w--o-filepath--a-number--d--i-filepath--n-filepath---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) -## `sfdx sgd:source:delta -f [-t ] [-r ] [-i ] [-D ] [-s ] [-W] [-o ] [-a ] [-d] [-I ] [-N ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` +- [`sfdx sgd:source:delta -f [-t ] [-r ] [-i ] [-D ] [-s ] [-W] [-o ] [-a ] [-d] [-n ] [-N ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-sgdsourcedelta--f-string--t-string--r-filepath--i-filepath--d-filepath--s-filepath--w--o-filepath--a-number--d--n-filepath--n-filepath---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) + +## `sfdx sgd:source:delta -f [-t ] [-r ] [-i ] [-D ] [-s ] [-W] [-o ] [-a ] [-d] [-n ] [-N ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` Generate the sfdx content in source format and destructive change from two git commits ``` USAGE - $ sfdx sgd:source:delta -f [-t ] [-r ] [-i ] [-D ] [-s ] [-W] - [-o ] [-a ] [-d] [-I ] [-N ] [--json] [--loglevel + $ sfdx sgd:source:delta -f [-t ] [-r ] [-i ] [-D ] [-s ] [-W] + [-o ] [-a ] [-d] [-n ] [-N ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS -D, --ignore-destructive=ignore-destructive file listing paths to explicitly ignore for any destructive actions - -I, --include=include file listing paths to explicitly - include for any diff actions - -N, --include-destructive=include-destructive file listing paths to explicitly include for any destructive actions @@ -128,6 +126,9 @@ OPTIONS -i, --ignore=ignore file listing paths to explicitly ignore for any diff actions + -n, --include=include file listing paths to explicitly + include for any diff actions + -o, --output=output [default: ./output] source package specific output @@ -146,6 +147,7 @@ OPTIONS ``` _See code: [src/commands/sgd/source/delta.ts](https://github.com/scolladon/sfdx-git-delta/blob/v4.10.0/src/commands/sgd/source/delta.ts)_ + ### Important note for Windows users: @@ -310,7 +312,7 @@ Note that in a situation where only the `--ignore [-i]` parameter is specified ( ### Explicitly including specific files for inclusion or destruction regardless of diff: -The `--include [-I]` parameter allows you to specify a file based on [micromatch glob matching](https://github.com/micromatch/micromatch) used to explicitly include the specific files, regardless whether they have diffed or not. Similar to the `--ignore` flag, this file defines a list of glob file matchers to indicate which `git` aware files should always be included in the `package.xml` package. Every matching the pattern from the include file specified in the `--include [-I]` will be included by SGD. +The `--include [-n]` parameter allows you to specify a file based on [micromatch glob matching](https://github.com/micromatch/micromatch) used to explicitly include the specific files, regardless whether they have diffed or not. Similar to the `--ignore` flag, this file defines a list of glob file matchers to indicate which `git` aware files should always be included in the `package.xml` package. Every matching the pattern from the include file specified in the `--include [-n]` will be included by SGD. As with `--ignore`, sometimes you may need to have two different include policies for generating the `package.xml` and `destructiveChanges.xml` files. This is where the `--include-destructive [-N]` option comes handy! @@ -399,6 +401,7 @@ console.log(JSON.stringify(work)) - [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. - [xmlbuilder](https://github.com/oozcitak/xmlbuilder-js) - An XML builder for node.js similar to java-xmlbuilder. +- [micromatch](https://github.com/micromatch/micromatch) - a file glob matcher utility ## Versioning diff --git a/__tests__/unit/lib/utils/cliHelper.test.js b/__tests__/unit/lib/utils/cliHelper.test.js index bf23e74d..a848ffd7 100644 --- a/__tests__/unit/lib/utils/cliHelper.test.js +++ b/__tests__/unit/lib/utils/cliHelper.test.js @@ -74,6 +74,46 @@ describe(`test if the appli`, () => { }).toThrow() }) + test('throw errors when file is not found for --ignore', () => { + cliHelper = new CLIHelper({ + ...testConfig, + ignore: 'not-a-file', + }) + expect(() => { + cliHelper.validateConfig() + }).toThrow() + }) + + test('throw errors when file is not found for --ignore-destructive', () => { + cliHelper = new CLIHelper({ + ...testConfig, + ignoreDestructive: 'not-a-file', + }) + expect(() => { + cliHelper.validateConfig() + }).toThrow() + }) + + test('throw errors when file is not found for --include', () => { + cliHelper = new CLIHelper({ + ...testConfig, + include: 'not-a-file', + }) + expect(() => { + cliHelper.validateConfig() + }).toThrow() + }) + + test('throw errors when file is not found for --include-destructive', () => { + cliHelper = new CLIHelper({ + ...testConfig, + includeDestructive: 'not-a-file', + }) + expect(() => { + cliHelper.validateConfig() + }).toThrow() + }) + test('throw errors when "-t" and "-d" are set', () => { const notHeadSHA = 'test' child_process.spawnSync diff --git a/bin/cli b/bin/cli index fe5a2987..297d47cd 100644 --- a/bin/cli +++ b/bin/cli @@ -32,7 +32,7 @@ const options = program ) .option('-r, --repo [dir]', messages.repoFlag, CliHelper.REPO_DEFAULT_VALUE) .option('-d, --generate-delta', messages.deltaFlag) - .option('-I, --include', messages.includeFlag) + .option('-n, --include', messages.includeFlag) .option('-N, --include-destructive', messages.includeDestructiveFlag) .parse(process.argv) .opts() diff --git a/package.json b/package.json index dee5be53..04743127 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,6 @@ "@types/node": "^16.10.3", "@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/parser": "^4.33.0", - "chai": "^4.3.4", "codeclimate": "^0.0.32", "conventional-github-releaser": "^3.1.5", "eslint": "^8.0.0", diff --git a/src/commands/sgd/source/delta.ts b/src/commands/sgd/source/delta.ts index efe6799c..d997e836 100644 --- a/src/commands/sgd/source/delta.ts +++ b/src/commands/sgd/source/delta.ts @@ -64,7 +64,7 @@ export default class SourceDeltaGenerate extends SfdxCommand { description: messages.getMessage('deltaFlag'), }), include: flags.filepath({ - char: 'I', + char: 'n', description: messages.getMessage('includeFlag'), }), 'include-destructive': flags.filepath({ @@ -92,7 +92,7 @@ export default class SourceDeltaGenerate extends SfdxCommand { repo: this.flags.repo, ignoreWhitespace: this.flags['ignore-whitespace'], generateDelta: this.flags['generate-delta'], - include: this.flags['include'], + include: this.flags.include, includeDestructive: this.flags['include-destructive'], }) output.warnings = jobResult?.warnings?.map(warning => warning.message) diff --git a/src/main.js b/src/main.js index 705d74fd..22c0452e 100644 --- a/src/main.js +++ b/src/main.js @@ -22,8 +22,8 @@ module.exports = config => { ) const repoGitDiffHelper = new RepoGitDiff(config, metadata) - let filteredLines = repoGitDiffHelper.getFilteredDiff(config, metadata) - let includedLines = repoGitDiffHelper.getIncludedFiles() + const filteredLines = repoGitDiffHelper.getFilteredDiff() + const includedLines = repoGitDiffHelper.getIncludedFiles() const lines = [...filteredLines, ...includedLines] const work = treatDiff(config, lines, metadata) treatPackages(work.diffs, config, metadata) diff --git a/yarn.lock b/yarn.lock index 12294a4d..1533ea02 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1544,11 +1544,6 @@ assert-plus@1.0.0, assert-plus@^1.0.0: resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" integrity sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU= -assertion-error@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b" - integrity sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw== - astral-regex@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" @@ -1834,18 +1829,6 @@ caseless@~0.12.0: resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= -chai@^4.3.4: - version "4.3.4" - resolved "https://registry.yarnpkg.com/chai/-/chai-4.3.4.tgz#b55e655b31e1eac7099be4c08c21964fce2e6c49" - integrity sha512-yS5H68VYOCtN1cjfwumDSuzn/9c+yza4f3reKXlE5rUg7SFcCEy90gJvydNgOYtblyf4Zi6jIWRnXOgErta0KA== - dependencies: - assertion-error "^1.1.0" - check-error "^1.0.2" - deep-eql "^3.0.1" - get-func-name "^2.0.0" - pathval "^1.1.1" - type-detect "^4.0.5" - chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" @@ -1879,11 +1862,6 @@ char-regex@^1.0.2: resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" integrity sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw== -check-error@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82" - integrity sha1-V00xLt2Iu13YkS6Sht1sCu1KrII= - chownr@^1.1.1: version "1.1.4" resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b" @@ -2628,13 +2606,6 @@ dedent@^0.7.0: resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" integrity sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw= -deep-eql@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-3.0.1.tgz#dfc9404400ad1c8fe023e7da1df1c147c4b444df" - integrity sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw== - dependencies: - type-detect "^4.0.0" - deep-is@^0.1.3, deep-is@~0.1.3: version "0.1.4" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" @@ -3529,11 +3500,6 @@ get-caller-file@^2.0.1, get-caller-file@^2.0.5: resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== -get-func-name@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.0.tgz#ead774abee72e20409433a066366023dd6887a41" - integrity sha1-6td0q+5y4gQJQzoGY2YCPdaIekE= - get-intrinsic@^1.0.2, get-intrinsic@^1.1.0, get-intrinsic@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.1.1.tgz#15f59f376f855c446963948f0d24cd3637b4abc6" @@ -6037,11 +6003,6 @@ path-type@^4.0.0: resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== -pathval@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.1.tgz#8534e77a77ce7ac5a2512ea21e0fdb8fcf6c3d8d" - integrity sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ== - performance-now@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" @@ -7385,7 +7346,7 @@ type-check@~0.3.2: dependencies: prelude-ls "~1.1.2" -type-detect@4.0.8, type-detect@^4.0.0, type-detect@^4.0.5: +type-detect@4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== From d7de74bb55847cf8afeca4085d61f8db39ba283d Mon Sep 17 00:00:00 2001 From: Brian Goad Date: Wed, 24 Nov 2021 10:26:34 -0500 Subject: [PATCH 4/4] fix: readme lint tweak --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 66b458ac..772c5d97 100644 --- a/README.md +++ b/README.md @@ -91,8 +91,7 @@ If you encounter this issue while having installed the correct version of node o ## How to use it? - -- [`sfdx sgd:source:delta -f [-t ] [-r ] [-i ] [-D ] [-s ] [-W] [-o ] [-a ] [-d] [-n ] [-N ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-sgdsourcedelta--f-string--t-string--r-filepath--i-filepath--d-filepath--s-filepath--w--o-filepath--a-number--d--n-filepath--n-filepath---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) +* [`sfdx sgd:source:delta -f [-t ] [-r ] [-i ] [-D ] [-s ] [-W] [-o ] [-a ] [-d] [-n ] [-N ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-sgdsourcedelta--f-string--t-string--r-filepath--i-filepath--d-filepath--s-filepath--w--o-filepath--a-number--d--n-filepath--n-filepath---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) ## `sfdx sgd:source:delta -f [-t ] [-r ] [-i ] [-D ] [-s ] [-W] [-o ] [-a ] [-d] [-n ] [-N ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` @@ -100,8 +99,8 @@ Generate the sfdx content in source format and destructive change from two git c ``` USAGE - $ sfdx sgd:source:delta -f [-t ] [-r ] [-i ] [-D ] [-s ] [-W] - [-o ] [-a ] [-d] [-n ] [-N ] [--json] [--loglevel + $ sfdx sgd:source:delta -f [-t ] [-r ] [-i ] [-D ] [-s ] [-W] + [-o ] [-a ] [-d] [-n ] [-N ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -147,7 +146,6 @@ OPTIONS ``` _See code: [src/commands/sgd/source/delta.ts](https://github.com/scolladon/sfdx-git-delta/blob/v4.10.0/src/commands/sgd/source/delta.ts)_ - ### Important note for Windows users: