简体   繁体   中英

Best practices to store “dist” folder on repo for deploy

We are developing a project built with yeoman angular generator. Now appears the need of "puppetize" it for deployment.

Obviusly the machine serving client part should be provided with a compiled (minimified, optimized) version of the angular project. But I have no idea if we should store it on our bitbucket repo -for example on the master branch when tagging a new release-

I couldn't find any post about this practice and I could use some help.

There are some facts about angular minified version:

  • It is uglificated and minificated, so code is unreadable and hard to change.
  • It demands compilation with tool like gruntjs, which takes some time to build each time.
  • It works on server, but when you choose to deploy non minificated, revisioned version, you can have other problems during adding new versions to same repo - scripts have same name and are cached in browser and possible other problems.

You decided to deploy compiled version to a client machine.

If you are using version control like git. you can add to repo a folder with compiled version, so your repository have sources and dist in same folder. Possibly you have also backend code, sometimes in backend code you can add compiled version to host on server. It's better to have all code and builds in one repo, so you can do this with one command.

In my case, i wrote scripts in java, to copy builded folder to another folder. We use also Visual Studio for backend, so i wrote script adding new filenames to .cs file, so it can be visible by continous integration tool.

Going to a final, create new branch in git from release master branch. It is useful to have copy of your partial work. I don't know how often you have releases, but you can solve it by having branches in git. So your branches can look like this:

master

release1

release2

...

Assuming you are doing development on master and copying new versions to releases.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM