diff --git a/.depcheckrc b/.depcheckrc index 086d05fa..a46b8e0c 100644 --- a/.depcheckrc +++ b/.depcheckrc @@ -1,9 +1,12 @@ ignores: [ '@commitlint/*', - '@types/jest', '@salesforce/*', '@stryker-mutator/*', - 'lint-staged', + '@types/jest', 'chai', + 'depcheck', + 'lint-staged', + 'mocha', + 'nyc', 'sinon', ] diff --git a/.github/linters/.cspell.json b/.github/linters/.cspell.json index ccd3be6c..3e408e4e 100644 --- a/.github/linters/.cspell.json +++ b/.github/linters/.cspell.json @@ -61,7 +61,9 @@ "datacategorygroups", "destructiveignore", "destructiveinclude", + "depcheck", "emailservices", + "eslintcache", "firstsha", "flexipage", "flexipages", @@ -140,6 +142,7 @@ "testlevel", "testtest", "trivyignore", + "tsbuildinfo", "unmanaged", "unmocked", "unpackaged", @@ -152,6 +155,7 @@ "wearerequired", "weblink", "weblinks", + "wireit", "wlens", "xmlbuilder", "yarnrc", diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml index c254285a..eb303cd3 100644 --- a/.github/workflows/reusable-build.yml +++ b/.github/workflows/reusable-build.yml @@ -18,12 +18,13 @@ jobs: - name: Setup dependencies, cache and install uses: ./.github/actions/install - - name: Build plugin + - uses: google/wireit@setup-github-actions-caching/v1 + - name: Build plugin run: yarn pack - name: Unit test - run: yarn test:unit:coverage --runInBand + run: yarn test:unit -- --runInBand - name: Upload coverage uses: codecov/codecov-action@v3 diff --git a/.gitignore b/.gitignore index b78756b0..58448baf 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,5 @@ perf-result.txt .stryker-tmp megalinter-reports/ +.wireit +.eslintcache diff --git a/.husky/pre-push b/.husky/pre-push index 0732679d..a330e76d 100755 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -1,11 +1,8 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" -yarn lint yarn pack -yarn test:unit:coverage -yarn test:nut -yarn analysis src +yarn test npm outdated || true yarn npm audit || true yarn lint:dependencies || true diff --git a/.prettierrc.json b/.prettierrc.json index e4df4740..4a3c6b92 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -3,5 +3,6 @@ "tabWidth": 2, "semi": false, "arrowParens": "avoid", - "singleQuote": true + "singleQuote": true, + "endOfLine":"auto" } \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index af544b42..517ffbd8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -45,9 +45,6 @@ When developing, use [jest](https://jestjs.io/en/) unit testing to provide test ```bash # just run test yarn test:unit - -# run test with coverage details -yarn test:unit:coverage ``` To execute a particular test, use the following command: diff --git a/README.md b/README.md index f3af2210..8b56a6eb 100644 --- a/README.md +++ b/README.md @@ -188,7 +188,7 @@ OPTIONS this command invocation ``` -_See code: [src/commands/sgd/source/delta.ts](https://github.com/scolladon/sfdx-git-delta/blob/main/src/commands/sgd/source/delta.ts)_ +_See code: [src/commands/sgd/source/delta.ts](https://github.com/scolladon/sfdx-git-delta/blob/v5.36.0/src/commands/sgd/source/delta.ts)_ ### Windows users diff --git a/package.json b/package.json index c92cb054..6196904a 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "async": "^3.2.5", "fast-xml-parser": "^4.3.4", "fs-extra": "^11.2.0", - "ignore": "^5.3.0", + "ignore": "^5.3.1", "isomorphic-git": "^1.25.3", "lodash": "^4.17.21", "simple-git": "^3.22.0", @@ -41,30 +41,133 @@ }, "homepage": "https://github.com/scolladon/sfdx-git-delta#readme", "scripts": { - "analysis": "codeclimate analyze", - "clean": "shx rm -rf lib 'reports/*' .nyc_output oclif.manifest.json package.tgz 'sfdx-git-delta-v*.tgz' 'stderr*.txt' 'stdout*.txt' '.stryker-tmp/*' perf-result.txt", + "build": "wireit", + "clean": "wireit", + "dependencies:reinstall": "git diff HEAD^ HEAD --exit-code --quiet -- ./yarn.lock || yarn", + "dependencies:upgrade": "shx rm -rf yarn.lock ; shx touch yarn.lock ; yarn-upgrade-all ; yarn-audit-fix", "increment:apiversion": "bash ./tooling/incrementApiVersion.sh", - "lint": "eslint src/", - "lint:dependencies": "depcheck", - "lint:fix": "eslint --fix src/", - "test": "yarn test:unit && yarn test:nut", + "lint": "wireit", + "lint:dependencies": "wireit", + "test": "wireit", "test:build": "yarn clean ; shx rm -rf .yarn/cache node_modules ; yarn && yarn pack && yarn test", - "test:mutation": "stryker run", - "test:nut": "nyc mocha **/*.nut.ts", + "test:mutation": "wireit", + "test:nut": "wireit", "test:perf": "node __tests__/perf/bench.mjs | tee perf-result.txt", - "test:unit": "jest", - "test:unit:clear:cache": "jest --clearCache", - "test:unit:coverage": "jest --coverage", + "test:unit": "wireit", "test:unit:debug": "node --inspect node_modules/.bin/jest", "test:unit:debug:break": "node --inspect-brk node_modules/.bin/jest", - "test:unit:watch": "jest --watch", - "build": "tsc -b", "postpack": "shx rm -f oclif.manifest.json && prettier --write README.md", - "prebuild": "yarn clean", "prepack": "yarn build && oclif-dev manifest && oclif-dev readme", - "prepare": "husky install", - "dependencies:reinstall": "git diff HEAD^ HEAD --exit-code --quiet -- ./yarn.lock || yarn", - "dependencies:upgrade": "shx rm -rf yarn.lock ; shx touch yarn.lock ; yarn-upgrade-all ; yarn-audit-fix" + "prepare": "husky install" + }, + "wireit": { + "build": { + "dependencies": [ + "compile", + "lint" + ] + }, + "clean": { + "command": "shx rm -rf lib 'reports/*' .nyc_output oclif.manifest.json package.tgz 'sfdx-git-delta-v*.tgz' 'stderr*.txt' 'stdout*.txt' '.stryker-tmp/*' perf-result.txt", + "files": [ + "lib", + "reports/*", + ".nyc_output", + "oclif.manifest.json", + "package.tgz", + "sfdx-git-delta-v*.tgz", + "stderr*.txt", + "stdout*.txt", + ".stryker-tmp/*", + "perf-result.txt" + ] + }, + "compile": { + "command": "tsc -p . --incremental", + "files": [ + "src/**/*.ts", + "**/tsconfig.json", + "messages/**" + ], + "output": [ + "lib/**", + "*.tsbuildinfo" + ], + "clean": "if-file-deleted" + }, + "lint": { + "command": "eslint src __tests__ --cache --cache-location .eslintcache", + "files": [ + "src/**/*.ts", + "test/**/*.ts", + "messages/**", + "**/.eslint*", + "**/tsconfig.json" + ], + "output": [] + }, + "lint:dependencies": { + "command": "depcheck", + "files": [ + "src/**/*.ts", + "test/**/*.ts", + "messages/**", + "**/tsconfig.json", + ".depcheckrc" + ], + "output": [] + }, + "test": { + "dependencies": [ + "test:unit", + "test:nut" + ] + }, + "test:mutation": { + "command": "stryker run", + "files": [ + "src/**/*.ts", + "test/**/*.ts", + "messages/**", + "**/tsconfig.json" + ], + "output": [ + ".stryker-tmp/**" + ], + "dependencies": [ + "lint" + ] + }, + "test:nut": { + "command": "nyc mocha **/*.nut.ts", + "files": [ + "src/**/*.ts", + "test/**/*.ts", + "messages/**", + "**/tsconfig.json" + ], + "output": [ + ".nyc_output/**" + ], + "dependencies": [ + "build" + ] + }, + "test:unit": { + "command": "jest --coverage", + "files": [ + "src/**/*.ts", + "test/**/*.ts", + "messages/**", + "**/tsconfig.json" + ], + "output": [ + "reports/coverage/**" + ], + "dependencies": [ + "lint" + ] + } }, "devDependencies": { "@commitlint/cli": "^18.6.0", @@ -80,7 +183,7 @@ "@types/async": "^3.2.24", "@types/jest": "^29.5.11", "@types/mocha": "^10.0.6", - "@types/node": "^20.11.10", + "@types/node": "^20.11.15", "@typescript-eslint/eslint-plugin": "^6.20.0", "@typescript-eslint/parser": "^6.20.0", "benchmark": "^2.1.4", @@ -92,7 +195,7 @@ "eslint-plugin-prettier": "^5.1.3", "husky": "^9.0.7", "jest": "^29.7.0", - "lint-staged": "^15.2.0", + "lint-staged": "^15.2.1", "mocha": "^10.2.0", "nyc": "^15.1.0", "prettier": "^3.2.4", @@ -101,6 +204,7 @@ "ts-jest": "^29.1.2", "ts-node": "^10.9.2", "typescript": "^5.3.3", + "wireit": "^0.14.4", "yarn-audit-fix": "^10.0.7", "yarn-upgrade-all": "^0.7.2" }, diff --git a/yarn.lock b/yarn.lock index 555e3c48..b4b91f8c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -97,8 +97,8 @@ __metadata: linkType: hard "@babel/helper-create-class-features-plugin@npm:^7.23.6, @babel/helper-create-class-features-plugin@npm:^7.23.9": - version: 7.23.9 - resolution: "@babel/helper-create-class-features-plugin@npm:7.23.9" + version: 7.23.10 + resolution: "@babel/helper-create-class-features-plugin@npm:7.23.10" dependencies: "@babel/helper-annotate-as-pure": ^7.22.5 "@babel/helper-environment-visitor": ^7.22.20 @@ -111,7 +111,7 @@ __metadata: semver: ^6.3.1 peerDependencies: "@babel/core": ^7.0.0 - checksum: 0f0c8592ec8833c0fd1d131655de929af07942fd626049d1e8fae5d85c1fe33fad97f7e9457a14b10258bc926a0cb39debc54a553abe8b4f7575c446d1c16d80 + checksum: ff0730c21f0e73b9e314701bca6568bb5885dff2aa3c32b1e2e3d18ed2818f56851b9ffdbe2e8008c9bb94b265a1443883ae4c1ca5dde278ce71ac4218006d68 languageName: node linkType: hard @@ -2244,12 +2244,12 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:*, @types/node@npm:^20.11.10": - version: 20.11.10 - resolution: "@types/node@npm:20.11.10" +"@types/node@npm:*, @types/node@npm:^20.11.15": + version: 20.11.15 + resolution: "@types/node@npm:20.11.15" dependencies: undici-types: ~5.26.4 - checksum: 58544f52c14d839cc5fca7a9f001303016aefa85fea684de9aa3c24a1340a55a03a6744fa20f601ca032a9f9d08b32c1ff074ccb75dcd57d61a1a65c50a949b1 + checksum: 80fe17561636e6e72a0264c26232ea4c46b5ee700888a703f06ae6c9115a2dadb16ccd09b79aa2c66a07cb547a201b2609ab939b9bde42bdad56eeefd161bc12 languageName: node linkType: hard @@ -3004,9 +3004,9 @@ __metadata: linkType: hard "available-typed-arrays@npm:^1.0.5": - version: 1.0.5 - resolution: "available-typed-arrays@npm:1.0.5" - checksum: 20eb47b3cefd7db027b9bbb993c658abd36d4edd3fe1060e83699a03ee275b0c9b216cc076ff3f2db29073225fb70e7613987af14269ac1fe2a19803ccc97f1a + version: 1.0.6 + resolution: "available-typed-arrays@npm:1.0.6" + checksum: 8295571eb86447138adf64a0df0c08ae61250b17190bba30e1fae8c80a816077a6d028e5506f602c382c0197d3080bae131e92e331139d55460989580eeae659 languageName: node linkType: hard @@ -3361,9 +3361,9 @@ __metadata: linkType: hard "caniuse-lite@npm:^1.0.30001580": - version: 1.0.30001581 - resolution: "caniuse-lite@npm:1.0.30001581" - checksum: ca4e2cd9d0acf5e3c71fa2e7cd65561e4532d32b640145f634c333792074bb63de1239b35abfb6b6d372f97caf26f8d97faac7ba51ef190717ad2d3ae9c0d7a2 + version: 1.0.30001582 + resolution: "caniuse-lite@npm:1.0.30001582" + checksum: 2fc420cb6e6080a9808781ff81a2f0d37d63897c8c981d477001be18e55c8ec33422cf966e49efdca61d4a5335d16a4d6a09d5bd6da22a8396d0dcd350b9b9da languageName: node linkType: hard @@ -3476,7 +3476,7 @@ __metadata: languageName: node linkType: hard -"chokidar@npm:3.5.3": +"chokidar@npm:3.5.3, chokidar@npm:^3.5.3": version: 3.5.3 resolution: "chokidar@npm:3.5.3" dependencies: @@ -4418,9 +4418,9 @@ __metadata: linkType: hard "electron-to-chromium@npm:^1.4.648": - version: 1.4.650 - resolution: "electron-to-chromium@npm:1.4.650" - checksum: cec3f3b4ec844f175d7802731f91fd6e40c85065796706dd7719a238f7ec08d057ba67dd44da89a6b349b58d9e5e082c53f0d8cbc34f5765e4910cb757a265d9 + version: 1.4.653 + resolution: "electron-to-chromium@npm:1.4.653" + checksum: 5e1fb48e749811f4384cd7a9940585a124f46d2a9f5bdfd2d7e79685d55db448433da303bd0fb6c3665ed052299843b5661319e10119821defbc3be8ff8eb060 languageName: node linkType: hard @@ -4996,7 +4996,7 @@ __metadata: languageName: node linkType: hard -"fast-glob@npm:^3.0.3, fast-glob@npm:^3.2.9, fast-glob@npm:^3.3.1": +"fast-glob@npm:^3.0.3, fast-glob@npm:^3.2.11, fast-glob@npm:^3.2.9, fast-glob@npm:^3.3.1": version: 3.3.2 resolution: "fast-glob@npm:3.3.2" dependencies: @@ -5931,10 +5931,10 @@ __metadata: languageName: node linkType: hard -"ignore@npm:^5.1.1, ignore@npm:^5.1.4, ignore@npm:^5.2.0, ignore@npm:^5.2.4, ignore@npm:^5.3.0": - version: 5.3.0 - resolution: "ignore@npm:5.3.0" - checksum: 2736da6621f14ced652785cb05d86301a66d70248597537176612bd0c8630893564bd5f6421f8806b09e8472e75c591ef01672ab8059c07c6eb2c09cefe04bf9 +"ignore@npm:^5.1.1, ignore@npm:^5.1.4, ignore@npm:^5.2.0, ignore@npm:^5.2.4, ignore@npm:^5.3.1": + version: 5.3.1 + resolution: "ignore@npm:5.3.1" + checksum: 71d7bb4c1dbe020f915fd881108cbe85a0db3d636a0ea3ba911393c53946711d13a9b1143c7e70db06d571a5822c0a324a6bcde5c9904e7ca5047f01f1bf8cd3 languageName: node linkType: hard @@ -7180,6 +7180,13 @@ __metadata: languageName: node linkType: hard +"jsonc-parser@npm:^3.0.0": + version: 3.2.1 + resolution: "jsonc-parser@npm:3.2.1" + checksum: 656d9027b91de98d8ab91b3aa0d0a4cab7dc798a6830845ca664f3e76c82d46b973675bbe9b500fae1de37fd3e81aceacbaa2a57884bf2f8f29192150d2d1ef7 + languageName: node + linkType: hard + "jsonfile@npm:^4.0.0": version: 4.0.0 resolution: "jsonfile@npm:4.0.0" @@ -7361,29 +7368,29 @@ __metadata: languageName: node linkType: hard -"lint-staged@npm:^15.2.0": - version: 15.2.0 - resolution: "lint-staged@npm:15.2.0" +"lint-staged@npm:^15.2.1": + version: 15.2.1 + resolution: "lint-staged@npm:15.2.1" dependencies: chalk: 5.3.0 commander: 11.1.0 debug: 4.3.4 execa: 8.0.1 lilconfig: 3.0.0 - listr2: 8.0.0 + listr2: 8.0.1 micromatch: 4.0.5 pidtree: 0.6.0 string-argv: 0.3.2 yaml: 2.3.4 bin: lint-staged: bin/lint-staged.js - checksum: 4fb178b8d3ff454f7874697dfbd41017630f61a06296d12ac9dfd578d078c70aff7108b67fab38af94896ef2740a1e7541c1512d0d3c688ed90e6c3af3530f0d + checksum: d2b0361b311cb3384e58a5d4bfd5d34e6ff6ad41e5ea5dcc87c65379ea6e280c84f0a037df147355963dcf4d3dc1487795e3132c38e1bc5511b25889f405e189 languageName: node linkType: hard -"listr2@npm:8.0.0": - version: 8.0.0 - resolution: "listr2@npm:8.0.0" +"listr2@npm:8.0.1": + version: 8.0.1 + resolution: "listr2@npm:8.0.1" dependencies: cli-truncate: ^4.0.0 colorette: ^2.0.20 @@ -7391,7 +7398,7 @@ __metadata: log-update: ^6.0.0 rfdc: ^1.3.0 wrap-ansi: ^9.0.0 - checksum: 5cb110a710d14488c71d2207fc5141256abb1f21cbe5ebc12177ae640f94e040a1ef8c031b70ff9f24c4a8fa57c0825a54b534e52bdfaffc122a81082faae8ed + checksum: 4dfeabfa037b3981d0edbf30789971ba727ba4cfcc13051ceaff7a1b3d26509ef2d946015c65c600b0775ec9d1ef58a81937d94c9c03de464b654f429cc7c3ed languageName: node linkType: hard @@ -7713,11 +7720,11 @@ __metadata: linkType: hard "magic-string@npm:^0.30.5": - version: 0.30.5 - resolution: "magic-string@npm:0.30.5" + version: 0.30.6 + resolution: "magic-string@npm:0.30.6" dependencies: "@jridgewell/sourcemap-codec": ^1.4.15 - checksum: da10fecff0c0a7d3faf756913ce62bd6d5e7b0402be48c3b27bfd651b90e29677e279069a63b764bcdc1b8ecdcdb898f29a5c5ec510f2323e8d62ee057a6eb18 + checksum: d6d825aeccfc6eea2b27423e34d51b315ff81f1bfa35c5978c0e82486fdbb4f71777aa144c0f04f4c7cbe4fe531a38cbeff928a0abaf511cf75ec7691ed9e117 languageName: node linkType: hard @@ -8267,15 +8274,15 @@ __metadata: linkType: hard "nise@npm:^5.1.5": - version: 5.1.7 - resolution: "nise@npm:5.1.7" + version: 5.1.9 + resolution: "nise@npm:5.1.9" dependencies: "@sinonjs/commons": ^3.0.0 "@sinonjs/fake-timers": ^11.2.2 "@sinonjs/text-encoding": ^0.7.2 just-extend: ^6.2.0 path-to-regexp: ^6.2.1 - checksum: bc1f43825ffb9572a1abea37386c3d847b965d7aca40ca899a6f37400cf2d6405a4738efa03991c276cb738e5b80bdc24dffeba24c45085d1cc6251199f27312 + checksum: ab9fd6eabc98170f18aef6c9567983145c1dc62c7aef46eda0fea754083316c1f0f9b2c32e9b4bfdd25122276d670293596ed672b54dd1ffa8eb58b56a30ea95 languageName: node linkType: hard @@ -9807,7 +9814,7 @@ __metadata: "@types/async": ^3.2.24 "@types/jest": ^29.5.11 "@types/mocha": ^10.0.6 - "@types/node": ^20.11.10 + "@types/node": ^20.11.15 "@typescript-eslint/eslint-plugin": ^6.20.0 "@typescript-eslint/parser": ^6.20.0 async: ^3.2.5 @@ -9821,10 +9828,10 @@ __metadata: fast-xml-parser: ^4.3.4 fs-extra: ^11.2.0 husky: ^9.0.7 - ignore: ^5.3.0 + ignore: ^5.3.1 isomorphic-git: ^1.25.3 jest: ^29.7.0 - lint-staged: ^15.2.0 + lint-staged: ^15.2.1 lodash: ^4.17.21 mocha: ^10.2.0 nyc: ^15.1.0 @@ -9835,6 +9842,7 @@ __metadata: ts-jest: ^29.1.2 ts-node: ^10.9.2 typescript: ^5.3.3 + wireit: ^0.14.4 xmlbuilder2: ^3.1.1 yarn-audit-fix: ^10.0.7 yarn-upgrade-all: ^0.7.2 @@ -11240,6 +11248,21 @@ __metadata: languageName: node linkType: hard +"wireit@npm:^0.14.4": + version: 0.14.4 + resolution: "wireit@npm:0.14.4" + dependencies: + braces: ^3.0.2 + chokidar: ^3.5.3 + fast-glob: ^3.2.11 + jsonc-parser: ^3.0.0 + proper-lockfile: ^4.1.2 + bin: + wireit: bin/wireit.js + checksum: 38bc038d965858272b0245448689d693cc03657e8ed57cc1158835b155eb5b8daeeb5f223267b2a97add079ad7739df7324d9fe50d613f850a720deefaf28dd0 + languageName: node + linkType: hard + "wordwrap@npm:^1.0.0": version: 1.0.0 resolution: "wordwrap@npm:1.0.0"