1.2.2 • Published 5 years ago

new-file v1.2.2

Weekly downloads
95
License
MIT
Repository
github
Last release
5 years ago

Build Status

Title

Super simple file templates, no fuss, just the way you like them.

Video

Install

npm install -g new-file

.template.yml

Create folders that contain the files that make up your template.

Include a .template.yml file within the folder defining the template and variable parameters to insert into the files:

# .template.yml

name: React Component (TSX)
folder: NAME
install: true # Optionally `{yarn|npm} install` on the folder (default: false).
variables:
  NAME: Component name
  DESCRIPTION: Description
  NAMESPACE: Storybook namespace

The folder NAME is taken as a parameter from the command line. Each variable key (eg NAME, DESCRIPTION, NAMESPACE) is inserted into the files where the variable name is surrunded by double __, eg:

export class __NAME__ extends React.Component<I__NAME__Props> {
  public render() {
    return <div>__NAME__</div>;
  }
}

.templates.yml

Place an index in some containing folder where want the templates to be accessible via the command-line from, eg:

# .templates.yml

templateDirs:
  - code/templates/*/
  - helpers/my-other-templates/*/

package.json

If you are creating a template that contains a package.json file within it, you can use the special __LATEST__ version value for dependencies. The generator will retrieve the latest version of the module from NPM and insert it.

{
  "name": "__NAME__",
  "version": "0.0.0",
  "dependencies": {
    "ramda": "__LATEST__"
  },
  "devDependencies": {
    "electron": "__LATEST__",
  },
}

NOTE: If you are already using LATEST as a variable name, your variable name will override this feature.

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.28

5 years ago

1.1.27

5 years ago

1.1.26

5 years ago

1.1.25

5 years ago

1.1.24

5 years ago

1.1.21

5 years ago

1.1.20

5 years ago

1.1.19

5 years ago

1.1.18

5 years ago

1.1.17

5 years ago

1.1.16

5 years ago

1.1.15

5 years ago

1.1.14

5 years ago

1.1.13

5 years ago

1.1.12

5 years ago

1.1.11

5 years ago

1.1.10

5 years ago

1.1.9

5 years ago

1.1.8

6 years ago

1.1.7

6 years ago

1.1.6

7 years ago

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago