@joystick.js/cli-canary 0.0.0-canary.1006 → 0.0.0-canary.1007

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,3 +1,3 @@
1
- import g from"chalk";import y from"child_process";import s from"fs";import{dirname as w}from"path";import $ from"util";import x from"./build_files.js";import z from"./get_files_to_build.js";import v from"./get_file_operation.js";import k from"./get_path_platform.js";import F from"./get_tar_ignore_list.js";import j from"../load_settings.js";import B from"../loader.js";import f from"../path_exists.js";import P from"../../lib/encrypt_buffer.js";const{mkdir:S,copyFile:A,readFile:D,writeFile:L,readdir:q}=s.promises,c=$.promisify(y.exec),C=(r=[])=>r?.map(n=>({path:n,operation:v(n),platform:k(n)})),E=async(r={})=>{const n=new B,e=r?.type||"tar",l=r?.environment||"production";n.print(`Building app to ${e} for ${l}...`);const a=await j(l),u=a?.config?.build?.excluded_paths||a?.config?.build?.excludedPaths,m=await z(u),o=e==="tar"?".build/.tar":".build",_=C(m);await f(".build")&&await c("rm -rf .build"),console.log(a?.config?.build?.copy_paths);const p=[];for(let t=0;t<a?.config?.build?.copy_paths?.length;t+=1){const i=a?.config?.build?.copy_paths[t];if(s.existsSync(i)){const h=s.lstatSync(i).isDirectory()?await q(i,{recursive:!0}):[i];p.push(...h||[])}}console.log(p);const d=[..._?.filter(t=>t?.operation==="copy_file"),...(p||[])?.map(t=>({path:t}))],b=_?.filter(t=>t?.operation==="build_file");for(let t=0;t<d?.length;t+=1){const i=d[t];await S(w(`${o}/${i?.path}`),{recursive:!0}),await A(i?.path,`${o}/${i?.path}`)}if(await x({files:b,environment:l,output_path:o}).catch(t=>{console.warn(t)}),e==="tar"){const t=F(a?.config?.build?.excludedPaths);await c(`cd ${o} && tar --exclude=${t} -czf ../build.tar.gz .`),await c(`rm -rf ${o}`)}if(e==="tar"&&r?.encrypt_build){const t=o?.replace("/.tar","/build.tar.gz"),i=P(await D(t),r?.encryption_key);await L(".build/build.encrypted.tar.gz",i)}r?.silence_confirmation||console.log(g.greenBright(`
1
+ import y from"chalk";import w from"child_process";import s from"fs";import{dirname as $}from"path";import x from"util";import z from"./build_files.js";import v from"./get_files_to_build.js";import k from"./get_file_operation.js";import F from"./get_path_platform.js";import j from"./get_tar_ignore_list.js";import B from"../load_settings.js";import P from"../loader.js";import f from"../path_exists.js";import S from"../../lib/encrypt_buffer.js";const{mkdir:A,copyFile:D,readFile:L,writeFile:q,readdir:C}=s.promises,l=x.promisify(w.exec),E=(r=[])=>r?.map(a=>({path:a,operation:k(a),platform:F(a)})),G=async(r={})=>{const a=new P,e=r?.type||"tar",p=r?.environment||"production";a.print(`Building app to ${e} for ${p}...`);const n=await B(p),u=n?.config?.build?.excluded_paths||n?.config?.build?.excludedPaths,m=await v(u),o=e==="tar"?".build/.tar":".build",_=E(m);await f(".build")&&await l("rm -rf .build");const c=[];for(let t=0;t<n?.config?.build?.copy_paths?.length;t+=1){const i=n?.config?.build?.copy_paths[t];if(s.existsSync(i))if(s.lstatSync(i).isDirectory()){const h=await C(i,{recursive:!0});c.push(...(h||[])?.map(g=>`${i}/${g}`))}else c.push(i)}console.log(c);const d=[..._?.filter(t=>t?.operation==="copy_file"),...(c||[])?.map(t=>({path:t}))],b=_?.filter(t=>t?.operation==="build_file");for(let t=0;t<d?.length;t+=1){const i=d[t];await A($(`${o}/${i?.path}`),{recursive:!0}),await D(i?.path,`${o}/${i?.path}`)}if(await z({files:b,environment:p,output_path:o}).catch(t=>{console.warn(t)}),e==="tar"){const t=j(n?.config?.build?.excludedPaths);await l(`cd ${o} && tar --exclude=${t} -czf ../build.tar.gz .`),await l(`rm -rf ${o}`)}if(e==="tar"&&r?.encrypt_build){const t=o?.replace("/.tar","/build.tar.gz"),i=S(await L(t),r?.encryption_key);await q(".build/build.encrypted.tar.gz",i)}r?.silence_confirmation||console.log(y.greenBright(`
2
2
  \u2714 App built as ${e} to ${e==="tar"?o?.replace("/.tar","/build.tar.gz"):o}!
3
- `)),await f(".build/component_id_cache.json")&&await c("rm -rf .build/component_id_cache.json")};var Y=E;export{Y as default};
3
+ `)),await f(".build/component_id_cache.json")&&await l("rm -rf .build/component_id_cache.json")};var Z=G;export{Z 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.1006",
5
- "canary_version": "0.0.0-canary.1005",
4
+ "version": "0.0.0-canary.1007",
5
+ "canary_version": "0.0.0-canary.1006",
6
6
  "description": "The CLI for Joystick.",
7
7
  "main": "dist/index.js",
8
8
  "bin": {
@@ -44,8 +44,6 @@ const build = async (options = {}) => {
44
44
  await exec(`rm -rf .build`);
45
45
  }
46
46
 
47
- console.log(settings?.config?.build?.copy_paths);
48
-
49
47
  const custom_copy_paths = [];
50
48
 
51
49
  for (let i = 0; i < settings?.config?.build?.copy_paths?.length; i += 1) {
@@ -53,8 +51,17 @@ const build = async (options = {}) => {
53
51
 
54
52
  if (fs.existsSync(custom_copy_path)) {
55
53
  const stat = fs.lstatSync(custom_copy_path);
56
- const paths = stat.isDirectory() ? await readdir(custom_copy_path, { recursive: true }) : [custom_copy_path];
57
- custom_copy_paths.push(...(paths || []));
54
+
55
+ if (stat.isDirectory()) {
56
+ const paths = await readdir(custom_copy_path, { recursive: true });
57
+ custom_copy_paths.push(
58
+ ...(paths || [])?.map((path) => {
59
+ return `${custom_copy_path}/${path}`;
60
+ })
61
+ );
62
+ } else {
63
+ custom_copy_paths.push(custom_copy_path);
64
+ }
58
65
  }
59
66
  }
60
67