bobp 0.10.15 → 0.11.1
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 +7 -0
- package/dist/cli.js +2 -2
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/templates/license/README.md +0 -7
- package/templates/license/mit.txt +0 -21
- package/templates/prettier/editorconfig +0 -13
- package/templates/prettier/prettierignore +0 -10
- package/templates/prettier/prettierrc +0 -6
package/README.md
CHANGED
|
@@ -96,6 +96,13 @@ npx bobp prettier
|
|
|
96
96
|
|
|
97
97
|
- [Documentation](https://rdarida.github.io/bobp/)
|
|
98
98
|
- [Rowan Atkinson demonstrating how funny "Bob" can be](https://www.youtube.com/watch?v=wOdfNwD9cEA)
|
|
99
|
+
|
|
100
|
+
- **License**
|
|
101
|
+
- [choosealicense.com](https://choosealicense.com/)
|
|
102
|
+
- [choosealicense.com License List](https://github.com/github/choosealicense.com/tree/gh-pages/_licenses)
|
|
103
|
+
- [GitHub License List](https://api.github.com/licenses)
|
|
104
|
+
- [SPDX License List](https://spdx.org/licenses/)
|
|
105
|
+
|
|
99
106
|
</details>
|
|
100
107
|
<hr>
|
|
101
108
|
|
package/dist/cli.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var
|
|
3
|
-
`).map(
|
|
2
|
+
"use strict";var z=Object.create;var y=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var U=Object.getPrototypeOf,W=Object.prototype.hasOwnProperty;var q=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of _(e))!W.call(t,r)&&r!==o&&y(t,r,{get:()=>e[r],enumerable:!(n=M(e,r))||n.enumerable});return t};var m=(t,e,o)=>(o=t!=null?z(U(t)):{},q(e||!t||!t.__esModule?y(o,"default",{value:t,enumerable:!0}):o,t));var G=m(require("yargs")),H=require("yargs/helpers");var v=require("fs"),w=require("path"),b=require("canvas"),N=1280,x=640,E='"Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',K=`700 80px ${E}`,Q=`300 48px ${E}`,O=1.2;function C({title:t,description:e,path:o}){let n=(0,b.createCanvas)(N,x),{width:r,height:i}=n,s=n.getContext("2d");s.fillStyle="#001220",s.fillRect(0,0,r,i),s.textAlign="center",s.textBaseline="top";let d=[{str:t,font:K,y:0,h:0,g:1.3},...e.split(`
|
|
3
|
+
`).map(a=>({str:a,font:Q,y:0,h:0,g:O}))].map(a=>X(s,a)),c=d[d.length-1].h;c-=c/O,c=d.reduce((a,$)=>a+$.h,-c),c=Math.ceil(c);let h=Math.floor((x-c)*.5);for(let a of d)V(s,a,h),h+=a.h;let R=(0,w.join)(o,"cover.png"),Y=n.toBuffer("image/png");(0,v.writeFileSync)(R,Y)}function V(t,e,o){t.fillStyle="white",t.font=e.font,t.fillText(e.str,N*.5,o+e.y)}function X(t,e){t.font=e.font;let o=t.measureText(e.str),{actualBoundingBoxAscent:n,actualBoundingBoxDescent:r}=o,i=n+r;return{...e,y:n,h:i*e.g}}var l=require("fs"),g=require("path"),S=m(require("degit")),P=require("rimraf");async function j(t){await Z(t),tt(t),et(t)}async function Z({name:t,path:e}){return await(0,S.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,P.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"}),i={...JSON.parse(r),name:t,productName:e,version:"0.0.0"};(0,l.writeFileSync)(n,JSON.stringify(i,null,2))}var T=require("fs"),k=require("path");async function L({type:t,year:e,author:o,path:n}){let r=`https://api.github.com/licenses/${t.toLowerCase()}`;return await fetch(r).then(i=>i.json()).then(i=>{let s=i.body.replace("[year]",e).replace("[fullname]",o).replace("[author]",o);(0,T.writeFileSync)((0,k.join)(n,"LICENSE"),s)}).catch()}var f=require("fs"),u=require("path"),F=m(require("degit")),B=require("rimraf");async function D(t){await ot(t),nt(t),rt(t)}async function ot({name:t,path:e}){return await(0,F.default)("rdarida/template-next#main").clone((0,u.join)(e,t))}function nt({name:t,path:e}){["package-lock.json"].forEach(o=>{let n=(0,u.join)(e,t,o);(0,B.rimrafSync)(n)})}function rt({name:t,path:e}){let o=(0,u.join)(e,t,"package.json"),n=(0,f.readFileSync)(o,{encoding:"utf-8"}),r={...JSON.parse(n),name:t,version:"0.0.0"};(0,f.writeFileSync)(o,JSON.stringify(r,null,2))}var I=m(require("degit"));async function J({path:t}){return(0,I.default)("https://gist.github.com/rdarida/d087f8bbf55735a85a36967c20409678").clone(t)}function A(t){return t.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9\-]/g,"")}(0,G.default)((0,H.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=>C(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()}),async t=>await L(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||A(t),await j({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 D(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()}),async t=>await J(t)).help().strict().parse();
|
|
4
4
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +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,EAAO,OAAAC,CAAO,EAAIF,EACpBG,EAAMH,EAAO,WAAW,IAAI,EAElCG,EAAI,UAAY,UAChBA,EAAI,SAAS,EAAG,EAAGF,EAAOC,CAAM,EAEhCC,EAAI,UAAY,SAChBA,EAAI,aAAe,MAEnB,IAAMC,EAAgB,CACpB,CAAE,IAAKP,EAAO,KAAMJ,EAAa,EAAG,EAAG,EAAG,EAAG,EAAG,GAAI,EACpD,GAAGK,EACA,MAAM;AAAA,CAAI,EACV,IAAIO,IAAS,CAAE,IAAKA,EAAM,KAAMX,GAAY,EAAG,EAAG,EAAG,EAAG,EAAGC,CAAS,EAAE,CAC3E,EAAE,IAAIW,GAAQC,GAAWJ,EAAKG,CAAI,CAAC,EAE/BE,EAAYJ,EAAMA,EAAM,OAAS,CAAC,EAAE,EACxCI,GAAaA,EAAYb,EACzBa,EAAYJ,EAAM,OAAO,CAACK,EAAGH,IAASG,EAAIH,EAAK,EAAG,CAACE,CAAS,EAC5DA,EAAY,KAAK,KAAKA,CAAS,EAE/B,IAAIE,EAAU,KAAK,OAAOnB,EAASiB,GAAa,EAAG,EAEnD,QAAWF,KAAQF,EACjBO,GAASR,E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WAAW,OAAQ,CAClB,KAAM,SACN,SAAU,4BACV,QAAS,KACX,CAAC,EACA,OAAO,OAAQ,CACd,KAAM,SACN,SAAU,6CACV,QAAS,QAAQ,IAAI,CACvB,CAAC,EAELC,GAAWE,EAAQF,CAAO,CAC5B,EACC,QACC,gCACA,kEACAD,GACSA,EACJ,WAAW,cAAe,CACzB,KAAM,SACN,SAAU,0BACV,aAAc,EAChB,CAAC,EACA,WAAW,OAAQ,CAClB,KAAM,SACN,SAAU,+CACZ,CAAC,EACA,OAAO,OAAQ,CACd,KAAM,SACN,SAAU,iDACV,QAAS,QAAQ,IAAI,CACvB,CAAC,EAEL,MAAO,CAAE,YAAAI,EAAa,KAAAC,EAAM,KAAAC,CAAK,IAAM,CACrCD,EAAOA,GAAQE,EAAUH,CAAW,EACpC,MAAMI,EAAS,CAAE,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"]}
|
|
1
|
+
{"version":3,"sources":["../src/cli.ts","../src/cover.ts","../src/electron.ts","../src/license.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 async options => await 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 async options => await 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 { writeFileSync } from 'node:fs';\nimport { join } from 'node:path';\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 async function license({\n type,\n year,\n author,\n path\n}: LicenseOptions): Promise<void> {\n const url = `https://api.github.com/licenses/${type.toLowerCase()}`;\n\n return await fetch(url)\n .then(res => res.json())\n .then((json: any) => {\n const content = (json.body as string)\n .replace('[year]', year)\n .replace('[fullname]', author)\n .replace('[author]', author);\n\n writeFileSync(join(path, 'LICENSE'), content);\n })\n .catch();\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 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 degit from 'degit';\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 async function prettier({ path }: PrettierOptions): Promise<void> {\n const emitter = degit(\n 'https://gist.github.com/rdarida/d087f8bbf55735a85a36967c20409678'\n );\n\n return emitter.clone(path);\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,E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AH,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,EAEH,MAAMC,GAAW,MAAMS,EAAST,CAAO,CACzC,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","license","type","year","author","path","url","res","json","content","import_node_fs","import_node_path","import_degit","import_rimraf","next","nextOptions","cloneNextTemplate","deleteFiles","updatePackageJson","name","path","degit","file","filePath","packageJsonPath","content","object","import_degit","prettier","path","degit","normalize","name","yargs","options","cover","license","productName","name","path","normalize","electron","next","prettier"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -66,7 +66,7 @@ type LicenseOptions = {
|
|
|
66
66
|
*
|
|
67
67
|
* @param options Configuration options for the license generation.
|
|
68
68
|
*/
|
|
69
|
-
declare function license({ type, year, author, path }: LicenseOptions): void
|
|
69
|
+
declare function license({ type, year, author, path }: LicenseOptions): Promise<void>;
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* Options used to generate a new Next.js project.
|
|
@@ -99,7 +99,7 @@ type PrettierOptions = {
|
|
|
99
99
|
/**
|
|
100
100
|
* Copies Prettier configuration files into the current working directory.
|
|
101
101
|
*/
|
|
102
|
-
declare function prettier({ path }: PrettierOptions): void
|
|
102
|
+
declare function prettier({ path }: PrettierOptions): Promise<void>;
|
|
103
103
|
|
|
104
104
|
declare function normalize(name: string): string;
|
|
105
105
|
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
`).map(
|
|
1
|
+
"use strict";var I=Object.create;var m=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var A=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty;var _=(t,e)=>{for(var o in e)m(t,o,{get:e[o],enumerable:!0})},y=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of R(e))!Y.call(t,r)&&r!==o&&m(t,r,{get:()=>e[r],enumerable:!(n=H(e,r))||n.enumerable});return t};var x=(t,e,o)=>(o=t!=null?I(A(t)):{},y(e||!t||!t.__esModule?m(o,"default",{value:t,enumerable:!0}):o,t)),$=t=>y(m({},"__esModule",{value:!0}),t);var it={};_(it,{cover:()=>M,electron:()=>q,license:()=>X,next:()=>Z,normalize:()=>rt,prettier:()=>nt});module.exports=$(it);var T=require("fs"),O=require("path"),N=require("canvas"),E=1280,v=640,P='"Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',z=`700 80px ${P}`,G=`300 48px ${P}`,S=1.2;function M({title:t,description:e,path:o}){let n=(0,N.createCanvas)(E,v),{width:r,height:i}=n,s=n.getContext("2d");s.fillStyle="#001220",s.fillRect(0,0,r,i),s.textAlign="center",s.textBaseline="top";let f=[{str:t,font:z,y:0,h:0,g:1.3},...e.split(`
|
|
2
|
+
`).map(c=>({str:c,font:G,y:0,h:0,g:S}))].map(c=>W(s,c)),a=f[f.length-1].h;a-=a/S,a=f.reduce((c,D)=>c+D.h,-a),a=Math.ceil(a);let h=Math.floor((v-a)*.5);for(let c of f)U(s,c,h),h+=c.h;let J=(0,O.join)(o,"cover.png"),B=n.toBuffer("image/png");(0,T.writeFileSync)(J,B)}function U(t,e,o){t.fillStyle="white",t.font=e.font,t.fillText(e.str,E*.5,o+e.y)}function W(t,e){t.font=e.font;let o=t.measureText(e.str),{actualBoundingBoxAscent:n,actualBoundingBoxDescent:r}=o,i=n+r;return{...e,y:n,h:i*e.g}}var l=require("fs"),g=require("path"),w=x(require("degit")),C=require("rimraf");async function q(t){await K(t),Q(t),V(t)}async function K({name:t,path:e}){return await(0,w.default)("rdarida/template-electron#main").clone((0,g.join)(e,t))}function Q({name:t,path:e}){["package-lock.json"].forEach(o=>{let n=(0,g.join)(e,t,o);(0,C.rimrafSync)(n)})}function V({name:t,productName:e,path:o}){let n=(0,g.join)(o,t,"package.json"),r=(0,l.readFileSync)(n,{encoding:"utf-8"}),i={...JSON.parse(r),name:t,productName:e,version:"0.0.0"};(0,l.writeFileSync)(n,JSON.stringify(i,null,2))}var b=require("fs"),j=require("path");async function X({type:t,year:e,author:o,path:n}){let r=`https://api.github.com/licenses/${t.toLowerCase()}`;return await fetch(r).then(i=>i.json()).then(i=>{let s=i.body.replace("[year]",e).replace("[fullname]",o).replace("[author]",o);(0,b.writeFileSync)((0,j.join)(n,"LICENSE"),s)}).catch()}var u=require("fs"),d=require("path"),k=x(require("degit")),F=require("rimraf");async function Z(t){await tt(t),et(t),ot(t)}async function tt({name:t,path:e}){return await(0,k.default)("rdarida/template-next#main").clone((0,d.join)(e,t))}function et({name:t,path:e}){["package-lock.json"].forEach(o=>{let n=(0,d.join)(e,t,o);(0,F.rimrafSync)(n)})}function ot({name:t,path:e}){let o=(0,d.join)(e,t,"package.json"),n=(0,u.readFileSync)(o,{encoding:"utf-8"}),r={...JSON.parse(n),name:t,version:"0.0.0"};(0,u.writeFileSync)(o,JSON.stringify(r,null,2))}var L=x(require("degit"));async function nt({path:t}){return(0,L.default)("https://gist.github.com/rdarida/d087f8bbf55735a85a36967c20409678").clone(t)}function rt(t){return t.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9\-]/g,"")}0&&(module.exports={cover,electron,license,next,normalize,prettier});
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +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,E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AqB,gBAQrB,IAAMC,KAAe,QAAKC,EAAe,UAAU,EAa5C,SAASC,GAAS,CAAE,KAAAC,CAAK,EAA0B,CACxD,IAAMC,KAAQ,eAAYJ,CAAY,EAEtC,QAAWK,KAAYD,EAAO,CAC5B,IAAME,KAAM,QAAKN,EAAcK,CAAQ,EACjCE,KAAO,QAAKJ,EAAM,IAAIE,CAAQ,EAAE,KACtC,gBAAaC,EAAKC,CAAI,CACxB,CACF,CC9BO,SAASC,GAAUC,EAAsB,CAC9C,OAAOA,EACJ,YAAY,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"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/cover.ts","../src/electron.ts","../src/license.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 { writeFileSync } from 'node:fs';\nimport { join } from 'node:path';\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 async function license({\n type,\n year,\n author,\n path\n}: LicenseOptions): Promise<void> {\n const url = `https://api.github.com/licenses/${type.toLowerCase()}`;\n\n return await fetch(url)\n .then(res => res.json())\n .then((json: any) => {\n const content = (json.body as string)\n .replace('[year]', year)\n .replace('[fullname]', author)\n .replace('[author]', author);\n\n writeFileSync(join(path, 'LICENSE'), content);\n })\n .catch();\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 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 degit from 'degit';\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 async function prettier({ path }: PrettierOptions): Promise<void> {\n const emitter = degit(\n 'https://gist.github.com/rdarida/d087f8bbf55735a85a36967c20409678'\n );\n\n return emitter.clone(path);\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,EAAA,SAAAC,EAAA,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,UAAY,UAChBA,EAAI,SAAS,EAAG,EAAGF,EAAOC,CAAM,EAEhCC,EAAI,UAAY,SAChBA,EAAI,aAAe,MAEnB,IAAMC,EAAgB,CACpB,CAAE,IAAKP,EAAO,KAAMJ,EAAa,EAAG,EAAG,EAAG,EAAG,EAAG,GAAI,EACpD,GAAGK,EACA,MAAM;AAAA,CAAI,EACV,IAAIO,IAAS,CAAE,IAAKA,EAAM,KAAMX,EAAY,EAAG,EAAG,EAAG,EAAG,EAAGC,CAAS,EAAE,CAC3E,EAAE,IAAIW,GAAQC,EAAWJ,EAAKG,CAAI,CAAC,EAE/BE,EAAYJ,EAAMA,EAAM,OAAS,CAAC,EAAE,EACxCI,GAAaA,EA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QAAQE,GAAQ,CACpC,IAAMC,KAAW,QAAKH,EAAMD,EAAMG,CAAI,KACtC,cAAWC,CAAQ,CACrB,CAAC,CACH,CAEA,SAASL,GAAkB,CAAE,KAAAC,EAAM,KAAAC,CAAK,EAAsB,CAC5D,IAAMI,KAAkB,QAAKJ,EAAMD,EAAM,cAAc,EACjDM,KAAU,gBAAaD,EAAiB,CAAE,SAAU,OAAQ,CAAC,EAE7DE,EAAS,CACb,GAAG,KAAK,MAAMD,CAAO,EACrB,KAAAN,EACA,QAAS,OACX,KAEA,iBAAcK,EAAiB,KAAK,UAAUE,EAAQ,KAAM,CAAC,CAAC,CAChE,CCxDA,IAAAC,EAAkB,oBAalB,eAAsBC,GAAS,CAAE,KAAAC,CAAK,EAAmC,CAKvE,SAJgB,EAAAC,SACd,kEACF,EAEe,MAAMD,CAAI,CAC3B,CCnBO,SAASE,GAAUC,EAAsB,CAC9C,OAAOA,EACJ,YAAY,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","license","type","year","author","path","url","res","json","content","import_node_fs","import_node_path","import_degit","import_rimraf","next","nextOptions","cloneNextTemplate","deleteFiles","updatePackageJson","name","path","degit","file","filePath","packageJsonPath","content","object","import_degit","prettier","path","degit","normalize","name"]}
|
package/package.json
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
# License
|
|
2
|
-
|
|
3
|
-
## Resources
|
|
4
|
-
- [choosealicense.com](https://choosealicense.com/)
|
|
5
|
-
- [choosealicense.com License List](https://github.com/github/choosealicense.com/tree/gh-pages/_licenses)
|
|
6
|
-
- [GitHub License List](https://api.github.com/licenses)
|
|
7
|
-
- [SPDX License List](https://spdx.org/licenses/)
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) [year] [author]
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|