@coreframe/scripts 0.1.24 → 0.1.25
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/dev.d.ts +1 -1
- package/dist/dev.js +1 -1
- package/package.json +1 -1
package/dist/dev.d.ts
CHANGED
package/dist/dev.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{readProjectConfig as e}from"./config.js";import{fs as t,net as n}from"./environment.js";import{ProjectPostgresAlreadyRunningError as r,startProjectPostgres as i,stopProjectPostgres as a}from"./db/local-postgres.js";import o from"./_virtual/_@oxc-project_runtime@0.138.0/helpers/esm/usingCtx.js";import{devHttpsCertEnv as s,devHttpsKeyEnv as c,prepareDevHttps as l}from"./dev-https.js";import{acquireDevLock as u}from"./dev-lock.js";import{managedDevEnv as d}from"./managed-dev-protocol.js";import{isManagedDevCheckout as f}from"./managed-dev.js";import p from"node:path";import*as m from"@clack/prompts";import h from"node:process";import{createPrefixStream as g,supervise as _}from"procband";const v=[`web`,`desktop`,`ios`,`android`];function y(e){let t=e.dev?.platforms??[`web`];for(let e of t)if(!v.includes(e))throw Error(`Invalid development platform "${String(e)}". Expected one of: ${v.join(`, `)}.`);return[...new Set(t)]}const b=p.resolve(`node_modules`,`.bin`),x=h.platform===`win32`?`pnpm.cmd`:`pnpm`,S=h.platform===`win32`?`react-router.cmd`:`react-router`,C=h.platform===`win32`?`turso.cmd`:`turso`;async function w({cwd:r=h.cwd(),env:i=h.env,host:a,https:m=!1,interactive:v=h.stdin.isTTY===!0,managed:y=!1,noManaged:w=!1,platform:A=`web`,webPort:j}={}){let M=i.PATH??i.Path??``,N=A===`web`?k(j??i.COREFRAME_WEB_PORT):void 0,P,F,I=i;if(y&&w)throw Error(`Cannot use --managed and --no-managed together.`);if(m&&A!==`web`)throw Error(`Local HTTPS is only supported for the web development platform.`);let L=await u({cwd:r,interactive:v});if(!L)return;try{if(A===`web`){let a=await e({cwd:r}),u=m?await l({cwd:r}):void 0;if(I=u?{...i,[s]:u.cert,[c]:u.key}:i,(y||v&&!w)&&await f(r)&&(I={...I,[d]:`1`}),a.database?.dialect===`sqlite`){let e=await n.getAvailablePort(),a=p.resolve(r,`.coreframe`),o=p.join(a,`turso.db`);await t.mkdir(a,{recursive:!0}),I={...I,TURSO_DATABASE_URL:`http://127.0.0.1:${e}`,TURSO_AUTH_TOKEN:`dev`},P=_({name:`turso`,command:C,args:[`dev`,`--port`,String(e),`--db-file`,o],cwd:r,env:i}),await P.waitFor(`listening`),await _({name:`db`,command:x,args:[`db`,`ensure`],cwd:r,env:I,prefix:!1}).expectSuccess()}if(E(a)){let e=g({label:`postgres`});e.pipe(h.stdout,{end:!1});try{try{var R=o();let t=await T({config:a,cwd:r,env:I,interactive:v,postgresOutput:e,takeoverApproved:L.takeoverApproved});if(!t)return;R.a(t);let n=t.env;I=n,await _({name:`db`,command:x,args:[`db`,`ensure`],cwd:r,env:n,prefix:!1}).expectSuccess(),await z()}catch(e){R.e=e}finally{await R.d()}}finally{e.end()}return}await z();return}let a=D(A);await _({name:A,command:x,args:a,cwd:r,env:i}).expectSuccess()}finally{F?.kill(`SIGTERM`),P&&P.kill(`SIGTERM`),await L.release()}async function z(){F=_({name:`web`,command:S,args:O({host:a,port:N}),cwd:r,env:{...I,CLOUDFLARE_ENV:`development`,PATH:b+p.delimiter+M}}),await F.wait(),await F.expectSuccess(),F=void 0}}async function T({interactive:e,takeoverApproved:t,...n}){try{return await i(n)}catch(o){if(!(o instanceof r)||!e)throw o;if(!t){let e=await m.confirm({initialValue:!1,message:`PostgreSQL is already running for this project (PID ${o.pid}). Stop it and start here?`});if(m.isCancel(e)||!e){m.cancel(`Keeping the existing PostgreSQL process.`);return}}return await a(o),i(n)}}function E(e){return(e.database?.dialect??`postgres`)===`postgres`}function D(e){return[`--dir=tauri`,`tauri`,...e===`desktop`?[]:[e],`dev`]}function O({host:e,port:t}){return[`dev`,...e===void 0?[]:[`--host`,e],...t===void 0?[]:[`--port`,String(t)]]}function k(e){if(e===void 0)return;let t=Number(e);if(!Number.isInteger(t)||t<=0||t>65535)throw Error(`COREFRAME_WEB_PORT must be a valid TCP port.`);return t}export{v as devPlatforms,y as resolveDevPlatforms,w as runDevServer};
|
|
2
|
+
import{readProjectConfig as e}from"./config.js";import{fs as t,net as n}from"./environment.js";import{ProjectPostgresAlreadyRunningError as r,startProjectPostgres as i,stopProjectPostgres as a}from"./db/local-postgres.js";import o from"./_virtual/_@oxc-project_runtime@0.138.0/helpers/esm/usingCtx.js";import{devHttpsCertEnv as s,devHttpsKeyEnv as c,prepareDevHttps as l}from"./dev-https.js";import{acquireDevLock as u}from"./dev-lock.js";import{managedDevEnv as d}from"./managed-dev-protocol.js";import{isManagedDevCheckout as f}from"./managed-dev.js";import p from"node:path";import*as m from"@clack/prompts";import h from"node:process";import{createPrefixStream as g,supervise as _}from"procband";const v=[`web`,`desktop`,`ios`,`android`];function y(e){let t=e.dev?.platforms??[`web`];for(let e of t)if(!v.includes(e))throw Error(`Invalid development platform "${String(e)}". Expected one of: ${v.join(`, `)}.`);return[...new Set(t)]}const b=p.resolve(`node_modules`,`.bin`),x=h.platform===`win32`?`pnpm.cmd`:`pnpm`,S=h.platform===`win32`?`react-router.cmd`:`react-router`,C=h.platform===`win32`?`turso.cmd`:`turso`;async function w({cwd:r=h.cwd(),env:i=h.env,host:a,https:m=!1,interactive:v=h.stdin.isTTY===!0,managed:y=!1,noManaged:w=!1,platform:A=`web`,webPort:j}={}){let M=i.PATH??i.Path??``,N=A===`web`?k(j??i.COREFRAME_WEB_PORT):void 0,P,F,I=i;if(y&&w)throw Error(`Cannot use --managed and --no-managed together.`);if(m&&A!==`web`)throw Error(`Local HTTPS is only supported for the web development platform.`);let L=await u({cwd:r,interactive:v});if(!L)return;try{if(A===`web`){let a=await e({cwd:r}),u=m?await l({cwd:r}):void 0;if(I=u?{...i,[s]:u.cert,[c]:u.key}:i,(y||v&&!w)&&await f(r)&&(I={...I,[d]:`1`}),a.database?.dialect===`sqlite`){let e=await n.getAvailablePort(),a=p.resolve(r,`.coreframe`),o=p.join(a,`turso.db`);await t.mkdir(a,{recursive:!0}),I={...I,TURSO_DATABASE_URL:`http://127.0.0.1:${e}`,TURSO_AUTH_TOKEN:`dev`},P=_({name:`turso`,command:C,args:[`dev`,`--port`,String(e),`--db-file`,o],cwd:r,env:i}),await P.waitFor(`listening`),await _({name:`db`,command:x,args:[`db`,`ensure`],cwd:r,env:I,prefix:!1}).expectSuccess()}if(E(a)){let e=g({label:`postgres`});e.pipe(h.stdout,{end:!1});try{try{var R=o();let t=await T({config:a,cwd:r,env:I,interactive:v,postgresOutput:e,takeoverApproved:L.takeoverApproved});if(!t)return;R.a(t);let n=t.env;I=n,await _({name:`db`,command:x,args:[`db`,`ensure`],cwd:r,env:n,prefix:!1}).expectSuccess(),await z()}catch(e){R.e=e}finally{await R.d()}}finally{e.end()}return}await z();return}let a=D(A);await _({name:A,command:x,args:a,cwd:r,env:i}).expectSuccess()}finally{F?.kill(`SIGTERM`),P&&P.kill(`SIGTERM`),await L.release()}async function z(){F=_({name:`web`,command:S,args:O({host:a,port:N}),cwd:r,env:{...I,CLOUDFLARE_ENV:`development`,PATH:b+p.delimiter+M}}),await F.wait(),await F.expectSuccess(),F=void 0}}async function T({interactive:e,takeoverApproved:t,...n}){try{return await i(n)}catch(o){if(!(o instanceof r)||!e)throw o;if(!t){let e=await m.confirm({initialValue:!1,message:`PostgreSQL is already running for this project (PID ${o.pid}). Stop it and start here?`});if(m.isCancel(e)||!e){m.cancel(`Keeping the existing PostgreSQL process.`);return}}return await a(o),i(n)}}function E(e){return(e.database?.dialect??`postgres`)===`postgres`}function D(e){return[`--dir=tauri`,`tauri`,...e===`desktop`?[]:[e],`dev`]}function O({host:e,port:t}){return[`dev`,...e===void 0?[]:[`--host`,e===!0?`0.0.0.0`:e],...t===void 0?[]:[`--port`,String(t)]]}function k(e){if(e===void 0)return;let t=Number(e);if(!Number.isInteger(t)||t<=0||t>65535)throw Error(`COREFRAME_WEB_PORT must be a valid TCP port.`);return t}export{v as devPlatforms,y as resolveDevPlatforms,w as runDevServer};
|