Phase 1-2: Migrate to Deno with npm: and node: specifiers
- Created deno.json configuration - Updated all imports to use npm:net-snmp@3.20.0 - Changed all Node.js built-in imports to node: specifiers - Updated all .js extensions to .ts in imports - Created mod.ts as Deno entry point - Ready for Phase 3: CLI simplification
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { execSync } from 'child_process';
|
||||
import { Nupst } from './nupst.js';
|
||||
import { logger } from './logger.js';
|
||||
import { execSync } from "node:child_process";
|
||||
import { Nupst } from './nupst.ts';
|
||||
import { logger } from './logger.ts';
|
||||
|
||||
/**
|
||||
* Class for handling CLI commands
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { Nupst } from '../nupst.js';
|
||||
import { logger } from '../logger.js';
|
||||
import * as helpers from '../helpers/index.js';
|
||||
import { type IGroupConfig } from '../daemon.js';
|
||||
import { Nupst } from '../nupst.ts';
|
||||
import { logger } from '../logger.ts';
|
||||
import * as helpers from '../helpers/index.ts';
|
||||
import { type IGroupConfig } from '../daemon.ts';
|
||||
|
||||
/**
|
||||
* Class for handling group-related CLI commands
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { execSync } from 'child_process';
|
||||
import { Nupst } from '../nupst.js';
|
||||
import { logger } from '../logger.js';
|
||||
import { execSync } from "node:child_process";
|
||||
import { Nupst } from '../nupst.ts';
|
||||
import { logger } from '../logger.ts';
|
||||
|
||||
/**
|
||||
* Class for handling service-related CLI commands
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { execSync } from 'child_process';
|
||||
import { Nupst } from '../nupst.js';
|
||||
import { logger } from '../logger.js';
|
||||
import * as helpers from '../helpers/index.js';
|
||||
import { execSync } from "node:child_process";
|
||||
import { Nupst } from '../nupst.ts';
|
||||
import { logger } from '../logger.ts';
|
||||
import * as helpers from '../helpers/index.ts';
|
||||
|
||||
/**
|
||||
* Class for handling UPS-related CLI commands
|
||||
|
14
ts/daemon.ts
14
ts/daemon.ts
@@ -1,10 +1,10 @@
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import { exec, execFile } from 'child_process';
|
||||
import { promisify } from 'util';
|
||||
import { NupstSnmp } from './snmp/manager.js';
|
||||
import type { ISnmpConfig } from './snmp/types.js';
|
||||
import { logger } from './logger.js';
|
||||
import * as fs from "node:fs";
|
||||
import * as path from "node:path";
|
||||
import { exec, execFile } from "node:child_process";
|
||||
import { promisify } from "node:util";
|
||||
import { NupstSnmp } from './snmp/manager.ts';
|
||||
import type { ISnmpConfig } from './snmp/types.ts';
|
||||
import { logger } from './logger.ts';
|
||||
|
||||
const execAsync = promisify(exec);
|
||||
const execFileAsync = promisify(execFile);
|
||||
|
@@ -1 +1 @@
|
||||
export * from './shortid.js';
|
||||
export * from './shortid.ts';
|
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import { NupstCli } from './cli.js';
|
||||
import { logger } from './logger.js';
|
||||
import { NupstCli } from './cli.ts';
|
||||
import { logger } from './logger.ts';
|
||||
|
||||
/**
|
||||
* Main entry point for NUPST
|
||||
|
18
ts/nupst.ts
18
ts/nupst.ts
@@ -1,12 +1,12 @@
|
||||
import { NupstSnmp } from './snmp/manager.js';
|
||||
import { NupstDaemon } from './daemon.js';
|
||||
import { NupstSystemd } from './systemd.js';
|
||||
import { commitinfo } from './00_commitinfo_data.js';
|
||||
import { logger } from './logger.js';
|
||||
import { UpsHandler } from './cli/ups-handler.js';
|
||||
import { GroupHandler } from './cli/group-handler.js';
|
||||
import { ServiceHandler } from './cli/service-handler.js';
|
||||
import * as https from 'https';
|
||||
import { NupstSnmp } from './snmp/manager.ts';
|
||||
import { NupstDaemon } from './daemon.ts';
|
||||
import { NupstSystemd } from './systemd.ts';
|
||||
import { commitinfo } from './00_commitinfo_data.ts';
|
||||
import { logger } from './logger.ts';
|
||||
import { UpsHandler } from './cli/ups-handler.ts';
|
||||
import { GroupHandler } from './cli/group-handler.ts';
|
||||
import { ServiceHandler } from './cli/service-handler.ts';
|
||||
import * as https from "node:https";
|
||||
|
||||
/**
|
||||
* Main Nupst class that coordinates all components
|
||||
|
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
// Re-export all public types
|
||||
export type { IUpsStatus, IOidSet, TUpsModel, ISnmpConfig } from './types.js';
|
||||
export type { IUpsStatus, IOidSet, TUpsModel, ISnmpConfig } from './types.ts';
|
||||
|
||||
// Re-export the SNMP manager class
|
||||
export { NupstSnmp } from './manager.js';
|
||||
export { NupstSnmp } from './manager.ts';
|
@@ -1,6 +1,6 @@
|
||||
import * as snmp from 'net-snmp';
|
||||
import type { IOidSet, ISnmpConfig, TUpsModel, IUpsStatus } from './types.js';
|
||||
import { UpsOidSets } from './oid-sets.js';
|
||||
import * as snmp from "npm:net-snmp@3.20.0";
|
||||
import type { IOidSet, ISnmpConfig, TUpsModel, IUpsStatus } from './types.ts';
|
||||
import { UpsOidSets } from './oid-sets.ts';
|
||||
|
||||
/**
|
||||
* Class for SNMP communication with UPS devices
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import type { IOidSet, TUpsModel } from './types.js';
|
||||
import type { IOidSet, TUpsModel } from './types.ts';
|
||||
|
||||
/**
|
||||
* OID sets for different UPS models
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { promises as fs } from 'fs';
|
||||
import { execSync } from 'child_process';
|
||||
import { NupstDaemon } from './daemon.js';
|
||||
import { logger } from './logger.js';
|
||||
import { promises as fs } from "node:fs";
|
||||
import { execSync } from "node:child_process";
|
||||
import { NupstDaemon } from './daemon.ts';
|
||||
import { logger } from './logger.ts';
|
||||
|
||||
/**
|
||||
* Class for managing systemd service
|
||||
|
Reference in New Issue
Block a user