1 | # Contributing
|
2 |
|
3 | ## Cloning PM2 development
|
4 |
|
5 | ```bash
|
6 | $ git clone https://github.com/Unitech/pm2.git
|
7 | $ cd pm2
|
8 | $ git checkout development
|
9 | $ npm install
|
10 | ```
|
11 |
|
12 | I recommend having a pm2 alias pointing to the development version to make it easier to use pm2 development:
|
13 |
|
14 | ```
|
15 | $ cd pm2/
|
16 | $ echo "alias pm2='`pwd`/bin/pm2'" >> ~/.bashrc
|
17 | ```
|
18 |
|
19 | You are now able to use pm2 in dev mode:
|
20 |
|
21 | ```
|
22 | $ pm2 update
|
23 | $ pm2 ls
|
24 | ```
|
25 |
|
26 | ## Project structure
|
27 |
|
28 | ```
|
29 | .
|
30 | ├── bin // pm2, pmd, pm2-dev, pm2-docker are there
|
31 | ├── examples // examples files
|
32 | ├── lib // source files
|
33 | ├── pres // presentation files
|
34 | ├── test // test files
|
35 | └── types // TypeScript definition files
|
36 | ```
|
37 |
|
38 | ## Modifying the Daemon
|
39 |
|
40 | When you modify the Daemon (lib/Daemon.js, lib/God.js, lib/God/*, lib/Watcher.js), you must restart the pm2 Daemon by doing:
|
41 |
|
42 | ```
|
43 | $ pm2 update
|
44 | ```
|
45 |
|
46 | ## Commit rules
|
47 |
|
48 | ### Commit message
|
49 |
|
50 | A good commit message should describe what changed and why.
|
51 |
|
52 | It should :
|
53 | * contain a short description of the change (preferably 50 characters or less)
|
54 | * be entirely in lowercase with the exception of proper nouns, acronyms, and the words that refer to code, like function/variable names
|
55 | * be prefixed with one of the following word
|
56 | * fix : bug fix
|
57 | * hotfix : urgent bug fix
|
58 | * feat : new or updated feature
|
59 | * docs : documentation updates
|
60 | * BREAKING : if commit is a breaking change
|
61 | * refactor : code refactoring (no functional change)
|
62 | * perf : performance improvement
|
63 | * style : UX and display updates
|
64 | * test : tests and CI updates
|
65 | * chore : updates on build, tools, configuration ...
|
66 | * Merge branch : when merging branch
|
67 | * Merge pull request : when merging PR
|
68 |
|
69 | ## Tests
|
70 |
|
71 | There are two tests type. Programmatic and Behavioral.
|
72 | The main test command is `npm test`
|
73 |
|
74 | ### Programmatic
|
75 |
|
76 | Programmatic tests are runned by doing
|
77 |
|
78 | ```
|
79 | $ bash test/pm2_programmatic_tests.sh
|
80 | ```
|
81 |
|
82 | This test files are located in test/programmatic/*
|
83 |
|
84 | ### Behavioral
|
85 |
|
86 | Behavioral tests are runned by doing:
|
87 |
|
88 | ```
|
89 | $ bash test/e2e.sh
|
90 | ```
|
91 |
|
92 | This test files are located in test/e2e/*
|
93 |
|
94 | ## File of interest
|
95 |
|
96 | - `$HOME/.pm2` contain all PM2 related files
|
97 | - `$HOME/.pm2/logs` contain all applications logs
|
98 | - `$HOME/.pm2/pids` contain all applications pids
|
99 | - `$HOME/.pm2/pm2.log` PM2 logs
|
100 | - `$HOME/.pm2/pm2.pid` PM2 pid
|
101 | - `$HOME/.pm2/rpc.sock` Socket file for remote commands
|
102 | - `$HOME/.pm2/pub.sock` Socket file for publishable events
|
103 |
|
104 | ## Generate changelog
|
105 |
|
106 | ### requirements
|
107 |
|
108 | ```
|
109 | npm install git-changelog -g
|
110 | ```
|
111 |
|
112 | ### usage
|
113 |
|
114 | Edit .changelogrc
|
115 | Change "version_name" to the next version to release (example 1.1.2).
|
116 | Change "tag" to the latest existing tag (example 1.1.1).
|
117 |
|
118 | Run the following command into pm2 directory
|
119 | ```
|
120 | git-changelog
|
121 | ```
|
122 |
|
123 | It will generate currentTagChangelog.md file.
|
124 | Just copy/paste the result into changelog.md
|