mirror of
https://github.com/Unitech/pm2.git
synced 2025-12-08 20:35:53 +00:00
drop moment replace by dayjs -200kb
This commit is contained in:
commit
8b0417b3a9
@ -625,11 +625,11 @@ class API {
|
||||
}
|
||||
|
||||
if (opts && opts.rawArgs && opts.rawArgs.indexOf('--watch') > -1) {
|
||||
var moment = require('moment');
|
||||
var dayjs = require('dayjs');
|
||||
function show() {
|
||||
process.stdout.write('\x1b[2J');
|
||||
process.stdout.write('\x1b[0f');
|
||||
console.log('Last refresh: ', moment().format('LTS'));
|
||||
console.log('Last refresh: ', dayjs().format());
|
||||
that.Client.executeRemote('getMonitorData', {}, function(err, list) {
|
||||
UX.list(list, null);
|
||||
});
|
||||
|
||||
@ -12,7 +12,7 @@ var chalk = require('chalk');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var fmt = require('../tools/fmt.js');
|
||||
var moment = require('moment');
|
||||
var dayjs = require('dayjs');
|
||||
var pkg = require('../../package.json');
|
||||
const semver = require('semver');
|
||||
|
||||
@ -104,7 +104,7 @@ module.exports = function(CLI) {
|
||||
fmt.field('user', report.user);
|
||||
fmt.field('uid', report.uid);
|
||||
fmt.field('gid', report.gid);
|
||||
fmt.field('uptime', moment(new Date()).diff(report.started_at, 'minute') + 'min');
|
||||
fmt.field('uptime', dayjs(new Date()).diff(report.started_at, 'minute') + 'min');
|
||||
|
||||
fmt.sep();
|
||||
fmt.title(chalk.bold.blue('CLI'));
|
||||
@ -195,7 +195,7 @@ module.exports = function(CLI) {
|
||||
*/
|
||||
CLI.prototype.profile = function(type, time, cb) {
|
||||
var that = this;
|
||||
var moment = require('moment');
|
||||
var dayjs = require('dayjs');
|
||||
var cmd
|
||||
|
||||
if (type == 'cpu') {
|
||||
@ -211,7 +211,7 @@ module.exports = function(CLI) {
|
||||
}
|
||||
}
|
||||
|
||||
var file = path.join(process.cwd(), moment().format('dd-HH:mm:ss') + cmd.ext);
|
||||
var file = path.join(process.cwd(), dayjs().format('dd-HH:mm:ss') + cmd.ext);
|
||||
time = time || 10000
|
||||
|
||||
console.log(`Starting ${cmd.action} profiling for ${time}ms...`)
|
||||
|
||||
@ -7,7 +7,7 @@ var fs = require('fs'),
|
||||
util = require('util'),
|
||||
chalk = require('chalk'),
|
||||
forEachLimit = require('async/forEachLimit'),
|
||||
moment = require('moment');
|
||||
dayjs = require('dayjs');
|
||||
|
||||
var Log = module.exports = {};
|
||||
|
||||
@ -89,7 +89,7 @@ Log.stream = function(Client, id, raw, timestamp, exclusive, highlight) {
|
||||
socket.on('reconnect attempt', function() {
|
||||
if (global._auto_exit === true) {
|
||||
if (timestamp)
|
||||
process.stdout.write(chalk['dim'](chalk.grey(moment().format(timestamp) + ' ')));
|
||||
process.stdout.write(chalk['dim'](chalk.grey(dayjs().format(timestamp) + ' ')));
|
||||
process.stdout.write(chalk.blue(pad(DEFAULT_PADDING, 'PM2') + ' | ') + '[[[ Target PM2 killed. ]]]');
|
||||
process.exit(0);
|
||||
}
|
||||
@ -122,7 +122,7 @@ Log.stream = function(Client, id, raw, timestamp, exclusive, highlight) {
|
||||
return type === 'err' ? process.stderr.write(util.format(line) + '\n') : process.stdout.write(util.format(line) + '\n');
|
||||
|
||||
if (timestamp)
|
||||
process.stdout.write(chalk['dim'](chalk.grey(moment().format(timestamp) + ' ')));
|
||||
process.stdout.write(chalk['dim'](chalk.grey(dayjs().format(timestamp) + ' ')));
|
||||
|
||||
var name = packet.process.pm_id + '|' + packet.process.name;
|
||||
|
||||
@ -137,7 +137,7 @@ Log.stream = function(Client, id, raw, timestamp, exclusive, highlight) {
|
||||
process.stdout.write(chalk.blue(pad(' '.repeat(min_padding), 'PM2') + ' | '));
|
||||
if (highlight)
|
||||
process.stdout.write(util.format(line).replace(highlight, chalk.bgBlackBright(highlight)) + '\n');
|
||||
else
|
||||
else
|
||||
process.stdout.write(util.format(line)+ '\n');
|
||||
});
|
||||
});
|
||||
@ -188,7 +188,7 @@ Log.devStream = function(Client, id, raw, timestamp, exclusive) {
|
||||
return process.stdout.write(util.format(line) + '\n');
|
||||
|
||||
if (timestamp)
|
||||
process.stdout.write(chalk['dim'](chalk.grey(moment().format(timestamp) + ' ')));
|
||||
process.stdout.write(chalk['dim'](chalk.grey(dayjs().format(timestamp) + ' ')));
|
||||
|
||||
var name = packet.process.name + '-' + packet.process.pm_id;
|
||||
|
||||
@ -215,7 +215,7 @@ Log.jsonStream = function(Client, id) {
|
||||
|
||||
bus.on('process:event', function(packet) {
|
||||
process.stdout.write(JSON.stringify({
|
||||
timestamp : moment(packet.at),
|
||||
timestamp : dayjs(packet.at),
|
||||
type : 'process_event',
|
||||
status : packet.event,
|
||||
app_name : packet.process.name
|
||||
@ -237,7 +237,7 @@ Log.jsonStream = function(Client, id) {
|
||||
|
||||
process.stdout.write(JSON.stringify({
|
||||
message : packet.data,
|
||||
timestamp : moment(packet.at),
|
||||
timestamp : dayjs(packet.at),
|
||||
type : type,
|
||||
process_id : packet.process.pm_id,
|
||||
app_name : packet.process.name
|
||||
@ -280,7 +280,7 @@ Log.formatStream = function(Client, id, raw, timestamp, exclusive, highlight) {
|
||||
|
||||
if (!raw) {
|
||||
if (timestamp)
|
||||
process.stdout.write('timestamp=' + moment().format(timestamp) + ' ');
|
||||
process.stdout.write('timestamp=' + dayjs().format(timestamp) + ' ');
|
||||
if (packet.process.name === 'PM2')
|
||||
process.stdout.write('app=pm2 ');
|
||||
if (packet.process.name !== 'PM2')
|
||||
|
||||
@ -15,7 +15,7 @@ var util = require('util');
|
||||
var chalk = require('chalk');
|
||||
var fclone = require('fclone');
|
||||
var semver = require('semver');
|
||||
var moment = require('moment');
|
||||
var dayjs = require('dayjs');
|
||||
var isBinary = require('./tools/isbinaryfile.js');
|
||||
var cst = require('../constants.js');
|
||||
var extItps = require('./API/interpreter.json');
|
||||
@ -86,7 +86,7 @@ Common.lockReload = function() {
|
||||
// Check if content and if time < 30 return locked
|
||||
// Else if content detected (lock file staled), allow and rewritte
|
||||
if (t1 && t1 != '') {
|
||||
var diff = moment().diff(parseInt(t1));
|
||||
var diff = dayjs().diff(parseInt(t1));
|
||||
if (diff < cst.RELOAD_LOCK_TIMEOUT)
|
||||
return diff;
|
||||
}
|
||||
@ -94,7 +94,7 @@ Common.lockReload = function() {
|
||||
|
||||
try {
|
||||
// Write latest timestamp
|
||||
fs.writeFileSync(cst.PM2_RELOAD_LOCKFILE, moment.now());
|
||||
fs.writeFileSync(cst.PM2_RELOAD_LOCKFILE, dayjs().valueOf());
|
||||
return 0;
|
||||
} catch(e) {
|
||||
console.error(e.message || e);
|
||||
|
||||
@ -182,9 +182,9 @@
|
||||
"enquirer": "^2.3.2",
|
||||
"eventemitter2": "5.0.1",
|
||||
"fclone": "1.0.11",
|
||||
"lodash": "4.17.14",
|
||||
"mkdirp": "1.0.4",
|
||||
"moment": "2.24.0",
|
||||
"lodash": "4.17.14",
|
||||
"dayjs": "1.8.24",
|
||||
"needle": "2.4.0",
|
||||
"pidusage": "2.0.18",
|
||||
"pm2-axon": "3.3.0",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user