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

Plugin Updates: Questions and Discussion #1

Closed
35 tasks
shellscape opened this issue Aug 17, 2019 · 10 comments
Closed
35 tasks

Plugin Updates: Questions and Discussion #1

shellscape opened this issue Aug 17, 2019 · 10 comments

Comments

@shellscape
Copy link
Collaborator

shellscape commented Aug 17, 2019

Rollup isn't going anywhere, and if anything is gaining steam month over month. Bringing the plugin ecosystem inline and to a common standard will be helpful for maintaining the org long-term. Rollup currently maintains 27 plugins.

Questions

  • Should we mandate the use of TypeScript in plugins?
  • Should we mandate that plugins have tests? (many currently do not)
  • Should we update plugin CI to the same CI stack that rollup/rollup uses?
  • Should we curate a single code style/convention in plugins? (there is a large variance between plugins currently)
  • Should we make a distinction between org-owned¹ plugins and user-owned plugins?
  • Should new plugins be scoped? (This has been discussed internally and agreed to in the affirmative, but it's worth reasserting in the open)
  • Should new major versions of plugins be scoped, and their non-scoped older versions be deprecated?
  • Should plugins be actively updated to drop older, out of LTS Node versions?

¹ org-owned plugins are defined as those plugins which originated in the org, rather than being transferred in by the original author

Plugins

Below is a list of all plugins currently within the org:

  • plugin-auto-install
  • rollup-plugin-commonjs
  • rollup-plugin-node-resolve
  • rollup-plugin-babel
  • rollup-plugin-typescript
  • rollup-plugin-alias (in progress @shellscape)
  • rollup-plugin-svelte
  • rollup-plugin-replace (archived & ready for migration @wesleygrimes)
  • rollup-plugin-multi-entry
  • rollup-plugin-json
  • rollup-plugin-inject
  • rollup-pluginutils
  • rollup-plugin-url
  • rollup-plugin-image
  • rollup-plugin-wasm
  • rollup-plugin-strip
  • rollup-plugin-virtual
  • rollup-plugin-sucrase
  • rollup-plugin-buble
  • rollup-plugin-ractive
  • rollup-plugin-yaml
  • rollup-plugin-run
  • rollup-plugin-butternut
  • rollup-plugin-dsv
  • rollup-plugin-legacy
  • rollup-plugin-node-builtins
  • rollup-starter-plugin

We'll use the list above to track updates according to the general consensus here.

@rollup/core let's discuss these questions

@shellscape
Copy link
Collaborator Author

shellscape commented Aug 17, 2019

I'll provide my take to kick this off. Any/all of these can be left alone and we can operate as the wild west - there's nothing wrong with that. This is more about getting these choices written down.

Should we mandate the use of TypeScript in plugins?

I leave this to the majority to decide.

Should we mandate that plugins have tests? (many currently do not)

Yes. This will provide a level of stability for plugins.

Should we update plugin CI to the same CI stack that rollup/rollup uses?

Yes. Consistency in CI will make maintenance less burdensome.

Should we curate a single code style/convention in plugins? (there is a large variance between plugins currently)
I think this would be good. To what level is up to the majority.

Should we make a distinction between org-owned¹ plugins and user-owned plugins?

I leave this to the majority to decide. This is tricky. Not making a distinction raises the bar for bringing a plugin into the org. A higher bar might mean more work for the original author, or friction with any conventions, should we adopt any.

Should new plugins be scoped? (This has been discussed internally and agreed to in the affirmative, but it's worth reasserting in the open)

Yes. @rollup/plugin-{desc..} is a good format.

Should new major versions of plugins be scoped, and their non-scoped older versions be deprecated?

Yes. Many other orgs have taken this path and it seems relatively frictionless. We should branch any repo which does this so critical fixes can be back-ported.

Should plugins be actively updated to drop older, out of LTS Node versions?

I think yes. There's benefit to keeping everything in-line. But I can see the benefit of leaving older, stable plugins alone at the same time. I leave this to the majority to decide.

@bterlson
Copy link

Here are my votes!

Should we mandate the use of TypeScript in plugins?

I say yes of course 😝 Maybe the best argument is it allows editors to show e.g. supported options in rollup config files. These files can get fairly complex...

A middle ground to consider is allowing both .ts and .js with @ts-check.

Should we mandate that plugins have tests? (many currently do not)

+1.

Should we update plugin CI to the same CI stack that rollup/rollup uses?

+1.

Should we curate a single code style/convention in plugins? (there is a large variance between plugins currently)

+1 to just adopt prettier or some equivalent.

Should we make a distinction between org-owned¹ plugins and user-owned plugins?

Org-owned go in the npm scope @rollup, user-owned are elsewhere.

Should new plugins be scoped? (This has been discussed internally and agreed to in the affirmative, but it's worth reasserting in the open)

+1.

Should new major versions of plugins be scoped, and their non-scoped older versions be deprecated?

+1.

Should plugins be actively updated to drop older, out of LTS Node versions?

Not sure about actively, but adopting a support policy that doesn't include unsupported Node versions would allow opportunistic improvements over time.

@Rich-Harris
Copy link

I think using scopes (@rollup/plugin-foo) makes total sense; that we should move existing org plugins over as new majors; that we should try to bring widely-used plugins into the org; and that we should ditch non-LTS node.

I don't think we should, or that we have the power to, mandate that every plugin author uses TypeScript and adopts the same approach to testing/CI etc. We can encourage them to do so, and be rigorous about applying those standards to plugins in the org, but I think that's probably as far as we should take it.

If we're striving for that degree of consistency, I wonder if it would be worth having a rollup/plugins monorepo?

(Re CI — is anyone looking at GitHub Actions? I've heard good things...)

@shellscape
Copy link
Collaborator Author

shellscape commented Aug 19, 2019

Have also heard good things about Github Actions, but have not been invited to the beta yet.

The monorepo idea is interesting. I don't have much experience setting them up (and I really don't want to be forced to use yarn) but that's perhaps a good opportunity. There have been some rivals to lerna and yarn workspaces that have come about recently. Here are my concerns with a monorepo, which may be moot, but they're worth listing:

  • issues in monorepos can get out of hand quickly. we have 27 plugins, for which we'd need a label for each.
  • CI setups for monorepos are quite a bit more complex and has to be done right
  • Entry for contributors isn't quite as smooth, with a larger learning curve.
  • Isolating contributors to a single plugin wouldn't be possible (Not saying we should do that, but the ability to do that goes out the window)

Obviously those are all worst-case scenario. If none of us thinks those are concerns that we should be ... concerned... with, then I'm good with that idea. It would make juggling many of the standardization things listed in the OP a lot easier for sure.

@guybedford @lukastaegert please chime in when you have a moment 😄

@lukastaegert
Copy link
Member

Thanks for taking the initiative here. Here are some of my two cents:

Should we mandate the use of TypeScript in plugins?

I think new plugins in the organization should be TS. There have been requests (and contrubtions) from the community to add types to node-resolve and commonjs, but being TS from the start would make these things much simpler. We could discuss how we want to manage typings for the JS builds. Having a public d.ts file that is copied into the dist folder worked very well for rollup and rollup-pluginutils (and provides probably the smallest possible amount of typings for JS builds), but there are other approaches like rollup-plugin-dts that we might want to take a look at.

On the other hand, it would be nice to have a sample JS approach for plugins that are not important enough to be converted so they still fulfill certain standards.

Should we mandate that plugins have tests?

Certainly for organization owned plugins. Open questions are what framework. Rollup itself uses Mocha, which works well with the thounsands of directory/sample based tests we have there. rollup-pluginutils uses Jest, which I think may work better for plugins. However the parallelization of Jest does not really kick in with the sample-based test approach as for Jest, everythings is basically part of the same test file and parallelization only occurs between different files. We could, however, consider changing the sample file format of the _config files to be valid test files. This would however create a lot more boilerplate code.

Another point here is that test-suites in plugins should use the strictDeprecations option to make sure plugins are always up to date with the latest Rollup changes.

Should we update plugin CI to the same CI stack that rollup/rollup uses?
+1

Should we curate a single code style/convention in plugins? (there is a large variance between plugins currently)

Definitely. prettier is definitely the way to go here. Having additional checks via TSLint worked well for Rollup, but we should probably switch to ESLint considering TSLint is about to die.

Should we make a distinction between org-owned¹ plugins and user-owned plugins?

Absolutely! Everyone should be encouraged to write plugins the way they like, the more the merrier, even if this causes some friction for users. To mitigate that, org-owned plugins should be highlighted sufficiently.

However to help people meet certain standards, it could be helpful to provide tools/boilerplate etc. so that people can build plugins that meet the official standards so that such a plugin could be easily added to the organization. And we should encourage people to use that if they want to have a chance that their plugin becomes official.

I remember that this is an approach that ESLint follows, where you get basically a free test setup and boilerplate if you create a plugin repo the official way.

Should new plugins be scoped?
+1 (for the org-owned plugins that is)

Should new major versions of plugins be scoped, and their non-scoped older versions be deprecated?

Maybe this could be like: New major versions that meet our standards highlighted above, so that the @rollup/ is like a mark of quality.

Should plugins be actively updated to drop older, out of LTS Node versions?

I think org-owned plugins should be in-sync with the version supported by Rollup. At the moment this is still Node 6 (and I remember there always happen to be some Linux users that for some weirds reasons are stuck on old distros), but there should be a major this year that switches to Node 8.

I also think that plugins should use the latest JS code + transpilation, either by setting the TypeScript target accordingly or adding a Babel setup with babel-plugin-env (I think node-resolve/commonjs do that at the moment). Then when a new major Rollup version is released, when can easily release new majors of the plugins that have the new Node version as target.

As for the monorepo discussion, I am slightly in favor with the caveat that plugins in the monorepo should be considered critical to the ecosystem. At the moment, this is mostly node-resolve and commonjs but we could certainly talk about others. Download statistics could be a guide here. However, commonjs is in my opinion in a very sorry shape. I find the code nearly impossible to understand with its long winded functions, few abstractions and complicated dependencies. It might be worthwhile to start a rewrite that focuses less on tree-shakeability and more on correctness. @guybedford had some ideas what the wrapper code could look like.

The big advantage I see is having a combined test-suite that also checks if new Rollup fixes break plugins. Also we can do combined releases.

@shellscape
Copy link
Collaborator Author

I think org-owned plugins should be in-sync with the version supported by Rollup. At the moment this is still Node 6 (and I remember there always happen to be some Linux users that for some weirds reasons are stuck on old distros), but there should be a major this year that switches to Node 8.

I'm in slight disagreement with this. Users are given an incredible amount of runway (upwards of a year) to prepare for the drop of a Node version from LTS, and with the Active LTS status, that time frame doubles. Continuing to support out-of-LTS versions is a hamstring to the project(s). Most of the major ecosystem projects drop out-of-LTS versions very quickly after their expiration. I'm a bit of a semver purist, and don't feel bashful about a new major number any time there's a breaking change - even if there aren't any patch or minor releases between majors.

While I don't necessarily agree with the Rollup core's approach to waiting on that transition, we've got the opportunity for a fresh start for the plugins, and my vote would go towards keeping plugins on the LTS path. We also don't have the requirement, nor contribution level, that plugins are versioned to core (such as Babel).

I am slightly in favor with the caveat that plugins in the monorepo should be considered critical to the ecosystem

That blurs the lines a bit. Asking everyday users to parse which are mission critical and which aren't is asking a bit too much. I think it'd be easy to highlight that in a README, which maintainers will pick up on pretty easily. We've got 27 plugins that have been maintained by the org at one point in time, so the precedent is there that they're org-supported. Unless we want to deprecate some of them, I believe they should all go into the monorepo, should we use one.

Download statistics could be a guide here.

I've actually written a script to query NPM for user-owned third-party modules, based on download counts, that we should approach to bring into the org. Will keep everyone posted about that.

@lukastaegert
Copy link
Member

While I don't necessarily agree with the Rollup core's approach to waiting on that transition, we've got the opportunity for a fresh start for the plugins, and my vote would go towards keeping plugins on the LTS path

If this includes plugins that Rollup depends on, then this would force Rollup core to update anyway or stick with outdated version as otherwise the tests will no longer run. I am not against switching the version sooner than later but against pushing a major just for the Node update and another for the next "small" breaking change. At the very least, all currently deprecated features should be removed as well and all features marked for upcoming deprecation should have their deprecation warnings switch on for all users. Plus it would be nice if someone wrote a few words about the next major release because major releases tend to get featured e.g. in "JavaScript Weekly"

The thing is, there is little disadvantage to sticking with Node 6 at the moment. The only big feature that is transpiled is async await, which is replaced with a generator syntax that is still very efficient and has nice error stacks.

My suggestion is to make this and any future switches for plugins as painless as possible by either using TypeScript directly or including Babel, at which point switching is a matter of changing a line in configuration. There would be no syntax restrictions in what plugins can use and only some restrictions with regard to prototype properties on builtins, but there weren't too many new ones after Node 6 AFAIK.

@shellscape
Copy link
Collaborator Author

If this includes plugins that Rollup depends on, then this would force Rollup core to update anyway or stick with outdated version as otherwise the tests will no longer run.

That's a good point. We can use Rollup as a devDependency and check the engines field of package.json during CI for those plugins, to prevent them from jumping core.

@wesleygrimes
Copy link

wesleygrimes commented Aug 21, 2019

Before jumping to @shellscape questions, I would like to echo @Rich-Harris comments on going with a mono-repo approach. It's a fantastic way to ensure consistency in tests, code style, linting, and even opens up possibilities for creating interesting and helpful e2e and integration tests. We also ensure that all of our plugins have a consistent dependency tree and can quickly resolve issues with security audits and nasty bugs.

You can still have independent release cycles and versions between the plugins even though they are in a shared monorepo.

That said, here's my take on @shellscape questions...

Should we mandate the use of TypeScript in plugins?

Yes, we could argue for days about the advantage/disadvantages of TypeScript, but as library maintainers, the choice becomes much more clear. If we want to present a consistent and unified platform for developers to use, we should go all-in on TypeScript.

While initially only adopted in the Angular (2+) community, it is gaining popularity in the React and Vue communities. Users are coming to expect that 3rd party libraries and tools are in TypeScript as they are writing their code in TypeScript. In addition, there will most certainly be non-official DefinitelyTyped type definitions cropping up, and we want to be heading that off at the pass by writing in TypeScript in the first place.

Should we mandate that plugins have tests? (many currently do not)

Yes, this will ensure reliability and build trust with our user base.

Should we update plugin CI to the same CI stack that rollup/rollup uses?

+1

Should we curate a single code style/convention in plugins? (there is a large variance between plugins currently)

Yes, plugins should use and enforce prettier and have opinionated linting running as part of the CI/CD flow.

Should we make a distinction between org-owned¹ plugins and user-owned plugins?

Yes. Should it be that org-owned plugins exist in the scoped packages and user-owned plugins do not? If we go mono-repo, org-owned plugins live in the MR and user-owned do not.

Should new plugins be scoped? (This has been discussed internally and agreed to in the affirmative, but it's worth reasserting in the open)

Yes definitely.

Should new major versions of plugins be scoped, and their non-scoped older versions be deprecated?

So are we saying adopt a roll-over approach? Scope them as breaking changes are made? It makes sense to me.

Should plugins be actively updated to drop older, out of LTS Node versions?

Yes, this adds a level of technical debt, maintenance and overhead.


Nice to meet ya'll. Looking forward to working with you.

@shellscape
Copy link
Collaborator Author

We've started the process! Going to close this in favor of rollup/plugins#2

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

No branches or pull requests

5 participants