Do some regular maintenance#59
Conversation
| check-latest: true | ||
| cache: npm | ||
|
|
||
| - name: Cache Node modules |
There was a problem hiding this comment.
Caching the node_modules introduces more overhead than just installing from the existing NPM cache, so I've removed it.
| - name: Run build | ||
| run: npm run build | ||
|
|
||
| - name: Run publication linter | ||
| run: npm run publint | ||
|
|
There was a problem hiding this comment.
Building and publication linting (see below) is now done on CI as well.
| node_modules | ||
| dist | ||
| coverage | ||
| .DS_Store |
There was a problem hiding this comment.
This file is already ignored by Git by default.
There was a problem hiding this comment.
I've moved the Jest configuration into a seperate file, as well as ensuring that it uses ESM all the way trough instead of compiling to CommonJS for testing.
| "test:coverage": "jest --coverage", | ||
| "test:watch": "jest --watch --verbose", | ||
| "build": "tsc", | ||
| "build": "shx rm -rf dist && tsc --project tsconfig.build.json", |
There was a problem hiding this comment.
The build step now also removes the dist directory to ensure we don't end up with ghost files.
| "build": "tsc", | ||
| "prepublishOnly": "npm run build" | ||
| "build": "shx rm -rf dist && tsc --project tsconfig.build.json", | ||
| "publint": "publint && attw . --pack --ignore-rules cjs-resolves-to-esm", |
There was a problem hiding this comment.
This now lints the package using publint and Are the Types Wrong? before publishing so that no mistakes are made.
| "ts-jest": "^27.1.3", | ||
| "typescript": "^4.5.5" | ||
| }, | ||
| "jest": { |
There was a problem hiding this comment.
Most of the Jest config has been replaced as not all options are needed any longer, it has also been moved to it's own file.
| "node" | ||
| ], | ||
| "clearMocks": true | ||
| "@arethetypeswrong/cli": "^0.15.3", |
There was a problem hiding this comment.
All dependencies have been upgraded to the latest versions.
There was a problem hiding this comment.
I've co-located the tests with the source files, this allows us to use the default Jest config.
There was a problem hiding this comment.
This file includes some type updates now that we're extending a stricter config.
There was a problem hiding this comment.
Some type adjustments had to be made in order to satisfy the stricter typescript config.
There was a problem hiding this comment.
The configuration for the build has been split out from the base config so we can deal with build-specific options here.
| @@ -1,30 +1,8 @@ | |||
| { | |||
| "extends": "@tsconfig/strictest/tsconfig.json", | |||
There was a problem hiding this comment.
We now extend the strictest config from the TSConfig bases, this reduces the amount of configuration we need to keep around ourselves.
Signed-off-by: Jon Koops <jonkoops@gmail.com>
| strategy: | ||
| matrix: | ||
| node: [14, 16, 18] | ||
| node: [18, 20, 22] |
There was a problem hiding this comment.
I've added all currently supported Node.js versions to the matrix.
|
@kbrabrand let me know if you'd like to review this one, otherwise I'll just merge it in as-is :) |
Takes care of some overdue maintenance I've been meaning to get to, check the comments below to understand the refactoring done.