nextcloud / standards

1 stars 0 forks source link

Release automation #2

Open juliushaertl opened 2 years ago

juliushaertl commented 2 years ago

It would be nice to have the changeling generation and npm releases handled through GitHub actions or at least have some docs on which steps to take. This showed up to be an issue when trying to release @nextcloud/moment but is the same for other npm packages we have in our organisation. Only @nextcloud/vue seems to be automated/documented currently.

skjnldsv commented 2 years ago

Same for apps releases on https://github.com/nextcloud-releases/

vinicius73 commented 2 years ago

I took the liberty of creating a gist to track all our NPM Packages.

https://gist.github.com/vinicius73/555d739de02a431fc8a2a33aa4e5cb69

The idea is to improve every package with better docs and a standard release process.

For the build process

About ESM

ESM (EcmaScript Modules) are largely compatible with node and browsers.

It allows tree shaking and modern tooling like Vite, Skypack and Parcel.

It is a big step of JavaScript ecosystem and there are some incompatibilities between CJS and ESM but we can handle it using rollup and adjusting our package.json and release process.

"main": "dist/index.js",
"module": "dist/index.esm.js",
"types": "dist/index.d.ts",
"exports": {
  "import": "./dist/index.esm.js",
  "require": "./dist/index.js"
},
"files": [
  "dist/"
],

It keeps every old-style package manager, node version, and bundler working without any issue.

About Docs

It is very important to make sure we have a good doc with good references about some parts of Nextcloud usage and development.

Packages with poor README.md files must be revised to make them better.

About NPM and GPR

Nowadays we have NPM and GPR (Github Package Registry) as public options to store and distribute javascripr packages.

The idea is improving the security and resilience of the JS ecosystem. All major npm front-ends (NPM, Yarn, pnpm) are able to use not only other registries, also github repos directly.

Also, we can publish in gitlab too.

vinicius73 commented 2 years ago

Related PR who I've already sent about this.

skjnldsv commented 2 years ago

I created a nice config with typescript, esm, esnext, vue for rollup in https://github.com/nextcloud/nextcloud-upload/blob/master/rollup.config.js Thank you for the help @vinicius73, your configs helped me understand a bit better the process.

Feel free to take inspiration on this. It works great and also generates typings.

skjnldsv commented 8 months ago

@susnux I guess we could all move to the vite config? We should document the requirements here for the final ticket:

susnux commented 8 months ago

Not sure how that is related? Yes I would recommend to use vite for bundling and recommend our shared config - also to get some feedback on how to improve there.

But not sure how this is connected to automated releases?

skjnldsv commented 8 months ago

In my head that was: unifying the config will help having the same release process But you're right, this could be two very distinct steps :see_no_evil: