Skip to content

Chore: Solving TypeScript packaging issues#249

Merged
github-actions[bot] merged 1 commit intomainfrom
ts-packaging
Oct 5, 2025
Merged

Chore: Solving TypeScript packaging issues#249
github-actions[bot] merged 1 commit intomainfrom
ts-packaging

Conversation

@black7375
Copy link
Contributor

@black7375 black7375 commented Oct 5, 2025

Description

Fixes all package issues resulting from Are the types wrong.

image

Related Issue

Summary by CodeRabbit

  • Chores

    • Improved TypeScript declaration generation with dual-mode support for ESM/CJS builds.
    • Standardized published contents to include required nested package.json files across packages.
    • Added a build:full script to streamline release workflows.
    • Updated .gitignore to exclude workspace package.json variants and Nuxt dist-ssr outputs.
  • Refactor

    • Simplified build configuration by removing deprecated options and consolidating plugins for a cleaner, more reliable build process.

Additional context

Checklist

@black7375 black7375 added the config/build Config or Build system label Oct 5, 2025
@changeset-bot
Copy link

changeset-bot bot commented Oct 5, 2025

🦋 Changeset detected

Latest commit: 9699f0d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
@mincho-js/css-additional-types Patch
@mincho-js/transform-to-vanilla Patch
vite-config-custom Patch
@mincho-js/integration Patch
@mincho-js/debug-log Patch
@mincho-js/esbuild Patch
@mincho-js/babel Patch
@mincho-js/react Patch
@mincho-js/vite Patch
@mincho-js/css Patch
react-babel Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link

coderabbitai bot commented Oct 5, 2025

Walkthrough

Updates workspace packaging to include nested package.json files across multiple packages, modifies .gitignore, switches the Vite DTS setup to vite-plugin-dts-build’s dtsForEsm/dtsForCjs in configs/vite-config-custom, bumps that plugin version, removes a dependency, and adds a root build:full script. Adds a Changeset documenting patch releases.

Changes

Cohort / File(s) Summary
Changeset updates
./.changeset/tasty-ducks-turn.md
Adds patch-version entries for multiple @mincho-js packages and notes on using vite-plugin-dts-build dual mode.
Git ignore tweaks
./.gitignore
Ignores workspace package.json files under configs/, packages/, examples/ and adds Nuxt dist-ssr to ignore list.
Vite config + plugin upgrade
./configs/vite-config-custom/index.js, ./configs/vite-config-custom/package.json
Replaces dts plugin with dtsForEsm/dtsForCjs from vite-plugin-dts-build; removes PromisePool and custom DTS post-processing; updates devDependency to ^0.2.2 and drops @supercharge/promise-pool.
Root script addition
./package.json
Adds script build:full that sets PACKAGE_PUBLISH=true and runs task build.
Publish file-surface expansion
./packages/babel/package.json, ./packages/css-additional-types/package.json, ./packages/css/package.json, ./packages/debug-log/package.json, ./packages/esbuild/package.json, ./packages/integration/package.json, ./packages/react/package.json, ./packages/transform-to-vanilla/package.json, ./packages/vite/package.json
Adds "**/package.json" to files arrays to include nested package.json files in published artifacts; no runtime code changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Dev as Developer
  participant Vite as Vite Build
  participant DTS as vite-plugin-dts-build
  participant ESM as dtsForEsm
  participant CJS as dtsForCjs
  Dev->>Vite: Run build (PACKAGE_PUBLISH=true)
  Vite->>DTS: Initialize plugins
  DTS->>ESM: Generate ESM .d.ts
  DTS->>CJS: Generate CJS .d.ts
  note over ESM,CJS: Dual-mode DTS output<br/>(paths handled by plugin)
  Vite-->>Dev: Build artifacts + declarations
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Version Packages #117 — Overlapping changesets for @mincho-js/transform-to-vanilla and @mincho-js/css suggest related release/version adjustments.
  • Version Packages #77 — Similar packaging/version metadata edits for css, css-additional-types, transform-to-vanilla, and debug-log.

Poem

I thump my paws—new builds take flight,
Dual DTS hums, both day and night.
Package maps tucked neat inside,
Git’s broom sweeps the noisy tide.
With one full build, we leap and spin—
Patchy clouds, release begins.
(🐇✨)

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly conveys that this chore addresses packaging issues in TypeScript modules and aligns with the main changes which focus on updating packaging configurations across the repository without extraneous detail.
Description Check ✅ Passed The pull request description adheres to the repository template by including the required Description and Related Issue sections as well as the auto-generated summary tag, offering a clear summary and issue reference while maintaining the expected structure.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ts-packaging

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions
Copy link
Contributor

github-actions bot commented Oct 5, 2025

Triggered from #249 by @​black7375.

Checking if we can fast forward main (f1ca15c) to ts-packaging (9699f0d).

Target branch (main):

commit f1ca15cac81f1356b267060896b2c63cd871cfad (HEAD -> main, origin/main)
Author: alstjr7375 <alstjr7375@daum.net>
Date:   Thu Aug 7 00:00:00 2025 +0900

    Refactor: `hoistSelectors` makes to type-safe

Pull request (ts-packaging):

commit 9699f0d9628ec431f49dda9ef329d58516794189 (pull_request/ts-packaging)
Author: alstjr7375 <alstjr7375@daum.net>
Date:   Fri Aug 8 00:00:00 2025 +0900

    Chore: Solving TypeScript packaging issues

It is possible to fast forward main (f1ca15c) to ts-packaging (9699f0d). If you have write access to the target repository, you can add a comment with /fast-forward to fast forward main to ts-packaging.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
package.json (1)

15-15: Consider cross-platform environment variable syntax.

The PACKAGE_PUBLISH=true inline syntax works on Unix-like systems but may fail on Windows. Since other scripts in this file (e.g., line 32) use the same pattern, this is consistent with the project's approach.

If Windows compatibility is desired, consider using cross-env:

-    "build:full": "PACKAGE_PUBLISH=true yarn task build",
+    "build:full": "cross-env PACKAGE_PUBLISH=true yarn task build",

And add cross-env to devDependencies.

.changeset/tasty-ducks-turn.md (1)

14-15: Minor: Consider using a heading for "package".

The static analysis tool suggests converting the bolded text to a proper heading for better Markdown structure.

Apply this diff:

-**package**
+## package
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f1ca15c and 9699f0d.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (14)
  • .changeset/tasty-ducks-turn.md (1 hunks)
  • .gitignore (2 hunks)
  • configs/vite-config-custom/index.js (2 hunks)
  • configs/vite-config-custom/package.json (1 hunks)
  • package.json (1 hunks)
  • packages/babel/package.json (1 hunks)
  • packages/css-additional-types/package.json (1 hunks)
  • packages/css/package.json (1 hunks)
  • packages/debug-log/package.json (1 hunks)
  • packages/esbuild/package.json (1 hunks)
  • packages/integration/package.json (1 hunks)
  • packages/react/package.json (1 hunks)
  • packages/transform-to-vanilla/package.json (1 hunks)
  • packages/vite/package.json (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
.changeset/tasty-ducks-turn.md (2)
packages/vite/src/index.ts (2)
  • minchoVitePlugin (72-286)
  • transform (163-284)
packages/esbuild/src/index.ts (2)
  • setup (30-129)
  • minchoEsbuildPlugin (25-131)
🪛 markdownlint-cli2 (0.18.1)
.changeset/tasty-ducks-turn.md

14-14: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)

🔇 Additional comments (16)
configs/vite-config-custom/package.json (1)

9-14: Version bump aligns with the new dtsForEsm/Cjs flow.

Upgrading to ^0.2.2 matches the plugin guidance for dual-output declaration builds, so this dependency change looks correct. Based on learnings.

packages/css-additional-types/package.json (1)

44-48: Including nested package manifests preserves resolver metadata.

Shipping **/package.json alongside dist/ keeps the generated subpath manifests available to consumers, so this whitelist tweak looks good.

packages/transform-to-vanilla/package.json (1)

47-51: Files whitelist update looks correct.

Adding **/package.json ensures the runtime stubs accompanying your compiled outputs get published, preventing resolver gaps.

packages/react/package.json (1)

50-54: Shipping nested package.json files avoids subpath resolution issues.

