Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

How to handle dist artefacts in commits logs #11

Open
4 of 7 tasks
ThaNarie opened this issue Jul 5, 2016 · 4 comments
Open
4 of 7 tasks

How to handle dist artefacts in commits logs #11

ThaNarie opened this issue Jul 5, 2016 · 4 comments
Assignees

Comments

@ThaNarie
Copy link
Member

ThaNarie commented Jul 5, 2016

We currently generate different output versions of the code in the dist folder, and commit them with every source change, so people that don't consume our module via NPM can grab the dist bundles from github (browser, amd, umd, commonjs, systemjs and es6).

Doing this, gives an enormous overhead in all the commits, where every change in the source results in 6 additional (large) bundle files being changed as well. This makes reviewing commits and PRs more overwhelming.

Ideally, we only want them in releases (tags), so I was wondering if we could find a better way to manage this?

Or should we skip generating them altogether (by default), and 1) only run them (manually) when upping the package.json version and creating a tag/release, or 2) let the consumer clone/build them and add them to the .gitignore?

We've chosen for option 2, and will add two additional methods of downloading them, via a hosted link and as a binary from the GitHub release.

@flut1
Copy link
Contributor

flut1 commented Jul 7, 2016

Is it possible to .gitignore the dist files, let travis generate them and output them to some http server? Then we can link to those dist versions from our README.

@flut1
Copy link
Contributor

flut1 commented Jul 7, 2016

@ThaNarie
Copy link
Member Author

ThaNarie commented Jul 7, 2016

Alright, let's go that route!

  • ignoring the /dist in .gitignore
  • linking to hosted files we create in a travis build
  • OR/AND adding the dist files as a single ZIP to a github release from travis using the API

Regarding the hosted files, we could upload them to an S3 bucket from within travis linked to a domain:

  • use .org tld for open-source/community
  • add /libs/ in between so we don't pollute the root
  • use explicit version in url, latest could be trickier to provide; do we redirect them to the latest version (cannot be done with S3), or do we upload/override that version (invalidate caching, and how do we know if something is the latest, what if we patch a previous minor version, that's not the actual latest)

For amd/umd/browser/cjs
https://seng.mediamonks.org/libs/seng-xxx/[v1.0.0|latest]/seng-xxx-[moduleType][.min].js
Systemjs doesn't have a a .min version, because it's built with TS, could add uglify there?
es6 has multiple files, so we might want to create a .zip for that?

Steps are:

  • add /dist/ to .gitignore
  • get access to S3 bucket
  • only run dist script in travis, as an after_script
  • add an s3 node script that uses the aws-sdk to upload the dist files
  • add a github node script that uses the github API to attach a zip of the dist folder to the release
  • add section in .travis.yml to provide the secure S3 token
  • update README.md to explain this new workflow

mediamonks-arjan pushed a commit that referenced this issue Jul 7, 2016
As discussed in #11 we want to exclude the `/dist` folder from git, and
supply it in another way. Because the packages are not publicly
announced yet, and we provide a way in the readme to generate those
dist files, we already take the first step.

re #11
@ThaNarie ThaNarie self-assigned this Jul 8, 2016
flut1 added a commit to mediamonks/seng-event that referenced this issue Jul 9, 2016
mediamonks-arjan pushed a commit that referenced this issue Jul 9, 2016
Changed the output of the `dist` folder so all output files are in the
same folder, and now have the type (umd, amd, commonjs, system) in
their filename. The es6 target still has its own folder.

Updated the webpack output to only create a minified version of files
that are used in the browser (normal and umd), because other files will
only be used in a build system that can do the minification.

Added a `package-dist.js` script that prepares the dist for deploys to
s3 and GitHub release. It moves the files in the dist folder to a name +
version folder to mimic the s3 folder structure. It also packages the
es6 folder into a zip file so it can be linked.
For the GitHub release it creates a .zip and .tar.gz file with the
contents of the original dist folder.

Updated the `.travis.yml` to run the `build-dist` and `package-dist`
scripts before the deploy, and added configurations and tokens for the
s3 and Github Release deploys.

Updated the `npm run clean`, `.gitignore` and `.npmignore` to also
clean/ignore the two dist archives in the root.

re #11
@ThaNarie
Copy link
Member Author

ThaNarie commented Jul 9, 2016

In the readme I wanted to add links to the latest linkable version, but that's not really possible:

  • we don't have a way to link to a latest version, and/or
  • we cannot automatically update to the package.json version number in the README.md
  1. Add a latest version
    This can be an extra deploy to S3 which replaces the files in the latest folder, and has a fairly short max-age header set. However, if we deploy a 2.0.0 version, but after that patch a 1.8.4 version, that last one will be set as latest. So we need to figure out a way to know if the new version is the highest version we have, and somehow figure out how to use that as a travis deploy condition.

Or we need a rewrite rule that dynamically points latest to the latest version on the server, but S3 is static and we can't support that.

  1. update readme with package.json version
    We could create a script that parses the README.md for patterns where the version number is used, and update those occurrences with the desired version. We could run that script after we've updated the package.json version, or use that script to update the version in both the package.json and the README.md.

We could use a npm package that can bump major/minor/patch via the CLI, or even define a standard where each commit message should define if it's major/minor/patch, which can be used to update the version.

Any ideas @flut1 @art0rz @mientjan ?

mediamonks-arjan pushed a commit that referenced this issue Jul 10, 2016
Commented out the part that links to the s3 sources, as there is no
way to link to a specific version yet without updating this readme
manually after each new version.

re #11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants