- 
                Notifications
    
You must be signed in to change notification settings  - Fork 2
 
christian/bundling-improvements-for-types #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Package Size Increased by Missing Files Array
The files array was removed from package.json. This causes all files (except those ignored by .gitignore/.npmignore) to be included in the published npm package by default. This unnecessarily increases package size and can expose development files, source code, and other internal details. The files array should be re-added, specifying ["dist/"] to only publish the built output.
package.json#L1-L56
Lines 1 to 56 in 228047e
| { | |
| "name": "@onkernel/cu-playwright", | |
| "version": "0.1.2", | |
| "type": "module", | |
| "description": "Computer Use x Playwright SDK", | |
| "author": "Kernel", | |
| "license": "MIT", | |
| "keywords": [ | |
| "computer-use", | |
| "playwright", | |
| "anthropic", | |
| "automation", | |
| "ai", | |
| "typescript" | |
| ], | |
| "repository": { | |
| "type": "git", | |
| "url": "" | |
| }, | |
| "scripts": { | |
| "build": "bunchee --clean src/index.ts", | |
| "format": "bun run eslint . --fix", | |
| "lint": "bun run eslint .", | |
| "lint:fix": "bun run eslint . --fix", | |
| "prepublishOnly": "bun run lint && bun run build" | |
| }, | |
| "peerDependencies": { | |
| "typescript": "^5", | |
| "playwright": "^1.53.0", | |
| "playwright-core": "^1.53.0" | |
| }, | |
| "dependencies": { | |
| "@anthropic-ai/sdk": "0.52.0", | |
| "luxon": "3.6.0", | |
| "zod": "^3.25.0", | |
| "zod-to-json-schema": "^3.23.1" | |
| }, | |
| "devDependencies": { | |
| "@eslint/js": "^9.0.0", | |
| "@typescript-eslint/eslint-plugin": "^8.0.0", | |
| "@typescript-eslint/parser": "^8.0.0", | |
| "bunchee": "^6.5.4", | |
| "eslint": "^9.0.0", | |
| "eslint-config-prettier": "^9.0.0" | |
| }, | |
| "publishConfig": { | |
| "access": "public" | |
| }, | |
| "main": "./dist/index.js", | |
| "exports": { | |
| ".": { | |
| "import": "./dist/index.js", | |
| "types": "./dist/index.d.ts" | |
| } | |
| } | |
| } | 
Was this report helpful? Give feedback by reacting with 👍 or 👎
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What Changed
This PR overhauls the project's build process and structure. The key change is the migration from bun build to bunchee for bundling, as reflected in package.json. To support this, the source code has been reorganized into a src/ directory, with src/index.ts now serving as the main entry point. Type definitions have also been refactored and moved into the src directory, and the exports field in package.json has been updated accordingly to point to the new build artifacts in dist/.
Risks / Concerns
The files array was removed from package.json. This is a concern because it could lead to publishing unnecessary source files and other artifacts, resulting in a bloated npm package. It's recommended to re-add this field, specifying the build output directory (e.g., ["dist"]) to ensure only essential files are published.
11 files reviewed | 1 comments | Review on Mesa | Edit Reviewer Settings
| }, | ||
| "scripts": { | ||
| "build": "bunchee --clean src/index.ts", | ||
| "format": "bun run eslint . --fix", | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The files array was completely removed from the package.json. This array controls which files are included when the package is published to npm. Without it, npm will include all files by default (except those in .npmignore/.gitignore), which could lead to publishing unwanted files or a bloated package. Consider adding a files array that includes the appropriate files for your new structure, likely something like ["dist/"] since you're building to the dist directory.
Type: Performance | Severity: Medium
Description
This PR improves the bundling configuration and fixes type-related issues in the project. The changes include switching to bunchee for better bundling performance and resolving TypeScript type errors.
Testing
Docs
Visual Proof
Please provide a screenshot or video demonstrating that your changes work locally:
Related Issue
Fixes [Github issue link]
Additional Notes