Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename package to @primer/primitives #14

Merged
merged 14 commits into from
Oct 23, 2019
Merged

Rename package to @primer/primitives #14

merged 14 commits into from
Oct 23, 2019

Conversation

BinaryMuse
Copy link
Contributor

@BinaryMuse BinaryMuse commented Oct 21, 2019

This PR implements the move away from a monorepo and consolidation under @primer/primitives as described in #8.

  • Create @primer/primitives package at root
  • Remove lerna
  • Make old modules available at @primer/primitives/<module>
  • Add deprecation warnings to old npm packages (do this after @primer/primitives is published)
  • Update README and other documentation as appropriate

Fixes #8

@BinaryMuse
Copy link
Contributor Author

BinaryMuse commented Oct 22, 2019

@shawnbot I think the changes here would pretty much do it. I did have one thing I wanted to ask you about: in order to have, e.g., @primer/primitives/typography as a possible import, we need to either have top-level folders (/typography, /spacing, etc) at the top level of the repo, or we need to switch so that we "build" the data into a dist/ folder that has the structure we want. I'm personally fond of not having to depend on a build step, but also not a fan of having all these loose top-level folders (and we'll need to add more for any additional categories we add). Thoughts? 💭

(Edit: another thought I had was making the main import @primer/primitives and the others something like @primer/primitives/modules/typography)

@shawnbot
Copy link
Contributor

shawnbot commented Oct 22, 2019

A couple of thoughts:

  1. I like the brevity of import '@primer/primitives/spacing', so I think we should make that possible via either /spacing.js or /spacing/index.js (I prefer the latter).

  2. The only build step I'd expect to need is one that serializes each of the endpoints as JSON for other languages to consume. So our build step could serialize /spacing/index.js as /spacing.json, for instance.

  3. I feel like there's a disconnect between the words "primitives" and "theme" here, the latter being more specific. IMO, we should either:

    • Have index.js export colors, spacing, and typography so that the named exports match the individual entrypoints (import {spacing} from '@primer/primitives', instead of import {space}), then have a separate theme export (i.e. @primer/primitives/themetheme.js) that conforms to the theme-ui spec; or...

    • Publish a separate @primer/theme package that does the theme-ui thing.

I'm interested to hear what @emplums and @broccolini think too!

@BinaryMuse
Copy link
Contributor Author

I think I get where you're coming from. Although:

2. The only build step I'd expect to need is one that serializes each of the endpoints as JSON for other languages to consume

Since the files are already JSON, is there anything we would need to do at all?

@shawnbot
Copy link
Contributor

Since the files are already JSON, is there anything we would need to do at all?

Sorry, I don't know why I imagined them as JS. So yeah, no changes needed on that front! 😊

@BinaryMuse BinaryMuse marked this pull request as ready for review October 22, 2019 20:07
Copy link
Contributor

@emplums emplums left a comment

Choose a reason for hiding this comment

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

This looks good to me! I agree it's nice to have the theme as a separate export and fine with having different folders for each subfolder vs adding that as a build step!

@BinaryMuse
Copy link
Contributor Author

I agree it's nice to have the theme as a separate export

Cool, I like this as well. As I'm implementing these changes, all of the following are supported:

import theme from '@primer/primitives/theme'
import colors from '@primer/primitives/colors'
import typography from '@primer/primitives/typography'
// ...
import { theme, colors, typography } from '@primer/primitives'

The more I mess around with it, the more I'm in favor of exporting both theme and each of the other items (colors, typography, etc.) on the top-level object and not allowing the imports from @primer/primitives/<whatever> — it feels to me like it creates an additional API contract we have to maintain for no great benefit (since the import/require syntax works so well with destructuring already). But this opinion is fairly weakly held and I could be convinced pretty easily. :)

@shawnbot
Copy link
Contributor

The more I mess around with it, the more I'm in favor of exporting both theme and each of the other items (colors, typography, etc.) on the top-level object and not allowing the imports from @primer/primitives/<whatever> — it feels to me like it creates an additional API contract we have to maintain for no great benefit (since the import/require syntax works so well with destructuring already). But this opinion is fairly weakly held and I could be convinced pretty easily. :)

I'm totally on board with this. +1000 to fewer contracts to maintain!

@BinaryMuse
Copy link
Contributor Author

Sweet — in that case, the README is updated and this should be good to go.

Copy link
Contributor

@shawnbot shawnbot left a comment

Choose a reason for hiding this comment

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

Looking great! Let's ship this!

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
BinaryMuse and others added 2 commits October 22, 2019 15:42
Co-Authored-By: Shawn Allen <shawn.allen@github.com>
@emplums
Copy link
Contributor

emplums commented Oct 23, 2019

Wooooo!!! 🚢 it! 🎉

@BinaryMuse BinaryMuse merged commit cfddd1e into master Oct 23, 2019
@BinaryMuse BinaryMuse deleted the mkt/bye-lerna branch October 23, 2019 18:14
This was referenced Mar 25, 2021
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.

Rename primer-primitives to @primer/primitives
3 participants