Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eykrehbein/cook
👨🍳 CLI Tool to create universal boilerplates
https://github.com/eykrehbein/cook
Last synced: 29 days ago
JSON representation
👨🍳 CLI Tool to create universal boilerplates
- Host: GitHub
- URL: https://github.com/eykrehbein/cook
- Owner: eykrehbein
- License: mit
- Created: 2019-12-28T13:55:03.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2019-12-30T12:07:17.000Z (almost 5 years ago)
- Last Synced: 2024-08-13T07:18:09.450Z (4 months ago)
- Language: TypeScript
- Homepage:
- Size: 17.5 MB
- Stars: 111
- Watchers: 3
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - eykrehbein/cook - 👨🍳 CLI Tool to create universal boilerplates (TypeScript)
README
👨🍳
Cook
A minimal CLI Tool to create and use your own boilerplates
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:
```sh
yarn global add @eyk/cook
```With npm:
```sh
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.
```sh
cook create
```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:
```sh
# 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.
```sh
cook create --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 filesThe `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
``````jsx
// {{name}}.js file
import React from 'react';
import 'c{{name}}.css';export default props => {
;
return
};
```Command:
```sh
cook create rc --copy my-boilerplate
```### Applying Boilerplates
To apply a boilerplate, use the following command.
```sh
cook [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:
```sh
cook [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.
```sh
cook list
```### Removing Boilerplates
To remove a boilerplate, use the following command.
```sh
cook remove
```## License
MIT