File tree Expand file tree Collapse file tree 1 file changed +87
-0
lines changed
Expand file tree Collapse file tree 1 file changed +87
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ title : Upgrade packages
3+ description : A convenient way to upgrade all your project packages with one command
4+ ---
5+
6+
7+
8+ ## Related
9+
10+ - [ Upgrade packages] [ ] for a Node app using GitHub Actions for automation.
11+
12+ [ Upgrade packages] : {{ site.baseurl }}{% link recipes/ci-cd/github-actions/workflows/node/upgrade-packages.md %}
13+
14+
15+ ## Configure
16+
17+ Set up in your shell config, such as ` .bashrc ` , ` .zshrc ` , or ` .aliases ` .
18+
19+ ``` sh
20+ alias git-deps=' git commit . -m "build(deps): upgrade packages"'
21+
22+ # Upgrade packages and commit them.
23+ # Remember verify changes afterwards using a build or server command, or `git
24+ # push` and a hook.
25+ upgrade () {
26+ if [[ -n " $( git status --porcelain) " ]]; then
27+ echo ' ERROR: Working tree is not clean'
28+
29+ return 1
30+ fi
31+
32+ make upgrade
33+
34+ if [[ -z " $( git status --porcelain) " ]]; then
35+ echo ' No upgrade changes to commit'
36+
37+ return
38+ fi
39+
40+ git-deps
41+ }
42+ ```
43+
44+ If you don't use ` make ` , then replace ` make upgrade ` with your appropriate command.
45+
46+ e.g.
47+
48+ - NPM
49+ ``` sh
50+ npm update
51+ ```
52+ - Yarn
53+ ` ` ` sh
54+ yarn upgrade
55+ ` ` `
56+ - Ruby and Bundler
57+ ` ` ` sh
58+ bundle update
59+ ` ` `
60+
61+
62+ # # Usage
63+
64+ Run this:
65+
66+ ` ` ` sh
67+ $ make upgrade
68+ ` ` `
69+
70+ And test your app with commands like:
71+
72+ ` ` ` sh
73+ $ make build
74+ $ make serve
75+ $ git push
76+ ` ` `
77+
78+ Replace your own commands like ` npm run build` .
79+
80+ If upgrade specific package like with ` npm install eslint@latest` , then you can commit that change with this:
81+
82+ ` ` ` sh
83+ $ git-deps
84+ ` ` `
85+
86+ Assuming you don' t have any unrelated change that would get unintentionally committed too.
87+
You can’t perform that action at this time.
0 commit comments