@chmurson/scaffolding

Application scaffolding for any project.

Usage no npm install needed!

<script type="module">
  import chmursonScaffolding from 'https://cdn.skypack.dev/@chmurson/scaffolding';
</script>

README

Scaffolding any project

Install

npm install -g @chmurson/scaffolding

Simple to use

  1. Prepare scaffolding templates

tpl/src/base.js

This is template of {{ name }}.
The name can be written in different cases, e.g.
param case: {{#paramCase}}{{ name }}{{/paramCase}}
camel case: {{#camelCase}}{{ name }}{{/camelCase}}

Note: Case conversations are made via npm module change-case. For all possible methods please see its README.md

  1. Prepare scaffolding.json
{
  "properties": {
    "name": {
      "pattern": "^[a-zA-Z\\.\\-\\d]+quot;,
      "message": "Name must be only letters, numbers, dots, or dashes",
      "default": "sample",
      "required": true
    },
    "author": {
      "required": true
    }
  },
  "tpl": {
    "tpl/src/base.js": "dist/src/{{name}}.js",
    "tpl/test/base.test": "dist/test/{{name}}"
  }
}
  1. Execute the script.
scaffolding
  1. Input prompt answer.

  2. Generates files by tpl settings. The file contents, filename will be replaced with prompt answer.

Example of use

Example of use

CLI

scaffolding [ConfigFile]

[ConfigFile] - relative path to scaffolding configuration json file. Default: scaffolding.json

Global config file

The script searches for .scaffolding.json in current and parent directories. The closest file to current directory is taken.

Structure of .scaffolding.json:

{
  "configDirectory": "scaffolding"
}

configDirectory - relative to .scaffolding.json path where Script will search for scaffolding configs.

Thanks to it the script can be run quicker e.g. scaffolding my-config.json instead of scaffolding ../../scaffoldings/my-config.json

Further customization

  1. Prepare .default.scaffolding.json
{
  "author": "sideroad"
}
  1. You can override the default setting!

Dependencies with awesome library