4 Commits

Author SHA1 Message Date
74bfcb273a 1.3.1
Some checks failed
Default (tags) / security (push) Successful in 36s
Default (tags) / test (push) Successful in 53s
Default (tags) / release (push) Failing after 47s
Default (tags) / metadata (push) Successful in 56s
2025-03-01 19:47:46 +00:00
cefbce1ba0 fix(test): Update test script to fix type references and remove private method call 2025-03-01 19:47:46 +00:00
51bb3a8967 1.3.0
Some checks failed
Default (tags) / security (push) Successful in 37s
Default (tags) / test (push) Successful in 51s
Default (tags) / release (push) Failing after 47s
Default (tags) / metadata (push) Successful in 1m0s
2025-03-01 19:19:28 +00:00
c4a082031e feat(cli): Add CLI support with command parsing and version display 2025-03-01 19:19:28 +00:00
8 changed files with 69 additions and 6 deletions

View File

@ -1,5 +1,18 @@
# Changelog # Changelog
## 2025-03-01 - 1.3.1 - fix(test)
Update test script to fix type references and remove private method call
- Corrected type references in test script for IMonitorConfig.
- Fixed test script to use console.log instead of private method monitor.log.
## 2025-03-01 - 1.3.0 - feat(cli)
Add CLI support with command parsing and version display
- Added a basic CLI interface using smartcli.
- Implemented command parsing with a 'restart' command.
- Integrated project version display in the CLI.
## 2025-03-01 - 1.2.0 - feat(core) ## 2025-03-01 - 1.2.0 - feat(core)
Introduce ProcessMonitor with memory management and spawning features Introduce ProcessMonitor with memory management and spawning features

View File

