Skip to content

feat: core package build#139

Open
marcalexiei wants to merge 12 commits intostats-organization:npm-packagefrom
marcalexiei:core-build
Open

feat: core package build#139
marcalexiei wants to merge 12 commits intostats-organization:npm-packagefrom
marcalexiei:core-build

Conversation

@marcalexiei
Copy link
Copy Markdown


  • Build core package
  • Realtime typecheck between packages via customConditions
  • Use turbo to handle repo tasks

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 12, 2026

@marcalexiei is attempting to deploy a commit to the martin-mfg's projects Team on Vercel.

A member of the Team first needs to authorize it.

@marcalexiei marcalexiei changed the title Core build feat: core package build Apr 12, 2026
@@ -0,0 +1,21 @@
{
"$schema": "./node_modules/turbo/schema.json",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm curious why you use a local path here while the documentation proposes to use https://turborepo.dev/schema.json.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The remote version will be always the last version so it might not be in sync with the locally installed version.
Using the local version eliminates this potential discrepancy.

https://turborepo.dev/blog/turbo-2-4#schemajson-in-node_modules

@@ -1,19 +1,36 @@
// We need this file to be in ts to allow custom conditions to work
// At the moment we only
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It seems the end of this sentence is missing.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good catch. Thanks!

"exports": {
".": "./src/index.js"
".": {
"@stats/source": "./src/index.ts",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I roughly understand what this does, but I wonder why it's necessary. If we omit @stats/source everywhere and just export the *js files, isn't the result the same?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This article should give you a good overview: https://colinhacks.com/essays/live-types-typescript-monorepo

Check 5. Custom conditions in "exports"


It basically allows realtime type checking in the IDE without the need to rebuild them every time.

turbo.json Outdated
"dev": {
"persistent": true
},
"test": {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I started learning about turbo yesterday, so I might well be wrong, but I think we do not run test via turbo. So we don't need this config, right?

Also, I noticed that when I change something in the code of core, the test results of pnpm test don' reflect these changes. I have to run pnpm build:packages first and pnpm test afterwards for the test results to reflect my code changes. Imo this is a pitfall we should avoid. Can we make pnpm test execute build:packages first?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I added resolve.conditions to relevant vitest.config files.
Now when you are running vitest in watch mode and editing core files a test rerun is triggered.

Done via d36564a

@marcalexiei marcalexiei requested a review from martin-mfg April 14, 2026 02:25
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.

2 participants