Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

new-file

philcockfield146MIT1.2.2TypeScript support: included

Simple file templates.

readme

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.

changelog

Change Log

All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.

[Unreleased] - YYYY-MM-DD

Added

Changed

Deprecated

Removed

Fixed

Security


[1.1.7] - 2018-06-27

Changed

Updated refs


[0.0.1] - 2017-01-01

Added

Initial creation and publish.