The expanded files list will include the manifest stubs needed for the React package’s runtime/type splits, so this change looks good.

packages/babel/package.json (1)

39-43: Package manifest glob is a sensible addition.

Including **/package.json keeps any generated subpath metadata with the published bundle, which is exactly what the TypeScript packaging fix needs.

packages/css/package.json (1)

69-73: Expanded files list keeps declaration package.json stubs.

Publishing **/package.json alongside dist/ will prevent consumers from missing the helper manifests, so this update looks solid.

packages/vite/package.json (1)

40-44: Whitelist update matches the packaging fix.

With **/package.json included, the nested manifests generated during the build will ship correctly; no issues spotted.

packages/integration/package.json (1)

39-43: Nested package.json inclusion looks good.

This ensures any generated manifest stubs that TypeScript users rely on are part of the published artifact, so I’m on board with the change.

.gitignore (2)

45-48: LGTM! Gitignore patterns align with packaging strategy.

The patterns correctly ignore generated nested package.json files in workspace directories while preserving the root package.json files in each workspace. The glob pattern **/ will match files at any depth beyond the first level (e.g., packages/foo/dist/package.json).


98-98: LGTM! Addition of dist-ssr is appropriate.

Adding dist-ssr to the ignore list is correct for Nuxt.js server-side rendering build artifacts.

.changeset/tasty-ducks-turn.md (1)

1-15: LGTM! Changeset properly documents the scope of changes.

The changeset correctly lists all affected packages and provides a clear description linking to both the "Are the types wrong" tool and the dual mode feature being utilized.

configs/vite-config-custom/index.js (3)

11-11: LGTM! Import updated for dual-mode declaration generation.

The switch from dts to dtsForEsm and dtsForCjs aligns with vite-plugin-dts-build v0.2.2's dual-module declaration support, which generates matching declaration files for both ESM (.d.ts) and CJS (.d.cts) outputs.

Based on learnings.


40-44: LGTM! ESM declaration generation configured correctly.

The dtsForEsm plugin is properly configured with:

  • include: ["src"] to limit scope
  • tsconfigPath to ensure correct type resolution

This will generate .d.ts files for ESM module consumption.

Based on learnings.


46-53: Confirm dual-mode declaration output: please manually verify that a PUBLISH-mode build emits both ESM declarations (.d.ts/.d.mts) and CJS declarations (.d.cts) with matching module specifiers.

packages/debug-log/package.json (1)

45-50: Glob scope is safe; only root package.json matches
Verified with find: only package.json at the package root is included—no nested files will be published.

packages/esbuild/package.json (1)

39-43: Scope of **/package.json is safe
find lists only ./package.json; no nested files to be inadvertently published.

@black7375
Copy link
Contributor Author

/fast-forward

@github-actions
Copy link
Contributor

github-actions bot commented Oct 5, 2025

Triggered from #249 (comment) by @​black7375.

Trying to fast forward main (f1ca15c) to ts-packaging (9699f0d).

Target branch (main):

commit f1ca15cac81f1356b267060896b2c63cd871cfad (HEAD -> main, origin/main)
Author: alstjr7375 <alstjr7375@daum.net>
Date:   Thu Aug 7 00:00:00 2025 +0900

    Refactor: `hoistSelectors` makes to type-safe

Pull request (ts-packaging):

commit 9699f0d9628ec431f49dda9ef329d58516794189 (pull_request/ts-packaging)
Author: alstjr7375 <alstjr7375@daum.net>
Date:   Fri Aug 8 00:00:00 2025 +0900

    Chore: Solving TypeScript packaging issues

Fast forwarding main (f1ca15c) to ts-packaging (9699f0d).

$ git push origin 9699f0d9628ec431f49dda9ef329d58516794189:main
To https://github.com/mincho-js/mincho.git
   f1ca15c..9699f0d  9699f0d9628ec431f49dda9ef329d58516794189 -> main

@github-actions github-actions bot merged commit 9699f0d into main Oct 5, 2025
12 checks passed
@github-actions github-actions bot deleted the ts-packaging branch October 5, 2025 05:18
@github-actions github-actions bot mentioned this pull request Oct 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config/build Config or Build system

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant