A fast and typesafe code generator
Pinion is a task runner and scaffolding tool that lets you create code generators for any language. Using TypeScript, it gives you full flexibility over what you can do and provides typesafe templating out-of-the box.
Install Pinion into your project via:
npm install @featherscloud/pinion --save-dev
Then create your first generator file e.g. in generators/readme.tpl.ts
like this:
import { PinionContext, toFile, renderTemplate } from '@featherscloud/pinion'
// A template for a markdown Readme file
const readme = () => `
# Hello world
This is a readme generated by Pinion
Copyright (c) ${new Date().getFullYear()}
`
export const generate = (init: PinionContext) =>
Promise.resolve(init)
// Render the readme template
.then(renderTemplate(readme, toFile('readme.md')))
Then run
npx pinion generators/readme.tpl.ts
Head over to the Pinion documentation for the full documentation.
Copyright (c) 2024 Feathers Cloud Inc.
Licensed under the MIT license.