bobp 0.0.21 → 0.0.22
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.d.ts +6 -1
- package/dist/index.js +2 -2
- package/package.json +3 -1
package/dist/cli.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var
|
|
3
|
-
`).map(
|
|
2
|
+
"use strict";var U=Object.create;var y=Object.defineProperty,W=Object.defineProperties,k=Object.getOwnPropertyDescriptor,q=Object.getOwnPropertyDescriptors,z=Object.getOwnPropertyNames,h=Object.getOwnPropertySymbols,J=Object.getPrototypeOf,T=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable;var v=(t,e,o)=>e in t?y(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,O=(t,e)=>{for(var o in e||(e={}))T.call(e,o)&&v(t,o,e[o]);if(h)for(var o of h(e))K.call(e,o)&&v(t,o,e[o]);return t},C=(t,e)=>W(t,q(e));var Q=(t,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of z(e))!T.call(t,n)&&n!==o&&y(t,n,{get:()=>e[n],enumerable:!(r=k(e,n))||r.enumerable});return t};var b=(t,e,o)=>(o=t!=null?U(J(t)):{},Q(e||!t||!t.__esModule?y(o,"default",{value:t,enumerable:!0}):o,t));var d=(t,e,o)=>new Promise((r,n)=>{var s=c=>{try{i(o.next(c))}catch(m){n(m)}},p=c=>{try{i(o.throw(c))}catch(m){n(m)}},i=c=>c.done?r(c.value):Promise.resolve(c.value).then(s,p);i((o=o.apply(t,e)).next())});var j=b(require("yargs")),A=require("yargs/helpers");var I=require("path"),N=require("fs"),w=require("canvas");var D=1280,E=640,R='"Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',V=`700 80px ${R}`,X=`300 48px ${R}`,S=1.2;function L({title:t,description:e}){let o=(0,w.createCanvas)(D,E),{width:r,height:n}=o,s=o.getContext("2d");s.fillStyle="#001220",s.fillRect(0,0,r,n),s.textAlign="center",s.textBaseline="top";let p=[{str:t,font:V,y:0,h:0,g:1.3},...e.split(`
|
|
3
|
+
`).map(a=>({str:a,font:X,y:0,h:0,g:S}))].map(a=>tt(s,a)),i=p[p.length-1].h;i-=i/S,i=p.reduce((a,G)=>a+G.h,-i),i=Math.ceil(i);let c=Math.floor((E-i)*.5);for(let a of p)Z(s,a,c),c+=a.h;let m=(0,I.join)(process.cwd(),"cover.png"),Y=o.toBuffer("image/png");(0,N.writeFileSync)(m,Y)}function Z(t,e,o){t.fillStyle="white",t.font=e.font,t.fillText(e.str,D*.5,o+e.y)}function tt(t,e){t.font=e.font;let o=t.measureText(e.str),{actualBoundingBoxAscent:r,actualBoundingBoxDescent:n}=o,s=r+n;return C(O({},e),{y:r,h:s*e.g})}var f=require("path"),g=require("fs");var _=require("path"),l=(0,_.join)(__dirname,"..","templates");var et=(0,f.join)(l,"license");function B({type:t,year:e,author:o}){let r=`${t}.txt`,n=(0,f.join)(et,r),p=(0,g.readFileSync)(n,{encoding:"utf-8"}).replace("[year]",e).replace("[author]",o),i=(0,f.join)(process.cwd(),"LICENSE");(0,g.writeFileSync)(i,p)}var P=require("path"),F=b(require("degit"));function H(e){return d(this,arguments,function*({name:t}){return yield(0,F.default)("rdarida/template-next#main").clone((0,P.resolve)(process.cwd(),t))})}var u=require("path"),x=require("fs");var M=(0,u.join)(l,"prettier");function $(){let t=(0,x.readdirSync)(M);for(let e of t){let o=(0,u.join)(M,e),r=(0,u.join)(process.cwd(),`.${e}`);(0,x.copyFileSync)(o,r)}}(0,j.default)((0,A.hideBin)(process.argv)).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=>B(t)).command("next <name>","next description",t=>t.positional("name",{demandOption:!0,describe:"",type:"string"}),t=>d(null,null,function*(){return yield H(t)})).command("prettier","prettier description",t=>t,()=>$()).command("cover <title> <description>","cover description",t=>t.positional("title",{demandOption:!0,describe:"",type:"string"}).positional("description",{demandOption:!0,describe:"",type:"string"}),t=>L(t)).help().strict().parse();
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,11 @@ type LicenseOptions = {
|
|
|
11
11
|
};
|
|
12
12
|
declare function license({ type, year, author }: LicenseOptions): void;
|
|
13
13
|
|
|
14
|
+
type NextOptions = {
|
|
15
|
+
name: string;
|
|
16
|
+
};
|
|
17
|
+
declare function next({ name }: NextOptions): Promise<void>;
|
|
18
|
+
|
|
14
19
|
declare function prettier(): void;
|
|
15
20
|
|
|
16
|
-
export { type CoverOptions, type LicenseOptions, cover, license, prettier };
|
|
21
|
+
export { type CoverOptions, type LicenseOptions, type NextOptions, cover, license, next, prettier };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
`).map(
|
|
1
|
+
"use strict";var M=Object.create;var m=Object.defineProperty,j=Object.defineProperties,A=Object.getOwnPropertyDescriptor,$=Object.getOwnPropertyDescriptors,Y=Object.getOwnPropertyNames,y=Object.getOwnPropertySymbols,G=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable;var T=(e,t,o)=>t in e?m(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,v=(e,t)=>{for(var o in t||(t={}))h.call(t,o)&&T(e,o,t[o]);if(y)for(var o of y(t))U.call(t,o)&&T(e,o,t[o]);return e},E=(e,t)=>j(e,$(t));var W=(e,t)=>{for(var o in t)m(e,o,{get:t[o],enumerable:!0})},C=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Y(t))!h.call(e,n)&&n!==o&&m(e,n,{get:()=>t[n],enumerable:!(r=A(t,n))||r.enumerable});return e};var k=(e,t,o)=>(o=e!=null?M(G(e)):{},C(t||!e||!e.__esModule?m(o,"default",{value:e,enumerable:!0}):o,e)),q=e=>C(m({},"__esModule",{value:!0}),e);var I=(e,t,o)=>new Promise((r,n)=>{var s=c=>{try{i(o.next(c))}catch(f){n(f)}},p=c=>{try{i(o.throw(c))}catch(f){n(f)}},i=c=>c.done?r(c.value):Promise.resolve(c.value).then(s,p);i((o=o.apply(e,t)).next())});var ot={};W(ot,{cover:()=>K,license:()=>Z,next:()=>tt,prettier:()=>et});module.exports=q(ot);var D=require("path"),w=require("fs"),_=require("canvas");var N=1280,S=640,L='"Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',z=`700 80px ${L}`,J=`300 48px ${L}`,R=1.2;function K({title:e,description:t}){let o=(0,_.createCanvas)(N,S),{width:r,height:n}=o,s=o.getContext("2d");s.fillStyle="#001220",s.fillRect(0,0,r,n),s.textAlign="center",s.textBaseline="top";let p=[{str:e,font:z,y:0,h:0,g:1.3},...t.split(`
|
|
2
|
+
`).map(a=>({str:a,font:J,y:0,h:0,g:R}))].map(a=>V(s,a)),i=p[p.length-1].h;i-=i/R,i=p.reduce((a,H)=>a+H.h,-i),i=Math.ceil(i);let c=Math.floor((S-i)*.5);for(let a of p)Q(s,a,c),c+=a.h;let f=(0,D.join)(process.cwd(),"cover.png"),F=o.toBuffer("image/png");(0,w.writeFileSync)(f,F)}function Q(e,t,o){e.fillStyle="white",e.font=t.font,e.fillText(t.str,N*.5,o+t.y)}function V(e,t){e.font=t.font;let o=e.measureText(t.str),{actualBoundingBoxAscent:r,actualBoundingBoxDescent:n}=o,s=r+n;return E(v({},t),{y:r,h:s*t.g})}var x=require("path"),d=require("fs");var B=require("path"),l=(0,B.join)(__dirname,"..","templates");var X=(0,x.join)(l,"license");function Z({type:e,year:t,author:o}){let r=`${e}.txt`,n=(0,x.join)(X,r),p=(0,d.readFileSync)(n,{encoding:"utf-8"}).replace("[year]",t).replace("[author]",o),i=(0,x.join)(process.cwd(),"LICENSE");(0,d.writeFileSync)(i,p)}var O=require("path"),P=k(require("degit"));function tt(t){return I(this,arguments,function*({name:e}){return yield(0,P.default)("rdarida/template-next#main").clone((0,O.resolve)(process.cwd(),e))})}var g=require("path"),u=require("fs");var b=(0,g.join)(l,"prettier");function et(){let e=(0,u.readdirSync)(b);for(let t of e){let o=(0,g.join)(b,t),r=(0,g.join)(process.cwd(),`.${t}`);(0,u.copyFileSync)(o,r)}}0&&(module.exports={cover,license,next,prettier});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bobp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.22",
|
|
4
4
|
"description": "How can I help you, Bobp?",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,9 +35,11 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"canvas": "^3.1.0",
|
|
38
|
+
"degit": "^2.8.4",
|
|
38
39
|
"yargs": "^18.0.0"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
42
|
+
"@types/degit": "^2.8.6",
|
|
41
43
|
"@types/jest": "^30.0.0",
|
|
42
44
|
"@types/node": "^24.5.1",
|
|
43
45
|
"@types/yargs": "^17.0.33",
|