threepointone/glamor

Convert glamor to a monorepo

Closed this issue ยท 25 comments

Hello Glamor user! ๐Ÿ‘‹

Do you arrived here after seeing a deprecation warning like this?:

[Deprecation] In glamor v3 this file will be published as a standalone package: "glamor-*". See https://github.com/threepointone/glamor/issues/204 for more information.

If yes, than you'll probably want to look into our migration guide to find out how to fix this warning.

Below you'll find more in-depth information and discussion about this change and you can ask questions related to this issue. Thank you! ๐ŸŽ‰


This is a breaking change and part of the v3 roadmap: #83.

Motivation

To make it easier for glamor to add support for additional frameworks (e.g. #194) it would be useful, if we can publish framework level support as standalone packages. Framework specific dependencies can be managed separately and discoverability like the search on npmjs.com will better as we can tag the packages accordingly.

As an added benefit we probably get better tooling support in certain situations (e.g. better handling for TypeScript declarations as mentioned here: #49 (comment)).

TODOs

Note: It looks like some packages still miss a package.json (e.g. here). The version in lerna.json probably needs to match the version in the packages, too (see here). // cc @otbe

And what would be the right lerna command to create a new premajor version with next dist-tag?

lerna publish --npm-tag=next would publish the next tag instead of latest as documented here

Thanks. Okay, I've found that, too. But should I need to run $ npm version premajor in every package beforehand? (And later prerelease instead of premajor?) Or do I need to write the version I want in lerna.json and then run your command and lerna changes the versions of the packages?

Lerna will bump the sub packages when publishing. There is no need to maintain the version number in any sub packages. The only version that matters is lerna.json, which is controlled and bumped by lerna. Here is what publish does

Nevermind... I get a prompt to choose the version after lerna publish, right? ๐Ÿ‘

Thanks.

otbe commented

Btw: is there any reason why we not use a scoped package name (a la @glamor) for all the packages? I think it may help to distinguish between glamor supported and community provided packages (glamor-react vs @glamor/react)

I guess it was easier to start without scoped packages (no need to create a new npm user, no need to migrate glamor to something like @glamor/core or so...), but no other real reason...? ยฏ_(ใƒ„)_/ยฏ

Anyone who has an opinion on this? :)

otbe commented

ยฏ(ยฐ_o)/ยฏ

I did it as global packages in the initial PR because I wanted to get code up for review and separate package names was one less thing to discuss/deal with.

It's interesting to note that babel keeps the public namespace and that this works well for the scale of community-level plugins (and presets, etc), but I've also seen people grab names such as babel-preset-201xx who aren't affiliated with the babel project. If we use @glamor/*, I feel like it would still be weird to have a different project own the equivalent glamor-* package but don't have a strong opinion either way.

@otbe Looks like no one has a strong opinion about that. I'd pass the decision to you ๐Ÿ˜ƒ If you'd like to use scoped packages, feel free to create a new npm user ๐Ÿ˜„ Looks like glamor is still free. If we want that, we'd still need to rename the original glamor. After thinking about it I wouldn't recommend something like @glamor/core, because I think people could think that they would need another package to use glamor. When css becomes our bread and butter function (see #83) we could use @glamor/css. IMHO that would be a good name.

I have strong opinions :-) I think that there's not a single open source project that I know that uses scoped packages is an excellent reason for us to not use them.

Using scoped packages has no advantage so would needlessly confuse a high percentage of potential users. Let's just stick with gatsby-*.

Haha I meant glamor-*

Thank you. I highly appreciate feedback on this!

otbe commented

I cant imagine a reason why using @glamor should confuse anyone. Most of the time it is auto-imported (in case of TS) or at least autocompleted (path completion) while typing but nevertheless my opinion on this is not so strong. Lets keep glamor-* :)

By the way cycle uses scoped packages :)

I don't have a strong opinion on this, so I'll leave it up to you folks. I'd personally recommend keeping glamor-*, and don't mind other folks trying to get in on the fun, even if they're not part of the org. babel does this, no problems.

[btw, I'm just loving what you folks are doing. spending today to absorb the progress, will jump in once I'm comfortable]

and about time we add @ChristopherBiscardi to collaborators, I think? :)
[just did]

I just merged #207. @otbe just said that he probably wants to fix #210 soon. When he did this I'd publish the first v3 prerelease and release a v2 with deprecation warnings.

thanks for the add @threepointone :)

@donaldpipowitch I'll have #210 fixed soon.

#210 is closed now. Now I'll wait for a review of #214, because we added #212 to the v3 branch in the meantime. :)

After that everything should be fine for the first prerelease ๐Ÿ˜

Published ๐ŸŽ‰

$ npm i glamor@next
glamor@3.0.0-1

$ npm i glamor@latest
glamor@2.20.24

There's a depreciation message in the current version which links to this issue.

[Deprecation] In glamor v3 this file will be published as a standalone package: "glamor-server". See https://github.com/threepointone/glamor/issues/204 for more information.

It's confusing because this issue doesn't contain any information for users of glamor. How does it effect me? What should/can I do? What is this file?

The glamor-server readme is also empty and no help. I guess this will change soon, but at the moment the message is more confusing than helpful.

@electerious thanks for the feedback. In this case, it means that renderStatic and renderStaticOptimized are being moved to the glamor-server package in v3 (as opposed to glamor/server). There is a migration doc in the v3 branch.

You probably imported the file glamor/server somewhere, right? This file will not be part of glamor in v3. It will be (and currently is as a prerelease) published as a standalone package.
You can find more information about this in the migration guide which is linked in the first comment.

Thank you for your feedback. After your comment I think we could have found a better message for this deprecation. Instead of:

[Deprecation] In glamor v3 this file will be published as a standalone package: "glamor-server". See https://github.com/threepointone/glamor/issues/204 for more information.

Maybe this would have been better:

[Deprecation] You imported `glamor/server`. This file will not be a part of the next major release of glamor. It will be published as a standalone package called "glamor-server" instead. See https://github.com/threepointone/glamor/issues/204 for more information.

I'll also update the first comment to better reflect this.

(Edit: @ChristopherBiscardi was faster ๐Ÿ‘ )

Thanks for the help and clarification! :) The proposed message is less confusing.