bobp 0.0.15 → 0.0.16
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 -3
- package/dist/index.js +2 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var
|
|
3
|
-
|
|
4
|
-
`).map(c=>({str:c,font:X,y:0,h:0,g:C}))].map(c=>z(i,c)),s=p[p.length-1].h;s-=s/C,s=p.reduce((c,j)=>c+j.h,-s),s=Math.ceil(s);let u=Math.floor((E-s)*.5);for(let c of p)q(i,c,u),u+=c.h;let $=(0,b.join)(process.cwd(),"cover.png");o.createPNGStream().pipe((0,D.createWriteStream)($))}function q(t,e,o){t.fillStyle="white",t.font=e.font,t.fillText(e.str,O*.5,o+e.y)}function z(t,e){t.font=e.font;let o=t.measureText(e.str),{actualBoundingBoxAscent:n,actualBoundingBoxDescent:r}=o,i=n+r;return v(h({},e),{y:n,h:i*e.g})}var m=require("path"),l=require("fs");var L=require("path"),a=(0,L.join)(__dirname,"..","templates");var J=(0,m.join)(a,"license");function N({type:t,year:e,author:o}){let n=`${t}.txt`,r=(0,m.join)(J,n),p=(0,l.readFileSync)(r,{encoding:"utf-8"}).replace("[year]",e).replace("[author]",o),s=(0,m.join)(process.cwd(),"LICENSE");(0,l.writeFileSync)(s,p)}var d=require("path"),f=require("fs");var w=(0,d.join)(a,"prettier");function B(){let t=(0,f.readdirSync)(w);for(let e of t){let o=(0,d.join)(w,e),n=(0,d.join)(process.cwd(),`.${e}`);(0,f.copyFileSync)(o,n)}}P.default.scriptName("bobp").usage("$0 <cmd> [args]","Usage").demandCommand(1,"Need 1").command("license <author> [year] [type]","license description",t=>t.positional("author",{demandOption:!0,describe:"",type:"string"}).positional("year",{default:new Date().getFullYear().toString(),describe:"",type:"string"}).positional("type",{default:"mit",describe:"",type:"string"}),t=>N(t)).command("prettier","prettier description",t=>t,()=>B()).command("cover <title> <description>","cover description",t=>t.positional("title",{demandOption:!0,describe:"",type:"string"}).positional("description",{demandOption:!0,describe:"",type:"string"}),t=>_(t)).help().strict().parseSync();
|
|
2
|
+
"use strict";var M=Object.create;var g=Object.defineProperty,$=Object.defineProperties,j=Object.getOwnPropertyDescriptor,A=Object.getOwnPropertyDescriptors,Y=Object.getOwnPropertyNames,y=Object.getOwnPropertySymbols,G=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable;var x=(t,e,o)=>e in t?g(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,T=(t,e)=>{for(var o in e||(e={}))h.call(e,o)&&x(t,o,e[o]);if(y)for(var o of y(e))U.call(e,o)&&x(t,o,e[o]);return t},v=(t,e)=>$(t,A(e));var W=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Y(e))!h.call(t,r)&&r!==o&&g(t,r,{get:()=>e[r],enumerable:!(n=j(e,r))||n.enumerable});return t};var k=(t,e,o)=>(o=t!=null?M(G(t)):{},W(e||!t||!t.__esModule?g(o,"default",{value:t,enumerable:!0}):o,t));var B=k(require("yargs"));var S=require("path"),b=require("canvas"),I=require("fs");var D=1280,C=640,O='"Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',q=`700 80px ${O}`,z=`300 48px ${O}`,E=1.2;function R({title:t,description:e}){let o=(0,b.createCanvas)(D,C),{width:n,height:r}=o,i=o.getContext("2d");i.fillStyle="#001220",i.fillRect(0,0,n,r),i.textAlign="center",i.textBaseline="top";let p=[{str:t,font:q,y:0,h:0,g:1.3},...e.split(`
|
|
3
|
+
`).map(c=>({str:c,font:z,y:0,h:0,g:E}))].map(c=>K(i,c)),s=p[p.length-1].h;s-=s/E,s=p.reduce((c,H)=>c+H.h,-s),s=Math.ceil(s);let u=Math.floor((C-s)*.5);for(let c of p)J(i,c,u),u+=c.h;let F=(0,S.join)(process.cwd(),"cover.png"),P=o.toBuffer("image/png");(0,I.writeFileSync)(F,P)}function J(t,e,o){t.fillStyle="white",t.font=e.font,t.fillText(e.str,D*.5,o+e.y)}function K(t,e){t.font=e.font;let o=t.measureText(e.str),{actualBoundingBoxAscent:n,actualBoundingBoxDescent:r}=o,i=n+r;return v(T({},e),{y:n,h:i*e.g})}var m=require("path"),l=require("fs");var L=require("path"),a=(0,L.join)(__dirname,"..","templates");var Q=(0,m.join)(a,"license");function _({type:t,year:e,author:o}){let n=`${t}.txt`,r=(0,m.join)(Q,n),p=(0,l.readFileSync)(r,{encoding:"utf-8"}).replace("[year]",e).replace("[author]",o),s=(0,m.join)(process.cwd(),"LICENSE");(0,l.writeFileSync)(s,p)}var d=require("path"),f=require("fs");var w=(0,d.join)(a,"prettier");function N(){let t=(0,f.readdirSync)(w);for(let e of t){let o=(0,d.join)(w,e),n=(0,d.join)(process.cwd(),`.${e}`);(0,f.copyFileSync)(o,n)}}B.default.scriptName("bobp").usage("$0 <cmd> [args]","Usage").demandCommand(1,"Need 1").command("license <author> [year] [type]","license description",t=>t.positional("author",{demandOption:!0,describe:"",type:"string"}).positional("year",{default:new Date().getFullYear().toString(),describe:"",type:"string"}).positional("type",{default:"mit",describe:"",type:"string"}),t=>_(t)).command("prettier","prettier description",t=>t,()=>N()).command("cover <title> <description>","cover description",t=>t.positional("title",{demandOption:!0,describe:"",type:"string"}).positional("description",{demandOption:!0,describe:"",type:"string"}),t=>R(t)).help().strict().parseSync();
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
|
|
3
|
-
`).map(c=>({str:c,font:Y,y:0,h:0,g:C}))].map(c=>Q(i,c)),s=p[p.length-1].h;s-=s/C,s=p.reduce((c,P)=>c+P.h,-s),s=Math.ceil(s);let d=Math.floor((S-s)*.5);for(let c of p)k(i,c,d),d+=c.h;let B=(0,I.join)(process.cwd(),"cover.png");o.createPNGStream().pipe((0,D.createWriteStream)(B))}function k(e,t,o){e.fillStyle="white",e.font=t.font,e.fillText(t.str,_*.5,o+t.y)}function Q(e,t){e.font=t.font;let o=e.measureText(t.str),{actualBoundingBoxAscent:n,actualBoundingBoxDescent:r}=o,i=n+r;return E(y({},t),{y:n,h:i*t.g})}var m=require("path"),l=require("fs");var N=require("path"),f=(0,N.join)(__dirname,"..","templates");var U=(0,m.join)(f,"license");function X({type:e,year:t,author:o}){let n=`${e}.txt`,r=(0,m.join)(U,n),p=(0,l.readFileSync)(r,{encoding:"utf-8"}).replace("[year]",t).replace("[author]",o),s=(0,m.join)(process.cwd(),"LICENSE");(0,l.writeFileSync)(s,p)}var g=require("path"),T=require("fs");var w=(0,g.join)(f,"prettier");function q(){let e=(0,T.readdirSync)(w);for(let t of e){let o=(0,g.join)(w,t),n=(0,g.join)(process.cwd(),`.${t}`);(0,T.copyFileSync)(o,n)}}0&&(module.exports={cover,license,prettier});
|
|
1
|
+
"use strict";var f=Object.defineProperty,P=Object.defineProperties,F=Object.getOwnPropertyDescriptor,H=Object.getOwnPropertyDescriptors,M=Object.getOwnPropertyNames,d=Object.getOwnPropertySymbols;var h=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable;var T=(e,t,o)=>t in e?f(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,y=(e,t)=>{for(var o in t||(t={}))h.call(t,o)&&T(e,o,t[o]);if(d)for(var o of d(t))O.call(t,o)&&T(e,o,t[o]);return e},E=(e,t)=>P(e,H(t));var j=(e,t)=>{for(var o in t)f(e,o,{get:t[o],enumerable:!0})},A=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of M(t))!h.call(e,r)&&r!==o&&f(e,r,{get:()=>t[r],enumerable:!(n=F(t,r))||n.enumerable});return e};var $=e=>A(f({},"__esModule",{value:!0}),e);var K={};j(K,{cover:()=>U,license:()=>z,prettier:()=>J});module.exports=$(K);var I=require("path"),S=require("canvas"),R=require("fs");var D=1280,v=640,_='"Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',Y=`700 80px ${_}`,G=`300 48px ${_}`,C=1.2;function U({title:e,description:t}){let o=(0,S.createCanvas)(D,v),{width:n,height:r}=o,i=o.getContext("2d");i.fillStyle="#001220",i.fillRect(0,0,n,r),i.textAlign="center",i.textBaseline="top";let p=[{str:e,font:Y,y:0,h:0,g:1.3},...t.split(`
|
|
2
|
+
`).map(c=>({str:c,font:G,y:0,h:0,g:C}))].map(c=>k(i,c)),s=p[p.length-1].h;s-=s/C,s=p.reduce((c,b)=>c+b.h,-s),s=Math.ceil(s);let x=Math.floor((v-s)*.5);for(let c of p)W(i,c,x),x+=c.h;let B=(0,I.join)(process.cwd(),"cover.png"),N=o.toBuffer("image/png");(0,R.writeFileSync)(B,N)}function W(e,t,o){e.fillStyle="white",e.font=t.font,e.fillText(t.str,D*.5,o+t.y)}function k(e,t){e.font=t.font;let o=e.measureText(t.str),{actualBoundingBoxAscent:n,actualBoundingBoxDescent:r}=o,i=n+r;return E(y({},t),{y:n,h:i*t.g})}var m=require("path"),l=require("fs");var w=require("path"),a=(0,w.join)(__dirname,"..","templates");var q=(0,m.join)(a,"license");function z({type:e,year:t,author:o}){let n=`${e}.txt`,r=(0,m.join)(q,n),p=(0,l.readFileSync)(r,{encoding:"utf-8"}).replace("[year]",t).replace("[author]",o),s=(0,m.join)(process.cwd(),"LICENSE");(0,l.writeFileSync)(s,p)}var g=require("path"),u=require("fs");var L=(0,g.join)(a,"prettier");function J(){let e=(0,u.readdirSync)(L);for(let t of e){let o=(0,g.join)(L,t),n=(0,g.join)(process.cwd(),`.${t}`);(0,u.copyFileSync)(o,n)}}0&&(module.exports={cover,license,prettier});
|