Skip to content

Commit

Permalink
build: migrate to wireit scripts (#779)
Browse files Browse the repository at this point in the history
  • Loading branch information
scolladon committed Feb 1, 2024
1 parent e42f94a commit abe8932
Show file tree
Hide file tree
Showing 10 changed files with 205 additions and 73 deletions.
7 changes: 5 additions & 2 deletions .depcheckrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
ignores: [
'@commitlint/*',
'@types/jest',
'@salesforce/*',
'@stryker-mutator/*',
'lint-staged',
'@types/jest',
'chai',
'depcheck',
'lint-staged',
'mocha',
'nyc',
'sinon',
]
4 changes: 4 additions & 0 deletions .github/linters/.cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@
"datacategorygroups",
"destructiveignore",
"destructiveinclude",
"depcheck",
"emailservices",
"eslintcache",
"firstsha",
"flexipage",
"flexipages",
Expand Down Expand Up @@ -140,6 +142,7 @@
"testlevel",
"testtest",
"trivyignore",
"tsbuildinfo",
"unmanaged",
"unmocked",
"unpackaged",
Expand All @@ -152,6 +155,7 @@
"wearerequired",
"weblink",
"weblinks",
"wireit",
"wlens",
"xmlbuilder",
"yarnrc",
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/reusable-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ perf-result.txt
.stryker-tmp

megalinter-reports/
.wireit
.eslintcache
5 changes: 1 addition & 4 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -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
3 changes: 2 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"tabWidth": 2,
"semi": false,
"arrowParens": "avoid",
"singleQuote": true
"singleQuote": true,
"endOfLine":"auto"
}
3 changes: 0 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)_
<!-- commandsstop -->

### Windows users
Expand Down
144 changes: 124 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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"
},
Expand Down
Loading

0 comments on commit abe8932

Please sign in to comment.