@fugood/bricks-cli 2.25.9 → 2.25.11

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 CHANGED
@@ -217,7 +217,13 @@ bricks app bind <app-id> [-b device-ids] [-u device-ids]
217
217
  bricks app bind <app-id> [-b device-ids] [-u device-ids] [--dry-run] [-j|--json]
218
218
 
219
219
  # Trigger automation
220
- bricks app trigger <app-id> <test-id> [--play|--stop] [--setup-at-launch]
220
+ bricks app trigger <app-id> <test-id> [--play|--stop] [--setup-at-launch] [-g match-group]
221
+
222
+ # Application Control pages (Runtime Editor, Canvas Control, Device Control):
223
+ # issue a page token and print the URL of each page (needs an OAuth login: `bricks auth login`);
224
+ # --no-token prints the sign-in URLs only and works with any login
225
+ bricks app control-page <app-id> -t <short-edit,canvas-control,device-control,device-control-create-only> [--token-name name] [--expires-in days] [-e KEY=VALUE] [--no-token] [--dry-run] [-j|--json]
226
+ # The printed URL is <controller>/<page>.html?workspace_secret=…&application_id=…; set BRICKS_CONTROLLER_URL to override the controller origin.
221
227
 
222
228
  # Preview a release without publishing
223
229
  bricks app release <app-id> -c <config-path-or-json> [-n name] [--version version] [--changelogs text] [--dry-run] [-j|--json]
