Skip to content

Add prepublishOnly script to build dist before publishing - #46

Open
a1cd wants to merge 1 commit into
feyninc:mainfrom
a1cd:main
Open

Add prepublishOnly script to build dist before publishing#46
a1cd wants to merge 1 commit into
feyninc:mainfrom
a1cd:main

Conversation

@a1cd

@a1cd a1cd commented Apr 28, 2026

Copy link
Copy Markdown

This pull request fixes a bug in the package publishing workflow by ensuring the build process runs automatically before publishing. Currently dist for token doesn't end up in the published npm package. This PR should fix that.

  • Build process automation:
    • Added a prepublishOnly script to package.json to automatically run the build before publishing the package.…publishing

Summary by CodeRabbit

  • Chores
    • Improved package publication reliability by automating the build process to run automatically before each release, eliminating manual pre-publish build steps and ensuring consistent, properly compiled distributions.

…publishing (#1)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Apr 28, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Adds a prepublishOnly npm lifecycle hook to the token package that automatically executes the build pipeline (clean, tsc, tsc-alias) before publishing, removing the need for manual pre-publish build steps.

Changes

Cohort / File(s) Summary
npm Lifecycle Hook
packages/token/package.json
Added prepublishOnly script to automatically run the build pipeline (clean, tsc, tsc-alias) before package publication.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 Before the package hops away,
A hook ensures we build today,
No manual steps to slow the pace,
Clean, compile, alias—all in place! ✨
Automation makes the workflow flow,
Publish ready, off we go! 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add prepublishOnly script to build dist before publishing' clearly and accurately describes the main change: adding a prepublishOnly lifecycle hook to package.json that triggers the build process before publishing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@a1cd
a1cd marked this pull request as ready for review April 28, 2026 19:39
Copilot AI review requested due to automatic review settings April 28, 2026 19:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates the @chonkiejs/token package’s publish lifecycle so that dist/ is generated automatically during npm publish, preventing publishes that omit compiled output.

Changes:

  • Add a prepublishOnly script in packages/token/package.json to run the existing build step before publishing.

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/token/package.json (1)

23-28: Good fix: prepublishOnly will build before publish (but consider prepack for completeness).

prepublishOnly: "npm run build" is correctly placed in scripts and aligns with files: ["dist"] + main/types/exports pointing at dist/index.*, so publishing should now include compiled artifacts.

Optional hardening: if your workflow uses npm pack (or otherwise relies on the tarball being built even outside npm publish), consider using prepack (or adding it in addition to prepublishOnly) so the same build happens for packing too.

♻️ Optional diff
   "scripts": {
     "clean": "rimraf dist",
     "build": "npm run clean && tsc && tsc-alias -p tsconfig.json --resolve-full-paths",
     "prepublishOnly": "npm run build",
+    "prepack": "npm run build",
     "test": "echo 'No tests for `@chonkiejs/token` yet'"
   },
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/token/package.json` around lines 23 - 28, The package.json currently
uses "prepublishOnly": "npm run build" which ensures build before publish but
doesn't run when creating a tarball with npm pack; add a "prepack": "npm run
build" script (or add it alongside "prepublishOnly") so npm pack and other
workflows also produce the compiled dist artifacts; update the scripts block to
include "prepack" pointing to the same build command so "build" runs for both
pack and publish operations.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/token/package.json`:
- Around line 23-28: The package.json currently uses "prepublishOnly": "npm run
build" which ensures build before publish but doesn't run when creating a
tarball with npm pack; add a "prepack": "npm run build" script (or add it
alongside "prepublishOnly") so npm pack and other workflows also produce the
compiled dist artifacts; update the scripts block to include "prepack" pointing
to the same build command so "build" runs for both pack and publish operations.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f67472a9-7fbb-45a7-a5d4-b8c30e5d59be

📥 Commits

Reviewing files that changed from the base of the PR and between 0712ca7 and a0c9de9.

📒 Files selected for processing (1)
  • packages/token/package.json

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.

3 participants