1.4.0 • Published 1 year ago

pastry-cli v1.4.0

Weekly downloads
53
License
ISC
Repository
github
Last release
1 year ago

Pastry-CLI

This CLI aims to help speed up your workflow, guidelines and code reusability by adding support for pasting template building blocks.

Since it's not related to any specific frameworks or languages it can be used everywhere and for anything with minimal setup and full control.

Installation

Install globally with npm npm i -g pastry-cli or yarn yarn global add pastry-cli

Setup/Usage

  1. Create a /pastries directory in your project source directory.
  2. Populate the directory with template files/folders.
  3. Run pastry inside your terminal while located inside your project.

The cli will guide you through the rest of the steps.

It will look up for a /pastries directory starting from your cwd.

This means that you can have default pastries for all projects by placing them in a parent directory.

Name replacement

You can replace any text including filenames with the name you provide when running pastry.

For example: running pastry -n testFile would change the following:

PLACEHOLDER.ts ~> testFile.ts

When changing text inside a file you have more options:

export default PLACEHOLDER' ~> export default testFile

export default UPPER_PLACEHOLDER' ~> export default TESTFILE

export default LOWER_PLACEHOLDER' ~> export default testfile

export default PASCAL_PLACEHOLDER' ~> export default TestFile

Optional Snippets

With optional snippets you can predefine parts of code you might want to use in a file. For example this will prompt you if you want to include the log snippet:

// pastry-start log
console.log('I may be part of the file, yay!')
// pastry-end log

Renaming existing files

By running pastry --rename you can rename existing files. Currently, there is only support to rename together with the parent directory. The name of the directory will be used as PLACEHOLDER is used normally.

Available arguments

ArgumentShorthandDescription
--name-nDefine the new name
--path-pDefine the target path
--template-tName of the template to use
--rename-rRename existing
--help-hList available arguments

Configuration

Configuration can be done by creating a .pastryconfig.json in the root directory for the project.

{
  "templateDir": "{YOUR_TEMPLATE_DIRECTORY}" // default: pastries
}
1.4.0

1 year ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.0

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

0.0.2

9 years ago

0.0.1

9 years ago