simonplend / node-project-helper-cli

Command-line tool for running Node.js project tasks.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Command-line interface ideas

simonplend opened this issue · comments

Things this tool can currently be used for

  • Creating the configuration skeleton for a new Node.js project (application or package)
  • Creating the skeleton for a Node.js code example
  • Improving existing projects
    • Adding an EditorConfig configuration file
    • Installing and configuring linting and formatting tools
    • Generating a license file
    • Adding a git repository and pushing it to up to GitHub

Things this tool could be used for in future

  • Adding GitHub Actions CI workflows to projects
  • Adding Renovate configuration to projects
  • Configuring JSDoc types or TypeScript for a project
  • Generating a Contributor Covenant for a project
  • Generating GitHub issue and pull request templates for a project

Commands

nph <command> [<flags>]

nph -p create:app
nph -p create:app:fastify
nph git-init
nph git-commit --message='<message>'
nph github-init --public

nph package-json --esm
nph install-packages  --dependencies='<package_name>' --dev-dependencies='<package_name>'

nph editorconfig
nph prettier
nph eslint
nph lint-staged

nph license
nph readme

Configuration as JSON

{
  "presets": {
    "create:app": {
      "commands": [
        "git-init": true,
        "package-json": [ "--esm" ],
        "editorconfig": true,
        "prettier": true,
        "eslint": true,
        "lint-staged": true,
        "license": true,
        "readme": true
      ]
    },
    "create:app:fastify": {
      "extends": "create:app",
      "commands": {
        "install-packages": [ "--dependencies=fastify" ],
        "git-commit": [ "--message='Add Fastify app skeleton'"],
        "github-init": [ "--public" ]
      }
    }
  }
}

Configuration as TOML

[presets]

# Preset: Create a vanilla Node.js application

[presets.create-app]

[presets.create-app.commands]

git-init = true
package-json = [ "--esm" ]
editorconfig = true
prettier = true
eslint = true
lint-staged = true
license = true
readme = true

# Preset: Create Fastify application

[presets.create-app-fastify]

extends = "create-app"

[presets.create-app-fastify.commands]

install-packages = [ "--dependencies=fastify" ]
git-commit = [ "--message='Add Fastify app skeleton'" ]
github-init = [ "--public" ]