@joystick.js/cli-canary 0.0.0-canary.1570 → 0.0.0-canary.1571
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 +1 @@
|
|
|
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
|
|
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:O,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()},b=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 O(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}},x=(e={})=>({operation:e?.event,path:e?.path,after_run_tasks:process.initial_build_complete?o(e?.path):["start_app_server","start_hmr_server"]}),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={})=>({operation:e?.event,path:e?.path,after_run_tasks:process.initial_build_complete?o(e?.path):["start_app_server","start_hmr_server"]}),B=(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=(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"]}),I=(e={})=>{switch(e?.event){case"add_file":return E(e);case"change_file":return B(e);case"delete_file":return $(e);case"add_directory":return D(e);case"delete_directory":return x(e)}},J=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(console.log("JOB",c),await b(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{}},L=(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"}},S=(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:L(t),path:i,is_custom_copy_path:s?.custom_copy_paths?.length?s?.custom_copy_paths.some(_=>i.includes(_?.path)):!1}),g(async()=>{console.log(r),await J(r,e),process.initial_build_complete=!0,r=[]},100))})};var M=S;export{M 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.
|
|
5
|
-
"canary_version": "0.0.0-canary.
|
|
4
|
+
"version": "0.0.0-canary.1571",
|
|
5
|
+
"canary_version": "0.0.0-canary.1570",
|
|
6
6
|
"description": "The CLI for Joystick.",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"bin": {
|
|
@@ -139,6 +139,8 @@ const process_file_watcher_jobs = async (jobs = [], after_run_functions = {}) =>
|
|
|
139
139
|
const job_to_run = jobs[i];
|
|
140
140
|
const job = get_job_to_be_done(job_to_run);
|
|
141
141
|
|
|
142
|
+
console.log('JOB', job);
|
|
143
|
+
|
|
142
144
|
await run_job(job);
|
|
143
145
|
|
|
144
146
|
if (job?.after_run_tasks) {
|