From 23a65c89c8b55525b5d8efe88195d734d337d82a Mon Sep 17 00:00:00 2001 From: mshanemc Date: Thu, 20 Jan 2022 21:43:07 -0600 Subject: [PATCH 1/9] fix: handle gitignore outside pkgDirs --- src/shared/localShadowRepo.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/shared/localShadowRepo.ts b/src/shared/localShadowRepo.ts index 65f2a06d..deeebf1b 100644 --- a/src/shared/localShadowRepo.ts +++ b/src/shared/localShadowRepo.ts @@ -79,6 +79,7 @@ export class ShadowRepo { this.logger.debug('initializing git repo'); await this.gitInit(); } + await this.locateIgnoreFiles(); } /** @@ -88,7 +89,6 @@ export class ShadowRepo { public async gitInit(): Promise { await fs.promises.mkdir(this.gitDir, { recursive: true }); await git.init({ fs, dir: this.projectPath, gitdir: this.gitDir, defaultBranch: 'main' }); - await this.locateIgnoreFiles(); } /** @@ -265,17 +265,11 @@ export class ShadowRepo { dir: this.projectPath, gitdir: this.gitDir, trees: [git.WORKDIR()], - // TODO: this can be marginally faster if we limit it to pkgDirs and toplevel project files // eslint-disable-next-line @typescript-eslint/require-await map: async (filepath: string) => filepath, })) as string[] ) - .filter( - (filepath) => - filepath.includes(gitIgnoreFileName) && - // can be top-level like '.' (no sep) OR must be in one of the package dirs - (!filepath.includes(path.sep) || this.packageDirs.some((dir) => pathIsInFolder(filepath, dir.name))) - ) + .filter((filepath) => filepath.includes(gitIgnoreFileName)) .map((ignoreFile) => path.join(this.projectPath, ignoreFile)); } From fe4ba68f088f2bee685dcd0d46700a9db93d85b1 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Thu, 20 Jan 2022 21:43:28 -0600 Subject: [PATCH 2/9] test: nut for forceignore not in pkgdirs --- test/nuts/local/nonTopLevelIgnore.nut.ts | 36 +++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/test/nuts/local/nonTopLevelIgnore.nut.ts b/test/nuts/local/nonTopLevelIgnore.nut.ts index a40cf36e..36c06502 100644 --- a/test/nuts/local/nonTopLevelIgnore.nut.ts +++ b/test/nuts/local/nonTopLevelIgnore.nut.ts @@ -10,7 +10,7 @@ import { fs } from '@salesforce/core'; import { expect } from 'chai'; import { ShadowRepo } from '../../../src/shared/localShadowRepo'; -describe('handles non-top-level ignore', () => { +describe('handles non-top-level ignore inside project dir', () => { let session: TestSession; let repo: ShadowRepo; @@ -43,3 +43,37 @@ describe('handles non-top-level ignore', () => { await session?.clean(); }); }); + +describe('handles non-top-level ignore outside project dir', () => { + let session: TestSession; + let repo: ShadowRepo; + + before(async () => { + session = await TestSession.create({ + project: { + sourceDir: path.join('test', 'nuts', 'repros', 'nested-classes2'), + }, + authStrategy: 'NONE', + }); + }); + + it('initialize the local tracking', async () => { + repo = await ShadowRepo.getInstance({ + orgId: 'fakeOrgId2', + projectPath: session.project.dir, + packageDirs: [{ path: 'classes', name: 'classes', fullPath: path.join(session.project.dir, 'classes') }], + }); + // verify the local tracking files/directories + expect(fs.existsSync(repo.gitDir)); + }); + + it('should not be influenced by gitignore', async () => { + expect(await repo.getChangedFilenames()) + .to.be.an('array') + .with.length(2); + }); + + after(async () => { + await session?.clean(); + }); +}); From 9d404d966fd582d761477e2d6db392b895ea7522 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 25 Jan 2022 12:51:43 -0600 Subject: [PATCH 3/9] chore: individual nuts --- .circleci/config.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9b5c16f7..37cb096a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,6 +7,10 @@ jobs: description: Runs NUTs from other (external) repos by cloning them. Substitutes a dependency for the current pull request. For example, you're testing a PR to a library and want to test a plugin in another repo that uses the library. parameters: + command: + type: string + description: 'command to execute (ex: yarn test:nuts)' + default: 'yarn test:nuts' node_version: description: version of node to run tests against type: string @@ -106,7 +110,7 @@ jobs: - run: name: Nuts command: | - yarn test:nuts:tracking + <> workflows: version: 2 @@ -155,12 +159,22 @@ workflows: - release-management/test-package - release-management/test-nut sfdx_version: latest - size: large + size: medium matrix: parameters: os: [linux, windows] node_version: [lts] external_project_git_url: ['https://github.com/salesforcecli/plugin-source'] + command: + [ + 'yarn test:nuts:tracking:basics', + 'yarn test:nuts:tracking:conflicts', + 'yarn test:nuts:tracking:forceignore', + 'yarn test:nuts:tracking:remote', + 'yarn test:nuts:tracking:resetClear', + 'yarn test:nuts:tracking:lwc', + 'yarn mocha \"test/nuts/mpd-*.nut.ts\" --slow 3000 --timeout 600000 --parallel', + ] - release-management/release-package: github-release: true requires: From 28fbc02e5275fb8f2e22ed42431f2082ad641c07 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 25 Jan 2022 12:55:37 -0600 Subject: [PATCH 4/9] ci: rename param --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 37cb096a..3efc49b0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,7 +7,7 @@ jobs: description: Runs NUTs from other (external) repos by cloning them. Substitutes a dependency for the current pull request. For example, you're testing a PR to a library and want to test a plugin in another repo that uses the library. parameters: - command: + test_command: type: string description: 'command to execute (ex: yarn test:nuts)' default: 'yarn test:nuts' @@ -165,7 +165,7 @@ workflows: os: [linux, windows] node_version: [lts] external_project_git_url: ['https://github.com/salesforcecli/plugin-source'] - command: + test_command: [ 'yarn test:nuts:tracking:basics', 'yarn test:nuts:tracking:conflicts', From d27cbfb0cec2a3d5d2d7d28336966aaee34d019f Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 25 Jan 2022 13:00:56 -0600 Subject: [PATCH 5/9] ci: fix tpo --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3efc49b0..347fb88f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -110,7 +110,7 @@ jobs: - run: name: Nuts command: | - <> + <> workflows: version: 2 From b5b3fce0177590d957f8a5713290bf533d67f7ed Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 25 Jan 2022 13:32:44 -0600 Subject: [PATCH 6/9] ci: fix nuts path --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 347fb88f..14ae006a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -173,7 +173,7 @@ workflows: 'yarn test:nuts:tracking:remote', 'yarn test:nuts:tracking:resetClear', 'yarn test:nuts:tracking:lwc', - 'yarn mocha \"test/nuts/mpd-*.nut.ts\" --slow 3000 --timeout 600000 --parallel', + 'yarn mocha \"test/nuts/trackingCommands/mpd-*.nut.ts\" --slow 3000 --timeout 600000 --parallel', ] - release-management/release-package: github-release: true From f732ba3acd6b4ce2ecbc43fa57b5717705d808c2 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 25 Jan 2022 13:57:52 -0600 Subject: [PATCH 7/9] ci: windows path for yarn --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 14ae006a..9675b616 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -173,7 +173,7 @@ workflows: 'yarn test:nuts:tracking:remote', 'yarn test:nuts:tracking:resetClear', 'yarn test:nuts:tracking:lwc', - 'yarn mocha \"test/nuts/trackingCommands/mpd-*.nut.ts\" --slow 3000 --timeout 600000 --parallel', + 'yarn mocha "test/nuts/trackingCommands/mpd-*.nut.ts" --slow 3000 --timeout 600000 --parallel', ] - release-management/release-package: github-release: true From 1846cd892b8648811d314fc0d27c85d1b54b4af9 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 25 Jan 2022 13:58:44 -0600 Subject: [PATCH 8/9] ci: windows only temporary --- .circleci/config.yml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9675b616..9fe662f6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -162,17 +162,19 @@ workflows: size: medium matrix: parameters: - os: [linux, windows] + os: [ + # linux, + windows, + ] node_version: [lts] external_project_git_url: ['https://github.com/salesforcecli/plugin-source'] - test_command: - [ - 'yarn test:nuts:tracking:basics', - 'yarn test:nuts:tracking:conflicts', - 'yarn test:nuts:tracking:forceignore', - 'yarn test:nuts:tracking:remote', - 'yarn test:nuts:tracking:resetClear', - 'yarn test:nuts:tracking:lwc', + test_command: [ + # 'yarn test:nuts:tracking:basics', + # 'yarn test:nuts:tracking:conflicts', + # 'yarn test:nuts:tracking:forceignore', + # 'yarn test:nuts:tracking:remote', + # 'yarn test:nuts:tracking:resetClear', + # 'yarn test:nuts:tracking:lwc', 'yarn mocha "test/nuts/trackingCommands/mpd-*.nut.ts" --slow 3000 --timeout 600000 --parallel', ] - release-management/release-package: From 403295f8b43ccac459f535ef90a9f342035f4223 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Tue, 25 Jan 2022 14:19:46 -0600 Subject: [PATCH 9/9] ci: reenable all external nuts --- .circleci/config.yml | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9fe662f6..9675b616 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -162,19 +162,17 @@ workflows: size: medium matrix: parameters: - os: [ - # linux, - windows, - ] + os: [linux, windows] node_version: [lts] external_project_git_url: ['https://github.com/salesforcecli/plugin-source'] - test_command: [ - # 'yarn test:nuts:tracking:basics', - # 'yarn test:nuts:tracking:conflicts', - # 'yarn test:nuts:tracking:forceignore', - # 'yarn test:nuts:tracking:remote', - # 'yarn test:nuts:tracking:resetClear', - # 'yarn test:nuts:tracking:lwc', + test_command: + [ + 'yarn test:nuts:tracking:basics', + 'yarn test:nuts:tracking:conflicts', + 'yarn test:nuts:tracking:forceignore', + 'yarn test:nuts:tracking:remote', + 'yarn test:nuts:tracking:resetClear', + 'yarn test:nuts:tracking:lwc', 'yarn mocha "test/nuts/trackingCommands/mpd-*.nut.ts" --slow 3000 --timeout 600000 --parallel', ] - release-management/release-package: