bobp 0.9.1 → 0.10.0
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/cli.js +2 -2
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var X=Object.create;var
|
|
3
|
-
`).map(m=>({str:m,font:ct,y:0,h:0,g:j}))].map(m=>pt(a,m)),i=s[s.length-1].h;i-=i/j,i=s.reduce((m,V)=>m+V.h,-i),i=Math.ceil(i);let d=Math.floor((C-i)*.5);for(let m of s)at(a,m,d),d+=m.h;let K=(0,
|
|
2
|
+
"use strict";var X=Object.create;var S=Object.defineProperty,Z=Object.defineProperties,tt=Object.getOwnPropertyDescriptor,et=Object.getOwnPropertyDescriptors,ot=Object.getOwnPropertyNames,b=Object.getOwnPropertySymbols,nt=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty,rt=Object.prototype.propertyIsEnumerable;var T=(t,e,o)=>e in t?S(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,l=(t,e)=>{for(var o in e||(e={}))P.call(e,o)&&T(t,o,e[o]);if(b)for(var o of b(e))rt.call(e,o)&&T(t,o,e[o]);return t},f=(t,e)=>Z(t,et(e));var it=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of ot(e))!P.call(t,r)&&r!==o&&S(t,r,{get:()=>e[r],enumerable:!(n=tt(e,r))||n.enumerable});return t};var w=(t,e,o)=>(o=t!=null?X(nt(t)):{},it(e||!t||!t.__esModule?S(o,"default",{value:t,enumerable:!0}):o,t));var p=(t,e,o)=>new Promise((n,r)=>{var c=i=>{try{s(o.next(i))}catch(d){r(d)}},a=i=>{try{s(o.throw(i))}catch(d){r(d)}},s=i=>i.done?n(i.value):Promise.resolve(i.value).then(c,a);s((o=o.apply(t,e)).next())});var W=w(require("yargs")),q=require("yargs/helpers");var k=require("fs"),L=require("path"),I=require("canvas");var D=1280,C=640,F='"Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',st=`700 80px ${F}`,ct=`300 48px ${F}`,j=1.2;function R({title:t,description:e,path:o}){let n=(0,I.createCanvas)(D,C),{width:r,height:c}=n,a=n.getContext("2d");a.fillStyle="#001220",a.fillRect(0,0,r,c),a.textAlign="center",a.textBaseline="top";let s=[{str:t,font:st,y:0,h:0,g:1.3},...e.split(`
|
|
3
|
+
`).map(m=>({str:m,font:ct,y:0,h:0,g:j}))].map(m=>pt(a,m)),i=s[s.length-1].h;i-=i/j,i=s.reduce((m,V)=>m+V.h,-i),i=Math.ceil(i);let d=Math.floor((C-i)*.5);for(let m of s)at(a,m,d),d+=m.h;let K=(0,L.join)(o,"cover.png"),Q=n.toBuffer("image/png");(0,k.writeFileSync)(K,Q)}function at(t,e,o){t.fillStyle="white",t.font=e.font,t.fillText(e.str,D*.5,o+e.y)}function pt(t,e){t.font=e.font;let o=t.measureText(e.str),{actualBoundingBoxAscent:n,actualBoundingBoxDescent:r}=o,c=n+r;return f(l({},e),{y:n,h:c*e.g})}var g=require("fs"),u=require("path"),_=w(require("degit")),A=require("rimraf");function B(t){return p(this,null,function*(){yield mt(t),dt(t),lt(t)})}function mt(o){return p(this,arguments,function*({name:t,path:e}){return yield(0,_.default)("rdarida/template-electron#main").clone((0,u.join)(e,t))})}function dt({name:t,path:e}){["package-lock.json"].forEach(o=>{let n=(0,u.join)(e,t,o);(0,A.rimrafSync)(n)})}function lt({name:t,productName:e,path:o}){let n=(0,u.join)(o,t,"package.json"),r=(0,g.readFileSync)(n,{encoding:"utf-8"}),c=f(l({},JSON.parse(r)),{name:t,productName:e,version:"0.0.0"});(0,g.writeFileSync)(n,JSON.stringify(c,null,2))}var x=require("fs"),h=require("path");var J=require("path"),y=(0,J.join)(__dirname,"..","templates");var ft=(0,h.join)(y,"license");function M({type:t,year:e,author:o,path:n}){let r=`${t}.txt`,c=(0,h.join)(ft,r),s=(0,x.readFileSync)(c,{encoding:"utf-8"}).replace("[year]",e).replace("[author]",o),i=(0,h.join)(n,"LICENSE");(0,x.writeFileSync)(i,s)}var O=require("fs"),v=require("path"),G=w(require("degit")),H=require("rimraf");function Y(t){return p(this,null,function*(){yield gt(t),ut(t),yt(t)})}function gt(o){return p(this,arguments,function*({name:t,path:e}){return yield(0,G.default)("rdarida/template-next#main").clone((0,v.join)(e,t))})}function ut({name:t,path:e}){["package-lock.json"].forEach(o=>{let n=(0,v.join)(e,t,o);(0,H.rimrafSync)(n)})}function yt({name:t,path:e}){let o=(0,v.join)(e,t,"package.json"),n=(0,O.readFileSync)(o,{encoding:"utf-8"}),r=f(l({},JSON.parse(n)),{name:t,version:"0.0.0"});(0,O.writeFileSync)(o,JSON.stringify(r,null,2))}var N=require("fs"),E=require("path");var $=(0,E.join)(y,"prettier");function z({path:t}){let e=(0,N.readdirSync)($);for(let o of e){let n=(0,E.join)($,o),r=(0,E.join)(t,`.${o}`);(0,N.copyFileSync)(n,r)}}function U(t){return t.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9\-]/g,"")}(0,W.default)((0,q.hideBin)(process.argv)).scriptName("bobp").usage("$0 <cmd> [args]","Usage").demandCommand(1,"Need 1").command("cover <title> <description>","Generates a PNG cover image (cover.png) in the current working directory",t=>t.positional("title",{type:"string",describe:"Main title text displayed on the cover",demandOption:!0}).positional("description",{type:"string",describe:"Description text displayed below the title",demandOption:!0}).option("path",{type:"string",describe:"Output path for the generated cover image",default:process.cwd()}),t=>R(t)).command("license <author> [year] [type]","Generates a LICENSE file in the current working directory",t=>t.positional("author",{type:"string",describe:"Author or copyright holder name",demandOption:!0}).positional("year",{type:"string",describe:"Year to be inserted into the license text",default:new Date().getFullYear().toString()}).positional("type",{type:"string",describe:'License type (e.g. "mit")',default:"mit"}).option("path",{type:"string",describe:"Output path for the generated LICENSE file",default:process.cwd()}),t=>M(t)).command("electron <productName> [name]","Creates a new Electron project in the current working directory",t=>t.positional("productName",{type:"string",describe:"Name of the application",demandOption:!0}).positional("name",{type:"string",describe:"Name of the project directory and npm package"}).option("path",{type:"string",describe:"Output path for the generated Electron project",default:process.cwd()}),n=>p(null,[n],function*({productName:t,name:e,path:o}){e=e||U(t),yield B({name:e,productName:t,path:o})})).command("next <name>","Creates a new Next.js project in the current working directory",t=>t.positional("name",{type:"string",describe:"Name of the project directory and npm package",demandOption:!0}).option("path",{type:"string",describe:"Output path for the generated Next.js project",default:process.cwd()}),t=>p(null,null,function*(){return yield Y(t)})).command("prettier","Copies Prettier configuration files into the current working directory",t=>t.option("path",{type:"string",describe:"Output path for the generated Prettier configuration files",default:process.cwd()}),t=>z(t)).help().strict().parse();
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var G=Object.create;var d=Object.defineProperty,U=Object.defineProperties,W=Object.getOwnPropertyDescriptor,q=Object.getOwnPropertyDescriptors,K=Object.getOwnPropertyNames,P=Object.getOwnPropertySymbols,Q=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable;var O=(t,e,o)=>e in t?d(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,m=(t,e)=>{for(var o in e||(e={}))C.call(e,o)&&O(t,o,e[o]);if(P)for(var o of P(e))V.call(e,o)&&O(t,o,e[o]);return t},l=(t,e)=>U(t,q(e));var X=(t,e)=>{for(var o in e)d(t,o,{get:e[o],enumerable:!0})},I=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of K(e))!C.call(t,r)&&r!==o&&d(t,r,{get:()=>e[r],enumerable:!(n=W(e,r))||n.enumerable});return t};var j=(t,e,o)=>(o=t!=null?G(Q(t)):{},I(e||!t||!t.__esModule?d(o,"default",{value:t,enumerable:!0}):o,t)),Z=t=>I(d({},"__esModule",{value:!0}),t);var g=(t,e,o)=>new Promise((n,r)=>{var c=i=>{try{s(o.next(i))}catch(f){r(f)}},a=i=>{try{s(o.throw(i))}catch(f){r(f)}},s=i=>i.done?n(i.value):Promise.resolve(i.value).then(c,a);s((o=o.apply(t,e)).next())});var yt={};X(yt,{cover:()=>ot,electron:()=>it,license:()=>ft,next:()=>mt,normalize:()=>xt,prettier:()=>ut});module.exports=Z(yt);var
|
|
2
|
-
`).map(p=>({str:p,font:et,y:0,h:0,g:
|
|
1
|
+
"use strict";var G=Object.create;var d=Object.defineProperty,U=Object.defineProperties,W=Object.getOwnPropertyDescriptor,q=Object.getOwnPropertyDescriptors,K=Object.getOwnPropertyNames,P=Object.getOwnPropertySymbols,Q=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable;var O=(t,e,o)=>e in t?d(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,m=(t,e)=>{for(var o in e||(e={}))C.call(e,o)&&O(t,o,e[o]);if(P)for(var o of P(e))V.call(e,o)&&O(t,o,e[o]);return t},l=(t,e)=>U(t,q(e));var X=(t,e)=>{for(var o in e)d(t,o,{get:e[o],enumerable:!0})},I=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of K(e))!C.call(t,r)&&r!==o&&d(t,r,{get:()=>e[r],enumerable:!(n=W(e,r))||n.enumerable});return t};var j=(t,e,o)=>(o=t!=null?G(Q(t)):{},I(e||!t||!t.__esModule?d(o,"default",{value:t,enumerable:!0}):o,t)),Z=t=>I(d({},"__esModule",{value:!0}),t);var g=(t,e,o)=>new Promise((n,r)=>{var c=i=>{try{s(o.next(i))}catch(f){r(f)}},a=i=>{try{s(o.throw(i))}catch(f){r(f)}},s=i=>i.done?n(i.value):Promise.resolve(i.value).then(c,a);s((o=o.apply(t,e)).next())});var yt={};X(yt,{cover:()=>ot,electron:()=>it,license:()=>ft,next:()=>mt,normalize:()=>xt,prettier:()=>ut});module.exports=Z(yt);var R=require("fs"),D=require("path"),F=require("canvas");var k=1280,w=640,_='"Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',tt=`700 80px ${_}`,et=`300 48px ${_}`,L=1.2;function ot({title:t,description:e,path:o}){let n=(0,F.createCanvas)(k,w),{width:r,height:c}=n,a=n.getContext("2d");a.fillStyle="#001220",a.fillRect(0,0,r,c),a.textAlign="center",a.textBaseline="top";let s=[{str:t,font:tt,y:0,h:0,g:1.3},...e.split(`
|
|
2
|
+
`).map(p=>({str:p,font:et,y:0,h:0,g:L}))].map(p=>rt(a,p)),i=s[s.length-1].h;i-=i/L,i=s.reduce((p,z)=>p+z.h,-i),i=Math.ceil(i);let f=Math.floor((w-i)*.5);for(let p of s)nt(a,p,f),f+=p.h;let $=(0,D.join)(o,"cover.png"),Y=n.toBuffer("image/png");(0,R.writeFileSync)($,Y)}function nt(t,e,o){t.fillStyle="white",t.font=e.font,t.fillText(e.str,k*.5,o+e.y)}function rt(t,e){t.font=e.font;let o=t.measureText(e.str),{actualBoundingBoxAscent:n,actualBoundingBoxDescent:r}=o,c=n+r;return l(m({},e),{y:n,h:c*e.g})}var u=require("fs"),x=require("path"),b=j(require("degit")),J=require("rimraf");function it(t){return g(this,null,function*(){yield st(t),ct(t),at(t)})}function st(o){return g(this,arguments,function*({name:t,path:e}){return yield(0,b.default)("rdarida/template-electron#main").clone((0,x.join)(e,t))})}function ct({name:t,path:e}){["package-lock.json"].forEach(o=>{let n=(0,x.join)(e,t,o);(0,J.rimrafSync)(n)})}function at({name:t,productName:e,path:o}){let n=(0,x.join)(o,t,"package.json"),r=(0,u.readFileSync)(n,{encoding:"utf-8"}),c=l(m({},JSON.parse(r)),{name:t,productName:e,version:"0.0.0"});(0,u.writeFileSync)(n,JSON.stringify(c,null,2))}var S=require("fs"),h=require("path");var A=require("path"),y=(0,A.join)(__dirname,"..","templates");var pt=(0,h.join)(y,"license");function ft({type:t,year:e,author:o,path:n}){let r=`${t}.txt`,c=(0,h.join)(pt,r),s=(0,S.readFileSync)(c,{encoding:"utf-8"}).replace("[year]",e).replace("[author]",o),i=(0,h.join)(n,"LICENSE");(0,S.writeFileSync)(i,s)}var T=require("fs"),E=require("path"),B=j(require("degit")),H=require("rimraf");function mt(t){return g(this,null,function*(){yield lt(t),gt(t),dt(t)})}function lt(o){return g(this,arguments,function*({name:t,path:e}){return yield(0,B.default)("rdarida/template-next#main").clone((0,E.join)(e,t))})}function gt({name:t,path:e}){["package-lock.json"].forEach(o=>{let n=(0,E.join)(e,t,o);(0,H.rimrafSync)(n)})}function dt({name:t,path:e}){let o=(0,E.join)(e,t,"package.json"),n=(0,T.readFileSync)(o,{encoding:"utf-8"}),r=l(m({},JSON.parse(n)),{name:t,version:"0.0.0"});(0,T.writeFileSync)(o,JSON.stringify(r,null,2))}var N=require("fs"),v=require("path");var M=(0,v.join)(y,"prettier");function ut({path:t}){let e=(0,N.readdirSync)(M);for(let o of e){let n=(0,v.join)(M,o),r=(0,v.join)(t,`.${o}`);(0,N.copyFileSync)(n,r)}}function xt(t){return t.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9\-]/g,"")}0&&(module.exports={cover,electron,license,next,normalize,prettier});
|