Skip to content

Conversation

@mkcode
Copy link
Contributor

@mkcode mkcode commented Nov 5, 2025

This allows package installs from git refs to work properly, because it will build the dist dir.

With this I am able to reference my fork / changes included in #151 in via mkcode/better-auth#fixed and have it work seamlessly.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

This allows package installs from git refs to work properly, because it will build the dist dir.
Copilot AI review requested due to automatic review settings November 5, 2025 19:23
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a prepare script to the package.json that runs the build process. This ensures that the package is built automatically when dependencies are installed, which is particularly useful for git dependencies or when the package is linked locally via npm link.

Key Changes

  • Added a prepare npm lifecycle script that executes npm run build

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"build:cjs:generatePackageJson": "echo '{\\n \"type\": \"commonjs\"\\n}' > dist/commonjs/package.json",
"build:watch": "chokidar 'tsconfig*.json' 'src/**/*.{ts,tsx}' -c 'npm run build' --initial",
"typecheck": "tsc --noEmit",
"prepare": "npm run build",
Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The prepare script runs during npm install for all consumers, which could significantly slow down installation times. Consider using prepublishOnly (which is already present) for build automation before publishing, or use postinstall only if absolutely necessary. The prepare script is typically reserved for development dependencies setup, not full builds.

Suggested change
"prepare": "npm run build",

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prepare is not run when a package is installed via the npm registry, which is the most relevant case. This change will not increase the install time for developers using a tagged version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant