coo
@eyk/cook
npm i @eyk/cook
coo

@eyk/cook

👨‍🍳 CLI Tool to create universal boilerplates

by Eyk

1.3.0 (see all)License:MITTypeScript:Not Found
npm i @eyk/cook
Readme


👨‍🍳
Cook

A minimal CLI Tool to create and use your own boilerplates

NPM Version License PRs Welcome Open Issues

Key Features • Installation • Usage • License

Key Features

  • Create boilerplates containing files and folders with one command
  • Use unlimited variables / placeholders which will be filled on creation
  • Runs on Windows, MacOS and Linux

Installation

With yarn:

yarn global add @eyk/cook

With npm:

npm install -g @eyk/cook

Usage

Creating a Boilerplate

All boilerplates are stored in a newly created directory at HOMEDIR/.cook. You can create a new boilerplate by either creating a folder in this directory or using the following command.

cook create <name>

This command will create a new (empty) directory with the given name. You can modify the content by navigating into it.

Furthermore, you got the option to copy an existing directory into the newly created boilerplate folder automatically. This can be done by using the --copy flag.

Example:

# Copying the current working directory
cook create test --copy

# Copying a specific folder
cook create test --copy preparedFolder/

Cloning Boilerplates from Github

The remote boilerplate needs to be stored inside a folder called template.

template
└─── [any template files or folders]
│ [any other files]

Afterwards, you can copy/download it by using the copy flag.

cook create <name> --copy user/repo

Variables

Cook's boilerplates aren't static. You can use variables inside of folder names, file names and the files' content.

Syntax:

  • {{ variableName }} for using variables in file & folder names
  • c{{ variableName }} for using variables inside of files

The c letter in front of the curly-braces has no special meaning, but it ensures there won't be any conflicts with other curly-braces like in Vue.js files.

Example of creating a boilerplate for a React.js component:

# Current working directory
my-boilerplate
└─── {{name}}
    │   {{name}}.js
    │   {{name}}.css
// {{name}}.js file
import React from 'react';
import 'c{{name}}.css';

export default props => {
  return <div className="c{{name}}"></div>;
};

Command:

cook create rc --copy my-boilerplate

Applying Boilerplates

To apply a boilerplate, use the following command.

cook <name> [targetDir]

This will copy the named boilerplate into the target dir (or, if not specified, into the current working directory)

If you have used any variables, you can specify their value by using flags.

Optionally, you are able to not use any flags to set variables. You'll be prompted to fill in a value for any missing variable flag.

Example:

Specified variables: name, counter

Command:

cook <name> [targetDir] --name HelloWorld --counter 0

This will replace all occurrences of name and counter inside of pathnames and content.

Listing existing Boilerplates

If you want to get a list of all existing boilerplates, you can use the following command.

cook list

Removing Boilerplates

To remove a boilerplate, use the following command.

cook remove <name>

License

MIT

Downloads/wk

2

GitHub Stars

110

LAST COMMIT

2yrs ago

MAINTAINERS

1

CONTRIBUTORS

0

OPEN ISSUES

2

OPEN PRs

0
VersionTagPublished
1.3.0
latest
2yrs ago
No alternatives found
No tutorials found
Add a tutorial