@joystick.js/cli-canary 0.0.0-canary.635 → 0.0.0-canary.637

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
- const t=(o="production")=>({development:"http://localhost:2603",staging:"https://staging.push-provision.cheatcode.co",production:"https://push-provision.cheatcode.co"})[o];var p=t;export{p as default};
1
+ const t=(o="production")=>({development:"http://localhost:2603",staging:"https://staging.provision.cheatcode.co",production:"https://provision.cheatcode.co"})[o];var e=t;export{e as default};
@@ -1 +1 @@
1
- import n from"fs";import i from"../../lib/cli_log.js";import o from"../../lib/is_valid_json_string.js";import r from"../../lib/path_exists.js";const{readFile:c}=n.promises,a=async(t="")=>{const s=`settings.${t}.json`;return await r(s)?c(s):(i(`Could not find a ${s} in your project. Double-check this exists and try again.`,{level:"danger",docs:"https://cheatcode.co/docs/push/config"}),process.exit(0))},_=t=>{const s=`settings.${t?.environment}.json`,e=a(t?.environment);return o(e)?JSON.parse(e):(i(`${s} contains invalid JSON. Double-check the syntax and try again.`,{level:"danger",docs:"https://cheatcode.co/docs/push/config"}),process.exit(0))};var m=_;export{m as default};
1
+ import n from"fs";import i from"../../lib/cli_log.js";import o from"../../lib/is_valid_json_string.js";import r from"../../lib/path_exists.js";const{readFile:a}=n.promises,c=async(t="")=>{const s=`settings.${t}.json`;return await r(s)?a(s):(i(`Could not find a ${s} in your project. Double-check this exists and try again.`,{level:"danger",docs:"https://cheatcode.co/docs/push/config"}),process.exit(0))},_=async t=>{const s=`settings.${t?.environment}.json`,e=await c(t?.environment);return o(e)?JSON.parse(e):(i(`${s} contains invalid JSON. Double-check the syntax and try again.`,{level:"danger",docs:"https://cheatcode.co/docs/push/config"}),process.exit(0))};var m=_;export{m as default};
@@ -1,3 +1,3 @@
1
- import u from"chalk";import b from"child_process";import h from"fs";import{dirname as g}from"path";import w from"util";import $ from"./build_files.js";import x from"./get_files_to_build.js";import y from"./get_file_operation.js";import v from"./get_path_platform.js";import z from"./get_tar_ignore_list.js";import j from"../load_settings.js";import k from"../loader.js";import f from"../path_exists.js";const{mkdir:B,copyFile:P}=h.promises,a=w.promisify(b.exec),A=(o=[])=>o?.map(r=>({path:r,operation:y(r),platform:v(r)})),F=async(o={})=>{const r=new k,e=o?.type||"tar",n=o?.environment||"production";r.print(`Building app to ${e} for ${n}...`);const l=await j(n),_=l?.config?.build?.excluded_paths||l?.config?.build?.excludedPaths,d=await x(_),i=e==="tar"?".build/.tar":".build",p=A(d);await f(".build")&&await a("rm -rf .build");const s=p?.filter(t=>t?.operation==="copy_file"),m=p?.filter(t=>t?.operation==="build_file");for(let t=0;t<s?.length;t+=1){const c=s[t];await B(g(`${i}/${c?.path}`),{recursive:!0}),await P(c?.path,`${i}/${c?.path}`)}if(await $({files:m,environment:n,output_path:i}).catch(t=>{console.warn(t)}),e==="tar"){const t=z(l?.config?.build?.excludedPaths);await a(`cd ${i} && tar --exclude=${t} -czf ../build.tar.gz .`),await a(`rm -rf ${i}`)}o?.silence_confirmation||console.log(u.greenBright(`
2
- \u2714 App built as ${e} to ${e==="tar"?i?.replace("/.tar","/build.tar.gz"):i}!
3
- `)),await f(".build/component_id_cache.json")&&await a("rm -rf .build/component_id_cache.json")};var Q=F;export{Q as default};
1
+ import u from"chalk";import b from"child_process";import g from"fs";import{dirname as h}from"path";import w from"util";import y from"./build_files.js";import $ from"./get_files_to_build.js";import x from"./get_file_operation.js";import z from"./get_path_platform.js";import k from"./get_tar_ignore_list.js";import v from"../load_settings.js";import F from"../loader.js";import _ from"../path_exists.js";import j from"../../lib/encrypt_buffer.js";const{mkdir:B,copyFile:P,readFile:A,writeFile:L}=g.promises,l=w.promisify(b.exec),q=(r=[])=>r?.map(e=>({path:e,operation:x(e),platform:z(e)})),C=async(r={})=>{const e=new F,o=r?.type||"tar",n=r?.environment||"production";e.print(`Building app to ${o} for ${n}...`);const c=await v(n),f=c?.config?.build?.excluded_paths||c?.config?.build?.excludedPaths,s=await $(f),i=o==="tar"?".build/.tar":".build",p=q(s);await _(".build")&&await l("rm -rf .build");const d=p?.filter(t=>t?.operation==="copy_file"),m=p?.filter(t=>t?.operation==="build_file");for(let t=0;t<d?.length;t+=1){const a=d[t];await B(h(`${i}/${a?.path}`),{recursive:!0}),await P(a?.path,`${i}/${a?.path}`)}if(await y({files:m,environment:n,output_path:i}).catch(t=>{console.warn(t)}),o==="tar"){const t=k(c?.config?.build?.excludedPaths);await l(`cd ${i} && tar --exclude=${t} -czf ../build.tar.gz .`),await l(`rm -rf ${i}`)}if(o==="tar"&&r?.encrypt_build){const t=i?.replace("/.tar","/build.tar.gz"),a=j(await A(t),r?.encryption_key);await L(".build/build.encrypted.tar.gz",a)}r?.silence_confirmation||console.log(u.greenBright(`
2
+ \u2714 App built as ${o} to ${o==="tar"?i?.replace("/.tar","/build.tar.gz"):i}!
3
+ `)),await _(".build/component_id_cache.json")&&await l("rm -rf .build/component_id_cache.json")};var U=C;export{U 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.635",
4
+ "version": "0.0.0-canary.637",
5
5
  "description": "The CLI for Joystick.",
6
6
  "main": "dist/index.js",
7
7
  "bin": {
@@ -1,8 +1,8 @@
1
1
  const get_provision_domain = (provision_server = 'production') => {
2
2
  return {
3
3
  development: 'http://localhost:2603',
4
- staging: 'https://staging.push-provision.cheatcode.co',
5
- production: 'https://push-provision.cheatcode.co',
4
+ staging: 'https://staging.provision.cheatcode.co',
5
+ production: 'https://provision.cheatcode.co',
6
6
  }[provision_server];
7
7
  };
8
8
 
@@ -24,9 +24,9 @@ const read_settings_file = async (environment = '') => {
24
24
  return readFile(settings_file_name);
25
25
  };
26
26
 
27
- const get_settings_file = (options) => {
27
+ const get_settings_file = async (options) => {
28
28
  const settings_file_name = `settings.${options?.environment}.json`;
29
- const raw_settings_file = read_settings_file(options?.environment);
29
+ const raw_settings_file = await read_settings_file(options?.environment);
30
30
  const settings_file_is_valid_json = is_valid_json_string(raw_settings_file);
31
31
 
32
32
  if (!settings_file_is_valid_json) {
@@ -11,8 +11,9 @@ import get_tar_ignore_list from "./get_tar_ignore_list.js";
11
11
  import load_settings from "../load_settings.js";
12
12
  import Loader from "../loader.js";
13
13
  import path_exists from "../path_exists.js";
14
+ import encrypt_buffer from '../../lib/encrypt_buffer.js';
14
15
 
15
- const { mkdir, copyFile } = fs.promises;
16
+ const { mkdir, copyFile, readFile, writeFile } = fs.promises;
16
17
  const exec = util.promisify(child_process.exec);
17
18
 
18
19
  const get_files_to_build_with_operation_and_platform = (files = []) => {
@@ -75,6 +76,17 @@ const build = async (options = {}) => {
75
76
  await exec(`rm -rf ${output_path}`);
76
77
  }
77
78
 
79
+ if (build_type === "tar" && options?.encrypt_build) {
80
+ const build_path = output_path?.replace('/.tar', '/build.tar.gz');
81
+
82
+ const encrypted_build = encrypt_buffer(
83
+ await readFile(build_path),
84
+ options?.encryption_key,
85
+ );
86
+
87
+ await writeFile(`.build/build.encrypted.tar.gz`, encrypted_build);
88
+ }
89
+
78
90
  if (!options?.silence_confirmation) {
79
91
  console.log(
80
92
  chalk.greenBright(`\n✔ App built as ${build_type} to ${build_type === 'tar' ? output_path?.replace('/.tar', '/build.tar.gz') : output_path}!\n`)