@junobuild/cli 0.2.5 → 0.2.7

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.
package/dist/index.js CHANGED
@@ -644,7 +644,7 @@ tell application "System Events" to get value of property list item "CFBundleNam
644
644
  Are you sure the folder containing your built app (the "source" tag in the configuration file for Juno) files is correctly configured, or have you built your app?`),process.exit(1)}};var xxe=be(Qe(),1);var ua=be(Qe(),1);var Yh=be(Qe(),1),Qx="Clear existing dapp code by removing JavaScript, HTML, CSS, and other files from your satellite.",eE="Apply configuration to satellite.",tE="Deploy your dapp to your satellite.",rE="Handle development tasks like building serverless functions or running a local Internet Computer instance.",nE="Set up your project.",iE="Generate an authentication for use in non-interactive environments.",uD="Log out of the current device. \u26A0\uFE0F This action does not remove controllers from the module.",sE="Open your satellite in your browser.",aE="Handle snapshot-related tasks.",oE="Start a module.",cE="Stop a module.",uE="Upgrade a module to a new version.",lE="Switch between multiple profiles.",pE="Check the version of the modules and CLI.",lD="Display your current profile, controller, and links to your satellite.",fE="Start a local Internet Computer network in a container.",mq="Build your serverless functions.",yq="Generate the required files to begin developing serverless functions in your project.",pD=`- If no language is provided, the CLI attempts to determine the appropriate build.
645
645
  - Language can be shortened to ${(0,Yh.magenta)("rs")} for Rust, ${(0,Yh.magenta)("ts")} for TypeScript and ${(0,Yh.magenta)("mjs")} for JavaScript.
646
646
  - The path option maps to ${(0,Yh.magenta)("--manifest-path")} for Rust (Cargo) or to the source file for TypeScript and JavaScript (e.g. ${(0,Yh.magenta)("index.ts")} or ${(0,Yh.magenta)("index.mjs")}).
647
- - The watch option rebuilds when source files change, with a default debounce delay of 10 seconds; optionally, pass a delay in milliseconds.`;var c1e=be(Qe(),1),ei=`${(0,c1e.yellow)("-m, --mode")} Set env mode. For example production or a custom string. Default is production.`,Or=e=>Xt({args:e,options:["-d","--doc"]})?"doc":"cli";var Vn=be(Qe(),1);var dE="0.2.5";var VRt=` __ __ __ __ _ ____
647
+ - The watch option rebuilds when source files change, with a default debounce delay of 10 seconds; optionally, pass a delay in milliseconds.`;var c1e=be(Qe(),1),ei=`${(0,c1e.yellow)("-m, --mode")} Set env mode. For example production or a custom string. Default is production.`,Or=e=>Xt({args:e,options:["-d","--doc"]})?"doc":"cli";var Vn=be(Qe(),1);var dE="0.2.7";var VRt=` __ __ __ __ _ ____
648
648
  __) || | || \\| |/ \\
649
649
  \\___/ \\___/ |_|\\__|\\____/`,wr=`${VRt} CLI ${(0,Vn.grey)(`v${dE}`)}`,u1e=`Juno CLI ${(0,Vn.grey)(`v${dE}`)}`,hE=`
650
650
  ${wr}
