This repository has been archived by the owner on Sep 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from mobilejazz/feature/angular-nodowntime-build
New angular tips and tricks page
- Loading branch information
Showing
4 changed files
with
58 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
title: Angular | ||
--- | ||
## Tips and Tricks for Angular | ||
|
||
### Build with 0 downtime on Angular | ||
|
||
The recommended way to have 0 downtime it's using dockerized builds with a docker registry service. | ||
In case that this isn't possible in your project, here you have a quick fix. | ||
|
||
Create this folders on `/dist`: | ||
|
||
1. `/dist/previousbuild` | ||
1. `/dist/nginx` (the new production path) | ||
|
||
`package.json` add on `scripts` section: | ||
```json | ||
... | ||
"prebuild": "rm -rf dist/previousbuild", | ||
"build": "ng build --prod --source-map --optimization=true --buildOptimizer=true --progress=true", | ||
"postbuild": "mv dist/nginx dist/previousbuild && mv dist/tempbuild dist/nginx", | ||
... | ||
``` | ||
|
||
`angular.json` add on `projects -> *projectname* -> architect -> build -> options`: | ||
```json | ||
... | ||
"outputPath": "dist/tempbuild", | ||
... | ||
``` | ||
|
||
And the result: | ||
|
||
1. on build starts, the folder `previousbuild` will be erased | ||
1. the new build will be created on `tempbuild` | ||
1. when the new build is done, the previous production build will move to `previousbuild` and the new one will be on | ||
`nginx` folder | ||
1. in case that you need to recover the previous version, you only need rename the two folders |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
--- | ||
title: Git | ||
--- | ||
Tips and Tricks for Git | ||
## Tips and Tricks for Git | ||
|
||
### Git Submodules | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
title: Node | ||
--- | ||
## Tips and Tricks for Node | ||
|
||
### npm install | ||
|
||
Unlike with PHP `composer install`, the command `npm install` takes `package.json` and resolves the dependencies which means that you might introduce a version different from the one you tested on. | ||
|
||
For deploys, CI or initial local environment setup, the **recommended** way to install the dependencies of a project is using `npm ci`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters