Skip to content
This repository has been archived by the owner on Dec 3, 2024. It is now read-only.

fix: building components with rollup (BREAKING CHANGE) #536

Merged
merged 38 commits into from
Jan 18, 2022
Merged

Conversation

masone
Copy link
Contributor

@masone masone commented Dec 27, 2021

Todo:

  • issue a breaking change
  • test prerelease

References carforyou/carforyou-docs#147

Moving away from pika/pack, following the decisions outlined in the RFC above. Zero dependencies for a build

  • removed pika/pack
  • moved stories to .storybook for clearer separation
  • removed node entrypoint. it's not necessary with proper treeshaking

@autoricardo-bot autoricardo-bot deployed to branch-carforyou-components-pkg-esm-rollup January 5, 2022 13:19 Active
@autoricardo-bot autoricardo-bot deployed to branch-carforyou-components-pkg-esm-rollup January 5, 2022 13:34 Active
@masone masone changed the title fix: uilding components with rollup (BREAKING CHANGE) fix: building components with rollup (BREAKING CHANGE) Jan 12, 2022
@autoricardo-bot autoricardo-bot deployed to branch-carforyou-components-pkg-esm-rollup January 13, 2022 12:57 Active
@autoricardo-bot autoricardo-bot deployed to branch-carforyou-components-pkg-esm-rollup January 13, 2022 13:07 Active
@autoricardo-bot autoricardo-bot deployed to branch-carforyou-components-pkg-esm-rollup January 13, 2022 13:26 Active
@autoricardo-bot autoricardo-bot deployed to branch-carforyou-components-pkg-esm-rollup January 13, 2022 13:34 Active
@masone masone requested review from a team, GutierrezGo, ufkaya and Marine-Berthier and removed request for a team January 13, 2022 13:42
@masone masone marked this pull request as ready for review January 13, 2022 13:42
@autoricardo-bot autoricardo-bot deployed to branch-carforyou-components-pkg-esm-rollup January 13, 2022 13:54 Active
Copy link
Contributor

@lkappeler lkappeler left a comment

Choose a reason for hiding this comment

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

Nice job looks good to me

"path": "pkg/dist-web/index.js",
"maxSize": "25 kB"
"path": "pkg/cjs/index.js",
"maxSize": "30 kB"
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does it make the module bigger? Do we have node only deps?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the check was off - dist-web was building separate files since #459 and the check was only focussing on the entrypoint instead of the full bundle

@autoricardo-bot autoricardo-bot deployed to branch-carforyou-components-pkg-esm-rollup January 18, 2022 07:41 Active
Copy link
Member

@Averethel Averethel left a comment

Choose a reason for hiding this comment

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

Looks good to me, I have a few questions, nothing blocking though.

stories: ['../src/**/*.stories.@(js|tsx)'],
stories: ['./stories/**/*.stories.@(js|tsx)'],
Copy link
Member

Choose a reason for hiding this comment

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

Why are we piggybacking on collocating stories with components? We've put an effort into it to have it well grouped and improve developer experience in that regard. Interested to hear your motivation here.

Copy link
Member

Choose a reason for hiding this comment

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

Oh nvm, they weren't truly collocated, but in src/stories instead...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, I had the exactly same thought process - moving them all to src was not was we intended. since storybook and the build need different configs sometimes, I ended up separating completely

Copy link
Member

Choose a reason for hiding this comment

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

Do we still want to properly co-locate them? What is your view on it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see little benefit by now to be honest...

.storybook/stories.css Show resolved Hide resolved
@@ -2,8 +2,8 @@ import React, { FC } from "react"

import { StoryProps } from "./storyProps"
import StoryContainer from "./storyContainer"
import AlertMessage, { AlertMessageProps } from "../components/alertMessage"
import MailSent from "../../.storybook/icons/mailSent"
import AlertMessage, { AlertMessageProps } from "../../src/components/alertMessage"
Copy link
Member

Choose a reason for hiding this comment

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

Food for thought - if we import from the index we'd have a bit less pain moving those around. Plus it would fail if the component isn't exported from the package.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

very good point - I'll move that to another effort though

commonjs(),
typescript({
tsconfig: "./tsconfig.json",
exclude: ["**/__*__/**/*"],
Copy link
Member

Choose a reason for hiding this comment

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

Don't we need to exclude stories too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not now that they're in .storybook - that's one of the simplifications I was able to make with the move

import { DummyTooltip } from "../../../stories/badges/dummyTooltip"
import { DummyTooltip } from "../../../../.storybook/stories/badges/dummyTooltip"
Copy link
Member

Choose a reason for hiding this comment

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

I would've not expected to import from stories in tests, looks very weird.
Can we extract those dummy components somewhere where they are properly shared?
(not necessarily now, but in a follow-up tackled in due time)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

absolutely - had the same reaction. I already touched so many things in this PR and would like to push that to a separate effort

src/components/filters/input.tsx Show resolved Hide resolved
@autoricardo-bot autoricardo-bot deployed to branch-carforyou-components-pkg-esm-rollup January 18, 2022 10:47 Active
@autoricardo-bot autoricardo-bot temporarily deployed to branch-carforyou-components-pkg-esm-rollup January 18, 2022 12:09 Destroyed
@masone masone merged commit 102cb14 into master Jan 18, 2022
@masone masone deleted the esm-rollup branch January 18, 2022 12:25
@autoricardo-bot
Copy link
Collaborator

🎉 This PR is included in version 22.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging this pull request may close these issues.

4 participants