Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/tunnckoCoreLabs/charlike

Small, fast and streaming project scaffolder with support for hundreds of template engines (via @JSTransformers) and sane defaults
https://github.com/tunnckoCoreLabs/charlike

engine fast javascript scaffold scaffolder small starter-kit streaming template-engine templates tool

Last synced: 3 months ago
JSON representation

Small, fast and streaming project scaffolder with support for hundreds of template engines (via @JSTransformers) and sane defaults

Lists

README

        

# charlike [![npm version][npmv-img]][npmv-url] [![github release][ghrelease-img]][ghrelease-url] [![License][license-img]][license-url]

> Small, fast and streaming project scaffolder with support for hundreds of template engines and sane defaults

Please consider following this project's author, [Charlike Mike Reagent](https://github.com/tunnckoCore), and :star: the project to show your :heart: and support.

[![Code style][codestyle-img]][codestyle-url]
[![CircleCI linux build][linuxbuild-img]][linuxbuild-url]
[![CodeCov coverage status][codecoverage-img]][codecoverage-url]
[![DavidDM dependency status][dependencies-img]][dependencies-url]
[![Renovate App Status][renovateapp-img]][renovateapp-url]
[![Make A Pull Request][prs-welcome-img]][prs-welcome-url]
[![Semantically Released][standard-release-img]][standard-release-url]

