bobp 0.10.5 → 0.10.7
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 +3 -2
- package/dist/cli.js.map +1 -0
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -0
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var
|
|
3
|
-
`).map(
|
|
2
|
+
"use strict";var W=Object.create;var N=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var Q=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty;var X=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of K(e))!V.call(t,r)&&r!==o&&N(t,r,{get:()=>e[r],enumerable:!(n=q(e,r))||n.enumerable});return t};var v=(t,e,o)=>(o=t!=null?W(Q(t)):{},X(e||!t||!t.__esModule?N(o,"default",{value:t,enumerable:!0}):o,t));var H=v(require("yargs")),Y=require("yargs/helpers");var b=require("fs"),T=require("path"),P=require("canvas"),C=1280,S=640,j='"Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',Z=`700 80px ${j}`,tt=`300 48px ${j}`,w=1.2;function k({title:t,description:e,path:o}){let n=(0,P.createCanvas)(C,S),{width:r,height:a}=n,p=n.getContext("2d");p.fillStyle="#001220",p.fillRect(0,0,r,a),p.textAlign="center",p.textBaseline="top";let m=[{str:t,font:Z,y:0,h:0,g:1.3},...e.split(`
|
|
3
|
+
`).map(s=>({str:s,font:tt,y:0,h:0,g:w}))].map(s=>ot(p,s)),i=m[m.length-1].h;i-=i/w,i=m.reduce((s,U)=>s+U.h,-i),i=Math.ceil(i);let E=Math.floor((S-i)*.5);for(let s of m)et(p,s,E),E+=s.h;let $=(0,T.join)(o,"cover.png"),z=n.toBuffer("image/png");(0,b.writeFileSync)($,z)}function et(t,e,o){t.fillStyle="white",t.font=e.font,t.fillText(e.str,C*.5,o+e.y)}function ot(t,e){t.font=e.font;let o=t.measureText(e.str),{actualBoundingBoxAscent:n,actualBoundingBoxDescent:r}=o,a=n+r;return{...e,y:n,h:a*e.g}}var d=require("fs"),l=require("path"),L=v(require("degit")),I=require("rimraf");async function D(t){await nt(t),rt(t),it(t)}async function nt({name:t,path:e}){return await(0,L.default)("rdarida/template-electron#main").clone((0,l.join)(e,t))}function rt({name:t,path:e}){["package-lock.json"].forEach(o=>{let n=(0,l.join)(e,t,o);(0,I.rimrafSync)(n)})}function it({name:t,productName:e,path:o}){let n=(0,l.join)(o,t,"package.json"),r=(0,d.readFileSync)(n,{encoding:"utf-8"}),a={...JSON.parse(r),name:t,productName:e,version:"0.0.0"};(0,d.writeFileSync)(n,JSON.stringify(a,null,2))}var u=require("fs"),g=require("path");var F=require("path"),f=(0,F.join)(__dirname,"..","templates");var st=(0,g.join)(f,"license");function R({type:t,year:e,author:o,path:n}){let r=`${t}.txt`,a=(0,g.join)(st,r),m=(0,u.readFileSync)(a,{encoding:"utf-8"}).replace("[year]",e).replace("[author]",o),i=(0,g.join)(n,"LICENSE");(0,u.writeFileSync)(i,m)}var y=require("fs"),h=require("path"),_=v(require("degit")),A=require("rimraf");async function B(t){await ct(t),at(t),pt(t)}async function ct({name:t,path:e}){return await(0,_.default)("rdarida/template-next#main").clone((0,h.join)(e,t))}function at({name:t,path:e}){["package-lock.json"].forEach(o=>{let n=(0,h.join)(e,t,o);(0,A.rimrafSync)(n)})}function pt({name:t,path:e}){let o=(0,h.join)(e,t,"package.json"),n=(0,y.readFileSync)(o,{encoding:"utf-8"}),r={...JSON.parse(n),name:t,version:"0.0.0"};(0,y.writeFileSync)(o,JSON.stringify(r,null,2))}var O=require("fs"),x=require("path");var J=(0,x.join)(f,"prettier");function M({path:t}){let e=(0,O.readdirSync)(J);for(let o of e){let n=(0,x.join)(J,o),r=(0,x.join)(t,`.${o}`);(0,O.copyFileSync)(n,r)}}function G(t){return t.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9\-]/g,"")}(0,H.default)((0,Y.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=>k(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=>R(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()}),async({productName:t,name:e,path:o})=>{e=e||G(t),await D({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()}),async t=>await B(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=>M(t)).help().strict().parse();
|
|
4
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli.ts","../src/cover.ts","../src/electron.ts","../src/license.ts","../src/constants.ts","../src/next.ts","../src/prettier.ts","../src/utils.ts"],"sourcesContent":["#!/usr/bin/env node\nimport yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\n\nimport {\n CoverOptions,\n ElectronOptions,\n LicenseOptions,\n NextOptions,\n PrettierOptions,\n cover,\n electron,\n license,\n next,\n normalize,\n prettier\n} from '.';\n\nyargs(hideBin(process.argv))\n .scriptName('bobp')\n .usage('$0 <cmd> [args]', 'Usage')\n .demandCommand(1, 'Need 1')\n .command<CoverOptions>(\n 'cover <title> <description>',\n 'Generates a PNG cover image (cover.png) in the current working directory',\n yargs => {\n return yargs\n .positional('title', {\n type: 'string',\n describe: 'Main title text displayed on the cover',\n demandOption: true\n })\n .positional('description', {\n type: 'string',\n describe: 'Description text displayed below the title',\n demandOption: true\n })\n .option('path', {\n type: 'string',\n describe: 'Output path for the generated cover image',\n default: process.cwd()\n });\n },\n options => cover(options)\n )\n .command<LicenseOptions>(\n 'license <author> [year] [type]',\n 'Generates a LICENSE file in the current working directory',\n yargs => {\n return yargs\n .positional('author', {\n type: 'string',\n describe: 'Author or copyright holder name',\n demandOption: true\n })\n .positional('year', {\n type: 'string',\n describe: 'Year to be inserted into the license text',\n default: new Date().getFullYear().toString()\n })\n .positional('type', {\n type: 'string',\n describe: 'License type (e.g. \"mit\")',\n default: 'mit'\n })\n .option('path', {\n type: 'string',\n describe: 'Output path for the generated LICENSE file',\n default: process.cwd()\n });\n },\n options => license(options)\n )\n .command<ElectronOptions>(\n 'electron <productName> [name]',\n 'Creates a new Electron project in the current working directory',\n yargs => {\n return yargs\n .positional('productName', {\n type: 'string',\n describe: 'Name of the application',\n demandOption: true\n })\n .positional('name', {\n type: 'string',\n describe: 'Name of the project directory and npm package'\n })\n .option('path', {\n type: 'string',\n describe: 'Output path for the generated Electron project',\n default: process.cwd()\n });\n },\n async ({ productName, name, path }) => {\n name = name || normalize(productName);\n await electron({ name, productName, path });\n }\n )\n .command<NextOptions>(\n 'next <name>',\n 'Creates a new Next.js project in the current working directory',\n yargs => {\n return yargs\n .positional('name', {\n type: 'string',\n describe: 'Name of the project directory and npm package',\n demandOption: true\n })\n .option('path', {\n type: 'string',\n describe: 'Output path for the generated Next.js project',\n default: process.cwd()\n });\n },\n async options => await next(options)\n )\n .command<PrettierOptions>(\n 'prettier',\n 'Copies Prettier configuration files into the current working directory',\n yargs => {\n return yargs.option('path', {\n type: 'string',\n describe: 'Output path for the generated Prettier configuration files',\n default: process.cwd()\n });\n },\n options => prettier(options)\n )\n .help()\n .strict()\n .parse();\n","import { writeFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\nimport { CanvasRenderingContext2D, createCanvas } from 'canvas';\n\n/**\n * Options used to generate a cover image.\n */\nexport type CoverOptions = {\n /** Main title text displayed on the cover */\n title: string;\n\n /**\n * Description text displayed below the title.\n * New lines (`\\n`) are respected and rendered as separate lines.\n */\n description: string;\n\n /**\n * Output path for the generated cover.png\n * (default: the current working directory)\n */\n path: string;\n};\n\ntype Text = {\n str: string;\n font: string;\n y: number;\n h: number;\n g: number;\n};\n\nconst WIDTH = 1280;\nconst HEIGHT = 640;\nconst FONT = '\"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif'; // use 'TgByAQpjkl' to test\nconst TITLE_STYLE = `700 80px ${FONT}`;\nconst DESC_STYLE = `300 48px ${FONT}`;\nconst LINE_GAP = 1.2;\n\n/**\n * Generates a PNG cover image (cover.png) in the current working directory.\n *\n * @param options Configuration options for the cover image.\n */\nexport function cover({ title, description, path }: CoverOptions): void {\n const canvas = createCanvas(WIDTH, HEIGHT);\n const { width, height } = canvas;\n const ctx = canvas.getContext('2d');\n\n ctx.fillStyle = '#001220';\n ctx.fillRect(0, 0, width, height);\n\n ctx.textAlign = 'center';\n ctx.textBaseline = 'top';\n\n const texts: Text[] = [\n { str: title, font: TITLE_STYLE, y: 0, h: 0, g: 1.3 },\n ...description\n .split('\\n')\n .map(line => ({ str: line, font: DESC_STYLE, y: 0, h: 0, g: LINE_GAP }))\n ].map(text => getTextBox(ctx, text));\n\n let sumHeight = texts[texts.length - 1].h;\n sumHeight -= sumHeight / LINE_GAP;\n sumHeight = texts.reduce((p, text) => p + text.h, -sumHeight);\n sumHeight = Math.ceil(sumHeight);\n\n let offsetY = Math.floor((HEIGHT - sumHeight) * 0.5);\n\n for (const text of texts) {\n drawText(ctx, text, offsetY);\n offsetY += text.h;\n }\n\n const output = join(path, 'cover.png');\n const buffer = canvas.toBuffer('image/png');\n writeFileSync(output, buffer);\n}\n\nfunction drawText(ctx: CanvasRenderingContext2D, text: Text, y: number): void {\n ctx.fillStyle = 'white';\n ctx.font = text.font;\n ctx.fillText(text.str, WIDTH * 0.5, y + text.y);\n}\n\nfunction getTextBox(ctx: CanvasRenderingContext2D, text: Text): Text {\n ctx.font = text.font;\n const metrics = ctx.measureText(text.str);\n const { actualBoundingBoxAscent, actualBoundingBoxDescent } = metrics;\n const h = actualBoundingBoxAscent + actualBoundingBoxDescent;\n\n return {\n ...text,\n y: actualBoundingBoxAscent,\n h: h * text.g\n };\n}\n","import { readFileSync, writeFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\nimport degit from 'degit';\nimport { rimrafSync } from 'rimraf';\n\n/**\n * Options used to generate a new Electron project.\n */\nexport type ElectronOptions = {\n /** Name of the project directory and npm package */\n name: string;\n\n /** Name of the application */\n productName: string;\n\n /**\n * Output path for the generated Electron project\n * (default: the current working directory)\n */\n path: string;\n};\n\n/**\n * Creates a new Electron project from a\n * [predefined template](https://github.com/rdarida/template-electron)\n * in the current working directory.\n *\n * @param options Configuration options for the Electron project.\n */\nexport async function electron(\n electronOptions: ElectronOptions\n): Promise<void> {\n await cloneNextTemplate(electronOptions);\n deleteFiles(electronOptions);\n updatePackageJson(electronOptions);\n}\n\nasync function cloneNextTemplate({\n name,\n path\n}: ElectronOptions): Promise<void> {\n const emitter = degit('rdarida/template-electron#main');\n return await emitter.clone(join(path, name));\n}\n\nfunction deleteFiles({ name, path }: ElectronOptions): void {\n ['package-lock.json'].forEach(file => {\n const filePath = join(path, name, file);\n rimrafSync(filePath);\n });\n}\n\nfunction updatePackageJson({ name, productName, path }: ElectronOptions): void {\n const packageJsonPath = join(path, name, 'package.json');\n const content = readFileSync(packageJsonPath, { encoding: 'utf-8' });\n\n const object = {\n ...JSON.parse(content),\n name,\n productName,\n version: '0.0.0'\n };\n\n writeFileSync(packageJsonPath, JSON.stringify(object, null, 2));\n}\n","import { readFileSync, writeFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\nimport { TEMPLATES_DIR } from './constants';\n\n/**\n * Absolute path to the license template directory.\n * This directory contains license text templates.\n */\nconst LICENSE_DIR = join(TEMPLATES_DIR, 'license');\n\n/**\n * Options used to generate a LICENSE file.\n */\nexport type LicenseOptions = {\n /** License type (e.g. `MIT`) */\n type: string;\n\n /** Year to be inserted into the license text */\n year: string;\n\n /** Author or copyright holder name */\n author: string;\n\n /**\n * Output path for the generated LICENSE file\n * (default: the current working directory)\n */\n path: string;\n};\n\n/**\n * Generates a LICENSE file in the current working directory.\n *\n * @param options Configuration options for the license generation.\n */\nexport function license({ type, year, author, path }: LicenseOptions): void {\n const fileName = `${type}.txt`;\n const filePath = join(LICENSE_DIR, fileName);\n const template = readFileSync(filePath, { encoding: 'utf-8' });\n const content = template.replace('[year]', year).replace('[author]', author);\n const destination = join(path, 'LICENSE');\n writeFileSync(destination, content);\n}\n","import { join } from 'node:path';\n\nexport const TEMPLATES_DIR = join(__dirname, '..', 'templates');\n","import { readFileSync, writeFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\nimport degit from 'degit';\nimport { rimrafSync } from 'rimraf';\n\n/**\n * Options used to generate a new Next.js project.\n */\nexport type NextOptions = {\n /** Name of the project directory and npm package */\n name: string;\n\n /**\n * Output path for the generated Next.js project\n * (default: the current working directory)\n */\n path: string;\n};\n\n/**\n * Creates a new Next.js project from a\n * [predefined template](https://github.com/rdarida/template-next)\n * in the current working directory.\n *\n * @param options Configuration options for the Next.js project.\n */\nexport async function next(nextOptions: NextOptions): Promise<void> {\n await cloneNextTemplate(nextOptions);\n deleteFiles(nextOptions);\n updatePackageJson(nextOptions);\n}\n\nasync function cloneNextTemplate({ name, path }: NextOptions): Promise<void> {\n const emitter = degit('rdarida/template-next#main');\n return await emitter.clone(join(path, name));\n}\n\nfunction deleteFiles({ name, path }: NextOptions): void {\n ['package-lock.json'].forEach(file => {\n const filePath = join(path, name, file);\n rimrafSync(filePath);\n });\n}\n\nfunction updatePackageJson({ name, path }: NextOptions): void {\n const packageJsonPath = join(path, name, 'package.json');\n const content = readFileSync(packageJsonPath, { encoding: 'utf-8' });\n\n const object = {\n ...JSON.parse(content),\n name,\n version: '0.0.0'\n };\n\n writeFileSync(packageJsonPath, JSON.stringify(object, null, 2));\n}\n","import { copyFileSync, readdirSync } from 'node:fs';\nimport { join } from 'node:path';\n\nimport { TEMPLATES_DIR } from './constants';\n\n/**\n * Absolute path to the Prettier configuration directory.\n * This directory contains Prettier-related configuration files.\n */\nconst PRETTIER_DIR = join(TEMPLATES_DIR, 'prettier');\n\nexport type PrettierOptions = {\n /**\n * Output path for the generated Prettier configuration files\n * (default: the current working directory)\n */\n path: string;\n};\n\n/**\n * Copies Prettier configuration files into the current working directory.\n */\nexport function prettier({ path }: PrettierOptions): void {\n const files = readdirSync(PRETTIER_DIR);\n\n for (const fileName of files) {\n const src = join(PRETTIER_DIR, fileName);\n const dest = join(path, `.${fileName}`);\n copyFileSync(src, dest);\n }\n}\n","export function normalize(name: string): string {\n return name\n .toLowerCase()\n .replace(/\\s+/g, '-')\n .replace(/[^a-z0-9\\-]/g, '');\n}\n"],"mappings":";wdACA,IAAAA,EAAkB,oBAClBC,EAAwB,yBCFxB,IAAAC,EAA8B,cAC9BC,EAAqB,gBAErBC,EAAuD,kBA8BjDC,EAAQ,KACRC,EAAS,IACTC,EAAO,0DACPC,EAAc,YAAYD,CAAI,GAC9BE,GAAa,YAAYF,CAAI,GAC7BG,EAAW,IAOV,SAASC,EAAM,CAAE,MAAAC,EAAO,YAAAC,EAAa,KAAAC,CAAK,EAAuB,CACtE,IAAMC,KAAS,gBAAaV,EAAOC,CAAM,EACnC,CAAE,MAAAU,E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AE,KAAAH,EAAM,YAAAD,EAAa,KAAAE,CAAK,CAAC,CAC5C,CACF,EACC,QACC,cACA,iEACAN,GACSA,EACJ,WAAW,OAAQ,CAClB,KAAM,SACN,SAAU,gDACV,aAAc,EAChB,CAAC,EACA,OAAO,OAAQ,CACd,KAAM,SACN,SAAU,gDACV,QAAS,QAAQ,IAAI,CACvB,CAAC,EAEL,MAAMC,GAAW,MAAMQ,EAAKR,CAAO,CACrC,EACC,QACC,WACA,yEACAD,GACSA,EAAM,OAAO,OAAQ,CAC1B,KAAM,SACN,SAAU,6DACV,QAAS,QAAQ,IAAI,CACvB,CAAC,EAEHC,GAAWS,EAAST,CAAO,CAC7B,EACC,KAAK,EACL,OAAO,EACP,MAAM","names":["import_yargs","import_helpers","import_node_fs","import_node_path","import_canvas","WIDTH","HEIGHT","FONT","TITLE_STYLE","DESC_STYLE","LINE_GAP","cover","title","description","path","canvas","width","height","ctx","texts","line","text","getTextBox","sumHeight","p","offsetY","drawText","output","buffer","y","metrics","actualBoundingBoxAscent","actualBoundingBoxDescent","h","import_node_fs","import_node_path","import_degit","import_rimraf","electron","electronOptions","cloneNextTemplate","deleteFiles","updatePackageJson","name","path","degit","file","filePath","productName","packageJsonPath","content","object","import_node_fs","import_node_path","import_node_path","TEMPLATES_DIR","LICENSE_DIR","TEMPLATES_DIR","license","type","year","author","path","fileName","filePath","content","destination","import_node_fs","import_node_path","import_degit","import_rimraf","next","nextOptions","cloneNextTemplate","deleteFiles","updatePackageJson","name","path","degit","file","filePath","packageJsonPath","content","object","import_node_fs","import_node_path","PRETTIER_DIR","TEMPLATES_DIR","prettier","path","files","fileName","src","dest","normalize","name","yargs","options","cover","license","productName","name","path","normalize","electron","next","prettier"]}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
`).map(
|
|
1
|
+
"use strict";var H=Object.create;var m=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var Y=Object.getPrototypeOf,z=Object.prototype.hasOwnProperty;var G=(t,e)=>{for(var o in e)m(t,o,{get:e[o],enumerable:!0})},v=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of $(e))!z.call(t,r)&&r!==o&&m(t,r,{get:()=>e[r],enumerable:!(n=M(e,r))||n.enumerable});return t};var N=(t,e,o)=>(o=t!=null?H(Y(t)):{},v(e||!t||!t.__esModule?m(o,"default",{value:t,enumerable:!0}):o,t)),U=t=>v(m({},"__esModule",{value:!0}),t);var ft={};G(ft,{cover:()=>K,electron:()=>X,license:()=>nt,next:()=>rt,normalize:()=>pt,prettier:()=>at});module.exports=U(ft);var C=require("fs"),I=require("path"),j=require("canvas"),w=1280,P=640,L='"Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',W=`700 80px ${L}`,q=`300 48px ${L}`,O=1.2;function K({title:t,description:e,path:o}){let n=(0,j.createCanvas)(w,P),{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 f=[{str:t,font:W,y:0,h:0,g:1.3},...e.split(`
|
|
2
|
+
`).map(s=>({str:s,font:q,y:0,h:0,g:O}))].map(s=>V(a,s)),i=f[f.length-1].h;i-=i/O,i=f.reduce((s,B)=>s+B.h,-i),i=Math.ceil(i);let E=Math.floor((P-i)*.5);for(let s of f)Q(a,s,E),E+=s.h;let J=(0,I.join)(o,"cover.png"),A=n.toBuffer("image/png");(0,C.writeFileSync)(J,A)}function Q(t,e,o){t.fillStyle="white",t.font=e.font,t.fillText(e.str,w*.5,o+e.y)}function V(t,e){t.font=e.font;let o=t.measureText(e.str),{actualBoundingBoxAscent:n,actualBoundingBoxDescent:r}=o,c=n+r;return{...e,y:n,h:c*e.g}}var l=require("fs"),g=require("path"),R=N(require("degit")),D=require("rimraf");async function X(t){await Z(t),tt(t),et(t)}async function Z({name:t,path:e}){return await(0,R.default)("rdarida/template-electron#main").clone((0,g.join)(e,t))}function tt({name:t,path:e}){["package-lock.json"].forEach(o=>{let n=(0,g.join)(e,t,o);(0,D.rimrafSync)(n)})}function et({name:t,productName:e,path:o}){let n=(0,g.join)(o,t,"package.json"),r=(0,l.readFileSync)(n,{encoding:"utf-8"}),c={...JSON.parse(r),name:t,productName:e,version:"0.0.0"};(0,l.writeFileSync)(n,JSON.stringify(c,null,2))}var x=require("fs"),u=require("path");var F=require("path"),d=(0,F.join)(__dirname,"..","templates");var ot=(0,u.join)(d,"license");function nt({type:t,year:e,author:o,path:n}){let r=`${t}.txt`,c=(0,u.join)(ot,r),f=(0,x.readFileSync)(c,{encoding:"utf-8"}).replace("[year]",e).replace("[author]",o),i=(0,u.join)(n,"LICENSE");(0,x.writeFileSync)(i,f)}var y=require("fs"),h=require("path"),k=N(require("degit")),_=require("rimraf");async function rt(t){await it(t),st(t),ct(t)}async function it({name:t,path:e}){return await(0,k.default)("rdarida/template-next#main").clone((0,h.join)(e,t))}function st({name:t,path:e}){["package-lock.json"].forEach(o=>{let n=(0,h.join)(e,t,o);(0,_.rimrafSync)(n)})}function ct({name:t,path:e}){let o=(0,h.join)(e,t,"package.json"),n=(0,y.readFileSync)(o,{encoding:"utf-8"}),r={...JSON.parse(n),name:t,version:"0.0.0"};(0,y.writeFileSync)(o,JSON.stringify(r,null,2))}var T=require("fs"),S=require("path");var b=(0,S.join)(d,"prettier");function at({path:t}){let e=(0,T.readdirSync)(b);for(let o of e){let n=(0,S.join)(b,o),r=(0,S.join)(t,`.${o}`);(0,T.copyFileSync)(n,r)}}function pt(t){return t.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9\-]/g,"")}0&&(module.exports={cover,electron,license,next,normalize,prettier});
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/cover.ts","../src/electron.ts","../src/license.ts","../src/constants.ts","../src/next.ts","../src/prettier.ts","../src/utils.ts"],"sourcesContent":["export * from './cover';\nexport * from './electron';\nexport * from './license';\nexport * from './next';\nexport * from './prettier';\nexport * from './utils';\n","import { writeFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\nimport { CanvasRenderingContext2D, createCanvas } from 'canvas';\n\n/**\n * Options used to generate a cover image.\n */\nexport type CoverOptions = {\n /** Main title text displayed on the cover */\n title: string;\n\n /**\n * Description text displayed below the title.\n * New lines (`\\n`) are respected and rendered as separate lines.\n */\n description: string;\n\n /**\n * Output path for the generated cover.png\n * (default: the current working directory)\n */\n path: string;\n};\n\ntype Text = {\n str: string;\n font: string;\n y: number;\n h: number;\n g: number;\n};\n\nconst WIDTH = 1280;\nconst HEIGHT = 640;\nconst FONT = '\"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif'; // use 'TgByAQpjkl' to test\nconst TITLE_STYLE = `700 80px ${FONT}`;\nconst DESC_STYLE = `300 48px ${FONT}`;\nconst LINE_GAP = 1.2;\n\n/**\n * Generates a PNG cover image (cover.png) in the current working directory.\n *\n * @param options Configuration options for the cover image.\n */\nexport function cover({ title, description, path }: CoverOptions): void {\n const canvas = createCanvas(WIDTH, HEIGHT);\n const { width, height } = canvas;\n const ctx = canvas.getContext('2d');\n\n ctx.fillStyle = '#001220';\n ctx.fillRect(0, 0, width, height);\n\n ctx.textAlign = 'center';\n ctx.textBaseline = 'top';\n\n const texts: Text[] = [\n { str: title, font: TITLE_STYLE, y: 0, h: 0, g: 1.3 },\n ...description\n .split('\\n')\n .map(line => ({ str: line, font: DESC_STYLE, y: 0, h: 0, g: LINE_GAP }))\n ].map(text => getTextBox(ctx, text));\n\n let sumHeight = texts[texts.length - 1].h;\n sumHeight -= sumHeight / LINE_GAP;\n sumHeight = texts.reduce((p, text) => p + text.h, -sumHeight);\n sumHeight = Math.ceil(sumHeight);\n\n let offsetY = Math.floor((HEIGHT - sumHeight) * 0.5);\n\n for (const text of texts) {\n drawText(ctx, text, offsetY);\n offsetY += text.h;\n }\n\n const output = join(path, 'cover.png');\n const buffer = canvas.toBuffer('image/png');\n writeFileSync(output, buffer);\n}\n\nfunction drawText(ctx: CanvasRenderingContext2D, text: Text, y: number): void {\n ctx.fillStyle = 'white';\n ctx.font = text.font;\n ctx.fillText(text.str, WIDTH * 0.5, y + text.y);\n}\n\nfunction getTextBox(ctx: CanvasRenderingContext2D, text: Text): Text {\n ctx.font = text.font;\n const metrics = ctx.measureText(text.str);\n const { actualBoundingBoxAscent, actualBoundingBoxDescent } = metrics;\n const h = actualBoundingBoxAscent + actualBoundingBoxDescent;\n\n return {\n ...text,\n y: actualBoundingBoxAscent,\n h: h * text.g\n };\n}\n","import { readFileSync, writeFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\nimport degit from 'degit';\nimport { rimrafSync } from 'rimraf';\n\n/**\n * Options used to generate a new Electron project.\n */\nexport type ElectronOptions = {\n /** Name of the project directory and npm package */\n name: string;\n\n /** Name of the application */\n productName: string;\n\n /**\n * Output path for the generated Electron project\n * (default: the current working directory)\n */\n path: string;\n};\n\n/**\n * Creates a new Electron project from a\n * [predefined template](https://github.com/rdarida/template-electron)\n * in the current working directory.\n *\n * @param options Configuration options for the Electron project.\n */\nexport async function electron(\n electronOptions: ElectronOptions\n): Promise<void> {\n await cloneNextTemplate(electronOptions);\n deleteFiles(electronOptions);\n updatePackageJson(electronOptions);\n}\n\nasync function cloneNextTemplate({\n name,\n path\n}: ElectronOptions): Promise<void> {\n const emitter = degit('rdarida/template-electron#main');\n return await emitter.clone(join(path, name));\n}\n\nfunction deleteFiles({ name, path }: ElectronOptions): void {\n ['package-lock.json'].forEach(file => {\n const filePath = join(path, name, file);\n rimrafSync(filePath);\n });\n}\n\nfunction updatePackageJson({ name, productName, path }: ElectronOptions): void {\n const packageJsonPath = join(path, name, 'package.json');\n const content = readFileSync(packageJsonPath, { encoding: 'utf-8' });\n\n const object = {\n ...JSON.parse(content),\n name,\n productName,\n version: '0.0.0'\n };\n\n writeFileSync(packageJsonPath, JSON.stringify(object, null, 2));\n}\n","import { readFileSync, writeFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\nimport { TEMPLATES_DIR } from './constants';\n\n/**\n * Absolute path to the license template directory.\n * This directory contains license text templates.\n */\nconst LICENSE_DIR = join(TEMPLATES_DIR, 'license');\n\n/**\n * Options used to generate a LICENSE file.\n */\nexport type LicenseOptions = {\n /** License type (e.g. `MIT`) */\n type: string;\n\n /** Year to be inserted into the license text */\n year: string;\n\n /** Author or copyright holder name */\n author: string;\n\n /**\n * Output path for the generated LICENSE file\n * (default: the current working directory)\n */\n path: string;\n};\n\n/**\n * Generates a LICENSE file in the current working directory.\n *\n * @param options Configuration options for the license generation.\n */\nexport function license({ type, year, author, path }: LicenseOptions): void {\n const fileName = `${type}.txt`;\n const filePath = join(LICENSE_DIR, fileName);\n const template = readFileSync(filePath, { encoding: 'utf-8' });\n const content = template.replace('[year]', year).replace('[author]', author);\n const destination = join(path, 'LICENSE');\n writeFileSync(destination, content);\n}\n","import { join } from 'node:path';\n\nexport const TEMPLATES_DIR = join(__dirname, '..', 'templates');\n","import { readFileSync, writeFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\nimport degit from 'degit';\nimport { rimrafSync } from 'rimraf';\n\n/**\n * Options used to generate a new Next.js project.\n */\nexport type NextOptions = {\n /** Name of the project directory and npm package */\n name: string;\n\n /**\n * Output path for the generated Next.js project\n * (default: the current working directory)\n */\n path: string;\n};\n\n/**\n * Creates a new Next.js project from a\n * [predefined template](https://github.com/rdarida/template-next)\n * in the current working directory.\n *\n * @param options Configuration options for the Next.js project.\n */\nexport async function next(nextOptions: NextOptions): Promise<void> {\n await cloneNextTemplate(nextOptions);\n deleteFiles(nextOptions);\n updatePackageJson(nextOptions);\n}\n\nasync function cloneNextTemplate({ name, path }: NextOptions): Promise<void> {\n const emitter = degit('rdarida/template-next#main');\n return await emitter.clone(join(path, name));\n}\n\nfunction deleteFiles({ name, path }: NextOptions): void {\n ['package-lock.json'].forEach(file => {\n const filePath = join(path, name, file);\n rimrafSync(filePath);\n });\n}\n\nfunction updatePackageJson({ name, path }: NextOptions): void {\n const packageJsonPath = join(path, name, 'package.json');\n const content = readFileSync(packageJsonPath, { encoding: 'utf-8' });\n\n const object = {\n ...JSON.parse(content),\n name,\n version: '0.0.0'\n };\n\n writeFileSync(packageJsonPath, JSON.stringify(object, null, 2));\n}\n","import { copyFileSync, readdirSync } from 'node:fs';\nimport { join } from 'node:path';\n\nimport { TEMPLATES_DIR } from './constants';\n\n/**\n * Absolute path to the Prettier configuration directory.\n * This directory contains Prettier-related configuration files.\n */\nconst PRETTIER_DIR = join(TEMPLATES_DIR, 'prettier');\n\nexport type PrettierOptions = {\n /**\n * Output path for the generated Prettier configuration files\n * (default: the current working directory)\n */\n path: string;\n};\n\n/**\n * Copies Prettier configuration files into the current working directory.\n */\nexport function prettier({ path }: PrettierOptions): void {\n const files = readdirSync(PRETTIER_DIR);\n\n for (const fileName of files) {\n const src = join(PRETTIER_DIR, fileName);\n const dest = join(path, `.${fileName}`);\n copyFileSync(src, dest);\n }\n}\n","export function normalize(name: string): string {\n return name\n .toLowerCase()\n .replace(/\\s+/g, '-')\n .replace(/[^a-z0-9\\-]/g, '');\n}\n"],"mappings":"0jBAAA,IAAAA,GAAA,GAAAC,EAAAD,GAAA,WAAAE,EAAA,aAAAC,EAAA,YAAAC,GAAA,SAAAC,GAAA,cAAAC,GAAA,aAAAC,KAAA,eAAAC,EAAAR,ICAA,IAAAS,EAA8B,cAC9BC,EAAqB,gBAErBC,EAAuD,kBA8BjDC,EAAQ,KACRC,EAAS,IACTC,EAAO,0DACPC,EAAc,YAAYD,CAAI,GAC9BE,EAAa,YAAYF,CAAI,GAC7BG,EAAW,IAOV,SAASC,EAAM,CAAE,MAAAC,EAAO,YAAAC,EAAa,KAAAC,CAAK,EAAuB,CACtE,IAAMC,KAAS,gBAAaV,EAAOC,CAAM,EACnC,CAAE,MAAAU,EAAO,OAAAC,CAAO,EAAIF,EACpBG,EAAMH,EAAO,WAAW,IAAI,EAElCG,EAAI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,EACZ,QAAQ,OAAQ,GAAG,EACnB,QAAQ,eAAgB,EAAE,CAC/B","names":["index_exports","__export","cover","electron","license","next","normalize","prettier","__toCommonJS","import_node_fs","import_node_path","import_canvas","WIDTH","HEIGHT","FONT","TITLE_STYLE","DESC_STYLE","LINE_GAP","cover","title","description","path","canvas","width","height","ctx","texts","line","text","getTextBox","sumHeight","p","offsetY","drawText","output","buffer","y","metrics","actualBoundingBoxAscent","actualBoundingBoxDescent","h","import_node_fs","import_node_path","import_degit","import_rimraf","electron","electronOptions","cloneNextTemplate","deleteFiles","updatePackageJson","name","path","degit","file","filePath","productName","packageJsonPath","content","object","import_node_fs","import_node_path","import_node_path","TEMPLATES_DIR","LICENSE_DIR","TEMPLATES_DIR","license","type","year","author","path","fileName","filePath","content","destination","import_node_fs","import_node_path","import_degit","import_rimraf","next","nextOptions","cloneNextTemplate","deleteFiles","updatePackageJson","name","path","degit","file","filePath","packageJsonPath","content","object","import_node_fs","import_node_path","PRETTIER_DIR","TEMPLATES_DIR","prettier","path","files","fileName","src","dest","normalize","name"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bobp",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.7",
|
|
4
4
|
"description": "How can I help you, Bobp?",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"pretest": "rimraf ./coverage",
|
|
27
27
|
"test": "jest",
|
|
28
28
|
"prebuild": "rimraf ./dist",
|
|
29
|
-
"build": "tsup ./src/index.ts ./src/cli.ts --format cjs --dts --minify",
|
|
29
|
+
"build": "tsup ./src/index.ts ./src/cli.ts --format cjs --dts --clean --minify --shims --sourcemap",
|
|
30
30
|
"prepublishOnly": "npm run build",
|
|
31
31
|
"release": "release-it",
|
|
32
32
|
"predocs": "rimraf ./docs",
|