# @armit/generate-template-files

> A simple generator that is independent of any language. Create custom boilerplate, scaffolding, skeleton, and templating code files that you need to create over and over again. All you need is NodeJS installed to get started.

Latest version **0.3.1** (published 2025-08-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install @armit/generate-template-files
pnpm add @armit/generate-template-files
yarn add @armit/generate-template-files
bun add @armit/generate-template-files
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads; pre 1.0.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 0.3.1 |
| Published | 2025-08-03 |
| First published | 2022-11-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=18.0.0 |
| Dependencies | 5 |
| Unpacked size | 73.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Yingchun Tian |
| Maintainers | tianyingchun, hyperse.net |

## Links

- npm: https://www.npmjs.com/package/@armit/generate-template-files
- Repository: https://github.com/armitjs/armit
- Issues: https://github.com/armitjs/armit/issues
- npm.io page: https://npm.io/package/@armit/generate-template-files

## Dependencies (5)

- [enquirer](https://npm.io/package/enquirer.md) ^2.4.1
- [through2](https://npm.io/package/through2.md) ^4.0.2
- [replace-string](https://npm.io/package/replace-string.md) ^4.0.0
- [@armit/logger-node](https://npm.io/package/@armit/logger-node.md) ^0.3.0
- [@armit/file-recursive-copy](https://npm.io/package/@armit/file-recursive-copy.md) ^0.3.1

## Recent versions

- 0.3.1 (latest) — 2025-08-03
- 0.3.0 — 2025-06-01
- 0.2.12 — 2025-03-31
- 0.2.11 — 2025-03-11
- 0.2.10 — 2025-02-10
- 0.2.9 — 2024-12-24
- 0.2.8 — 2024-11-21
- 0.2.7 — 2024-10-13
- 0.2.6 — 2024-09-06
- 0.2.5 — 2024-07-24
- 0.2.4 — 2024-07-15
- 0.2.3 — 2024-06-29
- 0.2.2 — 2024-06-20
- 0.2.1 — 2024-06-13
- 0.2.0 — 2024-06-12
- … 36 more at https://npm.io/package/@armit/generate-template-files/versions

## README

# @armit/generate-template-files

A simple generator that is independent of any language. Create custom boilerplate, scaffolding, skeleton, and templating code files that you need to create over and over again. All you need is NodeJS installed to get started.

## Install globally

- `npm install @armit/generate-template-files`
- `yarn add @armit/generate-template-files`

## Module/Programmatic Usage

1. Create a file called `generate.mjs`( Note that this file name is flexible).
2. In that file, add in the example code below.
3. Run node generate.js within Terminal (Mac) or Powershell (Win) once you've added your template files.

```typescript
import { generateTemplateFiles } from '@armit/generate-template-files';

const config = require('../package.json');

generateTemplateFiles([
  {
    option: 'Create Redux Store',
    defaultCase: '(pascalCase)',
    entry: {
      folderPath: './tools/templates/react/redux-store/',
    },
    stringReplacers: [
      '__store__',
      { question: 'Insert model name', slot: '__model__' },
    ],
    output: {
      path: './src/stores/__store__(lowerCase)',
      pathAndFileNameDefaultCase: '(kebabCase)',
      overwrite: true,
    },
  },
  {
    option: 'Create Reduce Action',
    defaultCase: '(pascalCase)',
    entry: {
      folderPath: './tools/templates/react/redux-store/__store__Action.ts',
    },
    stringReplacers: ['__store__', '__model__'],
    dynamicReplacers: [
      { slot: '__version__', slotValue: config.version },
      { slot: '__description__', slotValue: config.description },
    ],
    output: {
      path: './src/stores/__store__/__store__(lowerCase)/__store__(pascalCase)Action.ts',
      pathAndFileNameDefaultCase: '(kebabCase)',
    },
    onComplete: (results) => {
      console.log(`results`, results);
    },
  },
]);
```

As outlined in the examples folder, I prefer to create a tools folder and place generate.js w/ templates files in there. Additionally, I'll add a script task ("generate": "node ./tools/generate.ts") to my package.json file for convienent running of the generator using npm run generate or yarn generate.

```text
┣━ package.json
┣━ src
┗━ tools/
   ┣━ generate.ts
   ┗━ templates/
      ┣━ SomeFile.ts
      ┗━ __name__(pascalCase)Action.ts
```

## Contributing

Contributions are happily accepted. I respond to all PR's and can offer guidance on where to make changes. For contributing tips see CONTRIBUTING.md

---
_Source: https://npm.io/package/@armit/generate-template-files · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