If you have any _how-to_ kind of questions, please read the [Contributing Guide](./CONTRIBUTING.md) and [Code of Conduct](./CODE_OF_CONDUCT.md) documents.
For bugs reports and feature requests, [please create an issue][open-issue-url] or ping
[@tunnckoCore](https://twitter.com/tunnckoCore) at Twitter.

[![Become a Patron][patreon-img]][patreon-url]
[![Conventional Commits][ccommits-img]][ccommits-url]
[![Spectrum community][spectrum-community-img]][spectrum-community-url]
[![NPM Downloads Monthly][downloads-monthly-img]][npmv-url]
[![NPM Downloads Total][downloads-total-img]][npmv-url]
[![Share Love Tweet][shareb]][shareu]

Project is [semantically](https://semver.org) versioned & automatically released through [CircleCI](https://circleci.com) with [Standard Release][standard-release-url].

## Table of Contents

- [Install](#install)
- [CLI](#cli)
- [API](#api)
* [src/index.js](#srcindexjs)
+ [charlike](#charlike)
- [See Also](#see-also)
- [Contributing](#contributing)
* [Guides and Community](#guides-and-community)
* [Support the project](#support-the-project)
* [OPEN Open Source](#open-open-source)
* [Wonderful Contributors](#wonderful-contributors)
- [License](#license)

_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_

## Install

This project requires [**Node.js**](https://nodejs.org) **^8.10.0 || >=10.13.0** _(see [Support & Release Policy](https://github.com/tunnckoCoreLabs/support-release-policy))_. Install it using
[**yarn**](https://yarnpkg.com) or [**npm**](https://npmjs.com).
_We highly recommend to use Yarn when you think to contribute to this project._

```bash
$ yarn add charlike
# or globally
$ yarn global add charlike
```

## CLI

Install it globally or locally and run `charlike --help`.

```
Usage: charlike [name] [description] [flags]

Common Flags:
-h, --help Display this help.
-v, --version Display current version.

Flags:
-n, --name Project's name.
-d, --desc Project description, short for "--project.description".
-o, --owner Usually your GitHub username or organization.
-t, --templates Source templates directory.
--engine Engine to be used in the template files.
--locals Locals for the template files. Support dot notation.
--locals.author.name Project's author name.
--locals.author.email Project's author email. And so on.
--project Project metadata like name, description
--project.name Project name.
--project.description Project description.
--cwd Folder to be used as current working dir.
--ly Shortcut for --locals.license.year (license start year).
--ln Set --locals.license.name.

Examples:
charlike my-new-project --ly 2018 --ln MIT -o myOrg
charlike --project.name foobar --locals.author 'John Snow'
charlike foobar --locals.author.name 'John Snow'
charlike foobar --locals.license 'Apache-2.0' --locals.foo bar
charlike foobar 'This is description'
charlike foobar --project.description 'Some description here'
charlike foobar --desc 'Some description here'
charlike foobar 'Awesome description' --owner tunnckoCoreLabs
charlike --project.name qux --desc 'Yeah descr' --owner tunnckoCore

```

## API

_Generated using [docks](http://npm.im/docks)._

### [src/index.js](/src/index.js)

#### [charlike](/src/index.js#L62)
Generates a complete project using a set of templates.

You can define what _"templates"_ files to be used
by passing `settings.templates`, by default it uses [./templates](./templates)
folder from this repository root.

You can define project metadata in `settings.project` object, which should contain
`name`, `description` properties and also can contain `repo` and `dest`.
By default the destination folder is dynamically built from `settings.cwd` and `settings.project.name`,
but this behavior can be changed. If `settings.project.repo` is passed, then it will be used
instead of the `settings.project.name`.

To control the context of the templates, pass `settings.locals`. The default set of locals
includes `version` string and `project`, `author` and `license` objects.

**Params**
- `settings` **{object}** the only required is `project` which should be an object
- `settings.cwd` **{object}** working directory to create project to, defaults to `process.cwd()`
- `settings.project` **{object}** should contain `name`, `description`, `repo` and `dest`
- `settings.locals` **{object}** to pass more context to template files
- `settings.engine` **{string}** for different template engine to be used in template files, default is `lodash`

**Returns**
- `Promise` if successful, will resolve to object like `{ locals, project, dest, options }`

**Examples**
```javascript
import charlike from 'charlike';

const settings = {
project: { name: 'foobar', description: 'Awesome project' },
cwd: '/home/charlike/code',
templates: '/home/charlike/config/.jsproject',
locals: {
foo: 'bar',
// some helper
toUpperCase: (val) => val.toUpperCase(),
},
};

// the `dest` will be `/home/charlike/code/foobar`
charlike(settings)
.then(({ dest }) => console.log(`Project generated to ${dest}`))
.catch((err) => console.error(`Error occures: ${err.message}; Sorry!`));
```

**[back to top](#thetop)**

## See Also

Some of these projects are used here or were inspiration for this one, others are just related. So, thanks for your existance!

- [@tunnckocore/config](https://www.npmjs.com/package/@tunnckocore/config): All the configs for all the tools, in one place | [homepage](https://github.com/tunnckoCoreLabs/config "All the configs for all the tools, in one place")
- [@tunnckocore/create-project](https://www.npmjs.com/package/@tunnckocore/create-project): Create and scaffold a new project, its GitHub repository and… [more](https://github.com/tunnckoCoreLabs/create-project) | [homepage](https://github.com/tunnckoCoreLabs/create-project "Create and scaffold a new project, its GitHub repository and contents")
- [asia](https://www.npmjs.com/package/asia): Blazingly fast, magical and minimalist testing framework, for Today and… [more](https://github.com/olstenlarck/asia#readme) | [homepage](https://github.com/olstenlarck/asia#readme "Blazingly fast, magical and minimalist testing framework, for Today and Tomorrow")
- [docks](https://www.npmjs.com/package/docks): Extensible system for parsing and generating documentation. It just freaking… [more](https://github.com/tunnckoCore/docks) | [homepage](https://github.com/tunnckoCore/docks "Extensible system for parsing and generating documentation. It just freaking works!")
- [git-commits-since](https://www.npmjs.com/package/git-commits-since): Get all commits since given period of time or by… [more](https://github.com/tunnckoCoreLabs/git-commits-since) | [homepage](https://github.com/tunnckoCoreLabs/git-commits-since "Get all commits since given period of time or by default from latest git semver tag. Understands and follows both SemVer and the Conventional Commits specification.")
- [gitcommit](https://www.npmjs.com/package/gitcommit): Lightweight and joyful `git commit` replacement. Conventional Commits compliant. | [homepage](https://github.com/tunnckoCore/gitcommit "Lightweight and joyful `git commit` replacement. Conventional Commits compliant.")
- [recommended-bump](https://www.npmjs.com/package/recommended-bump): Calculates recommended bump (next semver version) based on given array… [more](https://github.com/tunnckoCoreLabs/recommended-bump) | [homepage](https://github.com/tunnckoCoreLabs/recommended-bump "Calculates recommended bump (next semver version) based on given array of commit messages following Conventional Commits specification")

**[back to top](#thetop)**

## Contributing

### Guides and Community

Please read the [Contributing Guide](./CONTRIBUTING.md) and [Code of Conduct](./CODE_OF_CONDUCT.md) documents for advices.

For bug reports and feature requests, please join our [Spectrum community][spectrum-community-url] forum and open a thread there with prefixing the title of the thread with the name of the project if there's no separate channel for it.

Consider reading the [Support and Release Policy](https://github.com/tunnckoCoreLabs/support-release-policy) guide if you are interested in what are the supported Node.js versions and how we proceed. In short, we support _latest two even-numbered_ Node.js release lines.

### Support the project

[Become a Partner or Sponsor?][patreon-url] :dollar: Check the **Partner**, **Sponsor** or **Omega-level** tiers! :tada: You can get your company logo, link & name on this file. It's also rendered on package page in [npmjs.com][npmv-url] and [yarnpkg.com](https://yarnpkg.com/en/package/charlike) sites too! :rocket:

Not financial support? Okey! [Pull requests](https://github.com/tunnckoCoreLabs/contributing#opening-a-pull-request), stars and all kind of [contributions](https://opensource.guide/how-to-contribute/#what-it-means-to-contribute) are always
welcome. :sparkles:

### OPEN Open Source

This project is following [OPEN Open Source](http://openopensource.org) model

> Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is built on collective efforts and it's not strongly guarded by its founders.

There are a few basic ground-rules for its contributors

1. Any **significant modifications** must be subject to a pull request to get feedback from other contributors.
2. [Pull requests](https://github.com/tunnckoCoreLabs/contributing#opening-a-pull-request) to get feedback are _encouraged_ for any other trivial contributions, but are not required.
3. Contributors should attempt to adhere to the prevailing code-style and development workflow.

### Wonderful Contributors

Thanks to the hard work of these wonderful people this project is alive! It follows the
[all-contributors](https://github.com/kentcdodds/all-contributors) specification.
Don't hesitate to add yourself to that list if you have made any contribution! ;) [See how,
here](https://github.com/jfmengels/all-contributors-cli#usage).

| [
Charlike Mike Reagent](https://tunnckocore.com)
[💻](https://github.com/tunnckoCoreLabs/charlike/commits?author=tunnckoCore "Code") [📖](https://github.com/tunnckoCoreLabs/charlike/commits?author=tunnckoCore "Documentation") [💬](#question-tunnckoCore "Answering Questions") [👀](#review-tunnckoCore "Reviewed Pull Requests") [🔍](#fundingFinding-tunnckoCore "Funding Finding") |
| :---: |

Consider showing your [support](#support-the-project) to them. :sparkling_heart:

## License

Copyright (c) 2016-present, [Charlike Mike Reagent](https://tunnckocore.com) `` & [contributors](#wonderful-contributors).
Released under the [Apache-2.0 License][license-url].

[npmv-url]: https://www.npmjs.com/package/charlike
[npmv-img]: https://badgen.net/npm/v/charlike?icon=npm

[ghrelease-url]: https://github.com/tunnckoCoreLabs/charlike/releases/latest
[ghrelease-img]: https://badgen.net/github/release/tunnckoCoreLabs/charlike?icon=github

[license-url]: https://github.com/tunnckoCoreLabs/charlike/blob/master/LICENSE
[license-img]: https://badgen.net/npm/license/charlike

[codestyle-url]: https://github.com/airbnb/javascript
[codestyle-img]: https://badgen.net/badge/code%20style/airbnb/ff5a5f?icon=airbnb

[linuxbuild-url]: https://circleci.com/gh/tunnckoCoreLabs/charlike/tree/master
[linuxbuild-img]: https://badgen.net/circleci/github/tunnckoCoreLabs/charlike/master?label=build&icon=circleci

[codecoverage-url]: https://codecov.io/gh/tunnckoCoreLabs/charlike
[codecoverage-img]: https://badgen.net/codecov/c/github/tunnckoCoreLabs/charlike?icon=codecov

[dependencies-url]: https://david-dm.org/tunnckoCoreLabs/charlike
[dependencies-img]: https://badgen.net/david/dep/tunnckoCoreLabs/charlike?label=deps

[ccommits-url]: https://conventionalcommits.org/
[ccommits-img]: https://badgen.net/badge/conventional%20commits/v1.0.0/dfb317

[standard-release-url]: https://github.com/standard-release/standard-release
[standard-release-img]: https://badgen.net/badge/semantically/released/05c5ff

[spectrum-community-img]: https://badgen.net/badge/spectrum/community/7b16ff
[spectrum-community-url]: https://spectrum.chat/tunnckoCore

[downloads-weekly-img]: https://badgen.net/npm/dw/charlike
[downloads-monthly-img]: https://badgen.net/npm/dm/charlike
[downloads-total-img]: https://badgen.net/npm/dt/charlike

[renovateapp-url]: https://renovatebot.com
[renovateapp-img]: https://badgen.net/badge/renovate/enabled/green

[prs-welcome-img]: https://badgen.net/badge/PRs/welcome/green
[prs-welcome-url]: http://makeapullrequest.com

[paypal-donate-url]: https://paypal.me/tunnckoCore/10
[paypal-donate-img]: https://badgen.net/badge/$/support/purple

[patreon-url]: https://www.patreon.com/bePatron?u=5579781
[patreon-img]: https://badgen.net/badge/patreon/tunnckoCore/F96854?icon=patreon
[patreon-sponsor-img]: https://badgen.net/badge/become/a%20sponsor/F96854?icon=patreon

[shareu]: https://twitter.com/intent/tweet?text=https://github.com/tunnckoCoreLabs/charlike&via=tunnckoCore
[shareb]: https://badgen.net/badge/twitter/share/1da1f2?icon=twitter

[open-issue-url]: https://github.com/tunnckoCoreLabs/charlike/issues/new