Skip to content

Commit

Permalink
fix: windows path separator with micromatch (#448)
Browse files Browse the repository at this point in the history
* fix: windows path separator with micromatch

* test: cleanup tab delimiter

* build: upgrade dependencies

* docs: explain path separator for includes file

* fix: remove versioning strategy for github action
  • Loading branch information
scolladon committed Feb 14, 2023
1 parent d79891b commit d49f161
Show file tree
Hide file tree
Showing 6 changed files with 135 additions and 179 deletions.
1 change: 0 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ updates:
directory: "/"
schedule:
interval: "daily"
versioning-strategy: increase

- package-ecosystem: "npm"
directory: "/"
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,8 @@ Consider the following:
$ sfdx sgd:source:delta --from commit --include-destructive .destructiveinclude
```

The path matchers in includes file must follow [`gitignore`](https://git-scm.com/docs/gitignore#:~:text=The%20slash%20/%20is%20used%20as%20the%20directory%20separator.) spec and accept only unix path separator `/` (even for windows system).

### 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.
Expand Down
12 changes: 6 additions & 6 deletions __tests__/unit/lib/utils/repoGitDiff.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ describe(`test if repoGitDiff`, () => {
globalMetadata
)
const work = await repoGitDiff.getLines()
const expected = ['A force-app/main/default/lwc/jsconfig.json']
const expected = [`A${TAB}force-app/main/default/lwc/jsconfig.json`]
expect(work).toStrictEqual(expected)
})

Expand All @@ -339,7 +339,7 @@ describe(`test if repoGitDiff`, () => {
globalMetadata
)
const work = await repoGitDiff.getLines()
const expected = ['D force-app/main/default/lwc/jsconfig.json']
const expected = [`D${TAB}force-app/main/default/lwc/jsconfig.json`]
expect(work).toStrictEqual(expected)
})

Expand All @@ -361,8 +361,8 @@ describe(`test if repoGitDiff`, () => {
const work = await repoGitDiff.getLines()
//should be empty
const expected = [
'A force-app/main/default/lwc/jsconfig.json',
'A force-app/main/default/staticresources/jsconfig.json',
`A${TAB}force-app/main/default/lwc/jsconfig.json`,
`A${TAB}force-app/main/default/staticresources/jsconfig.json`,
]
expect(work).toStrictEqual(expected)
})
Expand All @@ -384,8 +384,8 @@ describe(`test if repoGitDiff`, () => {
)
const work = await repoGitDiff.getLines()
const expected = [
`D force-app/main/default/lwc/jsconfig.json`,
'D force-app/main/default/staticresources/jsconfig.json',
`D${TAB}force-app/main/default/lwc/jsconfig.json`,
`D${TAB}force-app/main/default/staticresources/jsconfig.json`,
]
expect(work).toStrictEqual(expected)
})
Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@oclif/errors": "^1.3.6",
"@salesforce/command": "^5.3.0",
"@salesforce/core": "^3.33.1",
"fast-xml-parser": "^4.1.1",
"fast-xml-parser": "^4.1.2",
"fs-extra": "^11.1.0",
"ignore": "^5.2.4",
"micromatch": "^4.0.5",
Expand Down Expand Up @@ -62,27 +62,27 @@
"upgrade:dependencies": "yarn yarn-upgrade-all"
},
"devDependencies": {
"@commitlint/cli": "^17.4.2",
"@commitlint/config-angular": "^17.4.2",
"@commitlint/prompt-cli": "^17.4.2",
"@commitlint/cli": "^17.4.3",
"@commitlint/config-angular": "^17.4.3",
"@commitlint/prompt-cli": "^17.4.3",
"@oclif/dev-cli": "^1.26.10",
"@oclif/plugin-help": "^5.2.4",
"@oclif/test": "^2.3.5",
"@oclif/test": "^2.3.6",
"@salesforce/dev-config": "^3.1.0",
"@types/chai": "^4.3.4",
"@types/mocha": "^10.0.1",
"@types/node": "^18.13.0",
"@typescript-eslint/eslint-plugin": "^5.51.0",
"@typescript-eslint/parser": "^5.51.0",
"@typescript-eslint/eslint-plugin": "^5.52.0",
"@typescript-eslint/parser": "^5.52.0",
"eslint": "^8.34.0",
"eslint-config-prettier": "^8.6.0",
"eslint-config-salesforce-typescript": "^1.1.1",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jsdoc": "^39.8.0",
"eslint-plugin-jsdoc": "^40.0.0",
"eslint-plugin-prettier": "^4.2.1",
"husky": "^8.0.3",
"jest": "^29.4.2",
"lint-staged": "^13.1.1",
"lint-staged": "^13.1.2",
"nyc": "^15.1.0",
"prettier": "^2.8.4",
"prettier-eslint": "^15.0.1",
Expand Down
2 changes: 1 addition & 1 deletion src/utils/repoGitDiff.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class RepoGitDiff {
static _addIncludes(lines, setup) {
return setup.flatMap(obj =>
micromatch(lines, obj.content).map(
include => `${obj.prefix} ${include}`
includedLine => `${obj.prefix}${TAB}${treatPathSep(includedLine)}`
)
)
}
Expand Down
Loading

0 comments on commit d49f161

Please sign in to comment.