@uniformdev/cli 12.2.1-alpha.58 → 13.0.1-alpha.73

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.
Files changed (2) hide show
  1. package/dist/index.mjs +2 -2
  2. package/package.json +10 -10
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- var l=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(o,n)=>(typeof require!="undefined"?require:o)[n]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});import M from"yargs";import I from"yargs";import g from"yargs";import t from"chalk";import{writeFile as C}from"fs";import b from"node-fetch";import{exit as a}from"process";var u="https://uniform.app";var v={command:"download [output]",describe:"Download intent manifest",builder:e=>{var o;return e.option("apiKey",{alias:"k",demandOption:!0,string:!0,default:process.env.UNIFORM_API_KEY,describe:"Uniform API key to use. Defaults to UNIFORM_API_KEY env if set."}).option("project",{describe:"Uniform project ID. Defaults to UOPT_CLI_PROJECT_ID or UNIFORM_PROJECT_ID env. Supports dotenv.",default:(o=process.env.UOPT_CLI_PROJECT_ID)!=null?o:process.env.UNIFORM_PROJECT_ID,type:"string",alias:["p"]}).option("preview",{describe:"If set, fetches the unpublished preview manifest (assuming your API key has permission)",default:!1,type:"boolean",alias:["d"]}).option("output",{string:!0,alias:"o",default:process.env.UNIFORM_MANIFEST_PATH,describe:"Path to write manifest to. Defaults to UNIFORM_MANIFEST_PATH env if set."})},handler:async({apiKey:e,output:o,project:n,preview:m})=>{/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test(e)?console.error(t.yellow("WARNING: you appear to be using a deprecated type of API key. Keys like this will stop working soon; please create new keys on uniform.app.")):n||(console.error(t.red("You must specify the project ID")),a(1));let U=P(),d=new URLSearchParams;n&&d.set("projectId",n),m&&d.set("preview","true");let i=`${U}api/v1/manifest?${d.toString()}`,r;try{if(r=await b(i,{headers:{"x-api-key":e}}),!r.ok)throw r.status===403?`The API key ${e} had no published data. This means it is either incorrectly entered, or intents have not been published since creating the API key.`:`${r.status} ${r.statusText}, content ${await r.text()}`}catch(s){console.error(t.red(`\u26A0 Error fetching intent manifest ${i}`)),console.error(t.gray(` \u2757 ${s}`)),a(1)}let f;try{f=await r.json()}catch(s){console.error(t.red(t.red(`\u26A0 Error parsing intent manifest ${i}`))),console.error(t.gray(` \u2757 ${s}`)),console.error(`Response: ${await r.text()}`),a(1)}let p=JSON.stringify(f,null,2);o?C(o,p,s=>{s&&(console.error(`Error writing file to ${o}
3
- `,s),a(1)),console.log(t.green(`\u2705 ${o} has been updated from ${i}`))}):console.log(p)}},P=()=>{let e=process.env.UNIFORM_CLI_BASE_URL||u;return e.endsWith("/")||(e+="/"),e},y=v;var _={command:"manifest <command>",describe:"Intent manifest commands",builder:()=>g.command(y),handler:()=>g.showHelp()},h=_;var A={command:"optimize <command>",aliases:["opt"],describe:"Uniform Optimize commands",builder:()=>I.command(h),handler:()=>I.showHelp()},w=A;l("dotenv").config();var O=["@uniformdev/canvas/cli"],c=M.scriptName("uniform");O.flatMap(e=>{try{let o=l(e).uniformCLI.commands;(Array.isArray(o)?o:[]).forEach(m=>{c=c.command(m)})}catch{}});c.command(w).demandCommand(1,"").strict().help().argv;
2
+ var f=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(o,n)=>(typeof require!="undefined"?require:o)[n]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});import R from"yargs";import U from"yargs";import I from"yargs";import t from"chalk";import{writeFile as v}from"fs";import P from"node-fetch";import{exit as d}from"process";var g="https://uniform.app";var _={command:"download [output]",describe:"Download intent manifest",builder:e=>{var o;return e.option("apiKey",{alias:"k",demandOption:!0,string:!0,default:process.env.UNIFORM_API_KEY,describe:"Uniform API key to use. Defaults to UNIFORM_API_KEY env if set."}).option("project",{describe:"Uniform project ID. Defaults to UOPT_CLI_PROJECT_ID or UNIFORM_PROJECT_ID env. Supports dotenv.",default:(o=process.env.UOPT_CLI_PROJECT_ID)!=null?o:process.env.UNIFORM_PROJECT_ID,type:"string",alias:["p"]}).option("preview",{describe:"If set, fetches the unpublished preview manifest (assuming your API key has permission)",default:!1,type:"boolean",alias:["d"]}).option("output",{string:!0,alias:"o",default:process.env.UNIFORM_MANIFEST_PATH,describe:"Path to write manifest to. Defaults to UNIFORM_MANIFEST_PATH env if set."})},handler:async({apiKey:e,output:o,project:n,preview:l})=>{/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test(e)?console.error(t.yellow("WARNING: you appear to be using a deprecated type of API key. Keys like this will stop working soon; please create new keys on uniform.app.")):n||(console.error(t.red("You must specify the project ID")),d(1));let b=A(),c=new URLSearchParams;n&&c.set("projectId",n),l&&c.set("preview","true");let i=`${b}api/v1/manifest?${c.toString()}`,r;try{if(r=await P(i,{headers:{"x-api-key":e}}),!r.ok)throw r.status===403?`The API key ${e} had no published data. This means it is either incorrectly entered, or intents have not been published since creating the API key.`:`${r.status} ${r.statusText}, content ${await r.text()}`}catch(s){console.error(t.red(`\u26A0 Error fetching intent manifest ${i}`)),console.error(t.gray(` \u2757 ${s}`)),d(1)}let u;try{u=await r.json()}catch(s){console.error(t.red(t.red(`\u26A0 Error parsing intent manifest ${i}`))),console.error(t.gray(` \u2757 ${s}`)),console.error(`Response: ${await r.text()}`),d(1)}let y=JSON.stringify(u,null,2);o?v(o,y,s=>{s&&(console.error(`Error writing file to ${o}
3
+ `,s),d(1)),console.log(t.green(`\u2705 ${o} has been updated from ${i}`))}):console.log(y)}},A=()=>{let e=process.env.UNIFORM_CLI_BASE_URL||g;return e.endsWith("/")||(e+="/"),e},h=_;var M={command:"manifest <command>",describe:"Intent manifest commands",builder:()=>I.command(h),handler:()=>I.showHelp()},w=M;var O={command:"optimize <command>",aliases:["opt"],describe:"Uniform Optimize commands",builder:()=>U.command(w),handler:()=>U.showHelp()},C=O;f("dotenv").config();var T=["@uniformdev/canvas/cli"],p=R.scriptName("uniform");T.flatMap(e=>{try{let o=f(e).uniformCLI.commands;(Array.isArray(o)?o:[]).forEach(l=>{p=p.command(l)})}catch{}});p.command(C).demandCommand(1,"").strict().help().argv;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/cli",
3
- "version": "12.2.1-alpha.58+8276bc93",
3
+ "version": "13.0.1-alpha.73+bb24cffe",
4
4
  "description": "Uniform command line interface tool",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./cli.js",
