@coreframe/scripts 0.1.17 → 0.1.18

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.
Files changed (2) hide show
  1. package/dist/dev.js +1 -1
  2. package/package.json +2 -2
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{startProjectPostgres as r}from"./db/local-postgres.js";import i from"./_virtual/_@oxc-project_runtime@0.138.0/helpers/esm/usingCtx.js";import{devHttpsCertEnv as a,devHttpsKeyEnv as o,prepareDevHttps as s}from"./dev-https.js";import{acquireDevLock as c}from"./dev-lock.js";import{isPrimaryGitCheckout as l,startManagedDevSession as u}from"./managed-dev.js";import d from"node:path";import f from"node:process";import{PassThrough as p}from"node:stream";import{supervise as m}from"procband";const h=[`web`,`desktop`,`ios`,`android`];function g(e){let t=e.dev?.platforms??[`web`];for(let e of t)if(!h.includes(e))throw Error(`Invalid development platform "${String(e)}". Expected one of: ${h.join(`, `)}.`);return[...new Set(t)]}const _=d.resolve(`node_modules`,`.bin`),v=f.platform===`win32`?`pnpm.cmd`:`pnpm`,y=f.platform===`win32`?`react-router.cmd`:`react-router`,b=f.platform===`win32`?`turso.cmd`:`turso`;async function x({cwd:h=f.cwd(),env:g=f.env,host:x,https:E=!1,interactive:D=f.stdin.isTTY===!0,managed:O=!1,noManaged:k=!1,platform:A=`web`,webPort:j}={}){let M=g.PATH??g.Path??``,N=A===`web`?T(j??g.COREFRAME_WEB_PORT):void 0,P,F,I,L=!1,R=g;if(O&&k)throw Error(`Cannot use --managed and --no-managed together.`);if(E&&A!==`web`)throw Error(`Local HTTPS is only supported for the web development platform.`);let z=await c({cwd:h,interactive:D});if(!z)return;try{if(A===`web`){let c=await e({cwd:h}),_=E?await s({cwd:h}):void 0;if(R=_?{...g,[a]:_.cert,[o]:_.key}:g,(O||D&&!k)&&await l(h)&&(F=await u({config:c,cwd:h,env:R,onRestart(){I&&(L=!0,I.kill(`SIGTERM`))}}),R=F.env),c.database?.dialect===`sqlite`){let e=await n.getAvailablePort(),r=d.resolve(h,`.coreframe`),i=d.join(r,`turso.db`);await t.mkdir(r,{recursive:!0}),R={...R,TURSO_DATABASE_URL:`http://127.0.0.1:${e}`},F?.setRuntimeEnv(R),P=m({name:`turso`,command:b,args:[`dev`,`--port`,String(e),`--db-file`,i],cwd:h,env:g}),await P.waitFor(`listening`),await m({name:`db`,command:v,args:[`db`,`ensure`],cwd:h,env:R,prefix:!1}).expectSuccess()}if(S(c)){let e=new p,t=m({name:`postgres`,command:f.execPath,args:[`-e`,`process.stdin.pipe(process.stdout)`],cwd:h,stdin:e});try{try{var B=i();let t=B.a(await r({config:c,cwd:h,env:R,postgresOutput:e})).env;F?.setRuntimeEnv(t),R=t,await m({name:`db`,command:v,args:[`db`,`ensure`],cwd:h,env:t,prefix:!1}).expectSuccess(),await V()}catch(e){B.e=e}finally{await B.d()}}finally{e.end(),await t.expectSuccess()}return}F?.setRuntimeEnv(R),await V();return}let c=C(A);await m({name:A,command:v,args:c,cwd:h,env:g}).expectSuccess()}finally{I?.kill(`SIGTERM`),await F?.close(),P&&P.kill(`SIGTERM`),await z.release()}async function V(){let e=async()=>{do L=!1,I=m({name:`web`,command:y,args:w({host:x,port:N}),cwd:h,env:{...R,CLOUDFLARE_ENV:`development`,PATH:_+d.delimiter+M}}),await I.wait(),L||await I.expectSuccess(),I=void 0;while(L)};if(!F){await e();return}await Promise.race([e(),F.failure.catch(e=>{throw L=!1,I?.kill(`SIGTERM`),e})])}}function S(e){return(e.database?.dialect??`postgres`)===`postgres`}function C(e){return[`--dir=tauri`,`tauri`,...e===`desktop`?[]:[e],`dev`]}function w({host:e,port:t}){return[`dev`,...e===void 0?[]:[`--host`,e],...t===void 0?[]:[`--port`,String(t)]]}function T(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{h as devPlatforms,g as resolveDevPlatforms,x as runDevServer};
2
+ import{readProjectConfig as e}from"./config.js";import{fs as t,net as n}from"./environment.js";import{startProjectPostgres as r}from"./db/local-postgres.js";import i from"./_virtual/_@oxc-project_runtime@0.138.0/helpers/esm/usingCtx.js";import{devHttpsCertEnv as a,devHttpsKeyEnv as o,prepareDevHttps as s}from"./dev-https.js";import{acquireDevLock as c}from"./dev-lock.js";import{isPrimaryGitCheckout as l,startManagedDevSession as u}from"./managed-dev.js";import d from"node:path";import f from"node:process";import{createPrefixStream as p,supervise as m}from"procband";const h=[`web`,`desktop`,`ios`,`android`];function g(e){let t=e.dev?.platforms??[`web`];for(let e of t)if(!h.includes(e))throw Error(`Invalid development platform "${String(e)}". Expected one of: ${h.join(`, `)}.`);return[...new Set(t)]}const _=d.resolve(`node_modules`,`.bin`),v=f.platform===`win32`?`pnpm.cmd`:`pnpm`,y=f.platform===`win32`?`react-router.cmd`:`react-router`,b=f.platform===`win32`?`turso.cmd`:`turso`;async function x({cwd:h=f.cwd(),env:g=f.env,host:x,https:E=!1,interactive:D=f.stdin.isTTY===!0,managed:O=!1,noManaged:k=!1,platform:A=`web`,webPort:j}={}){let M=g.PATH??g.Path??``,N=A===`web`?T(j??g.COREFRAME_WEB_PORT):void 0,P,F,I,L=!1,R=g;if(O&&k)throw Error(`Cannot use --managed and --no-managed together.`);if(E&&A!==`web`)throw Error(`Local HTTPS is only supported for the web development platform.`);let z=await c({cwd:h,interactive:D});if(!z)return;try{if(A===`web`){let c=await e({cwd:h}),_=E?await s({cwd:h}):void 0;if(R=_?{...g,[a]:_.cert,[o]:_.key}:g,(O||D&&!k)&&await l(h)&&(F=await u({config:c,cwd:h,env:R,onRestart(){I&&(L=!0,I.kill(`SIGTERM`))}}),R=F.env),c.database?.dialect===`sqlite`){let e=await n.getAvailablePort(),r=d.resolve(h,`.coreframe`),i=d.join(r,`turso.db`);await t.mkdir(r,{recursive:!0}),R={...R,TURSO_DATABASE_URL:`http://127.0.0.1:${e}`},F?.setRuntimeEnv(R),P=m({name:`turso`,command:b,args:[`dev`,`--port`,String(e),`--db-file`,i],cwd:h,env:g}),await P.waitFor(`listening`),await m({name:`db`,command:v,args:[`db`,`ensure`],cwd:h,env:R,prefix:!1}).expectSuccess()}if(S(c)){let e=p({label:`postgres`});e.pipe(f.stdout,{end:!1});try{try{var B=i();let t=B.a(await r({config:c,cwd:h,env:R,postgresOutput:e})).env;F?.setRuntimeEnv(t),R=t,await m({name:`db`,command:v,args:[`db`,`ensure`],cwd:h,env:t,prefix:!1}).expectSuccess(),await V()}catch(e){B.e=e}finally{await B.d()}}finally{e.end()}return}F?.setRuntimeEnv(R),await V();return}let c=C(A);await m({name:A,command:v,args:c,cwd:h,env:g}).expectSuccess()}finally{I?.kill(`SIGTERM`),await F?.close(),P&&P.kill(`SIGTERM`),await z.release()}async function V(){let e=async()=>{do L=!1,I=m({name:`web`,command:y,args:w({host:x,port:N}),cwd:h,env:{...R,CLOUDFLARE_ENV:`development`,PATH:_+d.delimiter+M}}),await I.wait(),L||await I.expectSuccess(),I=void 0;while(L)};if(!F){await e();return}await Promise.race([e(),F.failure.catch(e=>{throw L=!1,I?.kill(`SIGTERM`),e})])}}function S(e){return(e.database?.dialect??`postgres`)===`postgres`}function C(e){return[`--dir=tauri`,`tauri`,...e===`desktop`?[]:[e],`dev`]}function w({host:e,port:t}){return[`dev`,...e===void 0?[]:[`--host`,e],...t===void 0?[]:[`--port`,String(t)]]}function T(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{h as devPlatforms,g as resolveDevPlatforms,x as runDevServer};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coreframe/scripts",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/airlock-labs/coreframe.git",
@@ -26,7 +26,7 @@
26
26
  "drizzle-orm": "1.0.0-rc.4",
27
27
  "local-postgres": "0.3.0",
28
28
  "nano-spawn": "^2.1.0",
29
- "procband": "^0.3.6",
29
+ "procband": "^0.3.7",
30
30
  "tinyglobby": "^0.2.17"
31
31
  },
32
32
  "devDependencies": {