@featherscloud/pinion
TypeScript icon, indicating that this package has built-in type declarations

0.5.5 • Public • Published

@featherscloud/pinion

CI Download Status

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.

Quick start

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

Documentation

Head over to the Pinion documentation for the full documentation.

License

Copyright (c) 2024 Feathers Cloud Inc.

Licensed under the MIT license.

Package Sidebar

Install

npm i @featherscloud/pinion

Weekly Downloads

3,117

Version

0.5.5

License

MIT

Unpacked Size

99 kB

Total Files

61

Last publish

Collaborators

  • daffl