package/lib/1215.js CHANGED
@@ -1 +1 @@
1
- export const __rspack_esm_id=1215;export const __rspack_esm_ids=[1215];export const __webpack_modules__={5018(e){e.exports=function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports},44668(e,t,r){var i=r(56347);function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}e.exports=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e},e.exports.__esModule=!0,e.exports.default=e.exports},70604(e){e.exports=function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)},e.exports.__esModule=!0,e.exports.default=e.exports},90250(e,t,r){var i=r(3634),n=r(70604),o=r(78243),s=r(5523);e.exports=function(e){return i(e)||n(e)||o(e)||s()},e.exports.__esModule=!0,e.exports.default=e.exports},23878(e,t,r){var i=r(14319).default;e.exports=function(e,t){if("object"!=i(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=i(n))return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},56347(e,t,r){var i=r(14319).default,n=r(23878);e.exports=function(e){var t=n(e,"string");return"symbol"==i(t)?t:t+""},e.exports.__esModule=!0,e.exports.default=e.exports},14319(e){function t(r){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},69995(e,t,r){r.d(t,{H:()=>i});function i(e,t){try{var r=JSON.parse(e).error,i=r?.message??r;if("string"==typeof i&&i)return i}catch{}return e||t}},42208(e,t,r){r.d(t,{RP:()=>a});var i=r(99436),n=r(75720),o="CTOR",s="ctor@bricks.tools",u=`Co-authored-by: ${o} <${s}>`;function l(){return(l=i(function*(e){return!!(yield(0,n.sh)`cd ${e} && git config user.email`.quiet().nothrow().text()).trim()})).apply(this,arguments)}function a(e,t){return p.apply(this,arguments)}function p(){return(p=i(function*(e,t,r=[]){var i=yield function(e){return l.apply(this,arguments)}(e),n=i?[]:["-c",`user.name=${o}`,"-c",`user.email=${s}`],a=[];for(var p of t)a.push("-m",p);return i&&a.push("-m",u),[...n,"commit",...r,...a]})).apply(this,arguments)}},13376(e,t,r){r.d(t,{a:()=>l,p:()=>s});var i=r(99436),n=r(51455),o=".bricks/.last-pushed-commit";function s(e){return u.apply(this,arguments)}function u(){return(u=i(function*(e){try{return(yield(0,n.readFile)(`${e}/${o}`,"utf8")).trim()||null}catch{return null}})).apply(this,arguments)}function l(e,t){return a.apply(this,arguments)}function a(){return(a=i(function*(e,t){t&&(yield(0,n.mkdir)(`${e}/.bricks`,{recursive:!0}),yield(0,n.writeFile)(`${e}/${o}`,t))})).apply(this,arguments)}},69070(e,t,r){r.d(t,{k:()=>s,q:()=>l});var i=r(99436),n=r(26848),o=r(1708);function s(e){return u.apply(this,arguments)}function u(){return(u=i(function*(e){if(!o.stdin.isTTY)return"";var t=(0,n.createInterface)({input:o.stdin,output:o.stdout});try{return(yield t.question(`${e} `)).trim()}finally{t.close()}})).apply(this,arguments)}function l(e){return a.apply(this,arguments)}function a(){return(a=i(function*(e){return(yield s(e))==="y"})).apply(this,arguments)}},75720(e,t,r){r.d(t,{p:()=>c,sh:()=>h});var i,n,o=r(90250),s=r(99436),u=r(5018),l=r(44668),a=r(31421),p=r(73024),c=()=>{var e=process.argv[1];return e&&!(e.includes("$bunfs")||e.includes("~BUN"))&&(0,p.existsSync)(e)?[process.execPath,e]:[process.execPath]},d=l(function e(t){u(this,e),this._cwd=void 0,this._mode="default",this._throw=!0,this._env=void 0,this._promise=null,this.args=t},[{key:"cwd",value:function(e){return this._cwd=e,this}},{key:"quiet",value:function(){return this._mode="quiet",this}},{key:"nothrow",value:function(){return this._throw=!1,this}},{key:"env",value:function(e){return this._env={...this._env,...e},this}},{key:"text",value:(i=s(function*(){return"default"===this._mode&&(this._mode="text"),(yield this.run()).stdout.toString("utf8")}),function(){return i.apply(this,arguments)})},{key:"then",value:function(e,t){return this.run().then(e,t)}},{key:"run",value:function(){return this._promise||(this._promise=this.exec()),this._promise}},{key:"exec",value:(n=s(function*(){var e=o(this.args),t=e[0],r=(function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i})(e).slice(1);if(!t)throw Error("sh: empty command");var i="default"===this._mode?["inherit","pipe","pipe"]:"quiet"===this._mode?["ignore","pipe","pipe"]:["inherit","pipe","pipe"],n=this._env?{...process.env,...this._env}:void 0,s=(0,a.spawn)(t,r,{cwd:this._cwd,stdio:i,env:n}),u=[],l=[];s.stdout?.on("data",e=>{u.push(e),"default"===this._mode&&process.stdout.write(e)}),s.stderr?.on("data",e=>{l.push(e),"default"===this._mode&&process.stderr.write(e)});var p=yield new Promise((e,t)=>{s.on("error",t),s.on("close",t=>e(t??0))}),c=Buffer.concat(u),d=Buffer.concat(l);if(0!==p&&this._throw){var f=Error(`sh: command failed with exit ${p}: ${this.args.join(" ")}`);throw f.exitCode=p,f.stdout=c,f.stderr=d,f}return{exitCode:p,stdout:c,stderr:d}}),function(){return n.apply(this,arguments)})}]),f=/\s/;function h(e,...t){var r,i,n,o,s,u=(r=[],i="",n=!1,o=()=>{n&&(r.push(i),i="",n=!1)},s=e=>{i+=e,n=!0},(e.forEach((e,r)=>{for(var i=0;i<e.length;i++){var n=e[i];f.test(n)?o():s(n)}r<t.length&&(e=>{if(null!=e){if(Array.isArray(e))return e.forEach((e,t)=>{t>0&&o(),s(String(e))});s(String(e))}})(t[r])}),o(),r.length>=3&&"cd"===r[0]&&"&&"===r[2])?{tokens:r.slice(3),initialCwd:r[1]}:{tokens:r}),l=u.tokens,a=u.initialCwd,p=new d(l);return a&&p.cwd(a),p}},42914(e,t,r){r.r(t),r.d(t,{bumpPatchVersion:()=>y,deploy:()=>v});var i,n,o=r(68832),s=r(99436),u=r(51455),l=r(75720),a=r(69995),p=r(42208),c=r(13376),d=r(69070),f=(i=s(function*(e){try{return yield(0,u.access)(e),!0}catch{return!1}}),function(e){return i.apply(this,arguments)}),h=(n=s(function*(e){return JSON.parse((yield(0,u.readFile)(e,"utf8")))}),function(e){return n.apply(this,arguments)}),y=e=>{var t=/^(v?)(\d+)\.(\d+)(?:\.(\d+))?(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$/.exec(e);if(!t)return null;var r=o(t,6),i=r[1],n=r[2],s=r[3],u=r[4],l=void 0===u?"0":u;return r[5]?`${i}${n}.${s}.${l}`:`${i}${n}.${s}.${Number(l)+1}`};function v(){return m.apply(this,arguments)}function m(){return(m=s(function*(e={}){process.env.BRICKS_RELEASE_SIGN||(process.env.BRICKS_RELEASE_SIGN="CTOR");var t,r=process.cwd(),i=e.changelogs,n=e.changelogsFile,o=e.autoCommit,s=e.autoVersion,v=e.version,m=e.yes,_=0===(yield(0,l.sh)`cd ${r} && git status`.quiet().nothrow()).exitCode;if(!_&&!m&&!(yield(0,d.q)("No git repository found, continue? (y/n)")))throw Error("Deployment cancelled");var g=yield h(`${r}/application.json`),x=yield h(`${r}/.bricks/build/application-config.json`),w=`${r}/package.json`,$=yield f(w);if(v){if(t=v,$){var b=yield h(w);b.version=t,yield(0,u.writeFile)(w,JSON.stringify(b,null,2)+"\n")}}else if(s&&$){var S=yield h(w);if(!(t=y(S.version||"0.0.0")))throw Error(`Cannot auto-bump non-semver version "${S.version}" — pass an explicit version instead`);S.version=t,yield(0,u.writeFile)(w,JSON.stringify(S,null,2)+"\n")}else t=$?(yield h(w)).version:void 0;var k="";if(i)k=i;else if(n){if(!(yield f(n)))throw Error(`Changelogs file not found: ${n}`);k=yield(0,u.readFile)(n,"utf8")}else m||(k=(yield(0,d.k)("Enter changelogs (optional, press Enter to skip):"))||"");var E="";if(_){if(yield(0,l.sh)`cd ${r} && git diff --name-only --diff-filter=ACMR`.text())if(o){var C=`chore: release ${t||"new version"}`,A=k||"[no changelogs]";yield(0,l.sh)`cd ${r} && git add -A`;var N=yield(0,p.RP)(r,[C,A]);yield(0,l.sh)`cd ${r} && git ${N}`}else throw Error("Unstaged changes found, please commit or stash your changes before deploying");E=(yield(0,l.sh)`cd ${r} && git rev-parse HEAD`.text()).trim()}if(!m&&!(yield(0,d.q)("Are you sure you want to deploy? (y/n)")))throw Error("Deployment cancelled");var j="module"===g.type,q={...x,title:t||x.title,bricks_project_last_commit_id:E||void 0},M=`${r}/.bricks/build/release-config.json`;yield(0,u.writeFile)(M,JSON.stringify(q));var O=["bricks",j?"module":"app","release",g.id,"-c",M,"--json"];g.name&&O.push("--name",g.name),t&&O.push("--version",t),k&&O.push("--changelogs",k);var P=yield(0,l.sh)`${O}`.quiet().nothrow();if(0!==P.exitCode){var R=P.stderr.toString()||P.stdout.toString();throw Error((0,a.H)(R,"Release failed"))}var F=JSON.parse(P.stdout.toString());E&&(yield(0,c.a)(r,E)),console.log(`${j?"Module":"App"} deployed: ${F.target?.name||g.name}`)})).apply(this,arguments)}}};
1
+ export const __rspack_esm_id=1215;export const __rspack_esm_ids=[1215];export const __webpack_modules__={5018(e){e.exports=function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports},44668(e,t,r){var i=r(56347);function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}e.exports=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e},e.exports.__esModule=!0,e.exports.default=e.exports},70604(e){e.exports=function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)},e.exports.__esModule=!0,e.exports.default=e.exports},90250(e,t,r){var i=r(3634),n=r(70604),o=r(78243),s=r(5523);e.exports=function(e){return i(e)||n(e)||o(e)||s()},e.exports.__esModule=!0,e.exports.default=e.exports},23878(e,t,r){var i=r(14319).default;e.exports=function(e,t){if("object"!=i(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=i(n))return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},56347(e,t,r){var i=r(14319).default,n=r(23878);e.exports=function(e){var t=n(e,"string");return"symbol"==i(t)?t:t+""},e.exports.__esModule=!0,e.exports.default=e.exports},14319(e){function t(r){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},69995(e,t,r){r.d(t,{H:()=>i});function i(e,t){try{var r=JSON.parse(e).error,i=r?.message??r;if("string"==typeof i&&i)return i}catch{}return e||t}},42208(e,t,r){r.d(t,{RP:()=>a});var i=r(99436),n=r(75720),o="CTOR",s="ctor@bricks.tools",u=`Co-authored-by: ${o} <${s}>`;function l(){return(l=i(function*(e){return!!(yield(0,n.sh)`cd ${e} && git config user.email`.quiet().nothrow().text()).trim()})).apply(this,arguments)}function a(e,t){return c.apply(this,arguments)}function c(){return(c=i(function*(e,t,r=[]){var i=yield function(e){return l.apply(this,arguments)}(e),n=i?[]:["-c",`user.name=${o}`,"-c",`user.email=${s}`],a=[];for(var c of t)a.push("-m",c);return i&&a.push("-m",u),[...n,"commit",...r,...a]})).apply(this,arguments)}},13376(e,t,r){r.d(t,{a:()=>l,p:()=>s});var i=r(99436),n=r(51455),o=".bricks/.last-pushed-commit";function s(e){return u.apply(this,arguments)}function u(){return(u=i(function*(e){try{return(yield(0,n.readFile)(`${e}/${o}`,"utf8")).trim()||null}catch{return null}})).apply(this,arguments)}function l(e,t){return a.apply(this,arguments)}function a(){return(a=i(function*(e,t){t&&(yield(0,n.mkdir)(`${e}/.bricks`,{recursive:!0}),yield(0,n.writeFile)(`${e}/${o}`,t))})).apply(this,arguments)}},69070(e,t,r){r.d(t,{k:()=>s,q:()=>l});var i=r(99436),n=r(26848),o=r(1708);function s(e){return u.apply(this,arguments)}function u(){return(u=i(function*(e){if(!o.stdin.isTTY)return"";var t=(0,n.createInterface)({input:o.stdin,output:o.stdout});try{return(yield t.question(`${e} `)).trim()}finally{t.close()}})).apply(this,arguments)}function l(e){return a.apply(this,arguments)}function a(){return(a=i(function*(e){return(yield s(e))==="y"})).apply(this,arguments)}},75720(e,t,r){r.d(t,{p:()=>p,sh:()=>h});var i,n,o=r(90250),s=r(99436),u=r(5018),l=r(44668),a=r(31421),c=r(73024),p=()=>{var e=process.argv[1];return e&&!(e.includes("$bunfs")||e.includes("~BUN"))&&(0,c.existsSync)(e)?[process.execPath,e]:[process.execPath]},d=l(function e(t){u(this,e),this._cwd=void 0,this._mode="default",this._throw=!0,this._env=void 0,this._promise=null,this.args=t},[{key:"cwd",value:function(e){return this._cwd=e,this}},{key:"quiet",value:function(){return this._mode="quiet",this}},{key:"nothrow",value:function(){return this._throw=!1,this}},{key:"env",value:function(e){return this._env={...this._env,...e},this}},{key:"text",value:(i=s(function*(){return"default"===this._mode&&(this._mode="text"),(yield this.run()).stdout.toString("utf8")}),function(){return i.apply(this,arguments)})},{key:"then",value:function(e,t){return this.run().then(e,t)}},{key:"run",value:function(){return this._promise||(this._promise=this.exec()),this._promise}},{key:"exec",value:(n=s(function*(){var e=o(this.args),t=e[0],r=(function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i})(e).slice(1);if(!t)throw Error("sh: empty command");var i="default"===this._mode?["inherit","pipe","pipe"]:"quiet"===this._mode?["ignore","pipe","pipe"]:["inherit","pipe","pipe"],n=this._env?{...process.env,...this._env}:void 0,s=(0,a.spawn)(t,r,{cwd:this._cwd,stdio:i,env:n}),u=[],l=[];s.stdout?.on("data",e=>{u.push(e),"default"===this._mode&&process.stdout.write(e)}),s.stderr?.on("data",e=>{l.push(e),"default"===this._mode&&process.stderr.write(e)});var c=yield new Promise((e,t)=>{s.on("error",t),s.on("close",(t,r)=>e({code:t,signal:r}))}),p=c.code,d=c.signal,f=p??1,h=Buffer.concat(u),y=Buffer.concat(l);if(0!==f&&this._throw){var v=d?`signal ${d}`:`exit ${f}`,m=Error(`sh: command failed with ${v}: ${this.args.join(" ")}`);throw m.exitCode=f,m.stdout=h,m.stderr=y,m}return{exitCode:f,stdout:h,stderr:y}}),function(){return n.apply(this,arguments)})}]),f=/\s/;function h(e,...t){var r,i,n,o,s,u=(r=[],i="",n=!1,o=()=>{n&&(r.push(i),i="",n=!1)},s=e=>{i+=e,n=!0},(e.forEach((e,r)=>{for(var i=0;i<e.length;i++){var n=e[i];f.test(n)?o():s(n)}r<t.length&&(e=>{if(null!=e){if(Array.isArray(e))return e.forEach((e,t)=>{t>0&&o(),s(String(e))});s(String(e))}})(t[r])}),o(),r.length>=3&&"cd"===r[0]&&"&&"===r[2])?{tokens:r.slice(3),initialCwd:r[1]}:{tokens:r}),l=u.tokens,a=u.initialCwd,c=new d(l);return a&&c.cwd(a),c}},42914(e,t,r){r.r(t),r.d(t,{bumpPatchVersion:()=>y,deploy:()=>v});var i,n,o=r(68832),s=r(99436),u=r(51455),l=r(75720),a=r(69995),c=r(42208),p=r(13376),d=r(69070),f=(i=s(function*(e){try{return yield(0,u.access)(e),!0}catch{return!1}}),function(e){return i.apply(this,arguments)}),h=(n=s(function*(e){return JSON.parse((yield(0,u.readFile)(e,"utf8")))}),function(e){return n.apply(this,arguments)}),y=e=>{var t=/^(v?)(\d+)\.(\d+)(?:\.(\d+))?(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$/.exec(e);if(!t)return null;var r=o(t,6),i=r[1],n=r[2],s=r[3],u=r[4],l=void 0===u?"0":u;return r[5]?`${i}${n}.${s}.${l}`:`${i}${n}.${s}.${Number(l)+1}`};function v(){return m.apply(this,arguments)}function m(){return(m=s(function*(e={}){process.env.BRICKS_RELEASE_SIGN||(process.env.BRICKS_RELEASE_SIGN="CTOR");var t,r=process.cwd(),i=e.changelogs,n=e.changelogsFile,o=e.autoCommit,s=e.autoVersion,v=e.version,m=e.yes,_=0===(yield(0,l.sh)`cd ${r} && git status`.quiet().nothrow()).exitCode;if(!_&&!m&&!(yield(0,d.q)("No git repository found, continue? (y/n)")))throw Error("Deployment cancelled");var g=yield h(`${r}/application.json`),x=yield h(`${r}/.bricks/build/application-config.json`),w=`${r}/package.json`,$=yield f(w);if(v){if(t=v,$){var b=yield h(w);b.version=t,yield(0,u.writeFile)(w,JSON.stringify(b,null,2)+"\n")}}else if(s&&$){var S=yield h(w);if(!(t=y(S.version||"0.0.0")))throw Error(`Cannot auto-bump non-semver version "${S.version}" — pass an explicit version instead`);S.version=t,yield(0,u.writeFile)(w,JSON.stringify(S,null,2)+"\n")}else t=$?(yield h(w)).version:void 0;var k="";if(i)k=i;else if(n){if(!(yield f(n)))throw Error(`Changelogs file not found: ${n}`);k=yield(0,u.readFile)(n,"utf8")}else m||(k=(yield(0,d.k)("Enter changelogs (optional, press Enter to skip):"))||"");var E="";if(_){if(yield(0,l.sh)`cd ${r} && git diff --name-only --diff-filter=ACMR`.text())if(o){var C=`chore: release ${t||"new version"}`,A=k||"[no changelogs]";yield(0,l.sh)`cd ${r} && git add -A`;var N=yield(0,c.RP)(r,[C,A]);yield(0,l.sh)`cd ${r} && git ${N}`}else throw Error("Unstaged changes found, please commit or stash your changes before deploying");E=(yield(0,l.sh)`cd ${r} && git rev-parse HEAD`.text()).trim()}if(!m&&!(yield(0,d.q)("Are you sure you want to deploy? (y/n)")))throw Error("Deployment cancelled");var j="module"===g.type,q={...x,title:t||x.title,bricks_project_last_commit_id:E||void 0},M=`${r}/.bricks/build/release-config.json`;yield(0,u.writeFile)(M,JSON.stringify(q));var O=["bricks",j?"module":"app","release",g.id,"-c",M,"--json"];g.name&&O.push("--name",g.name),t&&O.push("--version",t),k&&O.push("--changelogs",k);var P=yield(0,l.sh)`${O}`.quiet().nothrow();if(0!==P.exitCode){var R=P.stderr.toString()||P.stdout.toString();throw Error((0,a.H)(R,"Release failed"))}var F=JSON.parse(P.stdout.toString());E&&(yield(0,p.a)(r,E)),console.log(`${j?"Module":"App"} deployed: ${F.target?.name||g.name}`)})).apply(this,arguments)}}};