@@ -20,22 +20,22 @@
20
20
  "dependencies": {
21
21
  "chalk": "^4.1.2",
22
22
  "dotenv": "^10.0.0",
23
- "node-fetch": "^2.6.1",
24
- "yargs": "^17.1.1"
23
+ "node-fetch": "^2.6.6",
24
+ "yargs": "^17.3.0"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/jest": "27.0.3",
28
- "@types/node": "16.7.1",
28
+ "@types/node": "16.11.12",
29
29
  "@types/node-fetch": "2.5.12",
30
- "@types/yargs": "17.0.5",
31
- "eslint": "7.32.0",
30
+ "@types/yargs": "17.0.7",
31
+ "eslint": "8.4.1",
32
32
  "eslint-plugin-react": "7.27.1",
33
33
  "eslint-plugin-react-hooks": "4.3.0",
34
- "jest": "27.3.1",
34
+ "jest": "27.4.4",
35
35
  "npm-run-all": "4.1.5",
36
36
  "rimraf": "3.0.2",
37
- "ts-jest": "27.0.7",
38
- "tsup": "5.7.2"
37
+ "ts-jest": "27.1.1",
38
+ "tsup": "5.11.1"
39
39
  },
40
40
  "bin": {
41
41
  "uniform": "./cli.js"
@@ -46,5 +46,5 @@
46
46
  "publishConfig": {
47
47
  "access": "public"
48
48
  },
49
- "gitHead": "8276bc9379b344eadfcb6e175e415f0ab0d93689"
49
+ "gitHead": "bb24cffed409f57c9b1b3fe0ece2313d8279f566"
50
50
  }