BREAKING CHANGE(core): switch to esm

This commit is contained in:
2022-07-27 12:00:38 +02:00
parent 057a0a329e
commit 173df91528
14 changed files with 7123 additions and 17838 deletions

8
ts/00_commitinfo_data.ts Normal file
View File

@ -0,0 +1,8 @@
/**
* autocreated commitinfo by @pushrocks/commitinfo
*/
export const commitinfo = {
name: '@pushrocks/smartmetrics',
version: '2.0.0',
description: 'easy system metrics'
}

View File

@ -1,2 +1,2 @@
export * from './smartmetrics.interfaces';
export * from './smartmetrics.classes.smartmetrics';
export * from './smartmetrics.interfaces.js';
export * from './smartmetrics.classes.smartmetrics.js';

View File

@ -1,5 +1,5 @@
import * as plugins from './smartmetrics.plugins';
import * as interfaces from './smartmetrics.interfaces';
import * as plugins from './smartmetrics.plugins.js';
import * as interfaces from './smartmetrics.interfaces.js';
export class SmartMetrics {
public started = false;
@ -68,7 +68,9 @@ export class SmartMetrics {
memoryUsageBytes += stats[stat].memory;
}
let memoryPercentage = Math.round((memoryUsageBytes / 1000000000) * 100 * 100) / 100;
let memoryUsageText = `${memoryPercentage}% | ${this.formatBytes(memoryUsageBytes)} / ${this.formatBytes(1000000000)}`;
let memoryUsageText = `${memoryPercentage}% | ${this.formatBytes(
memoryUsageBytes
)} / ${this.formatBytes(1000000000)}`;
console.log(`${cpuUsageText} ||| ${memoryUsageText} `);

View File

@ -9,4 +9,4 @@ export interface IMetricsSnapshot {
memoryPercentage: number;
memoryUsageBytes: number;
memoryUsageText: string;
}
}

View File

@ -1,26 +1,17 @@
// node native
import * as os from 'os';
export {
os
}
export { os };
// pushrocks scope
import * as smartdelay from '@pushrocks/smartdelay';
import * as smartlog from '@pushrocks/smartlog';
export {
smartdelay,
smartlog
}
export { smartdelay, smartlog };
// third party scope
import pidusage from 'pidusage';
import pidtree from 'pidtree';
import * as promClient from 'prom-client';
export {
pidusage,
pidtree,
promClient
}
export { pidusage, pidtree, promClient };