@@ -795,7 +795,7 @@ Useful ${(0,zf.green)("juno")} ${(0,zf.cyan)("dev")} ${(0,zf.magenta)("<subcomma
795
795
 
796
796
  Subcommands:
797
797
  ${y1e}
798
- `;var Jq=be(ct(),1);var dxe=be(Qe(),1);import{existsSync as L5t}from"node:fs";import{writeFile as M5t}from"node:fs/promises";import{basename as $5t,join as q5t}from"node:path";var hxe="../templates/docker",mxe=process.cwd(),yxe=async()=>{let{valid:e}=await Lq();e==="error"||!e||(await Mq(),await U5t(),await H5t(),await Ks({command:"docker",args:["compose","up"]}))},gxe=async()=>{let{valid:e}=await Lq();e==="error"||!e||(await Mq(),await Ks({command:"docker",args:["compose","stop"]}))},U5t=async()=>{if(await z1e())return;await _n("A config file is required for development. Would you like the CLI to create one for you?");let{configType:e,configPath:t}=await V5t();await qc({template:`${aS}.${e}`,sourceFolder:hxe,destinationFolder:mxe,...(0,Jq.nonNullish)(t)&&{destinationFilename:t}})},V5t=async()=>{let e=CD();return(0,Jq.nonNullish)(e)?e:{configType:await aD()}},H5t=async()=>{if(L5t("docker-compose.yml"))return;await _n(`The CLI utilizes Docker Compose, which is handy for customizing configurations. Would you like the CLI to generate a default ${(0,dxe.magenta)("docker-compose.yml")} file for you?`);let e=await qh({template:"docker-compose.yml",sourceFolder:hxe}),{configPath:t}=G1e(),r=$5t(t),n=e.replaceAll("<JUNO_DEV_CONFIG>",r);await M5t(q5t(mxe,"docker-compose.yml"),n,"utf-8")};var bxe=be(ct(),1);var vxe=async e=>{let{watch:t,...r}=_D(e);(0,bxe.nonNullish)(t)&&t!==!1&&zq({watch:t,...r}),await yxe()};var Exe=async e=>{let[t]=e??[];switch(t){case"eject":await pxe(e);break;case"build":await nxe(e);break;case"start":await vxe(e);break;case"stop":await gxe();break;default:console.log((0,xxe.red)("Unknown subcommand.")),mE()}},wxe=e=>{let[t]=e??[];switch(t){case"start":v1e(e);break;case"build":p1e(e);break;case"eject":d1e(e);break;default:mE(e)}};var _xe=be(Au(),1);var Txe=async e=>{if(!await bi()){nl();return}let t=qt({args:e,option:"-b"})??qt({args:e,option:"--browser"}),r=yi(e),{satellite:n}=await vi(r),i=await fi({satellite:n,env:r}),{satelliteId:s}=i;if(Xt({args:e,options:["-c","--console"]})){await B0({url:oD(s),browser:t});return}let a=await Hf({satellite:i});if(a.length===0){await B0({url:ng(s),browser:t});return}let o=await K5t({domains:a,satelliteId:s});await B0({url:o,browser:t})},K5t=async({satelliteId:e,domains:t})=>{let{url:r}=await(0,_xe.default)({type:"select",name:"url",message:"Which URL of your satellite should be opened?",choices:[...t.map(({domain:n})=>({title:`https://${n}`,value:`https://${n}`})),{title:ng(e),value:ng(e)}]});return Ei(r),r};var nU=be(Qe(),1);var ic=be(Qe(),1);var fp=be(Qe(),1),RD=e=>`${(0,fp.yellow)("-t, --target")} Which module type should be ${e==="snapshot"?"snapshotted":"upgraded"}? Valid targets are ${(0,fp.magenta)("satellite")}, ${(0,fp.magenta)("mission-control")} or ${(0,fp.magenta)("orbiter")}.`,BD=`- Targets can be shortened to ${(0,fp.magenta)("s")} for satellite, ${(0,fp.magenta)("m")} for mission-control and ${(0,fp.magenta)("o")} for orbiter.`;var Sxe=`Usage: ${(0,ic.green)("juno")} ${(0,ic.cyan)("snapshot")} ${(0,ic.magenta)("<subcommand>")} ${(0,ic.yellow)("[options]")}
798
+ `;var Jq=be(ct(),1);var dxe=be(Qe(),1);import{existsSync as L5t}from"node:fs";import{writeFile as M5t}from"node:fs/promises";import{basename as $5t,join as q5t}from"node:path";var hxe="../templates/docker",mxe=process.cwd(),yxe=async()=>{let{valid:e}=await Lq();e==="error"||!e||(await Mq(),await U5t(),await H5t(),console.log("\u{1F9EA} Launching local emulator..."),await Ks({command:"docker",args:["compose","up"]}))},gxe=async()=>{let{valid:e}=await Lq();e==="error"||!e||(await Mq(),await Ks({command:"docker",args:["compose","stop"]}))},U5t=async()=>{if(await z1e())return;await _n("A config file is required for development. Would you like the CLI to create one for you?");let{configType:e,configPath:t}=await V5t();await qc({template:`${aS}.${e}`,sourceFolder:hxe,destinationFolder:mxe,...(0,Jq.nonNullish)(t)&&{destinationFilename:t}})},V5t=async()=>{let e=CD();return(0,Jq.nonNullish)(e)?e:{configType:await aD()}},H5t=async()=>{if(L5t("docker-compose.yml"))return;await _n(`The CLI utilizes Docker Compose, which is handy for customizing configurations. Would you like the CLI to generate a default ${(0,dxe.magenta)("docker-compose.yml")} file for you?`);let e=await qh({template:"docker-compose.yml",sourceFolder:hxe}),{configPath:t}=G1e(),r=$5t(t),n=e.replaceAll("<JUNO_DEV_CONFIG>",r);await M5t(q5t(mxe,"docker-compose.yml"),n,"utf-8")};var bxe=be(ct(),1);var vxe=async e=>{let{watch:t,...r}=_D(e);(0,bxe.nonNullish)(t)&&t!==!1&&zq({watch:t,...r}),await yxe()};var Exe=async e=>{let[t]=e??[];switch(t){case"eject":await pxe(e);break;case"build":await nxe(e);break;case"start":await vxe(e);break;case"stop":await gxe();break;default:console.log((0,xxe.red)("Unknown subcommand.")),mE()}},wxe=e=>{let[t]=e??[];switch(t){case"start":v1e(e);break;case"build":p1e(e);break;case"eject":d1e(e);break;default:mE(e)}};var _xe=be(Au(),1);var Txe=async e=>{if(!await bi()){nl();return}let t=qt({args:e,option:"-b"})??qt({args:e,option:"--browser"}),r=yi(e),{satellite:n}=await vi(r),i=await fi({satellite:n,env:r}),{satelliteId:s}=i;if(Xt({args:e,options:["-c","--console"]})){await B0({url:oD(s),browser:t});return}let a=await Hf({satellite:i});if(a.length===0){await B0({url:ng(s),browser:t});return}let o=await K5t({domains:a,satelliteId:s});await B0({url:o,browser:t})},K5t=async({satelliteId:e,domains:t})=>{let{url:r}=await(0,_xe.default)({type:"select",name:"url",message:"Which URL of your satellite should be opened?",choices:[...t.map(({domain:n})=>({title:`https://${n}`,value:`https://${n}`})),{title:ng(e),value:ng(e)}]});return Ei(r),r};var nU=be(Qe(),1);var ic=be(Qe(),1);var fp=be(Qe(),1),RD=e=>`${(0,fp.yellow)("-t, --target")} Which module type should be ${e==="snapshot"?"snapshotted":"upgraded"}? Valid targets are ${(0,fp.magenta)("satellite")}, ${(0,fp.magenta)("mission-control")} or ${(0,fp.magenta)("orbiter")}.`,BD=`- Targets can be shortened to ${(0,fp.magenta)("s")} for satellite, ${(0,fp.magenta)("m")} for mission-control and ${(0,fp.magenta)("o")} for orbiter.`;var Sxe=`Usage: ${(0,ic.green)("juno")} ${(0,ic.cyan)("snapshot")} ${(0,ic.magenta)("<subcommand>")} ${(0,ic.yellow)("[options]")}
799
799
 
800
800
  Subcommands:
801
801
  ${(0,ic.magenta)("create")} Create a snapshot of your current state.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@junobuild/cli",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "description": "The Juno command-line interface",
5
5
  "author": "David Dal Busco (https://daviddalbusco.com)",
6
6
  "license": "MIT",
@@ -49,7 +49,7 @@
49
49
  "@eslint/eslintrc": "^3.3.0",
50
50
  "@eslint/js": "^9.22.0",
51
51
  "@junobuild/config": "^0.1.3",
52
- "@junobuild/functions": "^0.0.12",
52
+ "@junobuild/functions": "^0.0.13",
53
53
  "@types/node": "^22.13.10",
54
54
  "@types/prompts": "^2.4.9",
55
55
  "@types/semver": "^7.5.8",
@@ -4,12 +4,67 @@ import {defineAssert, defineHook} from '@junobuild/functions';
4
4
  // However, if you don’t have to implement all of them, for example to improve readability or reduce unnecessary logic,
5
5
  // you can selectively delete the features you do not need.
6
6
 
7
+ export const onSetDoc = defineHook({
8
+ collections: [],
9
+ run: async (context) => {}
10
+ });
11
+
12
+ export const onSetManyDocs = defineHook({
13
+ collections: [],
14
+ run: async (context) => {}
15
+ });
16
+
17
+ export const onDeleteDoc = defineHook({
18
+ collections: [],
19
+ run: async (context) => {}
20
+ });
21
+
22
+ export const onDeleteManyDocs = defineHook({
23
+ collections: [],
24
+ run: async (context) => {}
25
+ });
26
+
27
+ export const onDeleteFilteredDocs = defineHook({
28
+ collections: [],
29
+ run: async (context) => {}
30
+ });
31
+
32
+ export const onUploadAsset = defineHook({
33
+ collections: [],
34
+ run: async (context) => {}
35
+ });
36
+
37
+ export const onDeleteAsset = defineHook({
38
+ collections: [],
39
+ run: async (context) => {}
40
+ });
41
+
42
+ export const onDeleteManyAssets = defineHook({
43
+ collections: [],
44
+ run: async (context) => {}
45
+ });
46
+
47
+ export const onDeleteFilteredAssets = defineHook({
48
+ collections: [],
49
+ run: async (context) => {}
50
+ });
51
+
7
52
  export const assertSetDoc = defineAssert({
8
53
  collections: [],
9
54
  assert: (context) => {}
10
55
  });
11
56
 
12
- export const onSetDoc = defineHook({
57
+ export const assertDeleteDoc = defineAssert({
13
58
  collections: [],
14
- run: async (context) => {}
59
+ assert: (context) => {}
60
+ });
61
+
62
+ export const assertUploadAsset = defineAssert({
63
+ collections: [],
64
+ assert: (context) => {}
65
+ });
66
+
67
+ export const assertDeleteAsset = defineAssert({
68
+ collections: [],
69
+ assert: (context) => {}
15
70
  });
@@ -1,15 +1,86 @@
1
- import {type AssertSetDoc, defineAssert, defineHook, type OnSetDoc} from '@junobuild/functions';
1
+ import {
2
+ type AssertDeleteAsset,
3
+ type AssertDeleteDoc,
4
+ type AssertSetDoc,
5
+ type AssertUploadAsset,
6
+ defineAssert,
7
+ defineHook,
8
+ type OnDeleteAsset,
9
+ type OnDeleteDoc,
10
+ type OnDeleteFilteredAssets,
11
+ type OnDeleteFilteredDocs,
12
+ type OnDeleteManyAssets,
13
+ type OnDeleteManyDocs,
14
+ type OnSetDoc,
15
+ type OnSetManyDocs,
16
+ OnUploadAsset
17
+ } from '@junobuild/functions';
2
18
 
3
19
  // All the available hooks and assertions for your Datastore and Storage are scaffolded by default in this module.
4
20
  // However, if you don’t have to implement all of them, for example to improve readability or reduce unnecessary logic,
5
21
  // you can selectively delete the features you do not need.
6
22
 
23
+ export const onSetDoc = defineHook<OnSetDoc>({
24
+ collections: [],
25
+ run: async (context) => {}
26
+ });
27
+
28
+ export const onSetManyDocs = defineHook<OnSetManyDocs>({
29
+ collections: [],
30
+ run: async (context) => {}
31
+ });
32
+
33
+ export const onDeleteDoc = defineHook<OnDeleteDoc>({
34
+ collections: [],
35
+ run: async (context) => {}
36
+ });
37
+
38
+ export const onDeleteManyDocs = defineHook<OnDeleteManyDocs>({
39
+ collections: [],
40
+ run: async (context) => {}
41
+ });
42
+
43
+ export const onDeleteFilteredDocs = defineHook<OnDeleteFilteredDocs>({
44
+ collections: [],
45
+ run: async (context) => {}
46
+ });
47
+
48
+ export const onUploadAsset = defineHook<OnUploadAsset>({
49
+ collections: [],
50
+ run: async (context) => {}
51
+ });
52
+
53
+ export const onDeleteAsset = defineHook<OnDeleteAsset>({
54
+ collections: [],
55
+ run: async (context) => {}
56
+ });
57
+
58
+ export const onDeleteManyAssets = defineHook<OnDeleteManyAssets>({
59
+ collections: [],
60
+ run: async (context) => {}
61
+ });
62
+
63
+ export const onDeleteFilteredAssets = defineHook<OnDeleteFilteredAssets>({
64
+ collections: [],
65
+ run: async (context) => {}
66
+ });
67
+
7
68
  export const assertSetDoc = defineAssert<AssertSetDoc>({
8
69
  collections: [],
9
70
  assert: (context) => {}
10
71
  });
11
72
 
12
- export const onSetDoc = defineHook<OnSetDoc>({
73
+ export const assertDeleteDoc = defineAssert<AssertDeleteDoc>({
13
74
  collections: [],
14
- run: async (context) => {}
75
+ assert: (context) => {}
76
+ });
77
+
78
+ export const assertUploadAsset = defineAssert<AssertUploadAsset>({
79
+ collections: [],
80
+ assert: (context) => {}
81
+ });
82
+
83
+ export const assertDeleteAsset = defineAssert<AssertDeleteAsset>({
84
+ collections: [],
85
+ assert: (context) => {}
15
86
  });