@ -1,6 +1,6 @@
{ {
"name": "@git.zone/tspm", "name": "@git.zone/tspm",
"version": "1.2.0", "version": "1.3.1",
"private": false, "private": false,
"description": "a no fuzz process manager", "description": "a no fuzz process manager",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",
@ -11,7 +11,11 @@
"scripts": { "scripts": {
"test": "(tstest test/ --web)", "test": "(tstest test/ --web)",
"build": "(tsbuild --web --allowimplicitany)", "build": "(tsbuild --web --allowimplicitany)",
"buildDocs": "(tsdoc)" "buildDocs": "(tsdoc)",
"start": "(tsrun ./cli.ts -v)"
},
"bin": {
"tspm": "./cli.js"
}, },
"devDependencies": { "devDependencies": {
"@git.zone/tsbuild": "^2.1.25", "@git.zone/tsbuild": "^2.1.25",
@ -22,6 +26,7 @@
"@types/node": "^22.13.8" "@types/node": "^22.13.8"
}, },
"dependencies": { "dependencies": {
"@push.rocks/projectinfo": "^5.0.2",
"@push.rocks/smartcli": "^4.0.11", "@push.rocks/smartcli": "^4.0.11",
"@push.rocks/smartpath": "^5.0.18", "@push.rocks/smartpath": "^5.0.18",
"pidusage": "^4.0.0", "pidusage": "^4.0.0",

13
pnpm-lock.yaml generated
View File

@ -8,6 +8,9 @@ importers:
.: .:
dependencies: dependencies:
'@push.rocks/projectinfo':
specifier: ^5.0.2
version: 5.0.2
'@push.rocks/smartcli': '@push.rocks/smartcli':
specifier: ^4.0.11 specifier: ^4.0.11
version: 4.0.11 version: 4.0.11
@ -710,6 +713,9 @@ packages:
'@push.rocks/mongodump@1.0.8': '@push.rocks/mongodump@1.0.8':
resolution: {integrity: sha512-oDufyjNBg8I50OaJvbHhc0RnRpJQ544dr9her0G6sA8JmI3hD2/amTdcPLVIX1kzYf5GsTUKeWuRaZgdNqz3ew==} resolution: {integrity: sha512-oDufyjNBg8I50OaJvbHhc0RnRpJQ544dr9her0G6sA8JmI3hD2/amTdcPLVIX1kzYf5GsTUKeWuRaZgdNqz3ew==}
'@push.rocks/projectinfo@5.0.2':
resolution: {integrity: sha512-zzieCal6jwR++o+fDl8gMpWkNV2cGEsbT96vCNZu/H9kr0iqRmapOiA4DFadkhOnhlDqvRr6TPaXESu2YUbI8Q==}
'@push.rocks/qenv@6.1.0': '@push.rocks/qenv@6.1.0':
resolution: {integrity: sha512-1FUFMlSVwFSFg8LbqfkzJ2LLP4lMGApUtgOpsvrde6+AxBmB4gjoNgCUH7z3xXfDAtYqcrtSELXBNE0xVL1MqQ==} resolution: {integrity: sha512-1FUFMlSVwFSFg8LbqfkzJ2LLP4lMGApUtgOpsvrde6+AxBmB4gjoNgCUH7z3xXfDAtYqcrtSELXBNE0xVL1MqQ==}
@ -5412,6 +5418,13 @@ snapshots:
transitivePeerDependencies: transitivePeerDependencies:
- aws-crt - aws-crt
'@push.rocks/projectinfo@5.0.2':
dependencies:
'@push.rocks/smartfile': 10.0.41
'@push.rocks/smartpath': 5.0.18
'@push.rocks/smartpromise': 4.2.3
'@push.rocks/smartstring': 4.0.15
'@push.rocks/qenv@6.1.0': '@push.rocks/qenv@6.1.0':
dependencies: dependencies:
'@api.global/typedrequest': 3.1.10 '@api.global/typedrequest': 3.1.10

View File

@ -8,7 +8,7 @@ tap.test('first test', async () => {
tap.start(); tap.start();
// Example usage: // Example usage:
const config: IMonitorConfig = { const config: tspm.IMonitorConfig = {
name: 'Project XYZ Monitor', // Identifier for the instance name: 'Project XYZ Monitor', // Identifier for the instance
projectDir: '/path/to/your/project', // Set the project directory here projectDir: '/path/to/your/project', // Set the project directory here
command: 'npm run xyz', // Full command string (no need for args) command: 'npm run xyz', // Full command string (no need for args)
@ -16,12 +16,12 @@ const config: IMonitorConfig = {
monitorIntervalMs: 5000, // Check memory usage every 5 seconds monitorIntervalMs: 5000, // Check memory usage every 5 seconds
}; };
const monitor = new ProcessMonitor(config); const monitor = new tspm.ProcessMonitor(config);
monitor.start(); monitor.start();
// Ensure that on process exit (e.g. Ctrl+C) we clean up the child process and prevent respawns. // Ensure that on process exit (e.g. Ctrl+C) we clean up the child process and prevent respawns.
process.on('SIGINT', () => { process.on('SIGINT', () => {
monitor.log('Received SIGINT, stopping monitor...'); console.log('Received SIGINT, stopping monitor...');
monitor.stop(); monitor.stop();
process.exit(); process.exit();
}); });

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@git.zone/tspm', name: '@git.zone/tspm',
version: '1.2.0', version: '1.3.1',
description: 'a no fuzz process manager' description: 'a no fuzz process manager'
} }

21
ts/cli.ts Normal file
View File

@ -0,0 +1,21 @@
import * as plugins from './plugins.js';
import * as paths from './paths.js';
export const run = async () => {
const tspmProjectinfo = new plugins.projectinfo.ProjectInfo(paths.packageDir);
const smartcliInstance = new plugins.smartcli.Smartcli();
smartcliInstance.addVersion(tspmProjectinfo.npm.version);
smartcliInstance.standardCommand().subscribe({
next: (argvArg) => {
console.log(`Please specify a command.`)
},
});
smartcliInstance.addCommand('restart').subscribe({
})
smartcliInstance.startParse();
}

View File

@ -1,2 +1,11 @@
export * from './classes.tspm.js'; export * from './classes.tspm.js';
export * from './classes.processmonitor.js'; export * from './classes.processmonitor.js';
import * as cli from './cli.js';
/**
* called to run as cli
*/
export const runCli = async () => {
await cli.run();
}

View File

@ -8,10 +8,12 @@ export {
} }
// @push.rocks scope // @push.rocks scope
import * as projectinfo from '@push.rocks/projectinfo';
import * as smartpath from '@push.rocks/smartpath'; import * as smartpath from '@push.rocks/smartpath';
import * as smartcli from '@push.rocks/smartcli'; import * as smartcli from '@push.rocks/smartcli';
export { export {
projectinfo,
smartpath, smartpath,
smartcli, smartcli,
} }