Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jacksteamdev/dot-plop
A simple approach to PlopJS with first class TypeScript support and a one-line plopfile.
https://github.com/jacksteamdev/dot-plop
Last synced: 2 months ago
JSON representation
A simple approach to PlopJS with first class TypeScript support and a one-line plopfile.
- Host: GitHub
- URL: https://github.com/jacksteamdev/dot-plop
- Owner: jacksteamdev
- Created: 2020-02-14T17:36:51.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-08-03T06:32:44.000Z (over 1 year ago)
- Last Synced: 2024-10-18T22:14:33.505Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 559 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# `dot-plop`
A simple approach to PlopJS with first class TypeScript support and a one-line
plopfile.## Installation
```sh
$ npm i plop dot-plop -D
```Put `plopfile.js` in your project directory:
```javascript
module.exports = require('dot-plop')
```## Usage
1. Create a new folder in your project directory called `.plop`.
2. Write your generators in TypeScript and put them in `.plop/generators`.
3. We put our templates in `.plop/templates/`, but you can put them anywhere you
like, just so your generators know where they are.
4. Write your helpers in TypeScript and put them in `.plop/helpers`.
5. Write your Inquirer prompts in TypeScript and put them in `.plop/prompts`.
6. Run `plop` from the command line.`dot-plop` will auto discover your generators and helpers. They will have the
same name as their export name.## Examples
### `.plop/generators/my-generator.ts`
```typescript
import { PlopGenerator } from 'plop'export const units: PlopGenerator = {
description: 'Feature logic and API integrations',
prompts: [
{
type: 'input',
name: 'fileName',
message: 'unit name please',
},
],
actions: [
{
type: 'add',
path: 'src/units/{{dashCase fileName}}.ts',
templateFile: '.plop/templates/units/unit.ts.hbs',
},
{
type: 'add',
path: 'src/units/{{dashCase fileName}}.test.ts',
templateFile: '.plop/templates/units/unit.test.ts.hbs',
},
],
}
```