@enterprisestandard/cli 0.0.8-beta.20260204.1
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/dist/cli.js +2 -0
- package/package.json +18 -0
package/dist/cli.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{createServer as f}from"node:http";import{spawn as H}from"node:child_process";import{platform as $}from"node:os";var K="https://ionite.com",D="/callback",M=300000;function P(){let G=process.argv.slice(2),z,x=K;for(let N of G)if(N.startsWith("--appId="))z=N.slice(8).trim();else if(N.startsWith("--baseUrl="))x=N.slice(10).trim().replace(/\/$/,"");if(!z)console.error("Error: --appId is required. Example: es --appId=1234"),process.exit(1);return{appId:z,baseUrl:x}}function E(G){let z=$()==="win32"?{command:"cmd",args:["/c","start","",G]}:$()==="darwin"?{command:"open",args:[G]}:{command:"xdg-open",args:[G]};H(z.command,z.args,{stdio:"ignore",detached:!0}).unref()}function S(){let{appId:G,baseUrl:z}=P(),x=f((j,Q)=>{let W=j.url??"",[V,Y]=W.split("?");if(V!==D&&V!=="/"){Q.writeHead(404,{"Content-Type":"text/plain"}),Q.end("Not found");return}let F=Y?Object.fromEntries(new URLSearchParams(Y)):{},X=[];j.on("data",(J)=>X.push(J)),j.on("end",()=>{let J=X.length>0?Buffer.concat(X).toString("utf-8"):"",Z=J;if((j.headers["content-type"]??"").includes("application/json")&&J)try{Z=JSON.parse(J)}catch{}let O={query:F,body:J?Z:void 0};Q.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),Q.end("<!DOCTYPE html><html><head><title>Success</title></head><body><p>Success. You can close this window.</p></body></html>"),x.close(),console.log(JSON.stringify(O,null,2)),process.exit(0)})});x.listen(0,"127.0.0.1",()=>{let j=x.address();if(!j||typeof j==="string")console.error("Error: could not bind callback server"),process.exit(1);let W=`http://127.0.0.1:${j.port}${D}`,V=`${z}/api/dev?appId=${encodeURIComponent(G)}&redirect=${encodeURIComponent(W)}`;console.error(`Opening browser to ${V} ...`),E(V)}),x.on("error",(j)=>{console.error("Error starting callback server:",j.message),process.exit(1)}),setTimeout(()=>{x.close(),console.error("Timeout: no callback received within 5 minutes. Please try again."),process.exit(1)},M).unref()}S();
|
package/package.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@enterprisestandard/cli",
|
|
3
|
+
"version": "0.0.8-beta.20260204.1",
|
|
4
|
+
"description": "Enterprise Standard CLI - Wrangler-style SSO dev flow",
|
|
5
|
+
"private": false,
|
|
6
|
+
"author": "enterprisestandard",
|
|
7
|
+
"license": "proprietary",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"bin": {
|
|
10
|
+
"es": "./dist/cli.js"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=18"
|
|
17
|
+
}
|
|
18
|
+
}
|