Skip to content

Commit

Permalink
Merge branch 'development' of ssh://github.com/deltasource/pm2 into h…
Browse files Browse the repository at this point in the history
…otfix/scoped-package-support

# Conflicts:
#	package.json
  • Loading branch information
daankets committed Feb 7, 2018
2 parents 5968661 + 0d2b717 commit 94ea9d9
Show file tree
Hide file tree
Showing 29 changed files with 459 additions and 199 deletions.
2 changes: 1 addition & 1 deletion .bithoundrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"**/examples/**"
],
"critics": {
"lint": {"engine": "semistandard"}
"lint": {"engine": "eslint"}
}
}
61 changes: 61 additions & 0 deletions .changelogrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"app_name": "",
"logo": "",
"intro": "",
"branch" : "master",
"repo_url": "https://github.com/Unitech/pm2",
"version_name" : "v2.9.2",
"tag": "2.9.1",
"file": "currentTagChangelog.md",
"template": "changelogTemplate.md",
"sections": [
{
"title": "Bug Fixes",
"grep": "^fix"
},
{
"title": "Hot Fixes",
"grep": "^hotfix"
},
{
"title": "Features",
"grep": "^feat"
},
{
"title": "Documentation",
"grep": "^docs"
},
{
"title": "Breaking changes",
"grep": "BREAKING"
},
{
"title": "Refactor",
"grep": "^refactor"
},
{
"title": "Performance improvement",
"grep": "^perf"
},
{
"title": "Style",
"grep": "^style"
},
{
"title": "Test",
"grep": "^test"
},
{
"title": "Chore",
"grep": "^chore"
},
{
"title": "Branchs merged",
"grep": "^Merge branch"
},
{
"title" : "Pull requests merged",
"grep": "^Merge pull request"
}
]
}
1 change: 0 additions & 1 deletion .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pipeline:
image: keymetrics/alpine-pm2-builder:latest
environment:
- AWS_REPO_BUCKET=alpine-apk.pm2.io
- PM2_TARGET_VERSION=2.7.2
secrets: ['apk_rsa_priv_key', 'apk_rsa_pub_key', 'aws_access_key_id', 'aws_secret_access_key']
when:
event: tag
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/node_modules
*.log
*.log
*.pid
test/child
*.iml
Expand All @@ -15,3 +14,4 @@ package-lock.json
.DS_Store
*.swp
*.swo
currentTagChangelog.md
23 changes: 23 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,29 @@ When you modify the Daemon (lib/Daemon.js, lib/God.js, lib/God/*, lib/Watcher.js
$ pm2 update
```

## Commit rules

### Commit message

A good commit message should describe what changed and why.

It should :
* contain a short description of the change (preferably 50 characters or less)
* be entirely in lowercase with the exception of proper nouns, acronyms, and the words that refer to code, like function/variable names
* be prefixed with one of the following word
* fix : bug fix
* hotfix : urgent bug fix
* feat : new or updated feature
* docs : documentation updates
* BREAKING : if commit is a breaking change
* refactor : code refactoring (no functional change)
* perf : performance improvement
* style : UX and display updates
* test : tests and CI updates
* chore : updates on build, tools, configuration ...
* Merge branch : when merging branch
* Merge pull request : when merging PR

## Tests

There are two tests type. Programmatic and Behavioral.
Expand Down
9 changes: 9 additions & 0 deletions bin/pm2
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ commander.version(pkg.version)
.option('--disable-trace', 'disable transaction tracing with km')
.option('--attach', 'attach logging after your start/restart/stop/reload')
.option('--sort <field_name:sort>', 'sort process according to field\'s name')
.option('--v8', 'enable v8 data collecting')
.option('--event-loop-inspector', 'enable event-loop-inspector dump in pmx')
.option('--deep-monitoring', 'enable all monitoring tools (equivalent to --v8 --event-loop-inspector --trace)')
.usage('[cmd] app');

commander.on('--help', function() {
Expand Down Expand Up @@ -309,6 +312,12 @@ commander.command('startOrReload <json>')
pm2._startJson(file, commander, 'reloadProcessId');
});

commander.command('pid [app_name]')
.description('return pid of [app_name] or all')
.action(function(app) {
pm2.getPID(app);
});

commander.command('startOrGracefulReload <json>')
.description('start or gracefully reload JSON file')
.action(function(file) {
Expand Down
13 changes: 13 additions & 0 deletions changelogTemplate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<% if(logo) { %><img width="710px" src="<%= logo %>" alt="pm2 logo" /> <% } %>
<% if(logo) { %># <%= title %> <% } %>
<% if(intro) { %><%= '\n' %><%= intro %><%= '\n' %><% } %>
<% if(version && (version.name || version.number)) { %>##<% if(version.name){%> <%= version.name %><% } %> <% if(version.date){ %>( <%= version.date %> )<% } %><%= '\n' %><% } %>
<% _.forEach(sections, function(section){
if(section.commitsCount > 0) { %>
## <%= section.title %>
<% _.forEach(section.commits, function(commit){ %> - <%= printCommit(commit, true) %><% }) %>
<% _.forEach(section.components, function(component){ %> - **<%= component.name %>**
<% _.forEach(component.commits, function(commit){ %> - <%= printCommit(commit, true) %><% }) %>
<% }) %>
<% } %>
<% }) %>
28 changes: 28 additions & 0 deletions lib/API/Extra.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,34 @@ module.exports = function(CLI) {
});
};

CLI.prototype.getPID = function(app_name, cb) {
var that = this;

if (typeof(app_name) === 'function') {
cb = app_name;
app_name = null;
}

this.Client.executeRemote('getMonitorData', {}, function(err, list) {
if (err) {
Common.printError(cst.PREFIX_MSG_ERR + err);
return cb ? cb(Common.retErr(err)) : that.exitCli(cst.ERROR_EXIT);
}

var pids = [];

list.forEach(function(app) {
if (!app_name || app_name == app.name)
pids.push(app.pid);
})

if (!cb) {
Common.printOut(pids.join("\n"))
return that.exitCli(cst.SUCCESS_EXIT);
}
return cb(null, pids);
})
}
/**
* Create PM2 memory snapshot
* @method getVersion
Expand Down
16 changes: 12 additions & 4 deletions lib/API/Log.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,34 +194,42 @@ Log.devStream = function(Client, id, raw, timestamp, exclusive) {
});
};

Log.jsonStream = function(Client, app_name) {
Log.jsonStream = function(Client, id) {
var that = this;

Client.launchBus(function(err, bus) {
if (err) console.error(err);

bus.on('process:event', function(packet) {
console.log(JSON.stringify({
process.stdout.write(JSON.stringify({
timestamp : moment(packet.at),
type : 'process_event',
status : packet.event,
app_name : packet.process.name
}));
process.stdout.write('\n');
});

bus.on('log:*', function(type, packet) {
if (app_name != 'all' && app_name && app_name != packet.process.name) return false;
if (id !== 'all'
&& packet.process.name != id
&& packet.process.pm_id != id)
return;

if (type === 'PM2')
return;

if (typeof(packet.data) == 'string')
packet.data = packet.data.replace(/(\r\n|\n|\r)/gm,'');

console.log(JSON.stringify({
process.stdout.write(JSON.stringify({
message : packet.data,
timestamp : moment(packet.at),
type : type,
process_id : packet.process.pm_id,
app_name : packet.process.name
}));
process.stdout.write('\n');
});
});
};
Expand Down
Loading

0 comments on commit 94ea9d9

Please sign in to comment.