@joystick.js/cli-canary 0.0.0-canary.587 → 0.0.0-canary.589

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 s from"./index.js";const[e,i,...t]=process.argv,n={description:"Start an existing Joystick app and run its tests.",args:{},options:{watch:{flags:{"--watch":{set:!!t.includes("--watch"),value:!!t.includes("--watch"),parent:"test"}},description:"Run joystick test in watch mode."}},command:s};var o=n;export{o as default};
1
+ import s from"./index.js";const[a,i,...t]=process.argv,e={description:"Start an existing Joystick app and run its tests.",args:{},options:{watch:{flags:{"-w":{set:!!t.includes("-w"),value:!!t.includes("-w"),parent:"test"},"--watch":{set:!!t.includes("--watch"),value:!!t.includes("--watch"),parent:"test"}},description:"Run joystick test in watch mode."}},command:s};var c=e;export{c as default};
@@ -1 +1 @@
1
- import t from"./index.js";const o={description:"Update all Joystick packages to their latest version.",args:{},options:{},command:t};var i=o;export{i as default};
1
+ import e from"./index.js";const a={description:"Update all Joystick packages to their latest version.",args:{},options:{release:{flags:{"-r":{set:!!raw_args.includes("-r"),value:!!raw_args.includes("-r")&&raw_args[raw_args.indexOf("-r")+1],parent:"create"},"--release":{set:!!raw_args.includes("--release"),value:!!raw_args.includes("--release")&&raw_args[raw_args.indexOf("--release")+1],parent:"create"}},description:"The release of Joystick to update (production or canary)."}},command:e};var s=a;export{s as default};
@@ -1 +1 @@
1
- import"chalk";import t from"child_process";import i from"util";import s from"../../lib/color_log.js";import e from"../../lib/loader.js";const o=i.promisify(t.exec),r=async(p={},c={})=>{process.loader=new e,process.loader.print("Updating Joystick dependencies..."),process.loader.print("Updating @joystick.js/node..."),await o("npm i @joystick.js/node@latest"),process.loader.print("Updating @joystick.js/ui..."),await o("npm i @joystick.js/ui@latest"),process.loader.print("Updating @joystick.js/cli..."),await o("npm i -g @joystick.js/cli@latest"),s("\u2714 Joystick updated!","green"),process.exit(0)};var y=r;export{y as default};
1
+ import"chalk";import e from"child_process";import s from"util";import c from"../../lib/color_log.js";import t from"../../lib/loader.js";const r=s.promisify(e.exec),i=async(n={},a={})=>{process.loader=new t,process.loader.print("Updating Joystick dependencies..."),process.loader.print(`Updating @joystick.js/node${a?.relase==="canary"?"-canary":""}...`),await r(`npm i @joystick.js/node${a?.relase==="canary"?"-canary":""}@latest`),process.loader.print(`Updating @joystick.js/test${a?.relase==="canary"?"-canary":""}...`),await r(`npm i @joystick.js/test${a?.relase==="canary"?"-canary":""}@latest`),process.loader.print(`Updating @joystick.js/ui${a?.relase==="canary"?"-canary":""}...`),await r(`npm i @joystick.js/ui${a?.relase==="canary"?"-canary":""}@latest`),process.loader.print(`Updating @joystick.js/cli${a?.relase==="canary"?"-canary":""}...`),await r(`npm i -g @joystick.js/cli${a?.relase==="canary"?"-canary":""}@latest`),c("\u2714 Joystick updated!","green"),process.exit(0)};var m=i;export{m 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 g from"../../debounce.js";import s 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:d}=h.promises,c=async(e={},i={})=>{const a=process.initial_build_complete?await k(e?.path):[];if(i?.is_build_file&&await y({files:[{path:e?.path,platform:v(e?.path)}]}).catch((t=[])=>{if(!process.initial_build_complete&&t?.length>0&&process.exit(0),process.initial_build_complete&&t?.length>0)throw process.app_server_process.send(JSON.stringify({type:"BUILD_ERROR",paths:t.filter(({success:r})=>!r)})),process.hmr_server_process.send(JSON.stringify({type:"BUILD_ERROR"})),new Error("BUILD_ERROR")}),a?.length>0)for(let t=0;t<a?.length;t+=1){const r=a[t];return c({path:r},i)}return Promise.resolve()},D=async(e={})=>{switch(e?.operation){case"add_directory":return p(`.joystick/build/${e?.path}`,{recursive:!0});case"build_file":return c(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}`),c(e,{is_build_file:!1});case"delete_directory":return d(`.joystick/build/${e?.path}`,{recursive:!0});case"delete_file":return await d(`.joystick/build/${e?.path}`,{recursive:!0}),c(e,{is_build_file:!1});default:return!0}},O=(e={})=>({operation:e?.event,path:e?.path,after_run_tasks:process.initial_build_complete?s(e?.path):["start_app_server","start_hmr_server"]}),$=(e={})=>({operation:e?.event,path:e?.path,after_run_tasks:process.initial_build_complete?s(e?.path):["start_app_server","start_hmr_server"]}),E=(e={})=>({operation:e?.event,path:e?.path,after_run_tasks:process.initial_build_complete?s(e?.path):["start_app_server","start_hmr_server"]}),B=(e={})=>({operation:l(e?.path),path:e?.path,after_run_tasks:process.initial_build_complete?s(e?.path):["start_app_server","start_hmr_server"]}),I=(e={})=>({operation:l(e?.path),path:e?.path,after_run_tasks:process.initial_build_complete?s(e?.path):["start_app_server","start_hmr_server"]}),L=(e={})=>{switch(e?.event){case"add_file":return I(e);case"change_file":return B(e);case"delete_file":return E(e);case"add_directory":return $(e);case"delete_directory":return O(e)}},S=async(e=[],i={})=>{try{const a=new Set([]);for(let r=0;r<e?.length;r+=1){const _=e[r],n=L(_);if(await D(n),n?.after_run_tasks)for(let o=0;o<n?.after_run_tasks?.length;o+=1){const u=n?.after_run_tasks[o];a.add(u)}}const t=Array.from(a);for(let r=0;r<t?.length;r+=1){const _=t[r];w.is_function(i[_])&&await i[_](e)}}catch{}},U=(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"}},x=(e={})=>{const i=f.watch(R.map(({path:t})=>t),{ignored:".joystick"});let a=[];process.initial_build_complete=!1,i.on("error",t=>console.error(t)),i.on("all",(t,r)=>{a.push({event:U(t),path:r}),g(async()=>{await S(a,e),process.initial_build_complete=!0,a=[]},100)})};var M=x;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 s 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:d}=h.promises,c=async(e={},i={})=>{const a=process.initial_build_complete?await k(e?.path):[];if(i?.is_build_file&&await y({files:[{path:e?.path,platform:v(e?.path)}]}).catch((t=[])=>{if(console.warn(t),!process.initial_build_complete&&t?.length>0&&process.exit(0),process.initial_build_complete&&t?.length>0)throw process.app_server_process.send(JSON.stringify({type:"BUILD_ERROR",paths:t.filter(({success:r})=>!r)})),process.hmr_server_process.send(JSON.stringify({type:"BUILD_ERROR"})),new Error("BUILD_ERROR")}),a?.length>0)for(let t=0;t<a?.length;t+=1){const r=a[t];return c({path:r},i)}return Promise.resolve()},D=async(e={})=>{switch(e?.operation){case"add_directory":return p(`.joystick/build/${e?.path}`,{recursive:!0});case"build_file":return c(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}`),c(e,{is_build_file:!1});case"delete_directory":return d(`.joystick/build/${e?.path}`,{recursive:!0});case"delete_file":return await d(`.joystick/build/${e?.path}`,{recursive:!0}),c(e,{is_build_file:!1});default:return!0}},O=(e={})=>({operation:e?.event,path:e?.path,after_run_tasks:process.initial_build_complete?s(e?.path):["start_app_server","start_hmr_server"]}),$=(e={})=>({operation:e?.event,path:e?.path,after_run_tasks:process.initial_build_complete?s(e?.path):["start_app_server","start_hmr_server"]}),E=(e={})=>({operation:e?.event,path:e?.path,after_run_tasks:process.initial_build_complete?s(e?.path):["start_app_server","start_hmr_server"]}),B=(e={})=>({operation:l(e?.path),path:e?.path,after_run_tasks:process.initial_build_complete?s(e?.path):["start_app_server","start_hmr_server"]}),I=(e={})=>({operation:l(e?.path),path:e?.path,after_run_tasks:process.initial_build_complete?s(e?.path):["start_app_server","start_hmr_server"]}),L=(e={})=>{switch(e?.event){case"add_file":return I(e);case"change_file":return B(e);case"delete_file":return E(e);case"add_directory":return $(e);case"delete_directory":return O(e)}},S=async(e=[],i={})=>{try{const a=new Set([]);for(let r=0;r<e?.length;r+=1){const _=e[r],n=L(_);if(await D(n),n?.after_run_tasks)for(let o=0;o<n?.after_run_tasks?.length;o+=1){const u=n?.after_run_tasks[o];a.add(u)}}const t=Array.from(a);for(let r=0;r<t?.length;r+=1){const _=t[r];w.is_function(i[_])&&await i[_](e)}}catch{}},U=(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"}},x=(e={})=>{const i=f.watch(R.map(({path:t})=>t),{ignored:".joystick"});let a=[];process.initial_build_complete=!1,i.on("error",t=>console.error(t)),i.on("all",(t,r)=>{a.push({event:U(t),path:r}),g(async()=>{await S(a,e),process.initial_build_complete=!0,a=[]},100)})};var M=x;export{M as default};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@joystick.js/cli-canary",
3
3
  "type": "module",
4
- "version": "0.0.0-canary.587",
4
+ "version": "0.0.0-canary.589",
5
5
  "description": "The CLI for Joystick.",
6
6
  "main": "dist/index.js",
7
7
  "bin": {
@@ -8,6 +8,11 @@ const definition = {
8
8
  options: {
9
9
  watch: {
10
10
  flags: {
11
+ '-w': {
12
+ set: !!raw_args.includes('-w'),
13
+ value: !!raw_args.includes('-w'),
14
+ parent: 'test'
15
+ },
11
16
  '--watch': {
12
17
  set: !!raw_args.includes('--watch'),
13
18
  value: !!raw_args.includes('--watch'),
@@ -3,7 +3,23 @@ import update from './index.js';
3
3
  const definition = {
4
4
  description: 'Update all Joystick packages to their latest version.',
5
5
  args: {},
6
- options: {},
6
+ options: {
7
+ release: {
8
+ flags: {
9
+ '-r': {
10
+ set: !!raw_args.includes('-r'),
11
+ value: !!raw_args.includes('-r') && raw_args[raw_args.indexOf('-r') + 1],
12
+ parent: 'create',
13
+ },
14
+ '--release': {
15
+ set: !!raw_args.includes('--release'),
16
+ value: !!raw_args.includes('--release') && raw_args[raw_args.indexOf('--release') + 1],
17
+ parent: 'create',
18
+ },
19
+ },
20
+ description: 'The release of Joystick to update (production or canary).',
21
+ },
22
+ },
7
23
  command: update,
8
24
  };
9
25
 
@@ -10,14 +10,17 @@ const update = async (args = {}, options = {}) => {
10
10
  process.loader = new Loader();
11
11
  process.loader.print('Updating Joystick dependencies...');
12
12
 
13
- process.loader.print('Updating @joystick.js/node...');
14
- await exec('npm i @joystick.js/node@latest');
13
+ process.loader.print(`Updating @joystick.js/node${options?.relase === 'canary' ? '-canary' : ''}...`);
14
+ await exec(`npm i @joystick.js/node${options?.relase === 'canary' ? '-canary' : ''}@latest`);
15
15
 
16
- process.loader.print('Updating @joystick.js/ui...');
17
- await exec('npm i @joystick.js/ui@latest');
16
+ process.loader.print(`Updating @joystick.js/test${options?.relase === 'canary' ? '-canary' : ''}...`);
17
+ await exec(`npm i @joystick.js/test${options?.relase === 'canary' ? '-canary' : ''}@latest`);
18
+
19
+ process.loader.print(`Updating @joystick.js/ui${options?.relase === 'canary' ? '-canary' : ''}...`);
20
+ await exec(`npm i @joystick.js/ui${options?.relase === 'canary' ? '-canary' : ''}@latest`);
18
21
 
19
- process.loader.print('Updating @joystick.js/cli...');
20
- await exec('npm i -g @joystick.js/cli@latest');
22
+ process.loader.print(`Updating @joystick.js/cli${options?.relase === 'canary' ? '-canary' : ''}...`);
23
+ await exec(`npm i -g @joystick.js/cli${options?.relase === 'canary' ? '-canary' : ''}@latest`);
21
24
 
22
25
  color_log('✔ Joystick updated!', 'green');
23
26
  process.exit(0);
@@ -22,6 +22,7 @@ const handle_build_files = async (job = {}, options = {}) => {
22
22
  await build_files({
23
23
  files: [{ path: job?.path, platform: get_path_platform(job?.path) }],
24
24
  }).catch((errors = []) => {
25
+ console.warn(errors);
25
26
  if (!process.initial_build_complete && errors?.length > 0) {
26
27
  process.exit(0);
27
28
  }