@ismartify/cli
Advanced tools
Sorry, the diff of this file is not supported yet
| declare const script: Map<any, any>; | ||
| export { script as default }; |
| // src/builtin/bip.ts | ||
| var script = /* @__PURE__ */ new Map(); | ||
| script.set("name", "BIP"); | ||
| script.set("title", "\u751F\u6210BIP32\u52A9\u8BB0\u8BCD"); | ||
| script.set("description", "\u751F\u6210BIP32\u52A9\u8BB0\u8BCD"); | ||
| script.set("setup", async (context) => { | ||
| console.log("setup"); | ||
| }); | ||
| script.set("main", async (context) => { | ||
| console.log("main"); | ||
| }); | ||
| var bip_default = script; | ||
| export { | ||
| bip_default as default | ||
| }; | ||
| //# sourceMappingURL=bip.js.map |
| {"version":3,"sources":["../../src/builtin/bip.ts"],"sourcesContent":["import * as bip39 from 'bip39';\nimport * as bip32 from 'bip32';\n\n// // 1. 生成随机助记词(默认12个英文单词)\n// const mnemonic = bip39.generateMnemonic();\n\n// // 2. 助记词转种子(Buffer)\n// const seed = bip39.mnemonicToSeedSync(mnemonic);\n\n// // 3. 由种子生成 BIP32 根节点(HD钱包主私钥)\n// const root = bip32.fromSeed(seed);\n\n// // 4. 导出根节点扩展私钥(xprv,base58格式)\n// const xprv = root.toBase58();\n\n// // 5. 输出\n// console.log('随机助记词:', mnemonic);\n// console.log('种子(hex):', seed.toString('hex'));\n// console.log('BIP32扩展私钥(xprv):', xprv);\n\nconst script = new Map();\nscript.set('name', 'BIP');\nscript.set('title', '生成BIP32助记词');\nscript.set('description', '生成BIP32助记词');\nscript.set('setup', async (context: any) => {\n console.log('setup');\n});\nscript.set('main', async (context: any) => {\n console.log('main');\n});\n\nexport default script;"],"mappings":";AAoBA,IAAM,SAAS,oBAAI,IAAI;AACvB,OAAO,IAAI,QAAQ,KAAK;AACxB,OAAO,IAAI,SAAS,qCAAY;AAChC,OAAO,IAAI,eAAe,qCAAY;AACtC,OAAO,IAAI,SAAS,OAAO,YAAiB;AAC1C,UAAQ,IAAI,OAAO;AACrB,CAAC;AACD,OAAO,IAAI,QAAQ,OAAO,YAAiB;AACzC,UAAQ,IAAI,MAAM;AACpB,CAAC;AAED,IAAO,cAAQ;","names":[]} |
| declare const script: Map<any, any>; | ||
| export { script as default }; |
| // src/builtin/server.ts | ||
| import http from "http"; | ||
| import inquirer from "inquirer"; | ||
| var script = /* @__PURE__ */ new Map(); | ||
| script.set("name", "Server"); | ||
| script.set("title", "\u542F\u52A8 HTTP \u670D\u52A1\u5668"); | ||
| script.set("description", "\u542F\u52A8 HTTP \u670D\u52A1\u5668"); | ||
| script.set("setup", async (context) => { | ||
| const { port } = await inquirer.prompt([ | ||
| { | ||
| type: "input", | ||
| name: "port", | ||
| message: "\u8BF7\u8F93\u5165\u7AEF\u53E3\u53F7:", | ||
| default: "3000" | ||
| } | ||
| ]); | ||
| context.port = parseInt(port); | ||
| console.log(`\u7AEF\u53E3\u8BBE\u7F6E\u4E3A: ${context.port}`); | ||
| }); | ||
| script.set("main", async (context) => { | ||
| const server = http.createServer((req, res) => { | ||
| res.writeHead(200, { "Content-Type": "application/json" }); | ||
| res.end(JSON.stringify({ | ||
| message: "hello world" | ||
| })); | ||
| }); | ||
| server.listen(context.port, () => { | ||
| console.log(`\u670D\u52A1\u5668\u8FD0\u884C\u5728 http://localhost:${context.port}`); | ||
| }); | ||
| await new Promise(() => { | ||
| process.on("SIGINT", () => { | ||
| console.log("\n\u6B63\u5728\u5173\u95ED\u670D\u52A1\u5668..."); | ||
| server.close(() => { | ||
| console.log("\u670D\u52A1\u5668\u5DF2\u5173\u95ED"); | ||
| process.exit(0); | ||
| }); | ||
| }); | ||
| }); | ||
| }); | ||
| var server_default = script; | ||
| export { | ||
| server_default as default | ||
| }; | ||
| //# sourceMappingURL=server.js.map |
| {"version":3,"sources":["../../src/builtin/server.ts"],"sourcesContent":["import http from \"node:http\"\nimport inquirer from \"inquirer\"\n\nconst script = new Map();\nscript.set('name', 'Server');\nscript.set('title', '启动 HTTP 服务器');\nscript.set('description', '启动 HTTP 服务器');\n\nscript.set('setup', async (context: any) => {\n const { port } = await inquirer.prompt([\n {\n type: 'input',\n name: 'port',\n message: '请输入端口号:',\n default: '3000'\n }\n ]);\n context.port = parseInt(port);\n console.log(`端口设置为: ${context.port}`);\n});\n\nscript.set('main', async (context: any) => {\n const server = http.createServer((req, res) => {\n res.writeHead(200, { 'Content-Type': 'application/json' });\n res.end(JSON.stringify({\n message: \"hello world\"\n }));\n });\n\n server.listen(context.port, () => {\n console.log(`服务器运行在 http://localhost:${context.port}`);\n });\n\n // 等待用户按 Ctrl+C\n await new Promise(() => {\n process.on('SIGINT', () => {\n console.log('\\n正在关闭服务器...');\n server.close(() => {\n console.log('服务器已关闭');\n process.exit(0);\n });\n });\n });\n});\n\nexport default script;"],"mappings":";AAAA,OAAO,UAAU;AACjB,OAAO,cAAc;AAErB,IAAM,SAAS,oBAAI,IAAI;AACvB,OAAO,IAAI,QAAQ,QAAQ;AAC3B,OAAO,IAAI,SAAS,sCAAa;AACjC,OAAO,IAAI,eAAe,sCAAa;AAEvC,OAAO,IAAI,SAAS,OAAO,YAAiB;AAC1C,QAAM,EAAE,KAAK,IAAI,MAAM,SAAS,OAAO;AAAA,IACrC;AAAA,MACE,MAAM;AAAA,MACN,MAAM;AAAA,MACN,SAAS;AAAA,MACT,SAAS;AAAA,IACX;AAAA,EACF,CAAC;AACD,UAAQ,OAAO,SAAS,IAAI;AAC5B,UAAQ,IAAI,mCAAU,QAAQ,IAAI,EAAE;AACtC,CAAC;AAED,OAAO,IAAI,QAAQ,OAAO,YAAiB;AACzC,QAAM,SAAS,KAAK,aAAa,CAAC,KAAK,QAAQ;AAC7C,QAAI,UAAU,KAAK,EAAE,gBAAgB,mBAAmB,CAAC;AACzD,QAAI,IAAI,KAAK,UAAU;AAAA,MACrB,SAAS;AAAA,IACX,CAAC,CAAC;AAAA,EACJ,CAAC;AAED,SAAO,OAAO,QAAQ,MAAM,MAAM;AAChC,YAAQ,IAAI,yDAA2B,QAAQ,IAAI,EAAE;AAAA,EACvD,CAAC;AAGD,QAAM,IAAI,QAAQ,MAAM;AACtB,YAAQ,GAAG,UAAU,MAAM;AACzB,cAAQ,IAAI,iDAAc;AAC1B,aAAO,MAAM,MAAM;AACjB,gBAAQ,IAAI,sCAAQ;AACpB,gBAAQ,KAAK,CAAC;AAAA,MAChB,CAAC;AAAA,IACH,CAAC;AAAA,EACH,CAAC;AACH,CAAC;AAED,IAAO,iBAAQ;","names":[]} |
| declare const script: Map<any, any>; | ||
| export { script as default }; |
| // src/builtin/version.ts | ||
| import { readFileSync } from "fs"; | ||
| import { join, dirname } from "path"; | ||
| import { fileURLToPath } from "url"; | ||
| var script = /* @__PURE__ */ new Map(); | ||
| script.set("name", "echo-version"); | ||
| script.set("title", "Version2"); | ||
| script.set("description", "\u663E\u793A\u5F53\u524D\u7248\u672C\u4FE1\u606F"); | ||
| script.set("setup", async (context) => { | ||
| const __filename = fileURLToPath(import.meta.url); | ||
| const __dirname = dirname(__filename); | ||
| const pkg = JSON.parse( | ||
| readFileSync(join(__dirname, "../../package.json"), "utf-8") | ||
| ); | ||
| context.name = pkg.name; | ||
| context.version = pkg.version; | ||
| context.description = pkg.description; | ||
| }); | ||
| script.set("main", async (context) => { | ||
| console.log("\n=== \u7248\u672C\u4FE1\u606F ==="); | ||
| console.log(`\u540D\u79F0: ${context.name}`); | ||
| console.log(`\u7248\u672C: ${context.version}`); | ||
| console.log(`\u63CF\u8FF0: ${context.description}`); | ||
| console.log("\n=== \u7CFB\u7EDF\u4FE1\u606F ==="); | ||
| console.log(`Node.js \u7248\u672C: ${process.version}`); | ||
| console.log(`\u5E73\u53F0: ${process.platform} ${process.arch}`); | ||
| console.log(`\u5F53\u524D\u76EE\u5F55: ${process.cwd()} | ||
| `); | ||
| }); | ||
| var version_default = script; | ||
| export { | ||
| version_default as default | ||
| }; | ||
| //# sourceMappingURL=version.js.map |
| {"version":3,"sources":["../../src/builtin/version.ts"],"sourcesContent":["import { readFileSync } from 'fs';\nimport { join, dirname } from 'path';\nimport { fileURLToPath } from 'url';\n\nconst script = new Map();\nscript.set('name', 'echo-version');\nscript.set('title', 'Version2');\nscript.set('description', '显示当前版本信息');\n\nscript.set('setup', async (context: any) => {\n // 获取当前脚本所在目录的路径\n const __filename = fileURLToPath(import.meta.url);\n const __dirname = dirname(__filename);\n \n // 读取 package.json 获取版本信息\n const pkg = JSON.parse(\n readFileSync(join(__dirname, '../../package.json'), 'utf-8')\n );\n context.name = pkg.name;\n context.version = pkg.version;\n context.description = pkg.description;\n});\n\nscript.set('main', async (context: any) => {\n console.log('\\n=== 版本信息 ===');\n console.log(`名称: ${context.name}`);\n console.log(`版本: ${context.version}`);\n console.log(`描述: ${context.description}`);\n \n console.log('\\n=== 系统信息 ===');\n console.log(`Node.js 版本: ${process.version}`);\n console.log(`平台: ${process.platform} ${process.arch}`);\n console.log(`当前目录: ${process.cwd()}\\n`);\n});\n\nexport default script;"],"mappings":";AAAA,SAAS,oBAAoB;AAC7B,SAAS,MAAM,eAAe;AAC9B,SAAS,qBAAqB;AAE9B,IAAM,SAAS,oBAAI,IAAI;AACvB,OAAO,IAAI,QAAQ,cAAc;AACjC,OAAO,IAAI,SAAS,UAAU;AAC9B,OAAO,IAAI,eAAe,kDAAU;AAEpC,OAAO,IAAI,SAAS,OAAO,YAAiB;AAE1C,QAAM,aAAa,cAAc,YAAY,GAAG;AAChD,QAAM,YAAY,QAAQ,UAAU;AAGpC,QAAM,MAAM,KAAK;AAAA,IACf,aAAa,KAAK,WAAW,oBAAoB,GAAG,OAAO;AAAA,EAC7D;AACA,UAAQ,OAAO,IAAI;AACnB,UAAQ,UAAU,IAAI;AACtB,UAAQ,cAAc,IAAI;AAC5B,CAAC;AAED,OAAO,IAAI,QAAQ,OAAO,YAAiB;AACzC,UAAQ,IAAI,oCAAgB;AAC5B,UAAQ,IAAI,iBAAO,QAAQ,IAAI,EAAE;AACjC,UAAQ,IAAI,iBAAO,QAAQ,OAAO,EAAE;AACpC,UAAQ,IAAI,iBAAO,QAAQ,WAAW,EAAE;AAExC,UAAQ,IAAI,oCAAgB;AAC5B,UAAQ,IAAI,yBAAe,QAAQ,OAAO,EAAE;AAC5C,UAAQ,IAAI,iBAAO,QAAQ,QAAQ,IAAI,QAAQ,IAAI,EAAE;AACrD,UAAQ,IAAI,6BAAS,QAAQ,IAAI,CAAC;AAAA,CAAI;AACxC,CAAC;AAED,IAAO,kBAAQ;","names":[]} |
| import * as bip39 from 'bip39'; | ||
| import * as bip32 from 'bip32'; | ||
| // // 1. 生成随机助记词(默认12个英文单词) | ||
| // const mnemonic = bip39.generateMnemonic(); | ||
| // // 2. 助记词转种子(Buffer) | ||
| // const seed = bip39.mnemonicToSeedSync(mnemonic); | ||
| // // 3. 由种子生成 BIP32 根节点(HD钱包主私钥) | ||
| // const root = bip32.fromSeed(seed); | ||
| // // 4. 导出根节点扩展私钥(xprv,base58格式) | ||
| // const xprv = root.toBase58(); | ||
| // // 5. 输出 | ||
| // console.log('随机助记词:', mnemonic); | ||
| // console.log('种子(hex):', seed.toString('hex')); | ||
| // console.log('BIP32扩展私钥(xprv):', xprv); | ||
| const script = new Map(); | ||
| script.set('name', 'BIP'); | ||
| script.set('title', '生成BIP32助记词'); | ||
| script.set('description', '生成BIP32助记词'); | ||
| script.set('setup', async (context: any) => { | ||
| console.log('setup'); | ||
| }); | ||
| script.set('main', async (context: any) => { | ||
| console.log('main'); | ||
| }); | ||
| export default script; |
| import http from "node:http" | ||
| import inquirer from "inquirer" | ||
| const script = new Map(); | ||
| script.set('name', 'Server'); | ||
| script.set('title', '启动 HTTP 服务器'); | ||
| script.set('description', '启动 HTTP 服务器'); | ||
| script.set('setup', async (context: any) => { | ||
| const { port } = await inquirer.prompt([ | ||
| { | ||
| type: 'input', | ||
| name: 'port', | ||
| message: '请输入端口号:', | ||
| default: '3000' | ||
| } | ||
| ]); | ||
| context.port = parseInt(port); | ||
| console.log(`端口设置为: ${context.port}`); | ||
| }); | ||
| script.set('main', async (context: any) => { | ||
| const server = http.createServer((req, res) => { | ||
| res.writeHead(200, { 'Content-Type': 'application/json' }); | ||
| res.end(JSON.stringify({ | ||
| message: "hello world" | ||
| })); | ||
| }); | ||
| server.listen(context.port, () => { | ||
| console.log(`服务器运行在 http://localhost:${context.port}`); | ||
| }); | ||
| // 等待用户按 Ctrl+C | ||
| await new Promise(() => { | ||
| process.on('SIGINT', () => { | ||
| console.log('\n正在关闭服务器...'); | ||
| server.close(() => { | ||
| console.log('服务器已关闭'); | ||
| process.exit(0); | ||
| }); | ||
| }); | ||
| }); | ||
| }); | ||
| export default script; |
| import { readFileSync } from 'fs'; | ||
| import { join, dirname } from 'path'; | ||
| import { fileURLToPath } from 'url'; | ||
| const script = new Map(); | ||
| script.set('name', 'echo-version'); | ||
| script.set('title', 'Version2'); | ||
| script.set('description', '显示当前版本信息'); | ||
| script.set('setup', async (context: any) => { | ||
| // 获取当前脚本所在目录的路径 | ||
| const __filename = fileURLToPath(import.meta.url); | ||
| const __dirname = dirname(__filename); | ||
| // 读取 package.json 获取版本信息 | ||
| const pkg = JSON.parse( | ||
| readFileSync(join(__dirname, '../../package.json'), 'utf-8') | ||
| ); | ||
| context.name = pkg.name; | ||
| context.version = pkg.version; | ||
| context.description = pkg.description; | ||
| }); | ||
| script.set('main', async (context: any) => { | ||
| console.log('\n=== 版本信息 ==='); | ||
| console.log(`名称: ${context.name}`); | ||
| console.log(`版本: ${context.version}`); | ||
| console.log(`描述: ${context.description}`); | ||
| console.log('\n=== 系统信息 ==='); | ||
| console.log(`Node.js 版本: ${process.version}`); | ||
| console.log(`平台: ${process.platform} ${process.arch}`); | ||
| console.log(`当前目录: ${process.cwd()}\n`); | ||
| }); | ||
| export default script; |
+18
-7
| { | ||
| "name": "@ismartify/cli", | ||
| "version": "1.1.2", | ||
| "version": "1.1.4", | ||
| "description": "iSmartify CLI 工具", | ||
@@ -9,5 +9,12 @@ "type": "module", | ||
| }, | ||
| "publishConfig": { | ||
| "bin": { | ||
| "ismartify": "./dist/index.js" | ||
| } | ||
| }, | ||
| "files": [ | ||
| "dist", | ||
| "src/scripts" | ||
| "src/scripts", | ||
| "src/builtin", | ||
| "bin" | ||
| ], | ||
@@ -19,6 +26,6 @@ "scripts": { | ||
| "test": "vitest", | ||
| "release": "standard-version", | ||
| "release:minor": "standard-version --release-as minor", | ||
| "release:major": "standard-version --release-as major", | ||
| "release:patch": "standard-version --release-as patch" | ||
| "prepare": "husky install", | ||
| "git:push": "node bin/git push", | ||
| "git:publish": "node bin/git publish", | ||
| "git:status": "node bin/git status" | ||
| }, | ||
@@ -30,2 +37,4 @@ "keywords": [ | ||
| "dependencies": { | ||
| "bip32": "5.0.0-rc.0", | ||
| "bip39": "^3.1.0", | ||
| "cross-env": "^7.0.3", | ||
@@ -37,5 +46,7 @@ "inquirer": "^12.4.3", | ||
| "devDependencies": { | ||
| "@actions/core": "^1.11.1", | ||
| "@types/inquirer": "^9.0.7", | ||
| "@types/node": "^22.13.10", | ||
| "glob": "^11.0.1", | ||
| "husky": "^9.1.7", | ||
| "standard-version": "^9.5.0", | ||
@@ -46,2 +57,2 @@ "tsup": "^8.4.0", | ||
| } | ||
| } | ||
| } |
| declare const script: Map<any, any>; | ||
| export { script as default }; |
| // src/scripts/server.ts | ||
| import http from "node:http"; | ||
| import inquirer from "inquirer"; | ||
| var script = /* @__PURE__ */ new Map(); | ||
| script.set("title", "Server"); | ||
| script.set("description", "\u542F\u52A8 HTTP \u670D\u52A1\u5668"); | ||
| script.set("setup", async (context) => { | ||
| const { port } = await inquirer.prompt([ | ||
| { | ||
| type: "input", | ||
| name: "port", | ||
| message: "\u8BF7\u8F93\u5165\u7AEF\u53E3\u53F7:", | ||
| default: "3000" | ||
| } | ||
| ]); | ||
| context.port = parseInt(port); | ||
| console.log(`\u7AEF\u53E3\u8BBE\u7F6E\u4E3A: ${context.port}`); | ||
| }); | ||
| script.set("main", async (context) => { | ||
| const server = http.createServer((req, res) => { | ||
| res.writeHead(200, { "Content-Type": "application/json" }); | ||
| res.end(JSON.stringify({ | ||
| message: "hello world" | ||
| })); | ||
| }); | ||
| server.listen(context.port, () => { | ||
| console.log(`\u670D\u52A1\u5668\u8FD0\u884C\u5728 http://localhost:${context.port}`); | ||
| }); | ||
| await new Promise(() => { | ||
| process.on("SIGINT", () => { | ||
| console.log("\n\u6B63\u5728\u5173\u95ED\u670D\u52A1\u5668..."); | ||
| server.close(() => { | ||
| console.log("\u670D\u52A1\u5668\u5DF2\u5173\u95ED"); | ||
| process.exit(0); | ||
| }); | ||
| }); | ||
| }); | ||
| }); | ||
| var server_default = script; | ||
| export { | ||
| server_default as default | ||
| }; | ||
| //# sourceMappingURL=server.js.map |
| {"version":3,"sources":["../../src/scripts/server.ts"],"sourcesContent":["import http from \"node:http\"\nimport inquirer from \"inquirer\"\n\nconst script = new Map();\n\nscript.set('title', 'Server');\nscript.set('description', '启动 HTTP 服务器');\n\nscript.set('setup', async (context: any) => {\n const { port } = await inquirer.prompt([\n {\n type: 'input',\n name: 'port',\n message: '请输入端口号:',\n default: '3000'\n }\n ]);\n context.port = parseInt(port);\n console.log(`端口设置为: ${context.port}`);\n});\n\nscript.set('main', async (context: any) => {\n const server = http.createServer((req, res) => {\n res.writeHead(200, { 'Content-Type': 'application/json' });\n res.end(JSON.stringify({\n message: \"hello world\"\n }));\n });\n\n server.listen(context.port, () => {\n console.log(`服务器运行在 http://localhost:${context.port}`);\n });\n\n // 等待用户按 Ctrl+C\n await new Promise(() => {\n process.on('SIGINT', () => {\n console.log('\\n正在关闭服务器...');\n server.close(() => {\n console.log('服务器已关闭');\n process.exit(0);\n });\n });\n });\n});\n\nexport default script;"],"mappings":";AAAA,OAAO,UAAU;AACjB,OAAO,cAAc;AAErB,IAAM,SAAS,oBAAI,IAAI;AAEvB,OAAO,IAAI,SAAS,QAAQ;AAC5B,OAAO,IAAI,eAAe,sCAAa;AAEvC,OAAO,IAAI,SAAS,OAAO,YAAiB;AAC1C,QAAM,EAAE,KAAK,IAAI,MAAM,SAAS,OAAO;AAAA,IACrC;AAAA,MACE,MAAM;AAAA,MACN,MAAM;AAAA,MACN,SAAS;AAAA,MACT,SAAS;AAAA,IACX;AAAA,EACF,CAAC;AACD,UAAQ,OAAO,SAAS,IAAI;AAC5B,UAAQ,IAAI,mCAAU,QAAQ,IAAI,EAAE;AACtC,CAAC;AAED,OAAO,IAAI,QAAQ,OAAO,YAAiB;AACzC,QAAM,SAAS,KAAK,aAAa,CAAC,KAAK,QAAQ;AAC7C,QAAI,UAAU,KAAK,EAAE,gBAAgB,mBAAmB,CAAC;AACzD,QAAI,IAAI,KAAK,UAAU;AAAA,MACrB,SAAS;AAAA,IACX,CAAC,CAAC;AAAA,EACJ,CAAC;AAED,SAAO,OAAO,QAAQ,MAAM,MAAM;AAChC,YAAQ,IAAI,yDAA2B,QAAQ,IAAI,EAAE;AAAA,EACvD,CAAC;AAGD,QAAM,IAAI,QAAQ,MAAM;AACtB,YAAQ,GAAG,UAAU,MAAM;AACzB,cAAQ,IAAI,iDAAc;AAC1B,aAAO,MAAM,MAAM;AACjB,gBAAQ,IAAI,sCAAQ;AACpB,gBAAQ,KAAK,CAAC;AAAA,MAChB,CAAC;AAAA,IACH,CAAC;AAAA,EACH,CAAC;AACH,CAAC;AAED,IAAO,iBAAQ;","names":[]} |
| declare const script: Map<any, any>; | ||
| export { script as default }; |
| // src/scripts/version.ts | ||
| import http from "node:http"; | ||
| import inquirer from "inquirer"; | ||
| var script = /* @__PURE__ */ new Map(); | ||
| script.set("title", "Server"); | ||
| script.set("description", "\u542F\u52A8 HTTP \u670D\u52A1\u5668"); | ||
| script.set("setup", async (context) => { | ||
| const { port } = await inquirer.prompt([ | ||
| { | ||
| type: "input", | ||
| name: "port", | ||
| message: "\u8BF7\u8F93\u5165\u7AEF\u53E3\u53F7:", | ||
| default: "3000" | ||
| } | ||
| ]); | ||
| context.port = parseInt(port); | ||
| console.log(`\u7AEF\u53E3\u8BBE\u7F6E\u4E3A: ${context.port}`); | ||
| }); | ||
| script.set("main", async (context) => { | ||
| const server = http.createServer((req, res) => { | ||
| res.writeHead(200, { "Content-Type": "application/json" }); | ||
| res.end(JSON.stringify({ | ||
| message: "hello world" | ||
| })); | ||
| }); | ||
| server.listen(context.port, () => { | ||
| console.log(`\u670D\u52A1\u5668\u8FD0\u884C\u5728 http://localhost:${context.port}`); | ||
| }); | ||
| await new Promise(() => { | ||
| process.on("SIGINT", () => { | ||
| console.log("\n\u6B63\u5728\u5173\u95ED\u670D\u52A1\u5668..."); | ||
| server.close(() => { | ||
| console.log("\u670D\u52A1\u5668\u5DF2\u5173\u95ED"); | ||
| process.exit(0); | ||
| }); | ||
| }); | ||
| }); | ||
| }); | ||
| var version_default = script; | ||
| export { | ||
| version_default as default | ||
| }; | ||
| //# sourceMappingURL=version.js.map |
| {"version":3,"sources":["../../src/scripts/version.ts"],"sourcesContent":["import http from \"node:http\"\nimport inquirer from \"inquirer\"\n\nconst script = new Map();\n\nscript.set('title', 'Server');\nscript.set('description', '启动 HTTP 服务器');\n\nscript.set('setup', async (context: any) => {\n const { port } = await inquirer.prompt([\n {\n type: 'input',\n name: 'port',\n message: '请输入端口号:',\n default: '3000'\n }\n ]);\n context.port = parseInt(port);\n console.log(`端口设置为: ${context.port}`);\n});\n\nscript.set('main', async (context: any) => {\n const server = http.createServer((req, res) => {\n res.writeHead(200, { 'Content-Type': 'application/json' });\n res.end(JSON.stringify({\n message: \"hello world\"\n }));\n });\n\n server.listen(context.port, () => {\n console.log(`服务器运行在 http://localhost:${context.port}`);\n });\n\n // 等待用户按 Ctrl+C\n await new Promise(() => {\n process.on('SIGINT', () => {\n console.log('\\n正在关闭服务器...');\n server.close(() => {\n console.log('服务器已关闭');\n process.exit(0);\n });\n });\n });\n});\n\nexport default script;"],"mappings":";AAAA,OAAO,UAAU;AACjB,OAAO,cAAc;AAErB,IAAM,SAAS,oBAAI,IAAI;AAEvB,OAAO,IAAI,SAAS,QAAQ;AAC5B,OAAO,IAAI,eAAe,sCAAa;AAEvC,OAAO,IAAI,SAAS,OAAO,YAAiB;AAC1C,QAAM,EAAE,KAAK,IAAI,MAAM,SAAS,OAAO;AAAA,IACrC;AAAA,MACE,MAAM;AAAA,MACN,MAAM;AAAA,MACN,SAAS;AAAA,MACT,SAAS;AAAA,IACX;AAAA,EACF,CAAC;AACD,UAAQ,OAAO,SAAS,IAAI;AAC5B,UAAQ,IAAI,mCAAU,QAAQ,IAAI,EAAE;AACtC,CAAC;AAED,OAAO,IAAI,QAAQ,OAAO,YAAiB;AACzC,QAAM,SAAS,KAAK,aAAa,CAAC,KAAK,QAAQ;AAC7C,QAAI,UAAU,KAAK,EAAE,gBAAgB,mBAAmB,CAAC;AACzD,QAAI,IAAI,KAAK,UAAU;AAAA,MACrB,SAAS;AAAA,IACX,CAAC,CAAC;AAAA,EACJ,CAAC;AAED,SAAO,OAAO,QAAQ,MAAM,MAAM;AAChC,YAAQ,IAAI,yDAA2B,QAAQ,IAAI,EAAE;AAAA,EACvD,CAAC;AAGD,QAAM,IAAI,QAAQ,MAAM;AACtB,YAAQ,GAAG,UAAU,MAAM;AACzB,cAAQ,IAAI,iDAAc;AAC1B,aAAO,MAAM,MAAM;AACjB,gBAAQ,IAAI,sCAAQ;AACpB,gBAAQ,KAAK,CAAC;AAAA,MAChB,CAAC;AAAA,IACH,CAAC;AAAA,EACH,CAAC;AACH,CAAC;AAED,IAAO,kBAAQ;","names":[]} |
| import http from "node:http" | ||
| import inquirer from "inquirer" | ||
| const script = new Map(); | ||
| script.set('title', 'Server'); | ||
| script.set('description', '启动 HTTP 服务器'); | ||
| script.set('setup', async (context: any) => { | ||
| const { port } = await inquirer.prompt([ | ||
| { | ||
| type: 'input', | ||
| name: 'port', | ||
| message: '请输入端口号:', | ||
| default: '3000' | ||
| } | ||
| ]); | ||
| context.port = parseInt(port); | ||
| console.log(`端口设置为: ${context.port}`); | ||
| }); | ||
| script.set('main', async (context: any) => { | ||
| const server = http.createServer((req, res) => { | ||
| res.writeHead(200, { 'Content-Type': 'application/json' }); | ||
| res.end(JSON.stringify({ | ||
| message: "hello world" | ||
| })); | ||
| }); | ||
| server.listen(context.port, () => { | ||
| console.log(`服务器运行在 http://localhost:${context.port}`); | ||
| }); | ||
| // 等待用户按 Ctrl+C | ||
| await new Promise(() => { | ||
| process.on('SIGINT', () => { | ||
| console.log('\n正在关闭服务器...'); | ||
| server.close(() => { | ||
| console.log('服务器已关闭'); | ||
| process.exit(0); | ||
| }); | ||
| }); | ||
| }); | ||
| }); | ||
| export default script; |
| import http from "node:http" | ||
| import inquirer from "inquirer" | ||
| const script = new Map(); | ||
| script.set('title', 'Server'); | ||
| script.set('description', '启动 HTTP 服务器'); | ||
| script.set('setup', async (context: any) => { | ||
| const { port } = await inquirer.prompt([ | ||
| { | ||
| type: 'input', | ||
| name: 'port', | ||
| message: '请输入端口号:', | ||
| default: '3000' | ||
| } | ||
| ]); | ||
| context.port = parseInt(port); | ||
| console.log(`端口设置为: ${context.port}`); | ||
| }); | ||
| script.set('main', async (context: any) => { | ||
| const server = http.createServer((req, res) => { | ||
| res.writeHead(200, { 'Content-Type': 'application/json' }); | ||
| res.end(JSON.stringify({ | ||
| message: "hello world" | ||
| })); | ||
| }); | ||
| server.listen(context.port, () => { | ||
| console.log(`服务器运行在 http://localhost:${context.port}`); | ||
| }); | ||
| // 等待用户按 Ctrl+C | ||
| await new Promise(() => { | ||
| process.on('SIGINT', () => { | ||
| console.log('\n正在关闭服务器...'); | ||
| server.close(() => { | ||
| console.log('服务器已关闭'); | ||
| process.exit(0); | ||
| }); | ||
| }); | ||
| }); | ||
| }); | ||
| export default script; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Network access
Supply chain riskThis module accesses the network.
Found 2 instances
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances
Network access
Supply chain riskThis module accesses the network.
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances
725830
2.76%19
35.71%7048
2%9
-18.18%6
50%9
28.57%10
42.86%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added