Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
e69b734 to
0dfe733
Compare
0dfe733 to
58d70c1
Compare
blakeembrey
left a comment
There was a problem hiding this comment.
I'm not sure we need to do both ESM and CommonJS, just CommonJS should be fine for a package like this.
Also the TypeScript refactor changes exports but this didn't update the README.
| "test-ci": "c8 --reporter=lcovonly --reporter=text npm test", | ||
| "test-cov": "c8 --reporter=html --reporter=text npm test" | ||
| "prepare": "husky", | ||
| "test": "vitest", |
There was a problem hiding this comment.
I prefer to have test run everything needed to pass, instead of configuring this in each place (e.g. local, CI, etc). That way everyone knows it's just npm test and if it passes you're good.
| "typecheck": "tsc --noEmit" | ||
| }, | ||
| "devDependencies": { | ||
| "@arethetypeswrong/core": "^0.18.2", |
| "devDependencies": { | ||
| "@arethetypeswrong/core": "^0.18.2", | ||
| "@eslint/js": "^9.39.2", | ||
| "@types/node": "^20.19.33", |
There was a problem hiding this comment.
This package shouldn't need @types/node now right?
| "prettier-plugin-packagejson": "^3.0.0", | ||
| "pretty-quick": "^4.2.2", | ||
| "publint": "^0.3.17", | ||
| "tsdown": "^0.20.3", |
There was a problem hiding this comment.
I'd prefer to just use the TypeScript compiler directly. This adds a bunch of overhead I don't need, e.g. without checking out this PR locally I can't confirm if it's generating the file structure with source maps and .d.ts files correctly, and it shouldn't be bundling any dependencies.
| "module": "preserve", | ||
| "moduleResolution": "bundler", | ||
| "resolveJsonModule": true, | ||
| "types": ["node"], |
There was a problem hiding this comment.
| "types": ["node"], | |
| "types": [], |
| "import": "./dist/index.js", | ||
| "require": "./dist/index.cjs" | ||
| }, | ||
| "./package.json": "./package.json" |
There was a problem hiding this comment.
Do we need to export package.json?
I'd love to know why. It's totally understandable to skip it as it's just something I started using once I was maintaining hundreds of packages and got sick of the config bloat of every package, as well as keeping up with minor changes/improvements to things like |
This PR is a full TypeScript rewrite of the package as suggested by @blakeembrey in #104 (comment). It also uses
tsdownto build a dual bundle: CommonJS for Node.js consumers and an ESM build for browsers and bundlers.This is another big step for #114.
Tooling
I tried to align the tooling as much as possible with Blake's
@borderless/ts-scriptsbut went for not using it directly. So the package now uses:tsdownas build tool (tsdown is powered byrolldown- the same bundler/transformer as vite 8 uses)vitestas testing tool with native typescript and coverage supporteslintandtypescript-eslintarethetypeswrongandpublintfor package validationprettieras formatterhuskyfor git hooks combined withpretty-quickto format only staged files