@joystick.js/cli-canary 0.0.0-canary.1566 → 0.0.0-canary.1568

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.
@@ -1,4 +1,4 @@
1
- import i from"chalk";import m from"child_process";import x from"fs";import"os";import g,{dirname as O}from"path";import{fileURLToPath as b}from"url";import k from"util";import u from"./check_if_port_occupied.js";import n from"../cli_log.js";import p from"./get_database_process_ids.js";import S from"../get_platform_safe_path.js";import y from"../kill_port_process.js";import h from"../load_settings.js";import $ from"../loader.js";import _ from"../path_exists.js";import v from"../required_files.js";import j from"./start_app_server.js";import D from"./start_databases.js";import T from"./start_hmr_server.js";import R from"./watch_for_changes/index.js";import I from"../constants.js";import N from"./kill_process_ids.js";import H from"./run_tests.js";import C from"../debounce.js";import M from"./databases/download_database_binary.js";const{stat:A}=x.promises,P=k.promisify(m.exec),d=parseInt(process?.version?.split(".")[0]?.replace("v",""),10),V=b(import.meta.url),f=O(V),l=[],q=async(s=!1)=>{const e=p();await H({watch:s,__dirname:f,process_ids:[...l,...e],cleanup_process:process.cleanup_process})},L=(s=[],e=0,t="")=>{const r=["--no-warnings"];e<19&&r.push("--experimental-specifier-resolution=node");const o=m.fork(g.resolve(`${t}/cleanup.js`),[],{detached:!0,silent:!0});process.cleanup_process=o,process.on("SIGINT",async()=>{const c=p();o.send(JSON.stringify({process_ids:[...s,...c]})),process.exit()}),process.on("SIGTERM",async()=>{const c=p();o.send(JSON.stringify({process_ids:[...s,...c]})),process.exit()})},G=async(s=[])=>{const e=s?.find(a=>a?.path?.match(I.SETTINGS_FILE_NAME_REGEX)?.length>0),t=s?.find(a=>a?.path?.includes("i18n")),r=s?.find(a=>a?.path?.includes("index.html")),o=s?.find(a=>a?.path?.includes("index.css")||a?.path?.incudes("css/")),c=s?.find(a=>a?.path?.includes("index.client.js"));process.hmr_server_process.send(JSON.stringify({type:"FILE_CHANGE",settings:e?await h(process.env.NODE_ENV):null,i18n_change:!!t,index_html_change:!!r,index_css_change:!!o,index_client_change:!!c}))},J=(s=0,e=!1,t={})=>{process.hmr_server_process.on("message",async r=>{["HAS_HMR_CONNECTIONS","HAS_NO_HMR_CONNECTIONS","HMR_UPDATE_COMPLETE"].includes(r?.type)||process.loader.print(r),r?.type==="HAS_HMR_CONNECTIONS"&&(process.hmr_server_process.has_connections=!0),r?.type==="HAS_NO_HMR_CONNECTIONS"&&(process.hmr_server_process.has_connections=!1),r?.type==="HMR_UPDATE_COMPLETE"&&process.app_server_process&&!process.app_server_restarting&&(process.app_server_restarting=!0,w(s,e,t))})},U=()=>{process.hmr_server_process.on("error",s=>{n(s.toString(),{level:"danger",docs:"https://github.com/cheatcode/joystick"})}),process.hmr_server_process.stdout.on("data",s=>{console.log(s.toString())}),process.hmr_server_process.stderr.on("data",s=>{n(s.toString(),{level:"danger",docs:"https://github.com/cheatcode/joystick"})})},F=(s=0,e="",t=!1,r={})=>{process.hmr_server_process=T(s,e),l.push(process.hmr_server_process?.pid),U(),J(s,t,r)},B=async(s={})=>{const e=await h(process.env.NODE_ENV),t=e?.config?.databases?JSON.stringify(e?.config?.databases):"",r=s?.config?.databases?JSON.stringify(s?.config?.databases):"";return t!==r},w=async(s=0,e=!1,t=null)=>{C(async()=>{if(await B(t)){const o=p();n(`Database configuration has changed in settings.${process.env.NODE_ENV}.json. Please restart your app to add, change, or remove databases.`,{level:"danger",docs:"https://cheatcode.co/docs/joystick/structure"}),N([process.hmr_server_process?.pid,process.app_server_process?.pid,...o]),process.exit(0)}else N([...process.app_server_process.external_process_ids||[]]),await y(process.env.PORT),E(s,e)},300)},z=(s=!1)=>{process.app_server_process.external_process_ids=[],process.app_server_process.on("message",e=>{e?.external_process_id&&(process.app_server_process.external_process_ids=[...process.app_server_process.external_process_ids||[],e?.external_process_id])}),process.app_server_process.on("error",e=>{n(e.toString(),{level:"danger",docs:"https://github.com/cheatcode/joystick"})}),process.app_server_process.stdout.on("data",e=>{const t=e.toString(),r=t.includes("App running at:");t&&r&&process.env.NODE_ENV!=="test"&&process.loader.print(t),t&&!r&&!t.includes("BUILD_ERROR")&&console.log(t),t&&r&&process.env.NODE_ENV==="test"&&q(s)}),process.app_server_process.stderr.on("data",e=>{n(e.toString(),{level:"danger",docs:"https://cheatcode.co/docs/joystick"})})},E=(s=0,e=!1)=>{process.app_server_process=j(s,e),l.push(process.app_server_process?.pid),z(e),process.app_server_restarting=!1},X=async(s={})=>{const e=s?.config?.databases?.map((t={})=>t?.provider);for(let t=0;t<e?.length;t+=1){const r=e[t];await M(r)}},K=(s={},e=2600)=>{process.title=s?.environment==="test"?"joystick_test":"joystick",process.project_folder=g.basename(process.cwd()),process.loader=new $,s?.environment==="test"&&process.loader.print("Initializing test environment..."),process.env.LOGS_PATH=s?.logs||null,process.env.NODE_ENV=s?.environment||"development",process.env.PORT=e,process.env.IS_DEBUG_MODE=s?.debug},Q=(s=2600)=>{n(`Port ${s} is already occupied. To start Joystick on this port, clear it and try again.`,{level:"danger"}),process.exit(0)},W=(s=2600)=>parseInt(s||2600,10),Y=async()=>{const s=S(`${process.cwd()}/.joystick/build`);await _(s)&&await P(`${process.platform==="win32"?"rmdir /s /q":"rm -rf"} ${s}`)},Z=async()=>{const s=[];for(let e=0;e<v?.length;e+=1){const t=v[e],r=await _(`${process.cwd()}/${t.path}`),o=r&&await A(`${process.cwd()}/${t.path}`);t&&t.type==="file"&&(!r||r&&!o.isFile())&&s.push({type:"file",path:t.path}),t&&t.type==="directory"&&(!r||r&&!o.isDirectory())&&s.push({type:"directory",path:t.path})}if(s?.length>0){const e=s?.filter(o=>o.type==="file"),t=s?.filter(o=>o.type==="directory");let r=`The following paths are missing and required in a Joystick project:
1
+ import i from"chalk";import m from"child_process";import x from"fs";import"os";import g,{dirname as O}from"path";import{fileURLToPath as b}from"url";import k from"util";import u from"./check_if_port_occupied.js";import n from"../cli_log.js";import p from"./get_database_process_ids.js";import S from"../get_platform_safe_path.js";import y from"../kill_port_process.js";import _ from"../load_settings.js";import D from"../loader.js";import d from"../path_exists.js";import v from"../required_files.js";import T from"./start_app_server.js";import $ from"./start_databases.js";import j from"./start_hmr_server.js";import I from"./watch_for_changes/index.js";import R from"../constants.js";import N from"./kill_process_ids.js";import H from"./run_tests.js";import C from"../debounce.js";import A from"./databases/download_database_binary.js";const{stat:M}=x.promises,V=k.promisify(m.exec),l=parseInt(process?.version?.split(".")[0]?.replace("v",""),10),P=b(import.meta.url),f=O(P),h=[],L=async(s=!1)=>{const e=p();await H({watch:s,__dirname:f,process_ids:[...h,...e],cleanup_process:process.cleanup_process})},q=(s=[],e=0,t="")=>{const r=["--no-warnings"];e<19&&r.push("--experimental-specifier-resolution=node");const o=m.fork(g.resolve(`${t}/cleanup.js`),[],{detached:!0,silent:!0});process.cleanup_process=o,process.on("SIGINT",async()=>{const c=p();o.send(JSON.stringify({process_ids:[...s,...c]})),process.exit()}),process.on("SIGTERM",async()=>{const c=p();o.send(JSON.stringify({process_ids:[...s,...c]})),process.exit()})},G=async(s=[])=>{const e=s?.find(a=>a?.path?.match(R.SETTINGS_FILE_NAME_REGEX)?.length>0),t=s?.find(a=>a?.path?.includes("i18n")),r=s?.find(a=>a?.path?.includes("index.html")),o=s?.find(a=>a?.path?.includes("index.css")||a?.path?.incudes("css/")),c=s?.find(a=>a?.path?.includes("index.client.js"));console.log("THIS",{type:"FILE_CHANGE",settings:e?await _(process.env.NODE_ENV):null,i18n_change:!!t,index_html_change:!!r,index_css_change:!!o,index_client_change:!!c}),process.hmr_server_process.send(JSON.stringify({type:"FILE_CHANGE",settings:e?await _(process.env.NODE_ENV):null,i18n_change:!!t,index_html_change:!!r,index_css_change:!!o,index_client_change:!!c}))},J=(s=0,e=!1,t={})=>{process.hmr_server_process.on("message",async r=>{["HAS_HMR_CONNECTIONS","HAS_NO_HMR_CONNECTIONS","HMR_UPDATE_COMPLETE"].includes(r?.type)||process.loader.print(r),r?.type==="HAS_HMR_CONNECTIONS"&&(process.hmr_server_process.has_connections=!0),r?.type==="HAS_NO_HMR_CONNECTIONS"&&(process.hmr_server_process.has_connections=!1),r?.type==="HMR_UPDATE_COMPLETE"&&process.app_server_process&&!process.app_server_restarting&&(process.app_server_restarting=!0,E(s,e,t))})},F=()=>{process.hmr_server_process.on("error",s=>{n(s.toString(),{level:"danger",docs:"https://github.com/cheatcode/joystick"})}),process.hmr_server_process.stdout.on("data",s=>{console.log(s.toString())}),process.hmr_server_process.stderr.on("data",s=>{n(s.toString(),{level:"danger",docs:"https://github.com/cheatcode/joystick"})})},U=(s=0,e="",t=!1,r={})=>{process.hmr_server_process=j(s,e),h.push(process.hmr_server_process?.pid),F(),J(s,t,r)},B=async(s={})=>{const e=await _(process.env.NODE_ENV),t=e?.config?.databases?JSON.stringify(e?.config?.databases):"",r=s?.config?.databases?JSON.stringify(s?.config?.databases):"";return t!==r},E=async(s=0,e=!1,t=null)=>{C(async()=>{if(await B(t)){const o=p();n(`Database configuration has changed in settings.${process.env.NODE_ENV}.json. Please restart your app to add, change, or remove databases.`,{level:"danger",docs:"https://cheatcode.co/docs/joystick/structure"}),N([process.hmr_server_process?.pid,process.app_server_process?.pid,...o]),process.exit(0)}else N([...process.app_server_process.external_process_ids||[]]),await y(process.env.PORT),w(s,e)},300)},z=(s=!1)=>{process.app_server_process.external_process_ids=[],process.app_server_process.on("message",e=>{e?.external_process_id&&(process.app_server_process.external_process_ids=[...process.app_server_process.external_process_ids||[],e?.external_process_id])}),process.app_server_process.on("error",e=>{n(e.toString(),{level:"danger",docs:"https://github.com/cheatcode/joystick"})}),process.app_server_process.stdout.on("data",e=>{const t=e.toString(),r=t.includes("App running at:");t&&r&&process.env.NODE_ENV!=="test"&&process.loader.print(t),t&&!r&&!t.includes("BUILD_ERROR")&&console.log(t),t&&r&&process.env.NODE_ENV==="test"&&L(s)}),process.app_server_process.stderr.on("data",e=>{n(e.toString(),{level:"danger",docs:"https://cheatcode.co/docs/joystick"})})},w=(s=0,e=!1)=>{process.app_server_process=T(s,e),h.push(process.app_server_process?.pid),z(e),process.app_server_restarting=!1},X=async(s={})=>{const e=s?.config?.databases?.map((t={})=>t?.provider);for(let t=0;t<e?.length;t+=1){const r=e[t];await A(r)}},K=(s={},e=2600)=>{process.title=s?.environment==="test"?"joystick_test":"joystick",process.project_folder=g.basename(process.cwd()),process.loader=new D,s?.environment==="test"&&process.loader.print("Initializing test environment..."),process.env.LOGS_PATH=s?.logs||null,process.env.NODE_ENV=s?.environment||"development",process.env.PORT=e,process.env.IS_DEBUG_MODE=s?.debug},Q=(s=2600)=>{n(`Port ${s} is already occupied. To start Joystick on this port, clear it and try again.`,{level:"danger"}),process.exit(0)},W=(s=2600)=>parseInt(s||2600,10),Y=async()=>{const s=S(`${process.cwd()}/.joystick/build`);await d(s)&&await V(`${process.platform==="win32"?"rmdir /s /q":"rm -rf"} ${s}`)},Z=async()=>{const s=[];for(let e=0;e<v?.length;e+=1){const t=v[e],r=await d(`${process.cwd()}/${t.path}`),o=r&&await M(`${process.cwd()}/${t.path}`);t&&t.type==="file"&&(!r||r&&!o.isFile())&&s.push({type:"file",path:t.path}),t&&t.type==="directory"&&(!r||r&&!o.isDirectory())&&s.push({type:"directory",path:t.path})}if(s?.length>0){const e=s?.filter(o=>o.type==="file"),t=s?.filter(o=>o.type==="directory");let r=`The following paths are missing and required in a Joystick project:
2
2
 
3
3
  `;if(e?.length>0){r+=` ${i.yellow(">")} Required Files:
4
4
 
@@ -7,4 +7,4 @@ ${a&&t?.length>0?`
7
7
  `:""}`)}`}}if(t?.length>0){r+=` ${i.yellow(">")} Required Directories:
8
8
 
9
9
  `;for(let o=0;o<t?.length;o+=1){const c=t[o];r+=` ${i.red(`/${c.path}
10
- `)}`}}n(r,{level:"danger",docs:"https://cheatcode.co/docs/joystick/structure"}),process.exit(0)}},ss=async()=>{const s=await _(`${process.cwd()}/.joystick`),e=await _(`${process.cwd()}/tests`);process.env.NODE_ENV==="test"&&(!s||!e)&&(n("joystick test must be run in a directory with a .joystick folder and tests folder.",{level:"danger",docs:"https://cheatcode.co/docs/joystick/cli/test"}),process.exit(0)),process.env.NODE_ENV!=="test"&&!s&&(n("joystick start must be run in a directory with a .joystick folder.",{level:"danger",docs:"https://cheatcode.co/docs/joystick/cli/start"}),process.exit(0))},es=async(s={})=>{await ss(),await Z(),await Y();const e=W(s?.port),t=await u(e),r=await u(e+1);t&&Q(e),r&&y(e),K(s,e);const o=await h(process.env.NODE_ENV);await X(o),await D({environment:process.env.NODE_ENV,port:e,settings:o}),R({hot_module_reload:(c=[])=>G(c),restart_app_server:()=>w(d,s?.watch,o),start_app_server:()=>E(d,s?.watch),start_hmr_server:s?.environment!=="test"?()=>F(d,f,s?.watch,o):null},{excluded_paths:o?.config?.build?.excluded_paths,custom_copy_paths:o?.config?.build?.copy_paths?.map(c=>({path:c}))||[]}),L(l,d,f)};var $s=es;export{$s as default};
10
+ `)}`}}n(r,{level:"danger",docs:"https://cheatcode.co/docs/joystick/structure"}),process.exit(0)}},ss=async()=>{const s=await d(`${process.cwd()}/.joystick`),e=await d(`${process.cwd()}/tests`);process.env.NODE_ENV==="test"&&(!s||!e)&&(n("joystick test must be run in a directory with a .joystick folder and tests folder.",{level:"danger",docs:"https://cheatcode.co/docs/joystick/cli/test"}),process.exit(0)),process.env.NODE_ENV!=="test"&&!s&&(n("joystick start must be run in a directory with a .joystick folder.",{level:"danger",docs:"https://cheatcode.co/docs/joystick/cli/start"}),process.exit(0))},es=async(s={})=>{await ss(),await Z(),await Y();const e=W(s?.port),t=await u(e),r=await u(e+1);t&&Q(e),r&&y(e),K(s,e);const o=await _(process.env.NODE_ENV);await X(o),await $({environment:process.env.NODE_ENV,port:e,settings:o}),I({hot_module_reload:(c=[])=>G(c),restart_app_server:()=>E(l,s?.watch,o),start_app_server:()=>w(l,s?.watch),start_hmr_server:s?.environment!=="test"?()=>U(l,f,s?.watch,o):null},{excluded_paths:o?.config?.build?.excluded_paths,custom_copy_paths:o?.config?.build?.copy_paths?.map(c=>({path:c}))||[]}),q(h,l,f)};var Ds=es;export{Ds as default};
@@ -1 +1 @@
1
- import f from"chokidar";import h from"fs";import{dirname as m}from"path";import y from"../../build/build_files.js";import k from"../../debounce.js";import n from"./get_after_run_tasks.js";import v from"./get_file_codependencies.js";import p from"../../build/get_file_operation.js";import g from"../../build/get_path_platform.js";import w from"../../types.js";import R from"./watch_paths.js";const{mkdir:l,copyFile:b,rm:u}=h.promises,o=async(e={},s={})=>{const a=process.initial_build_complete?await v(e?.path):[];if(s?.is_build_file&&await y({files:[{path:e?.path,platform:g(e?.path)}]}).catch((r=[])=>{if(!process.initial_build_complete&&r?.length>0&&process.exit(0),process.initial_build_complete&&r?.length>0)throw process.app_server_process.send(JSON.stringify({type:"BUILD_ERROR",paths:r.filter(({success:t})=>!t)})),process.hmr_server_process.send(JSON.stringify({type:"BUILD_ERROR"})),new Error("BUILD_ERROR")}),a?.length>0)for(let r=0;r<a?.length;r+=1){const t=a[r];await o({path:t},s)}return Promise.resolve()},x=async(e={})=>{switch(e?.operation){case"add_directory":return l(`.joystick/build/${e?.path}`,{recursive:!0});case"build_file":return o(e,{is_build_file:!0});case"copy_file":return await l(m(`.joystick/build/${e?.path}`),{recursive:!0}),await b(e?.path,`.joystick/build/${e?.path}`),o(e,{is_build_file:!1});case"delete_directory":return u(`.joystick/build/${e?.path}`,{recursive:!0});case"delete_file":return await u(`.joystick/build/${e?.path}`,{recursive:!0}),o(e,{is_build_file:!1});default:return!0}},D=(e={})=>({operation:e?.event,path:e?.path,after_run_tasks:process.initial_build_complete?n(e?.path):["start_app_server","start_hmr_server"]}),O=(e={})=>({operation:e?.event,path:e?.path,after_run_tasks:process.initial_build_complete?n(e?.path):["start_app_server","start_hmr_server"]}),$=(e={})=>({operation:e?.event,path:e?.path,after_run_tasks:process.initial_build_complete?n(e?.path):["start_app_server","start_hmr_server"]}),E=(e={})=>({operation:e?.is_custom_copy_path?"copy_file":p(e?.path),path:e?.path,after_run_tasks:process.initial_build_complete?n(e?.path):["start_app_server","start_hmr_server"]}),B=(e={})=>({operation:e?.is_custom_copy_path?"copy_file":p(e?.path),path:e?.path,after_run_tasks:process.initial_build_complete?n(e?.path):["start_app_server","start_hmr_server"]}),I=(e={})=>{switch(e?.event){case"add_file":return B(e);case"change_file":return E(e);case"delete_file":return $(e);case"add_directory":return O(e);case"delete_directory":return D(e)}},L=async(e=[],s={})=>{try{const a=new Set([]);for(let t=0;t<e?.length;t+=1){const i=e[t],c=I(i);if(await x(c),c?.after_run_tasks)for(let _=0;_<c?.after_run_tasks?.length;_+=1){const d=c?.after_run_tasks[_];a.add(d)}}const r=Array.from(a);for(let t=0;t<r?.length;t+=1){const i=r[t];w.is_function(s[i])&&await s[i](e)}}catch{}},S=(e="")=>{switch(e){case"add":return"add_file";case"change":return"change_file";case"unlink":return"delete_file";case"addDir":return"add_directory";case"unlinkDir":return"delete_directory"}},U=(e={},s={})=>{const a=f.watch([...R,...s?.custom_copy_paths||[]].map(({path:t})=>t),{ignored:".joystick"});let r=[];process.initial_build_complete=!1,a.on("error",t=>console.error(t)),a.on("all",(t,i)=>{s?.excluded_paths?.some(_=>i.includes(_))||(r.push({event:S(t),path:i,is_custom_copy_path:s?.custom_copy_paths?.length?s?.custom_copy_paths.some(_=>i.includes(_?.path)):!1}),k(async()=>{await L(r,e),process.initial_build_complete=!0,r=[]},100))})};var M=U;export{M as default};
1
+ import f from"chokidar";import h from"fs";import{dirname as m}from"path";import y from"../../build/build_files.js";import g from"../../debounce.js";import o from"./get_after_run_tasks.js";import k from"./get_file_codependencies.js";import l from"../../build/get_file_operation.js";import v from"../../build/get_path_platform.js";import w from"../../types.js";import R from"./watch_paths.js";const{mkdir:p,copyFile:b,rm:u}=h.promises,n=async(e={},s={})=>{const a=process.initial_build_complete?await k(e?.path):[];if(s?.is_build_file&&await y({files:[{path:e?.path,platform:v(e?.path)}]}).catch((r=[])=>{if(!process.initial_build_complete&&r?.length>0&&process.exit(0),process.initial_build_complete&&r?.length>0)throw process.app_server_process.send(JSON.stringify({type:"BUILD_ERROR",paths:r.filter(({success:t})=>!t)})),process.hmr_server_process.send(JSON.stringify({type:"BUILD_ERROR"})),new Error("BUILD_ERROR")}),a?.length>0)for(let r=0;r<a?.length;r+=1){const t=a[r];await n({path:t},s)}return Promise.resolve()},x=async(e={})=>{switch(e?.operation){case"add_directory":return p(`.joystick/build/${e?.path}`,{recursive:!0});case"build_file":return n(e,{is_build_file:!0});case"copy_file":return await p(m(`.joystick/build/${e?.path}`),{recursive:!0}),await b(e?.path,`.joystick/build/${e?.path}`),n(e,{is_build_file:!1});case"delete_directory":return u(`.joystick/build/${e?.path}`,{recursive:!0});case"delete_file":return await u(`.joystick/build/${e?.path}`,{recursive:!0}),n(e,{is_build_file:!1});default:return!0}},D=(e={})=>({operation:e?.event,path:e?.path,after_run_tasks:process.initial_build_complete?o(e?.path):["start_app_server","start_hmr_server"]}),E=(e={})=>({operation:e?.event,path:e?.path,after_run_tasks:process.initial_build_complete?o(e?.path):["start_app_server","start_hmr_server"]}),O=(e={})=>({operation:e?.event,path:e?.path,after_run_tasks:process.initial_build_complete?o(e?.path):["start_app_server","start_hmr_server"]}),S=(e={})=>({operation:e?.is_custom_copy_path?"copy_file":l(e?.path),path:e?.path,after_run_tasks:process.initial_build_complete?o(e?.path):["start_app_server","start_hmr_server"]}),$=(e={})=>({operation:e?.is_custom_copy_path?"copy_file":l(e?.path),path:e?.path,after_run_tasks:process.initial_build_complete?o(e?.path):["start_app_server","start_hmr_server"]}),U=(e={})=>{switch(e?.event){case"add_file":return $(e);case"change_file":return S(e);case"delete_file":return O(e);case"add_directory":return E(e);case"delete_directory":return D(e)}},A=async(e=[],s={})=>{try{const a=new Set([]);for(let t=0;t<e?.length;t+=1){const i=e[t],c=U(i);if(await x(c),c?.after_run_tasks)for(let _=0;_<c?.after_run_tasks?.length;_+=1){const d=c?.after_run_tasks[_];a.add(d)}}console.log("AFTER RUN TASKS",job);const r=Array.from(a);for(let t=0;t<r?.length;t+=1){const i=r[t];w.is_function(s[i])&&await s[i](e)}}catch{}},B=(e="")=>{switch(e){case"add":return"add_file";case"change":return"change_file";case"unlink":return"delete_file";case"addDir":return"add_directory";case"unlinkDir":return"delete_directory"}},I=(e={},s={})=>{const a=f.watch([...R,...s?.custom_copy_paths||[]].map(({path:t})=>t),{ignored:".joystick"});let r=[];process.initial_build_complete=!1,a.on("error",t=>console.error(t)),a.on("all",(t,i)=>{s?.excluded_paths?.some(_=>i.includes(_))||(r.push({event:B(t),path:i,is_custom_copy_path:s?.custom_copy_paths?.length?s?.custom_copy_paths.some(_=>i.includes(_?.path)):!1}),g(async()=>{await A(r,e),process.initial_build_complete=!0,r=[]},100))})};var H=I;export{H as default};
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@joystick.js/cli-canary",
3
3
  "type": "module",
