开发者社区> 镜像站> NPM> new-file
new-file
Simple file templates.
Last updated 2 years ago by philcockfield .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install new-file 
SYNC missed versions from official npm registry.

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.

Current Tags

  • 1.2.2                                ...           latest (2 years ago)

31 Versions

  • 1.2.2                                ...           2 years ago
  • 1.2.1                                ...           2 years ago
  • 1.2.0                                ...           2 years ago
  • 1.1.28                                ...           2 years ago
  • 1.1.27                                ...           2 years ago
  • 1.1.26                                ...           2 years ago
  • 1.1.25                                ...           2 years ago
  • 1.1.24                                ...           2 years ago
  • 1.1.21                                ...           2 years ago
  • 1.1.20                                ...           2 years ago
  • 1.1.19                                ...           2 years ago
  • 1.1.18                                ...           2 years ago
  • 1.1.17                                ...           2 years ago
  • 1.1.16                                ...           2 years ago
  • 1.1.15                                ...           2 years ago
  • 1.1.14                                ...           2 years ago
  • 1.1.13                                ...           2 years ago
  • 1.1.12                                ...           2 years ago
  • 1.1.11                                ...           2 years ago
  • 1.1.10                                ...           2 years ago
  • 1.1.9                                ...           2 years ago
  • 1.1.8                                ...           2 years ago
  • 1.1.7                                ...           2 years ago
  • 1.1.6                                ...           4 years ago
  • 1.1.5                                ...           4 years ago
  • 1.1.4                                ...           4 years ago
  • 1.1.3                                ...           4 years ago
  • 1.1.2                                ...           4 years ago
  • 1.1.1                                ...           4 years ago
  • 1.1.0                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (2)