@design-edito/cli 0.0.83 → 0.0.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/assets/list.txt +1 -0
- package/cli/assets/version.txt +1 -1
- package/package.json +5 -2
- package/serve/index.js +3 -0
- package/serve/index.js.map +7 -0
package/cli/assets/list.txt
CHANGED
package/cli/assets/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.86
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@design-edito/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.86",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Maxime Fabas",
|
|
6
6
|
"license": "ISC",
|
|
@@ -14,14 +14,17 @@
|
|
|
14
14
|
"bin": {
|
|
15
15
|
"cli": "./cli/index.js",
|
|
16
16
|
"make-template": "./make-template/index.js",
|
|
17
|
-
"tree": "./tree/index.js"
|
|
17
|
+
"tree": "./tree/index.js",
|
|
18
|
+
"serve": "./serve/index.js"
|
|
18
19
|
},
|
|
19
20
|
"dependencies": {
|
|
20
21
|
"@design-edito/tools": "^0.1.48",
|
|
21
22
|
"commander": "^12.1.0",
|
|
23
|
+
"http-server": "^14.1.1",
|
|
22
24
|
"prompts": "^2.4.2"
|
|
23
25
|
},
|
|
24
26
|
"devDependencies": {
|
|
27
|
+
"@types/http-server": "^0.12.4",
|
|
25
28
|
"@types/node": "^22.13.4",
|
|
26
29
|
"@types/prompts": "^2.4.9",
|
|
27
30
|
"@types/semver": "^7.5.8",
|
package/serve/index.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{program as c}from"commander";import l from"http-server";c.name("@design-edito/serve").description("Quickly spawn a HTTP server").argument("[port]","Depth (optional, defaults to 3000)").option("-c, --cache <seconds>","Cache duration in seconds (default:-1)","-1").option("--cors <boolean>","Enable CORS (default: false)","false").action(async(s,n)=>{let e=s!==void 0?parseInt(s):0,a=parseInt(n.cache),i=n.cors==="true";if(Number.isNaN(e))return console.error("Port should be a number"),process.exit(1);let r=l.createServer({cache:a,cors:i});r.listen(e,()=>console.log(`Server is running on http://localhost:${e}`)),r.on("error",o=>(console.error(o),process.exit(1)));let t=()=>{console.log("Shutting down..."),r.close(o=>{o!==void 0?console.error("Error while shutting down:",o):console.error(`Server stopped at http://localhost:${e}`),process.exit(0)})};process.on("SIGINT",t),process.on("SIGTERM",t)});c.parse(process.argv);
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/serve/index.ts"],
|
|
4
|
+
"sourcesContent": ["import { program } from 'commander'\nimport httpServer from 'http-server'\n\nprogram\n .name('@design-edito/serve')\n .description('Quickly spawn a HTTP server')\n .argument('[port]', 'Depth (optional, defaults to 3000)')\n .option('-c, --cache <seconds>', 'Cache duration in seconds (default:-1)', '-1')\n .option('--cors <boolean>', 'Enable CORS (default: false)', 'false')\n .action(async (_port, options) => {\n const port = _port !== undefined ? parseInt(_port) : 0\n const cache = parseInt(options.cache)\n const cors = options.cors === 'true'\n if (Number.isNaN(port)) {\n console.error('Port should be a number')\n return process.exit(1)\n }\n const server = httpServer.createServer({ cache, cors })\n server.listen(port, () => console.log(`Server is running on http://localhost:${port}`))\n server.on('error', err => {\n console.error(err)\n return process.exit(1)\n })\n const onShutdown = () => {\n console.log('Shutting down...')\n server.close(err => {\n if (err !== undefined) console.error('Error while shutting down:', err)\n else console.error(`Server stopped at http://localhost:${port}`)\n process.exit(0)\n })\n }\n process.on('SIGINT', onShutdown)\n process.on('SIGTERM', onShutdown)\n })\n\nprogram.parse(process.argv)\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,WAAAA,MAAe,YACxB,OAAOC,MAAgB,cAEvBD,EACG,KAAK,qBAAqB,EAC1B,YAAY,6BAA6B,EACzC,SAAS,SAAU,oCAAoC,EACvD,OAAO,wBAAyB,yCAA0C,IAAI,EAC9E,OAAO,mBAAoB,+BAAgC,OAAO,EAClE,OAAO,MAAOE,EAAOC,IAAY,CAChC,IAAMC,EAAOF,IAAU,OAAY,SAASA,CAAK,EAAI,EAC/CG,EAAQ,SAASF,EAAQ,KAAK,EAC9BG,EAAOH,EAAQ,OAAS,OAC9B,GAAI,OAAO,MAAMC,CAAI,EACnB,eAAQ,MAAM,yBAAyB,EAChC,QAAQ,KAAK,CAAC,EAEvB,IAAMG,EAASN,EAAW,aAAa,CAAE,MAAAI,EAAO,KAAAC,CAAK,CAAC,EACtDC,EAAO,OAAOH,EAAM,IAAM,QAAQ,IAAI,yCAAyCA,CAAI,EAAE,CAAC,EACtFG,EAAO,GAAG,QAASC,IACjB,QAAQ,MAAMA,CAAG,EACV,QAAQ,KAAK,CAAC,EACtB,EACD,IAAMC,EAAa,IAAM,CACvB,QAAQ,IAAI,kBAAkB,EAC9BF,EAAO,MAAMC,GAAO,CACdA,IAAQ,OAAW,QAAQ,MAAM,6BAA8BA,CAAG,EACjE,QAAQ,MAAM,sCAAsCJ,CAAI,EAAE,EAC/D,QAAQ,KAAK,CAAC,CAChB,CAAC,CACH,EACA,QAAQ,GAAG,SAAUK,CAAU,EAC/B,QAAQ,GAAG,UAAWA,CAAU,CAClC,CAAC,EAEHT,EAAQ,MAAM,QAAQ,IAAI",
|
|
6
|
+
"names": ["program", "httpServer", "_port", "options", "port", "cache", "cors", "server", "err", "onShutdown"]
|
|
7
|
+
}
|