4
- "version": "0.0.0-canary.1566",
5
- "canary_version": "0.0.0-canary.1565",
4
+ "version": "0.0.0-canary.1568",
5
+ "canary_version": "0.0.0-canary.1567",
6
6
  "description": "The CLI for Joystick.",
7
7
  "main": "dist/index.js",
8
8
  "bin": {
@@ -90,6 +90,15 @@ const handle_signal_hmr_update = async (jobs = []) => {
90
90
  const has_index_css_change = jobs?.find((job) => job?.path?.includes('index.css') || job?.path?.incudes('css/'));
91
91
  const has_index_client_change = jobs?.find((job) => job?.path?.includes('index.client.js'));
92
92
 
93
+ console.log('THIS', {
94
+ type: 'FILE_CHANGE',
95
+ settings: has_settings_change ? await load_settings(process.env.NODE_ENV) : null,
96
+ i18n_change: !!has_i18n_change,
97
+ index_html_change: !!has_index_html_change,
98
+ index_css_change: !!has_index_css_change,
99
+ index_client_change: !!has_index_client_change,
100
+ });
101
+
93
102
  process.hmr_server_process.send(JSON.stringify({
94
103
  type: 'FILE_CHANGE',
95
104
  settings: has_settings_change ? await load_settings(process.env.NODE_ENV) : null,
@@ -149,6 +149,8 @@ const process_file_watcher_jobs = async (jobs = [], after_run_functions = {}) =>
149
149
  }
150
150
  }
151
151
 
152
+ console.log('AFTER RUN TASKS', job);
153
+
152
154
  const tasks_to_run = Array.from(after_run_tasks);
153
155
 
154
156
  for (let i = 0; i < tasks_to_run?.length; i += 1) {