BREAKING CHANGE(core): switch to esm
This commit is contained in:
		| @@ -12,20 +12,12 @@ stages: | ||||
|   - release | ||||
|   - metadata | ||||
|  | ||||
| before_script: | ||||
|   - npm install -g @shipzone/npmci | ||||
|  | ||||
| # ==================== | ||||
| # security stage | ||||
| # ==================== | ||||
| mirror: | ||||
|   stage: security | ||||
|   script: | ||||
|     - npmci git mirror | ||||
|   only: | ||||
|     - tags | ||||
|   tags: | ||||
|     - lossless | ||||
|     - docker | ||||
|     - notpriv | ||||
|  | ||||
| auditProductionDependencies: | ||||
|   image: registry.gitlab.com/hosttoday/ht-docker-node:npmci | ||||
|   stage: security | ||||
| @@ -36,6 +28,7 @@ auditProductionDependencies: | ||||
|     - npmci command npm audit --audit-level=high --only=prod --production | ||||
|   tags: | ||||
|     - docker | ||||
|   allow_failure: true | ||||
|  | ||||
| auditDevDependencies: | ||||
|   image: registry.gitlab.com/hosttoday/ht-docker-node:npmci | ||||
| @@ -96,10 +89,9 @@ codequality: | ||||
|   only: | ||||
|     - tags | ||||
|   script: | ||||
|     - npmci command npm install -g tslint typescript | ||||
|     - npmci command npm install -g typescript | ||||
|     - npmci npm prepare | ||||
|     - npmci npm install | ||||
|     - npmci command "tslint -c tslint.json ./ts/**/*.ts" | ||||
|   tags: | ||||
|     - lossless | ||||
|     - docker | ||||
| @@ -119,11 +111,10 @@ trigger: | ||||
| pages: | ||||
|   stage: metadata | ||||
|   script: | ||||
|     - npmci node install lts | ||||
|     - npmci command npm install -g @gitzone/tsdoc | ||||
|     - npmci node install stable  | ||||
|     - npmci npm prepare | ||||
|     - npmci npm install | ||||
|     - npmci command tsdoc | ||||
|     - npmci command npm run buildDocs | ||||
|   tags: | ||||
|     - lossless | ||||
|     - docker | ||||
|   | ||||
							
								
								
									
										24
									
								
								.vscode/launch.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										24
									
								
								.vscode/launch.json
									
									
									
									
										vendored
									
									
								
							| @@ -2,28 +2,10 @@ | ||||
|   "version": "0.2.0", | ||||
|   "configurations": [ | ||||
|     { | ||||
|       "name": "current file", | ||||
|       "type": "node", | ||||
|       "command": "npm test", | ||||
|       "name": "Run npm test", | ||||
|       "request": "launch", | ||||
|       "args": [ | ||||
|         "${relativeFile}" | ||||
|       ], | ||||
|       "runtimeArgs": ["-r", "@gitzone/tsrun"], | ||||
|       "cwd": "${workspaceRoot}", | ||||
|       "protocol": "inspector", | ||||
|       "internalConsoleOptions": "openOnSessionStart" | ||||
|     }, | ||||
|     { | ||||
|       "name": "test.ts", | ||||
|       "type": "node", | ||||
|       "request": "launch", | ||||
|       "args": [ | ||||
|         "test/test.ts" | ||||
|       ], | ||||
|       "runtimeArgs": ["-r", "@gitzone/tsrun"], | ||||
|       "cwd": "${workspaceRoot}", | ||||
|       "protocol": "inspector", | ||||
|       "internalConsoleOptions": "openOnSessionStart" | ||||
|       "type": "node-terminal" | ||||
|     } | ||||
|   ] | ||||
| } | ||||
|   | ||||
| @@ -5,7 +5,7 @@ | ||||
|       "githost": "gitlab.com", | ||||
|       "gitscope": "pushrocks", | ||||
|       "gitrepo": "smartmetrics", | ||||
|       "shortDescription": "easy system metrics", | ||||
|       "description": "easy system metrics", | ||||
|       "npmPackagename": "@pushrocks/smartmetrics", | ||||
|       "license": "MIT", | ||||
|       "projectDomain": "push.rocks" | ||||
|   | ||||
							
								
								
									
										24804
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										24804
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										28
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								package.json
									
									
									
									
									
								
							| @@ -9,14 +9,15 @@ | ||||
