@uniformdev/cli 12.0.1-alpha.98 → 12.2.1-alpha.122
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/LICENSE.txt +1 -1
- package/README.md +3 -3
- package/dist/index.d.ts +8 -1
- package/dist/index.js +2 -1
- package/dist/index.mjs +3 -0
- package/package.json +17 -16
- package/dist/UniformCLIPlugin.d.ts +0 -5
- package/dist/UniformCLIPlugin.js +0 -1
- package/dist/commands/optimize/manifest/download.d.ts +0 -9
- package/dist/commands/optimize/manifest/download.js +0 -1
- package/dist/commands/optimize/manifest.d.ts +0 -3
- package/dist/commands/optimize/manifest.js +0 -1
- package/dist/commands/optimize.d.ts +0 -3
- package/dist/commands/optimize.js +0 -1
- package/dist/constants.d.ts +0 -1
- package/dist/constants.js +0 -1
package/LICENSE.txt
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
© 2021 Uniform Systems, Inc. All Rights Reserved.
|
|
1
|
+
© 2021 Uniform Systems, Inc. All Rights Reserved.
|
|
2
2
|
See details of Uniform Systems, Inc. Master Subscription Agreement here: https://uniform.dev/eula
|
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
Uniform command line interface tool.
|
|
2
|
-
|
|
3
|
-
part of the [Uniform Platform](https://uniform.app). See our [documentation](https://docs.uniform.app) for more details.
|
|
1
|
+
Uniform command line interface tool.
|
|
2
|
+
|
|
3
|
+
part of the [Uniform Platform](https://uniform.app). See our [documentation](https://docs.uniform.app) for more details.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
import { CommandModule } from 'yargs';
|
|
3
|
+
|
|
4
|
+
/** Export this type as `uniformCLI` from a package to define a Uniform CLI plugin. The plugin must be known to the CLI as well. */
|
|
5
|
+
declare type UniformCLIPlugin = {
|
|
6
|
+
commands: Array<CommandModule>;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export { UniformCLIPlugin };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
var R=Object.create;var f=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var w=e=>f(e,"__esModule",{value:!0});var U=(e,o,r,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of $(o))!x.call(e,i)&&(r||i!=="default")&&f(e,i,{get:()=>o[i],enumerable:!(s=T(o,i))||s.enumerable});return e},m=(e,o)=>U(w(f(e!=null?R(k(e)):{},"default",!o&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),D=(e=>(o,r)=>e&&e.get(o)||(r=U(w({}),o,1),e&&e.set(o,r),r))(typeof WeakMap!="undefined"?new WeakMap:0);var j={};var O=m(require("yargs"));var y=m(require("yargs"));var u=m(require("yargs"));var t=m(require("chalk")),v=require("fs"),C=m(require("node-fetch")),d=require("process");var b="https://uniform.app";var E={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:r,preview:s})=>{/^(?:[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.default.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.")):r||(console.error(t.default.red("You must specify the project ID")),(0,d.exit)(1));let P=N(),p=new URLSearchParams;r&&p.set("projectId",r),s&&p.set("preview","true");let l=`${P}api/v1/manifest?${p.toString()}`,n;try{if(n=await(0,C.default)(l,{headers:{"x-api-key":e}}),!n.ok)throw n.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.`:`${n.status} ${n.statusText}, content ${await n.text()}`}catch(a){console.error(t.default.red(`\u26A0 Error fetching intent manifest ${l}`)),console.error(t.default.gray(` \u2757 ${a}`)),(0,d.exit)(1)}let g;try{g=await n.json()}catch(a){console.error(t.default.red(t.default.red(`\u26A0 Error parsing intent manifest ${l}`))),console.error(t.default.gray(` \u2757 ${a}`)),console.error(`Response: ${await n.text()}`),(0,d.exit)(1)}let I=JSON.stringify(g,null,2);o?(0,v.writeFile)(o,I,a=>{a&&(console.error(`Error writing file to ${o}
|
|
3
|
+
`,a),(0,d.exit)(1)),console.log(t.default.green(`\u2705 ${o} has been updated from ${l}`))}):console.log(I)}},N=()=>{let e=process.env.UNIFORM_CLI_BASE_URL||b;return e.endsWith("/")||(e+="/"),e},_=E;var F={command:"manifest <command>",describe:"Intent manifest commands",builder:()=>u.default.command(_),handler:()=>u.default.showHelp()},A=F;var L={command:"optimize <command>",aliases:["opt"],describe:"Uniform Optimize commands",builder:()=>y.default.command(A),handler:()=>y.default.showHelp()},M=L;require("dotenv").config();var S=["@uniformdev/canvas/cli","@uniformdev/context/cli"],h=O.default.scriptName("uniform");S.flatMap(e=>{try{let o=require(e).uniformCLI.commands;(Array.isArray(o)?o:[]).forEach(s=>{h=h.command(s)})}catch{}});h.command(M).demandCommand(1,"").strict().help().argv;module.exports=D(j);
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var p=(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 C}from"fs";import _ from"node-fetch";import{exit as d}from"process";var h="https://uniform.app";var A={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 v=M(),c=new URLSearchParams;n&&c.set("projectId",n),l&&c.set("preview","true");let i=`${v}api/v1/manifest?${c.toString()}`,r;try{if(r=await _(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?C(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)}},M=()=>{let e=process.env.UNIFORM_CLI_BASE_URL||h;return e.endsWith("/")||(e+="/"),e},g=A;var O={command:"manifest <command>",describe:"Intent manifest commands",builder:()=>I.command(g),handler:()=>I.showHelp()},w=O;var P={command:"optimize <command>",aliases:["opt"],describe:"Uniform Optimize commands",builder:()=>U.command(w),handler:()=>U.showHelp()},b=P;p("dotenv").config();var T=["@uniformdev/canvas/cli","@uniformdev/context/cli"],f=R.scriptName("uniform");T.flatMap(e=>{try{let o=p(e).uniformCLI.commands;(Array.isArray(o)?o:[]).forEach(l=>{f=f.command(l)})}catch{}});f.command(b).demandCommand(1,"").strict().help().argv;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/cli",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.2.1-alpha.122+78b1fc2b",
|
|
4
4
|
"description": "Uniform command line interface tool",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./cli.js",
|
|
@@ -8,33 +8,34 @@
|
|
|
8
8
|
"sideEffects": false,
|
|
9
9
|
"scripts": {
|
|
10
10
|
"uniform": "uniform",
|
|
11
|
-
"build": "
|
|
12
|
-
"dev": "
|
|
11
|
+
"build": "tsup",
|
|
12
|
+
"dev": "tsup --watch",
|
|
13
13
|
"clean": "rimraf dist",
|
|
14
14
|
"test": "jest --maxWorkers=1 --passWithNoTests",
|
|
15
15
|
"lint": "eslint \"src/**/*.{js,ts,tsx}\"",
|
|
16
16
|
"format": "prettier --write \"src/**/*.{js,ts,tsx}\"",
|
|
17
17
|
"ci:verify": "run-p lint test",
|
|
18
|
-
"ci:build": "
|
|
18
|
+
"ci:build": "tsup --minify --clean"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"chalk": "^4.1.2",
|
|
22
|
-
"dotenv": "^
|
|
23
|
-
"node-fetch": "^2.6.
|
|
24
|
-
"yargs": "
|
|
22
|
+
"dotenv": "^11.0.0",
|
|
23
|
+
"node-fetch": "^2.6.6",
|
|
24
|
+
"yargs": "17.3.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@types/jest": "27.0
|
|
28
|
-
"@types/node": "16.
|
|
27
|
+
"@types/jest": "27.4.0",
|
|
28
|
+
"@types/node": "16.11.19",
|
|
29
29
|
"@types/node-fetch": "2.5.12",
|
|
30
|
-
"@types/yargs": "17.0.
|
|
31
|
-
"eslint": "
|
|
32
|
-
"eslint-plugin-react": "7.
|
|
33
|
-
"eslint-plugin-react-hooks": "4.
|
|
34
|
-
"jest": "27.
|
|
30
|
+
"@types/yargs": "17.0.8",
|
|
31
|
+
"eslint": "8.6.0",
|
|
32
|
+
"eslint-plugin-react": "7.28.0",
|
|
33
|
+
"eslint-plugin-react-hooks": "4.3.0",
|
|
34
|
+
"jest": "27.4.7",
|
|
35
35
|
"npm-run-all": "4.1.5",
|
|
36
36
|
"rimraf": "3.0.2",
|
|
37
|
-
"ts-jest": "27.
|
|
37
|
+
"ts-jest": "27.1.2",
|
|
38
|
+
"tsup": "5.11.11"
|
|
38
39
|
},
|
|
39
40
|
"bin": {
|
|
40
41
|
"uniform": "./cli.js"
|
|
@@ -45,5 +46,5 @@
|
|
|
45
46
|
"publishConfig": {
|
|
46
47
|
"access": "public"
|
|
47
48
|
},
|
|
48
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "78b1fc2b13464a32c3d1256c1d98ca2a7f59fd34"
|
|
49
50
|
}
|
package/dist/UniformCLIPlugin.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var __awaiter=this&&this.__awaiter||function(e,a,i,u){return new(i=i||Promise)(function(r,t){function n(e){try{s(u.next(e))}catch(e){t(e)}}function o(e){try{s(u.throw(e))}catch(e){t(e)}}function s(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i(function(e){e(t)})).then(n,o)}s((u=u.apply(e,a||[])).next())})},__generator=this&&this.__generator||function(r,n){var o,s,a,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(o)throw new TypeError("Generator is already executing.");for(;i;)try{if(o=1,s&&(a=2&t[0]?s.return:t[0]?s.throw||((a=s.return)&&a.call(s),0):s.next)&&!(a=a.call(s,t[1])).done)return a;switch(s=0,(t=a?[2&t[0],a.value]:t)[0]){case 0:case 1:a=t;break;case 4:return i.label++,{value:t[1],done:!1};case 5:i.label++,s=t[1],t=[0];continue;case 7:t=i.ops.pop(),i.trys.pop();continue;default:if(!(a=0<(a=i.trys).length&&a[a.length-1])&&(6===t[0]||2===t[0])){i=0;continue}if(3===t[0]&&(!a||t[1]>a[0]&&t[1]<a[3])){i.label=t[1];break}if(6===t[0]&&i.label<a[1]){i.label=a[1],a=t;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(t);break}a[2]&&i.ops.pop(),i.trys.pop();continue}t=n.call(r,i)}catch(e){t=[6,e],s=0}finally{o=a=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});var chalk_1=__importDefault(require("chalk")),fs_1=require("fs"),node_fetch_1=__importDefault(require("node-fetch")),process_1=require("process"),constants_1=require("../../../constants"),module={command:"download [output]",describe:"Download intent manifest",builder:function(e){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:null!==(e=process.env.UOPT_CLI_PROJECT_ID)&&void 0!==e?e: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:function(e){var c=e.apiKey,f=e.output,p=e.project,d=e.preview;return __awaiter(void 0,void 0,void 0,function(){var t,r,n,o,s,a,i,u,l;return __generator(this,function(e){switch(e.label){case 0:/^(?:[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(c)?console.error(chalk_1.default.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.")):p||(console.error(chalk_1.default.red("You must specify the project ID")),(0,process_1.exit)(1)),r=resolveBaseUrl(),o=new URLSearchParams,p&&o.set("projectId",p),d&&o.set("preview","true"),t=r+"api/v1/manifest?"+o.toString(),r=void 0,e.label=1;case 1:return e.trys.push([1,5,,6]),[4,(0,node_fetch_1.default)(t,{headers:{"x-api-key":c}})];case 2:if((r=e.sent()).ok)return[3,4];if(403===r.status)throw"The API key "+c+" had no published data. This means it is either incorrectly entered, or intents have not been published since creating the API key.";return n=r.status+" "+r.statusText+", content ",[4,r.text()];case 3:throw n+e.sent();case 4:return[3,6];case 5:return o=e.sent(),console.error(chalk_1.default.red("⚠ Error fetching intent manifest "+t)),console.error(chalk_1.default.gray(" ❗ "+o)),(0,process_1.exit)(1),[3,6];case 6:return e.trys.push([6,8,,10]),[4,r.json()];case 7:return s=e.sent(),[3,10];case 8:return l=e.sent(),console.error(chalk_1.default.red(chalk_1.default.red("⚠ Error parsing intent manifest "+t))),console.error(chalk_1.default.gray(" ❗ "+l)),i=(a=console).error,u="Response: ",[4,r.text()];case 9:return i.apply(a,[u+e.sent()]),(0,process_1.exit)(1),[3,10];case 10:return l=JSON.stringify(s,null,2),f?(0,fs_1.writeFile)(f,l,function(e){e&&(console.error("Error writing file to "+f+"\n",e),(0,process_1.exit)(1)),console.log(chalk_1.default.green("✅ "+f+" has been updated from "+t))}):console.log(l),[2]}})})}},resolveBaseUrl=function(){var e=process.env.UNIFORM_CLI_BASE_URL||constants_1.UniformBaseUrl;return e.endsWith("/")||(e+="/"),e};exports.default=module;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});var yargs_1=__importDefault(require("yargs")),download_1=__importDefault(require("./manifest/download")),module={command:"manifest <command>",describe:"Intent manifest commands",builder:function(){return yargs_1.default.command(download_1.default)},handler:function(){return yargs_1.default.showHelp()}};exports.default=module;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});var yargs_1=__importDefault(require("yargs")),manifest_1=__importDefault(require("./optimize/manifest")),command={command:"optimize <command>",aliases:["opt"],describe:"Uniform Optimize commands",builder:function(){return yargs_1.default.command(manifest_1.default)},handler:function(){return yargs_1.default.showHelp()}};exports.default=command;
|
package/dist/constants.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const UniformBaseUrl = "https://uniform.app";
|
package/dist/constants.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.UniformBaseUrl=void 0,exports.UniformBaseUrl="https://uniform.app";
|