bobp 0.2.1 → 0.2.2
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 +9 -0
- package/dist/cli.js +2 -2
- package/dist/index.d.ts +11 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -38,6 +38,15 @@ npm i -g bobp
|
|
|
38
38
|
|
|
39
39
|
## Commands
|
|
40
40
|
|
|
41
|
+
### `license`
|
|
42
|
+
|
|
43
|
+
Generates a LICENSE file in the current working directory.
|
|
44
|
+
|
|
45
|
+
**Usage:**
|
|
46
|
+
```sh
|
|
47
|
+
npx bobp license "John Doe"
|
|
48
|
+
```
|
|
49
|
+
|
|
41
50
|
### `prettier`
|
|
42
51
|
|
|
43
52
|
Copies Prettier configuration files into the current working directory.
|
package/dist/cli.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var U=Object.create;var
|
|
3
|
-
`).map(
|
|
2
|
+
"use strict";var U=Object.create;var N=Object.defineProperty,W=Object.defineProperties,q=Object.getOwnPropertyDescriptor,z=Object.getOwnPropertyDescriptors,K=Object.getOwnPropertyNames,O=Object.getOwnPropertySymbols,Q=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable;var S=(t,e,o)=>e in t?N(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,l=(t,e)=>{for(var o in e||(e={}))w.call(e,o)&&S(t,o,e[o]);if(O)for(var o of O(e))V.call(e,o)&&S(t,o,e[o]);return t},f=(t,e)=>W(t,z(e));var X=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of K(e))!w.call(t,r)&&r!==o&&N(t,r,{get:()=>e[r],enumerable:!(n=q(e,r))||n.enumerable});return t};var C=(t,e,o)=>(o=t!=null?U(Q(t)):{},X(e||!t||!t.__esModule?N(o,"default",{value:t,enumerable:!0}):o,t));var d=(t,e,o)=>new Promise((n,r)=>{var s=c=>{try{i(o.next(c))}catch(m){r(m)}},a=c=>{try{i(o.throw(c))}catch(m){r(m)}},i=c=>c.done?n(c.value):Promise.resolve(c.value).then(s,a);i((o=o.apply(t,e)).next())});var Y=C(require("yargs")),$=require("yargs/helpers");var I=require("path"),D=require("fs"),L=require("canvas");var P=1280,E=640,R='"Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',Z=`700 80px ${R}`,tt=`300 48px ${R}`,b=1.2;function _({title:t,description:e}){let o=(0,L.createCanvas)(P,E),{width:n,height:r}=o,s=o.getContext("2d");s.fillStyle="#001220",s.fillRect(0,0,n,r),s.textAlign="center",s.textBaseline="top";let a=[{str:t,font:Z,y:0,h:0,g:1.3},...e.split(`
|
|
3
|
+
`).map(p=>({str:p,font:tt,y:0,h:0,g:b}))].map(p=>ot(s,p)),i=a[a.length-1].h;i-=i/b,i=a.reduce((p,G)=>p+G.h,-i),i=Math.ceil(i);let c=Math.floor((E-i)*.5);for(let p of a)et(s,p,c),c+=p.h;let m=(0,I.join)(process.cwd(),"cover.png"),J=o.toBuffer("image/png");(0,D.writeFileSync)(m,J)}function et(t,e,o){t.fillStyle="white",t.font=e.font,t.fillText(e.str,P*.5,o+e.y)}function ot(t,e){t.font=e.font;let o=t.measureText(e.str),{actualBoundingBoxAscent:n,actualBoundingBoxDescent:r}=o,s=n+r;return f(l({},e),{y:n,h:s*e.g})}var u=require("path"),y=require("fs");var F=require("path"),g=(0,F.join)(__dirname,"..","templates");var nt=(0,u.join)(g,"license");function B({type:t,year:e,author:o}){let n=`${t}.txt`,r=(0,u.join)(nt,n),a=(0,y.readFileSync)(r,{encoding:"utf-8"}).replace("[year]",e).replace("[author]",o),i=(0,u.join)(process.cwd(),"LICENSE");(0,y.writeFileSync)(i,a)}var x=require("path"),h=require("fs"),j=C(require("degit")),k=require("rimraf");function A(t){return d(this,null,function*(){yield rt(t),it(t),st(t)})}function rt(e){return d(this,arguments,function*({name:t}){return yield(0,j.default)("rdarida/template-next#main").clone((0,x.resolve)(process.cwd(),t))})}function it({name:t}){let e=(0,x.resolve)(process.cwd(),t,"package.json"),o=(0,h.readFileSync)(e,{encoding:"utf-8"}),n=f(l({},JSON.parse(o)),{name:t,version:"0.0.0"});(0,h.writeFileSync)(e,JSON.stringify(n,null,2))}function st({name:t}){["package-lock.json"].forEach(e=>{let o=(0,x.resolve)(process.cwd(),t,e);(0,k.rimrafSync)(o)})}var v=require("path"),T=require("fs");var H=(0,v.join)(g,"prettier");function M(){let t=(0,T.readdirSync)(H);for(let e of t){let o=(0,v.join)(H,e),n=(0,v.join)(process.cwd(),`.${e}`);(0,T.copyFileSync)(o,n)}}(0,Y.default)((0,$.hideBin)(process.argv)).scriptName("bobp").usage("$0 <cmd> [args]","Usage").demandCommand(1,"Need 1").command("license <author> [year] [type]","Generates a LICENSE file in the current working directory",t=>t.positional("author",{demandOption:!0,describe:"Author or copyright holder name",type:"string"}).positional("year",{default:new Date().getFullYear().toString(),describe:"Year to be inserted into the license text",type:"string"}).positional("type",{default:"mit",describe:'License type (e.g. "mit")',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 A(t)})).command("prettier","Copies Prettier configuration files into the current working directory",t=>t,()=>M()).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().parse();
|
package/dist/index.d.ts
CHANGED
|
@@ -4,11 +4,22 @@ type CoverOptions = {
|
|
|
4
4
|
};
|
|
5
5
|
declare function cover({ title, description }: CoverOptions): void;
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Options used to generate a LICENSE file.
|
|
9
|
+
*/
|
|
7
10
|
type LicenseOptions = {
|
|
11
|
+
/** License type (e.g. `MIT`) */
|
|
8
12
|
type: string;
|
|
13
|
+
/** Year to be inserted into the license text */
|
|
9
14
|
year: string;
|
|
15
|
+
/** Author or copyright holder name */
|
|
10
16
|
author: string;
|
|
11
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* Generates a LICENSE file in the current working directory.
|
|
20
|
+
*
|
|
21
|
+
* @param options Configuration options for the license generation.
|
|
22
|
+
*/
|
|
12
23
|
declare function license({ type, year, author }: LicenseOptions): void;
|
|
13
24
|
|
|
14
25
|
type NextOptions = {
|