|   "license": "MIT", | ||||
|   "scripts": { | ||||
|     "test": "(tstest test/ --web)", | ||||
|     "build": "(tsbuild --web)" | ||||
|     "build": "(tsbuild --web)", | ||||
|     "buildDocs": "tsdoc" | ||||
|   }, | ||||
|   "devDependencies": { | ||||
|     "@gitzone/tsbuild": "^2.1.26", | ||||
|     "@gitzone/tsbundle": "^1.0.78", | ||||
|     "@gitzone/tstest": "^1.0.44", | ||||
|     "@pushrocks/tapbundle": "^3.2.9", | ||||
|     "@types/node": "^16.6.1", | ||||
|     "@gitzone/tsbuild": "^2.1.63", | ||||
|     "@gitzone/tsbundle": "^2.0.6", | ||||
|     "@gitzone/tstest": "^1.0.72", | ||||
|     "@pushrocks/tapbundle": "^5.0.4", | ||||
|     "@types/node": "^18.6.1", | ||||
|     "tslint": "^6.1.3", | ||||
|     "tslint-config-prettier": "^1.15.0" | ||||
|   }, | ||||
| @@ -37,10 +38,11 @@ | ||||
|   ], | ||||
|   "dependencies": { | ||||
|     "@pushrocks/smartdelay": "^2.0.13", | ||||
|     "@pushrocks/smartlog": "^2.0.44", | ||||
|     "@types/pidusage": "^2.0.1", | ||||
|     "pidtree": "^0.5.0", | ||||
|     "pidusage": "^2.0.21", | ||||
|     "prom-client": "^13.2.0" | ||||
|   } | ||||
| } | ||||
|     "@pushrocks/smartlog": "^3.0.1", | ||||
|     "@types/pidusage": "^2.0.2", | ||||
|     "pidtree": "^0.6.0", | ||||
|     "pidusage": "^3.0.0", | ||||
|     "prom-client": "^14.0.1" | ||||
|   }, | ||||
|   "type": "module" | ||||
| } | ||||
| @@ -1,5 +1,3 @@ | ||||
| import * as smartlog from '@pushrocks/smartlog'; | ||||
|  | ||||
| export { | ||||
|   smartlog | ||||
| } | ||||
| export { smartlog }; | ||||
|   | ||||
							
								
								
									
										12
									
								
								test/test.ts
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								test/test.ts
									
									
									
									
									
								
							| @@ -1,18 +1,18 @@ | ||||
| import * as plugins from './plugins'; | ||||
| import * as plugins from './plugins.js'; | ||||
|  | ||||
| import { expect, tap } from '@pushrocks/tapbundle'; | ||||
| import * as smartmetrics from '../ts/index'; | ||||
| import * as smartmetrics from '../ts/index.js'; | ||||
|  | ||||
| let testSmartMetrics: smartmetrics.SmartMetrics; | ||||
|  | ||||
| tap.test('should create a smartmetrics instance', async () => { | ||||
|   const logger = new plugins.smartlog.Smartlog({ | ||||
|     logContext: null, | ||||
|     minimumLogLevel: 'silly' | ||||
|     minimumLogLevel: 'silly', | ||||
|   }); | ||||
|   logger.enableConsole(); | ||||
|   testSmartMetrics = new smartmetrics.SmartMetrics(logger, 'testContainer'); | ||||
|   expect(testSmartMetrics).to.be.instanceOf(smartmetrics.SmartMetrics); | ||||
|   expect(testSmartMetrics).toBeInstanceOf(smartmetrics.SmartMetrics); | ||||
| }); | ||||
|  | ||||
| tap.test('should start smartmetrics', async () => { | ||||
| @@ -20,8 +20,8 @@ tap.test('should start smartmetrics', async () => { | ||||
| }); | ||||
|  | ||||
| tap.test('should produce valid metrics', async (tools) => { | ||||
|   console.log('calling .getMetrics from Testfile:') | ||||
|   console.log('calling .getMetrics from Testfile:'); | ||||
|   console.log(await testSmartMetrics.getMetrics()); | ||||
| }) | ||||
| }); | ||||
|  | ||||
| tap.start(); | ||||
|   | ||||
							
								
								
									
										8
									
								
								ts/00_commitinfo_data.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								ts/00_commitinfo_data.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| /** | ||||
|  * autocreated commitinfo by @pushrocks/commitinfo | ||||
|  */ | ||||
| export const commitinfo = { | ||||
|   name: '@pushrocks/smartmetrics', | ||||
|   version: '2.0.0', | ||||
|   description: 'easy system metrics' | ||||
| } | ||||
| @@ -1,2 +1,2 @@ | ||||
| export * from './smartmetrics.interfaces'; | ||||
| export * from './smartmetrics.classes.smartmetrics'; | ||||
| export * from './smartmetrics.interfaces.js'; | ||||
| export * from './smartmetrics.classes.smartmetrics.js'; | ||||
|   | ||||
| @@ -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} `); | ||||
|  | ||||
|   | ||||
| @@ -9,4 +9,4 @@ export interface IMetricsSnapshot { | ||||
|   memoryPercentage: number; | ||||
|   memoryUsageBytes: number; | ||||
|   memoryUsageText: string; | ||||
| } | ||||
| } | ||||
|   | ||||
| @@ -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 }; | ||||
|   | ||||
							
								
								
									
										10
									
								
								tsconfig.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								tsconfig.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| { | ||||
|   "compilerOptions": { | ||||
|     "experimentalDecorators": true, | ||||
|     "useDefineForClassFields": false, | ||||
|     "target": "ES2022", | ||||
|     "module": "ES2022", | ||||
|     "moduleResolution": "nodenext", | ||||
|     "esModuleInterop": true | ||||
|   } | ||||
| } | ||||
							
								
								
									
										17
									
								
								tslint.json
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								tslint.json
									
									
									
									
									
								
							| @@ -1,17 +0,0 @@ | ||||
| { | ||||
|   "extends": ["tslint:latest", "tslint-config-prettier"], | ||||
|   "rules": { | ||||
|     "semicolon": [true, "always"], | ||||
|     "no-console": false, | ||||
|     "ordered-imports": false, | ||||
|     "object-literal-sort-keys": false, | ||||
|     "member-ordering": { | ||||
|       "options":{ | ||||
|         "order": [ | ||||
|           "static-method" | ||||
|         ] | ||||
|       } | ||||
|     } | ||||
|   }, | ||||
|   "defaultSeverity": "warning" | ||||
| } | ||||
		Reference in New Issue
	
	Block a user