# initfiles

> Create multiple files based on custom templates.

Latest version **1.0.0** (published 2019-04-19) · ISC license · 0 weekly downloads

## Install

```sh
npm install initfiles
pnpm add initfiles
yarn add initfiles
bun add initfiles
```

Provides the command `ifs`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-04-19 |
| First published | 2019-04-18 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | obpt123 |

## Links

- npm: https://www.npmjs.com/package/initfiles
- Repository: https://github.com/triday/initfiles
- Homepage: https://github.com/triday/initfiles#readme
- Issues: https://github.com/triday/initfiles/issues
- npm.io page: https://npm.io/package/initfiles

## Dependencies (3)

- [tsharp](https://npm.io/package/tsharp.md) ^1.7.3
- [logtick](https://npm.io/package/logtick.md) ^1.0.0
- [commander](https://npm.io/package/commander.md) ^2.20.0

## Recent versions

- 1.0.0 (latest) — 2019-04-19
- 0.0.4 — 2019-04-18
- 0.0.3 — 2019-04-18
- 0.0.2 — 2019-04-18
- 0.0.1 — 2019-04-18

## README

## InitFiles

```initfiles``` is a code generation tool for frontend project。

![image](https://github.com/triday/initfiles/blob/master/images/demo_react.gif?raw=true)

### How to use

1. ```npm install initfiles -D``` 
2. Create a template file in your project. You can add the **javascript** template file in any folder. eg ```templates/abc.js```.

    ```javascript
    module.exports = function (arg1, arg2) {
        return [
            {
                name: `src/pages/${arg1}/${arg2}.js`,
                content: '// this is js content'
            },
            {
                name: `src/pages/${arg1}/index.js`,
                type: 'append',
                content: '// this is append content\n'
            }
        ]
    }
    ```

    The js template file should return a object array, and the array item schame as below.
    
    | propertyname | description | required | defaultvalue |
    | ------ | ------ | ------ | ------ |
    |name|the file name, it should be a relative file name and can contains folder path.|true| |
    |content|the file content.|true| |
    |type|the file type, ['create' or 'append']. if 'create' then will crate a new file with content, if 'append' then will append the content to the file. |false|'create'|

3. Then you can run the command  ```ifs -t templates/abc.js value1 value2```, in this case, your project root folder then will add two file ```src/pages/value1/value2.js``` and ```src/pages/value1/index.js```.

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