@canva/cli 0.0.1-beta.25 → 0.0.1-beta.26
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/README.md +47 -41
- package/cli.js +1 -1
- package/package.json +1 -1
- package/templates/base/package.json +2 -2
- package/templates/dam/package.json +4 -4
- package/templates/gen_ai/package.json +3 -3
- package/templates/hello_world/package.json +3 -3
package/README.md
CHANGED
|
@@ -215,70 +215,76 @@ Manage your Canva apps.
|
|
|
215
215
|
canva apps
|
|
216
216
|
```
|
|
217
217
|
|
|
218
|
-
|
|
218
|
+
##### create
|
|
219
219
|
|
|
220
|
-
|
|
220
|
+
Create a new Canva app.
|
|
221
221
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
222
|
+
```shell
|
|
223
|
+
canva apps create "My New App" --template="hello_world" --distribution="public" --git --installDependencies
|
|
224
|
+
```
|
|
225
225
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
226
|
+
- **Arguments**:
|
|
227
|
+
- `--name`: Sets the app's name. Provide the name you want for the app.
|
|
228
|
+
- **Flags**:
|
|
229
229
|
|
|
230
|
-
|
|
230
|
+
- `--template`: Specifies the starting template for the app.
|
|
231
231
|
|
|
232
|
-
|
|
232
|
+
Available templates:
|
|
233
233
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
234
|
+
- `"hello_world"`: Basic starting point.
|
|
235
|
+
- `"dam"`: Digital asset management integration.
|
|
236
|
+
- `"gen_ai"`: Generative AI app creation.
|
|
237
237
|
|
|
238
|
-
|
|
238
|
+
- `--distribution`: Sets the app's distribution type.
|
|
239
239
|
|
|
240
|
-
|
|
240
|
+
Available types:
|
|
241
241
|
|
|
242
|
-
|
|
243
|
-
|
|
242
|
+
- `"public"`: Available to all Canva users, subject to Canva review.
|
|
243
|
+
- `"private"`: Only available to your team, and requires team admin approval.
|
|
244
244
|
|
|
245
|
-
|
|
245
|
+
**Note**: You can't change the distribution setting after creating a new app with the `canva apps create` command.
|
|
246
246
|
|
|
247
|
-
|
|
247
|
+
- `--git`: Initializes a Git repository in the project directory.
|
|
248
248
|
|
|
249
|
-
|
|
249
|
+
- `--installDependencies`: Automatically installs necessary npm dependencies during the app creation process.
|
|
250
250
|
|
|
251
|
-
|
|
251
|
+
- `--offline`: Scaffold the app locally without also creating an app in the Developer Portal.
|
|
252
252
|
|
|
253
|
-
|
|
253
|
+
##### list
|
|
254
254
|
|
|
255
|
-
|
|
256
|
-
canva apps list
|
|
257
|
-
```
|
|
255
|
+
List all Canva apps.
|
|
258
256
|
|
|
259
|
-
|
|
257
|
+
```shell
|
|
258
|
+
canva apps list
|
|
259
|
+
```
|
|
260
260
|
|
|
261
|
-
|
|
262
|
-
- `--all`, `-a`: Lists all apps at once without pagination.
|
|
263
|
-
- `--print`, `-p`: Prints the list of apps to the console without interactivity.
|
|
261
|
+
- **Flags**:
|
|
264
262
|
|
|
265
|
-
-
|
|
263
|
+
- `--appId`: Specifies an App ID to select.
|
|
264
|
+
- `--all`, `-a`: Lists all apps at once without pagination.
|
|
265
|
+
- `--print`, `-p`: Prints the list of apps to the console without interactivity.
|
|
266
266
|
|
|
267
|
-
|
|
268
|
-
canva apps preview
|
|
269
|
-
```
|
|
267
|
+
##### preview
|
|
270
268
|
|
|
271
|
-
|
|
269
|
+
Preview your app.
|
|
272
270
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
271
|
+
```shell
|
|
272
|
+
canva apps preview
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
##### doctor
|
|
276
|
+
|
|
277
|
+
Run diagnostics on your Canva App to identify and fix issues.
|
|
278
|
+
|
|
279
|
+
```shell
|
|
280
|
+
canva apps doctor
|
|
281
|
+
```
|
|
276
282
|
|
|
277
|
-
|
|
283
|
+
- **Flags**:
|
|
278
284
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
285
|
+
- `--fix`: Automatically apply fixes for issues where possible.
|
|
286
|
+
- `--report`: Output check results without prompting for fixes.
|
|
287
|
+
- `--verbose`: Show detailed diagnostic output optimized for AI agent assistance.
|
|
282
288
|
|
|
283
289
|
#### logout
|
|
284
290
|
|
package/cli.js
CHANGED
|
@@ -433,7 +433,7 @@ GFS4: `),console.error(t)});ar[dn]||(WK=global[dn]||[],KK(ar,WK),ar.close=functi
|
|
|
433
433
|
`:`
|
|
434
434
|
`)+r,i=n+1,n=t.indexOf(`
|
|
435
435
|
`,i)}while(n!==-1);return s+=t.slice(i),s}var{stdout:EI,stderr:CI}=vI,aE=Symbol("GENERATOR"),h0=Symbol("STYLER"),Hp=Symbol("IS_EMPTY"),wI=["ansi","ansi","ansi256","ansi16m"],m0=Object.create(null),nte=(t,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let r=EI?EI.level:0;t.level=e.level===void 0?r:e.level};var ite=t=>{let e=(...r)=>r.join(" ");return nte(e,t),Object.setPrototypeOf(e,Wp.prototype),e};function Wp(t){return ite(t)}Object.setPrototypeOf(Wp.prototype,Function.prototype);for(let[t,e]of Object.entries($s))m0[t]={get(){let r=z1(this,lE(e.open,e.close,this[h0]),this[Hp]);return Object.defineProperty(this,t,{value:r}),r}};m0.visible={get(){let t=z1(this,this[h0],!0);return Object.defineProperty(this,"visible",{value:t}),t}};var cE=(t,e,r,...n)=>t==="rgb"?e==="ansi16m"?$s[r].ansi16m(...n):e==="ansi256"?$s[r].ansi256($s.rgbToAnsi256(...n)):$s[r].ansi($s.rgbToAnsi(...n)):t==="hex"?cE("rgb",e,r,...$s.hexToRgb(...n)):$s[r][t](...n),ste=["rgb","hex","ansi256"];for(let t of ste){m0[t]={get(){let{level:r}=this;return function(...n){let i=lE(cE(t,wI[r],"color",...n),$s.color.close,this[h0]);return z1(this,i,this[Hp])}}};let e="bg"+t[0].toUpperCase()+t.slice(1);m0[e]={get(){let{level:r}=this;return function(...n){let i=lE(cE(t,wI[r],"bgColor",...n),$s.bgColor.close,this[h0]);return z1(this,i,this[Hp])}}}}var ote=Object.defineProperties(()=>{},{...m0,level:{enumerable:!0,get(){return this[aE].level},set(t){this[aE].level=t}}}),lE=(t,e,r)=>{let n,i;return r===void 0?(n=t,i=e):(n=r.openAll+t,i=e+r.closeAll),{open:t,close:e,openAll:n,closeAll:i,parent:r}},z1=(t,e,r)=>{let n=(...i)=>ute(n,i.length===1?""+i[0]:i.join(" "));return Object.setPrototypeOf(n,ote),n[aE]=t,n[h0]=e,n[Hp]=r,n},ute=(t,e)=>{if(t.level<=0||!e)return t[Hp]?"":e;let r=t[h0];if(r===void 0)return e;let{openAll:n,closeAll:i}=r;if(e.includes("\x1B"))for(;r!==void 0;)e=DI(e,r.close,r.open),r=r.parent;let s=e.indexOf(`
|
|
436
|
-
`);return s!==-1&&(e=SI(e,i,n,s)),n+e+i};Object.defineProperties(Wp.prototype,m0);var ate=Wp(),vAe=Wp({level:CI?CI.level:0});var Et=ate;var fE=Et.inverse(" "),AI=({isDisabled:t=!1,state:e,placeholder:r=""})=>{let n=_I(()=>t?r?Et.dim(r):"":r&&r.length>0?Et.inverse(r[0])+Et.dim(r.slice(1)):fE,[t,r]),i=_I(()=>{if(t)return e.value;let s=0,o=e.value.length>0?"":fE;for(let u of e.value)o+=s===e.cursorOffset?Et.inverse(u):u,s++;return e.suggestion?(e.cursorOffset===e.value.length?o+=Et.inverse(e.suggestion[0])+Et.dim(e.suggestion.slice(1)):o+=Et.dim(e.suggestion),o):(e.value.length>0&&e.cursorOffset===e.value.length&&(o+=fE),o)},[t,e.value,e.cursorOffset,e.suggestion]);return cte((s,o)=>{if(!(o.upArrow||o.downArrow||o.ctrl&&s==="c"||o.tab||o.shift&&o.tab)){if(o.return){e.submit();return}o.leftArrow?e.moveCursorLeft():o.rightArrow?e.moveCursorRight():o.backspace||o.delete?e.delete():e.insert(s)}},{isActive:!t}),{inputValue:e.value.length>0?i:n}};function TI({isDisabled:t=!1,defaultValue:e,placeholder:r="",suggestions:n,onChange:i,onSubmit:s}){let o=hI({defaultValue:e,suggestions:n,onChange:i,onSubmit:s}),{inputValue:u}=AI({isDisabled:t,placeholder:r,state:o}),{styles:a}=Rt("TextInput");return lte.createElement(fte,{...a.value()},u)}import{Box as gte}from"ink";import zp,{useContext as yte,isValidElement as II}from"react";import{Box as OI,Text as pte}from"ink";import dE,{useContext as hte}from"react";import{createContext as dte}from"react";var K1=dte({marker:cr.line});function X1({children:t}){let{marker:e}=hte(K1),{styles:r}=Rt("OrderedList");return dE.createElement(OI,{...r.listItem()},dE.createElement(pte,{...r.marker()},e),dE.createElement(OI,{...r.content()},t))}import{createContext as mte}from"react";var pE=mte({marker:""});function xte({children:t}){let{marker:e}=yte(pE),{styles:r}=Rt("OrderedList"),n=0;for(let s of zp.Children.toArray(t))!II(s)||s.type!==X1||n++;let i=String(n).length;return zp.createElement(gte,{...r.list()},zp.Children.map(t,(s,o)=>{if(!II(s)||s.type!==X1)return s;let u=`${String(o+1).padStart(i)}.`,a=`${e}${u}`;return zp.createElement(pE.Provider,{value:{marker:a}},zp.createElement(K1.Provider,{value:{marker:a}},s))}))}xte.Item=X1;import Ete from"react";import{Text as Cte}from"ink";import{useReducer as bte,useCallback as Kp,useEffect as vte}from"react";var Dte=(t,e)=>{switch(e.type){case"move-cursor-left":return{...t,cursorOffset:Math.max(0,t.cursorOffset-1)};case"move-cursor-right":return{...t,cursorOffset:Math.min(t.value.length,t.cursorOffset+1)};case"insert":return{...t,previousValue:t.value,value:t.value.slice(0,t.cursorOffset)+e.text+t.value.slice(t.cursorOffset),cursorOffset:t.cursorOffset+e.text.length};case"delete":{let r=Math.max(0,t.cursorOffset-1);return{...t,previousValue:t.value,value:t.value.slice(0,r)+t.value.slice(r+1),cursorOffset:r}}}},LI=({onChange:t,onSubmit:e})=>{let[r,n]=bte(Dte,{previousValue:"",value:"",cursorOffset:0}),i=Kp(()=>{n({type:"move-cursor-left"})},[]),s=Kp(()=>{n({type:"move-cursor-right"})},[]),o=Kp(c=>{n({type:"insert",text:c})},[]),u=Kp(()=>{n({type:"delete"})},[]),a=Kp(()=>{e?.(r.value)},[r.value,e]);return vte(()=>{r.value!==r.previousValue&&t?.(r.value)},[r.previousValue,r.value,t]),{...r,moveCursorLeft:i,moveCursorRight:s,insert:o,delete:u,submit:a}};import{useMemo as FI}from"react";import{useInput as Ste}from"ink";var hE=Et.inverse(" "),PI=({isDisabled:t=!1,state:e,placeholder:r=""})=>{let n=FI(()=>t?r?Et.dim(r):"":r&&r.length>0?Et.inverse(r[0])+Et.dim(r.slice(1)):hE,[t,r]),i=FI(()=>{let s="*".repeat(e.value.length);if(t)return s;let o=0,u=s.length>0?"":hE;for(let a of s)u+=o===e.cursorOffset?Et.inverse(a):a,o++;return s.length>0&&e.cursorOffset===s.length&&(u+=hE),u},[t,e.value,e.cursorOffset]);return Ste((s,o)=>{if(!(o.upArrow||o.downArrow||o.ctrl&&s==="c"||o.tab||o.shift&&o.tab)){if(o.return){e.submit();return}o.leftArrow?e.moveCursorLeft():o.rightArrow?e.moveCursorRight():o.backspace||o.delete?e.delete():e.insert(s)}},{isActive:!t}),{inputValue:e.value.length>0?i:n}};function NI({isDisabled:t=!1,placeholder:e="",onChange:r,onSubmit:n}){let i=LI({onChange:r,onSubmit:n}),{inputValue:s}=PI({isDisabled:t,placeholder:e,state:i}),{styles:o}=Rt("PasswordInput");return Ete.createElement(Cte,{...o.value()},s)}import hTe from"react";import{Box as gTe,Text as yTe}from"ink";import ETe from"react";import{Box as wTe,Text as _Te}from"ink";import zTe from"react";import{Text as XTe}from"ink";import{useReducer as FTe,useCallback as PTe,useEffect as NTe,useMemo as RTe}from"react";import{useMemo as BTe}from"react";import{useInput as VTe}from"ink";var qTe=Et.inverse(" ");import RI,{useContext as wte}from"react";var Mo=t=>{let{lite:e}=wte(ut),r=t.yesLabel||"Yes",n=t.noLabel||"No",i=[{label:r,value:"yes"},{label:n,value:"no"}],s=u=>{let a=u==="yes";t.onChange?.(a)},o=t.default==="no"?i.reverse():i;return e?RI.createElement(rI,{onConfirm:()=>s("yes"),onCancel:()=>s("no"),defaultChoice:t.default==="yes"?"confirm":"cancel"}):RI.createElement(_u,{options:o,onChange:u=>s(u)})};async function Si(t=500){let e=(await Promise.resolve().then(()=>(BI(),MI))).default;return e(t)}var VI=({packageName:t,handlePromptDecision:e})=>{let{exit:r}=_te(),[n,i]=Ta.useState(!1);return Ta.createElement(jI,{flexDirection:"column",paddingX:2,borderStyle:"round",borderColor:"yellow",width:80},Ta.createElement(mE,null,Ta.createElement(Ke,{color:"greenBright"},"? "),"You're using an older version of our CLI. Would you like to update?"),Ta.createElement(Mo,{default:"yes",yesLabel:"Yes (Recommended to access the latest templates)",noLabel:"No (Some features, such as app templates, may be outdated)",onChange:async o=>{o&&(i(!0),await Si(),r()),e(o)}}),n&&Ta.createElement(jI,{marginTop:1},Ta.createElement(mE,null,"Run ",Ta.createElement(mE,{bold:!0},"npm i -g ",t,"@latest")," to update.")))};import{Text as Ate}from"ink";import*as Xp from"react";var pn=t=>{let{lite:e}=Xp.useContext(ut);return e?Xp.createElement(Ate,null,t.label):Xp.createElement(pI,{type:"bouncingBall",...t})};import UI from"react";var Y1=class extends UI.Component{state={isCrashed:!1,message:void 0};static getDerivedStateFromError(e){return{isCrashed:!0,message:e.message}}render(){return this.state.isCrashed?UI.createElement(X,{variant:"error"},this.state.message??"Sorry, a problem occurred"):this.props.children}componentDidCatch(e){this.setState({isCrashed:!0,message:e.message})}componentDidMount(){process.setUncaughtExceptionCaptureCallback(this.crashed)}componentWillUnmount(){process.setUncaughtExceptionCaptureCallback(null)}crashed=e=>{this.setState({isCrashed:!0,message:e.message}),process.exitCode=1}};var GI=({pkg:t,getUpdateInfo:e,border:r="regular",children:n,shouldPromptUpdate:i=!1,Logo:s})=>{let{lite:o}=Tte(ut),[u,a]=J1(!0),[c,l]=J1(),[f,d]=J1(null),[p,h]=J1(!1);Ote(()=>{(async()=>{let y=await e();y.success?d(y.data.latest):h(!0),a(!1)})()},[t]);let g=m=>{l(m?"agreed":"disagreed")};return u?Au.createElement(pn,{type:"bouncingBall",label:"Loading..."}):i&&f&&f!==t.version&&!c?Au.createElement(VI,{packageName:t.name,handlePromptDecision:g}):Au.createElement(qI,{borderColor:r==="regular"&&!o?q1:void 0,borderStyle:r==="regular"&&!o?"round":void 0,margin:r==="regular"&&!o?2:void 0,flexDirection:"column"},s&&Au.createElement(qI,{flexDirection:"row",paddingY:1},Au.createElement($I,null),Au.createElement(s,null),Au.createElement($I,null)),Au.createElement(Y1,null,!p&&Au.createElement(R5,{name:t.name,currentVersion:t.version,latestVersion:f}),n))};var g0={name:"@canva/cli",version:"0.0.1-beta.25",description:"The official Canva CLI.",license:"SEE LICENSE IN LICENSE.md",author:"Canva Pty Ltd.",type:"module",main:"./lib/cjs/index.cjs",module:"./lib/esm/index.mjs",exports:{".":{require:"./lib/cjs/index.cjs",import:"./lib/esm/index.mjs"}},bin:{canva:"./dist/cli.js"},files:["templates","cli.js","LICENSE.md","README.md","lib"],scripts:{"//0":"The following scripts must be run from the root directory of cli/canva-cli",build:"npm run compile && npm run build:patch && npm run build:patch && npm run build:library","build:patch":"npm run build:docs && npm run build:templates && npm run build:meta && npm run build:patch:code","build:patch:code":"node ./build/patch.mjs ./dist/cli.js","build:docs":"cp README.md LICENSE.md dist","build:templates":"node ./build/templates.mjs ./templates dist/templates","build:meta":"node ./build/package_json.mjs ./package.json dist/package.json canva","build:library":"node ./build/library.mjs",compile:"rm -rf dist && node ./build/build.mjs","prepare:release":"cd ../.. && npm run build:package:beta cli/canva-cli","lint:types:watch":"tsc --watch","lint:types":"tsc",lint:"eslint .","lint:fix":"eslint . --fix","test:unit":"jest --no-cache","test:unit:watch":"jest --watchAll","test:unit:ci":"jest --ci --collectCoverage","prebuild:ava":"tsc && tsc-alias","test:feature":"npm run prebuild:ava && ava src/**/*.feature.*","test:feature:specific":"npm run prebuild:ava && ava","test:feature:watch":"npm run test:feature -- --watch","test:feature:ci":"npm run prebuild:ava && ava src/**/*.feature.*","test:feature:update-snapshots":"npm run test:feature -- --u",format:"prettier ./ --no-config --write","format:check":"prettier ./ --no-config --check",start:"npm run build && node ./dist/cli.js","readme:check":"node ./bin/readme_check.mjs",dev:"ENV=dev npm run start",staging:"ENV=staging npm run start",prod:"ENV=prod npm run start",link:"npm run build && npm link && chmod +x ./dist/cli.js"},dependencies:{"@inkjs/ui":"2.0.0","@modelcontextprotocol/sdk":"1.8.0","@t3-oss/env-core":"0.11.1",clipboardy:"4.0.0",ink:"5.1.0","ink-gradient":"3.0.0",jose:"5.9.6",linkedom:"0.18.9",mobx:"6.13.3","mobx-react":"9.1.1",open:"10.1.0",react:"18.3.1",semver:"7.6.3",systeminformation:"5.25.11","terminal-link":"3.0.0","update-notifier":"7.3.1",yargs:"17.7.2",zod:"3.24.1"},devDependencies:{"@ava/typescript":"5.0.0","@eslint/js":"9.23.0","@jest/globals":"29.7.0","@tsconfig/node20":"20.1.4","@types/jest":"29.5.14","@types/react":"18.3.12","@types/semver":"7.5.8","@types/update-notifier":"6.0.8","@typescript-eslint/eslint-plugin":"8.27.0","@typescript-eslint/parser":"8.27.0",ava:"6.2.0",esbuild:"0.25.0",eslint:"9.23.0","eslint-plugin-ava":"15.0.1","eslint-plugin-jest":"28.11.0","eslint-plugin-react":"7.37.4","eslint-plugin-unicorn":"57.0.0","ink-testing-library":"4.0.0",jest:"29.7.0",prettier:"3.4.2","react-dom":"18.3.1",testdouble:"3.20.2","ts-jest":"29.2.5","ts-jest-mock-import-meta":"1.2.1","ts-node":"10.9.2","tsc-alias":"1.8.10",typescript:"5.5.4","typescript-eslint":"8.27.0"},keywords:["apps sdk","canva","cli","starter kit"],engines:{node:">=16"}};import Gs from"react";import{Text as qL,Newline as ure}from"ink";var Bo=nt(ZI(),1),PE=nt(jL(),1);import sre from"react";import{Transform as ore}from"ink";function LE({onlyFirst:t=!1}={}){let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}var ire=LE();function FE(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(ire,"")}var VL=t=>{if(t.name&&t.colors)throw new Error("The `name` and `colors` props are mutually exclusive");let e;if(t.name)e=PE.default[t.name];else if(t.colors)e=(0,PE.default)(t.colors);else throw new Error("Either `name` or `colors` prop must be provided");let r=n=>e.multiline(FE(n));return sre.createElement(ore,{transform:r},t.children)};VL.propTypes={children:Bo.default.oneOfType([Bo.default.arrayOf(Bo.default.node),Bo.default.node]).isRequired,name:Bo.default.oneOf(["cristal","teen","mind","morning","vice","passion","fruit","instagram","atlas","retro","summer","pastel","rainbow"]),colors:Bo.default.arrayOf(Bo.default.oneOfType([Bo.default.string,Bo.default.object]))};var UL=VL;var are=`
|
|
436
|
+
`);return s!==-1&&(e=SI(e,i,n,s)),n+e+i};Object.defineProperties(Wp.prototype,m0);var ate=Wp(),vAe=Wp({level:CI?CI.level:0});var Et=ate;var fE=Et.inverse(" "),AI=({isDisabled:t=!1,state:e,placeholder:r=""})=>{let n=_I(()=>t?r?Et.dim(r):"":r&&r.length>0?Et.inverse(r[0])+Et.dim(r.slice(1)):fE,[t,r]),i=_I(()=>{if(t)return e.value;let s=0,o=e.value.length>0?"":fE;for(let u of e.value)o+=s===e.cursorOffset?Et.inverse(u):u,s++;return e.suggestion?(e.cursorOffset===e.value.length?o+=Et.inverse(e.suggestion[0])+Et.dim(e.suggestion.slice(1)):o+=Et.dim(e.suggestion),o):(e.value.length>0&&e.cursorOffset===e.value.length&&(o+=fE),o)},[t,e.value,e.cursorOffset,e.suggestion]);return cte((s,o)=>{if(!(o.upArrow||o.downArrow||o.ctrl&&s==="c"||o.tab||o.shift&&o.tab)){if(o.return){e.submit();return}o.leftArrow?e.moveCursorLeft():o.rightArrow?e.moveCursorRight():o.backspace||o.delete?e.delete():e.insert(s)}},{isActive:!t}),{inputValue:e.value.length>0?i:n}};function TI({isDisabled:t=!1,defaultValue:e,placeholder:r="",suggestions:n,onChange:i,onSubmit:s}){let o=hI({defaultValue:e,suggestions:n,onChange:i,onSubmit:s}),{inputValue:u}=AI({isDisabled:t,placeholder:r,state:o}),{styles:a}=Rt("TextInput");return lte.createElement(fte,{...a.value()},u)}import{Box as gte}from"ink";import zp,{useContext as yte,isValidElement as II}from"react";import{Box as OI,Text as pte}from"ink";import dE,{useContext as hte}from"react";import{createContext as dte}from"react";var K1=dte({marker:cr.line});function X1({children:t}){let{marker:e}=hte(K1),{styles:r}=Rt("OrderedList");return dE.createElement(OI,{...r.listItem()},dE.createElement(pte,{...r.marker()},e),dE.createElement(OI,{...r.content()},t))}import{createContext as mte}from"react";var pE=mte({marker:""});function xte({children:t}){let{marker:e}=yte(pE),{styles:r}=Rt("OrderedList"),n=0;for(let s of zp.Children.toArray(t))!II(s)||s.type!==X1||n++;let i=String(n).length;return zp.createElement(gte,{...r.list()},zp.Children.map(t,(s,o)=>{if(!II(s)||s.type!==X1)return s;let u=`${String(o+1).padStart(i)}.`,a=`${e}${u}`;return zp.createElement(pE.Provider,{value:{marker:a}},zp.createElement(K1.Provider,{value:{marker:a}},s))}))}xte.Item=X1;import Ete from"react";import{Text as Cte}from"ink";import{useReducer as bte,useCallback as Kp,useEffect as vte}from"react";var Dte=(t,e)=>{switch(e.type){case"move-cursor-left":return{...t,cursorOffset:Math.max(0,t.cursorOffset-1)};case"move-cursor-right":return{...t,cursorOffset:Math.min(t.value.length,t.cursorOffset+1)};case"insert":return{...t,previousValue:t.value,value:t.value.slice(0,t.cursorOffset)+e.text+t.value.slice(t.cursorOffset),cursorOffset:t.cursorOffset+e.text.length};case"delete":{let r=Math.max(0,t.cursorOffset-1);return{...t,previousValue:t.value,value:t.value.slice(0,r)+t.value.slice(r+1),cursorOffset:r}}}},LI=({onChange:t,onSubmit:e})=>{let[r,n]=bte(Dte,{previousValue:"",value:"",cursorOffset:0}),i=Kp(()=>{n({type:"move-cursor-left"})},[]),s=Kp(()=>{n({type:"move-cursor-right"})},[]),o=Kp(c=>{n({type:"insert",text:c})},[]),u=Kp(()=>{n({type:"delete"})},[]),a=Kp(()=>{e?.(r.value)},[r.value,e]);return vte(()=>{r.value!==r.previousValue&&t?.(r.value)},[r.previousValue,r.value,t]),{...r,moveCursorLeft:i,moveCursorRight:s,insert:o,delete:u,submit:a}};import{useMemo as FI}from"react";import{useInput as Ste}from"ink";var hE=Et.inverse(" "),PI=({isDisabled:t=!1,state:e,placeholder:r=""})=>{let n=FI(()=>t?r?Et.dim(r):"":r&&r.length>0?Et.inverse(r[0])+Et.dim(r.slice(1)):hE,[t,r]),i=FI(()=>{let s="*".repeat(e.value.length);if(t)return s;let o=0,u=s.length>0?"":hE;for(let a of s)u+=o===e.cursorOffset?Et.inverse(a):a,o++;return s.length>0&&e.cursorOffset===s.length&&(u+=hE),u},[t,e.value,e.cursorOffset]);return Ste((s,o)=>{if(!(o.upArrow||o.downArrow||o.ctrl&&s==="c"||o.tab||o.shift&&o.tab)){if(o.return){e.submit();return}o.leftArrow?e.moveCursorLeft():o.rightArrow?e.moveCursorRight():o.backspace||o.delete?e.delete():e.insert(s)}},{isActive:!t}),{inputValue:e.value.length>0?i:n}};function NI({isDisabled:t=!1,placeholder:e="",onChange:r,onSubmit:n}){let i=LI({onChange:r,onSubmit:n}),{inputValue:s}=PI({isDisabled:t,placeholder:e,state:i}),{styles:o}=Rt("PasswordInput");return Ete.createElement(Cte,{...o.value()},s)}import hTe from"react";import{Box as gTe,Text as yTe}from"ink";import ETe from"react";import{Box as wTe,Text as _Te}from"ink";import zTe from"react";import{Text as XTe}from"ink";import{useReducer as FTe,useCallback as PTe,useEffect as NTe,useMemo as RTe}from"react";import{useMemo as BTe}from"react";import{useInput as VTe}from"ink";var qTe=Et.inverse(" ");import RI,{useContext as wte}from"react";var Mo=t=>{let{lite:e}=wte(ut),r=t.yesLabel||"Yes",n=t.noLabel||"No",i=[{label:r,value:"yes"},{label:n,value:"no"}],s=u=>{let a=u==="yes";t.onChange?.(a)},o=t.default==="no"?i.reverse():i;return e?RI.createElement(rI,{onConfirm:()=>s("yes"),onCancel:()=>s("no"),defaultChoice:t.default==="yes"?"confirm":"cancel"}):RI.createElement(_u,{options:o,onChange:u=>s(u)})};async function Si(t=500){let e=(await Promise.resolve().then(()=>(BI(),MI))).default;return e(t)}var VI=({packageName:t,handlePromptDecision:e})=>{let{exit:r}=_te(),[n,i]=Ta.useState(!1);return Ta.createElement(jI,{flexDirection:"column",paddingX:2,borderStyle:"round",borderColor:"yellow",width:80},Ta.createElement(mE,null,Ta.createElement(Ke,{color:"greenBright"},"? "),"You're using an older version of our CLI. Would you like to update?"),Ta.createElement(Mo,{default:"yes",yesLabel:"Yes (Recommended to access the latest templates)",noLabel:"No (Some features, such as app templates, may be outdated)",onChange:async o=>{o&&(i(!0),await Si(),r()),e(o)}}),n&&Ta.createElement(jI,{marginTop:1},Ta.createElement(mE,null,"Run ",Ta.createElement(mE,{bold:!0},"npm i -g ",t,"@latest")," to update.")))};import{Text as Ate}from"ink";import*as Xp from"react";var pn=t=>{let{lite:e}=Xp.useContext(ut);return e?Xp.createElement(Ate,null,t.label):Xp.createElement(pI,{type:"bouncingBall",...t})};import UI from"react";var Y1=class extends UI.Component{state={isCrashed:!1,message:void 0};static getDerivedStateFromError(e){return{isCrashed:!0,message:e.message}}render(){return this.state.isCrashed?UI.createElement(X,{variant:"error"},this.state.message??"Sorry, a problem occurred"):this.props.children}componentDidCatch(e){this.setState({isCrashed:!0,message:e.message})}componentDidMount(){process.setUncaughtExceptionCaptureCallback(this.crashed)}componentWillUnmount(){process.setUncaughtExceptionCaptureCallback(null)}crashed=e=>{this.setState({isCrashed:!0,message:e.message}),process.exitCode=1}};var GI=({pkg:t,getUpdateInfo:e,border:r="regular",children:n,shouldPromptUpdate:i=!1,Logo:s})=>{let{lite:o}=Tte(ut),[u,a]=J1(!0),[c,l]=J1(),[f,d]=J1(null),[p,h]=J1(!1);Ote(()=>{(async()=>{let y=await e();y.success?d(y.data.latest):h(!0),a(!1)})()},[t]);let g=m=>{l(m?"agreed":"disagreed")};return u?Au.createElement(pn,{type:"bouncingBall",label:"Loading..."}):i&&f&&f!==t.version&&!c?Au.createElement(VI,{packageName:t.name,handlePromptDecision:g}):Au.createElement(qI,{borderColor:r==="regular"&&!o?q1:void 0,borderStyle:r==="regular"&&!o?"round":void 0,margin:r==="regular"&&!o?2:void 0,flexDirection:"column"},s&&Au.createElement(qI,{flexDirection:"row",paddingY:1},Au.createElement($I,null),Au.createElement(s,null),Au.createElement($I,null)),Au.createElement(Y1,null,!p&&Au.createElement(R5,{name:t.name,currentVersion:t.version,latestVersion:f}),n))};var g0={name:"@canva/cli",version:"0.0.1-beta.26",description:"The official Canva CLI.",license:"SEE LICENSE IN LICENSE.md",author:"Canva Pty Ltd.",type:"module",main:"./lib/cjs/index.cjs",module:"./lib/esm/index.mjs",exports:{".":{require:"./lib/cjs/index.cjs",import:"./lib/esm/index.mjs"}},bin:{canva:"./dist/cli.js"},files:["templates","cli.js","LICENSE.md","README.md","lib"],scripts:{"//0":"The following scripts must be run from the root directory of cli/canva-cli",build:"npm run compile && npm run build:patch && npm run build:patch && npm run build:library","build:patch":"npm run build:docs && npm run build:templates && npm run build:meta && npm run build:patch:code","build:patch:code":"node ./build/patch.mjs ./dist/cli.js","build:docs":"cp README.md LICENSE.md dist","build:templates":"node ./build/templates.mjs ./templates dist/templates","build:meta":"node ./build/package_json.mjs ./package.json dist/package.json canva","build:library":"node ./build/library.mjs",compile:"rm -rf dist && node ./build/build.mjs","prepare:release":"cd ../.. && npm run build:package:beta cli/canva-cli","lint:types:watch":"tsc --watch","lint:types":"tsc",lint:"eslint .","lint:fix":"eslint . --fix","test:unit":"jest --no-cache","test:unit:watch":"jest --watchAll","test:unit:ci":"jest --ci --collectCoverage","prebuild:ava":"tsc && tsc-alias","test:feature":"npm run prebuild:ava && ava src/**/*.feature.*","test:feature:specific":"npm run prebuild:ava && ava","test:feature:watch":"npm run test:feature -- --watch","test:feature:ci":"npm run prebuild:ava && ava src/**/*.feature.*","test:feature:update-snapshots":"npm run test:feature -- --u",format:"prettier ./ --no-config --write","format:check":"prettier ./ --no-config --check",start:"npm run build && node ./dist/cli.js","readme:check":"node ./bin/readme_check.mjs",dev:"ENV=dev npm run start",staging:"ENV=staging npm run start",prod:"ENV=prod npm run start",link:"npm run build && npm link && chmod +x ./dist/cli.js"},dependencies:{"@canva/app-ui-kit":"^4.9.0","@inkjs/ui":"2.0.0","@modelcontextprotocol/sdk":"1.8.0","@t3-oss/env-core":"0.11.1",clipboardy:"4.0.0",ink:"5.1.0","ink-gradient":"3.0.0",jose:"5.9.6",linkedom:"0.18.9",mobx:"6.13.3","mobx-react":"9.1.1",open:"10.1.0",react:"18.3.1",semver:"7.6.3",systeminformation:"5.25.11","terminal-link":"3.0.0","update-notifier":"7.3.1",yargs:"17.7.2",zod:"3.24.1"},devDependencies:{"@ava/typescript":"5.0.0","@eslint/js":"9.23.0","@jest/globals":"29.7.0","@tsconfig/node20":"20.1.4","@types/jest":"29.5.14","@types/react":"18.3.12","@types/semver":"7.5.8","@types/update-notifier":"6.0.8","@typescript-eslint/eslint-plugin":"8.27.0","@typescript-eslint/parser":"8.27.0",ava:"6.2.0",esbuild:"0.25.0",eslint:"9.23.0","eslint-plugin-ava":"15.0.1","eslint-plugin-jest":"28.11.0","eslint-plugin-react":"7.37.4","eslint-plugin-unicorn":"57.0.0","ink-testing-library":"4.0.0",jest:"29.7.0",prettier:"3.4.2","react-dom":"18.3.1",testdouble:"3.20.2","ts-jest":"29.2.5","ts-jest-mock-import-meta":"1.2.1","ts-node":"10.9.2","tsc-alias":"1.8.10",typescript:"5.5.4","typescript-eslint":"8.27.0"},keywords:["apps sdk","canva","cli","starter kit"],engines:{node:">=16"}};import Gs from"react";import{Text as qL,Newline as ure}from"ink";var Bo=nt(ZI(),1),PE=nt(jL(),1);import sre from"react";import{Transform as ore}from"ink";function LE({onlyFirst:t=!1}={}){let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}var ire=LE();function FE(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(ire,"")}var VL=t=>{if(t.name&&t.colors)throw new Error("The `name` and `colors` props are mutually exclusive");let e;if(t.name)e=PE.default[t.name];else if(t.colors)e=(0,PE.default)(t.colors);else throw new Error("Either `name` or `colors` prop must be provided");let r=n=>e.multiline(FE(n));return sre.createElement(ore,{transform:r},t.children)};VL.propTypes={children:Bo.default.oneOfType([Bo.default.arrayOf(Bo.default.node),Bo.default.node]).isRequired,name:Bo.default.oneOf(["cristal","teen","mind","morning","vice","passion","fruit","instagram","atlas","retro","summer","pastel","rainbow"]),colors:Bo.default.arrayOf(Bo.default.oneOfType([Bo.default.string,Bo.default.object]))};var UL=VL;var are=`
|
|
437
437
|
\u2584\u259F\u2580\u2580\u2580\u2584
|
|
438
438
|
|
|
439
439
|
\u2588\u259B \u259D\u2598 \u2584\u2584\u2596\u2584 \u2584 \u2584\u2584 \u2584 \u2597\u2580\u2596 \u2584\u2584\u2596\u2584
|
package/package.json
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
7
7
|
"author": "Canva Pty Ltd.",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@canva/app-ui-kit": "^4.
|
|
9
|
+
"@canva/app-ui-kit": "^4.9.0",
|
|
10
10
|
"@canva/asset": "^2.2.0",
|
|
11
|
-
"@canva/design": "^2.4.
|
|
11
|
+
"@canva/design": "^2.4.1",
|
|
12
12
|
"@canva/error": "^2.1.0",
|
|
13
13
|
"@canva/platform": "^2.1.0",
|
|
14
14
|
"@canva/user": "^2.1.0",
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
"postinstall": "ts-node ./scripts/copy_env.ts"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@canva/app-components": "^1.
|
|
21
|
+
"@canva/app-components": "^1.3.0",
|
|
22
22
|
"@canva/app-i18n-kit": "^1.0.2",
|
|
23
|
-
"@canva/app-ui-kit": "^4.
|
|
23
|
+
"@canva/app-ui-kit": "^4.9.0",
|
|
24
24
|
"@canva/asset": "^2.2.0",
|
|
25
|
-
"@canva/design": "^2.4.
|
|
25
|
+
"@canva/design": "^2.4.1",
|
|
26
26
|
"@canva/error": "^2.1.0",
|
|
27
27
|
"@canva/platform": "^2.1.0",
|
|
28
28
|
"@canva/user": "^2.1.0",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"react-intl": "6.8.7"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@canva/cli": ">= 0.0.1-beta.13 < 0.0.2",
|
|
37
36
|
"@canva/app-eslint-plugin": "^1.0.0-beta.3",
|
|
37
|
+
"@canva/cli": ">= 0.0.1-beta.13 < 0.0.2",
|
|
38
38
|
"@formatjs/cli": "6.3.15",
|
|
39
39
|
"@formatjs/ts-transformer": "3.13.27",
|
|
40
40
|
"@ngrok/ngrok": "1.4.1",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@canva/app-i18n-kit": "^1.0.2",
|
|
22
|
-
"@canva/app-ui-kit": "^4.
|
|
22
|
+
"@canva/app-ui-kit": "^4.9.0",
|
|
23
23
|
"@canva/asset": "^2.2.0",
|
|
24
|
-
"@canva/design": "^2.4.
|
|
24
|
+
"@canva/design": "^2.4.1",
|
|
25
25
|
"@canva/error": "^2.1.0",
|
|
26
26
|
"@canva/platform": "^2.1.0",
|
|
27
27
|
"@canva/user": "^2.1.0",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"react-router-dom": "6.28.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@canva/cli": ">= 0.0.1-beta.13 < 0.0.2",
|
|
40
39
|
"@canva/app-eslint-plugin": "^1.0.0-beta.3",
|
|
40
|
+
"@canva/cli": ">= 0.0.1-beta.13 < 0.0.2",
|
|
41
41
|
"@formatjs/cli": "6.3.15",
|
|
42
42
|
"@formatjs/ts-transformer": "3.13.27",
|
|
43
43
|
"@ngrok/ngrok": "1.4.1",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@canva/app-i18n-kit": "^1.0.2",
|
|
23
|
-
"@canva/app-ui-kit": "^4.
|
|
23
|
+
"@canva/app-ui-kit": "^4.9.0",
|
|
24
24
|
"@canva/asset": "^2.2.0",
|
|
25
|
-
"@canva/design": "^2.4.
|
|
25
|
+
"@canva/design": "^2.4.1",
|
|
26
26
|
"@canva/error": "^2.1.0",
|
|
27
27
|
"@canva/platform": "^2.1.0",
|
|
28
28
|
"@canva/user": "^2.1.0",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"react-intl": "6.8.7"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@canva/cli": ">= 0.0.1-beta.13 < 0.0.2",
|
|
35
34
|
"@canva/app-eslint-plugin": "^1.0.0-beta.3",
|
|
35
|
+
"@canva/cli": ">= 0.0.1-beta.13 < 0.0.2",
|
|
36
36
|
"@formatjs/cli": "6.3.15",
|
|
37
37
|
"@formatjs/ts-transformer": "3.13.27",
|
|
38
38
|
"@ngrok/ngrok": "1.4.1",
|