js-gardener
Minimizes project setup and maintenance complexity, so you can focus on writing code.
Last updated 3 days ago by simlu .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install js-gardener 
SYNC missed versions from official npm registry.

Gardener gardener

Build Status Test Coverage Dependabot Status Dependencies NPM Downloads Semantic-Release Gardener

Enforces highest code quality and minimizes package setup and maintenance complexity - so you can focus on writing code. Highly recommended if you are getting started with a new package and extremely useful if you are maintaining multiple packages.

What it does

  • Enforces best code style practises using ESLint and YAMLlint
  • Automates and assists with config generation and best practices via robo-config
  • Scans dependencies for vulnerabilities using npm audit
  • Provides various integrity tests (e.g. checks for un-used dependencies)
  • Enforces 100% test coverage using Nyc

Getting Started

Preparation

  • Create New Project (e.g. using Webstorm)
  • Create New Repository on Github
  • Run git init, git remote add origin URL, git checkout -b master
  • Run npm init and fill in details

Install Gardener

$ npm install --save-dev js-gardener

Run Basic Setup

Create gardener.js in the root folder with the following contents

const gardener = require('js-gardener');

if (require.main === module) {
  gardener().catch(() => process.exit(1));
}

Now create a .roboconfig.json file. Recommended for OpenSource npm packages is the following:

{
  "@blackflux/robo-config-plugin": {
    "tasks": [
      "assorted/@npm-opensource"
    ],
    "variables": {
      "repoKey": "org-name/repo-name",
      "packageName": "repo-name",
      "projectName": "repo-name",
      "owner": "owner-name",
      "ownerName": "Owner Name",
      "mergeBot": "mergebot-name"
    }
  }
}

Then run

$ node gardener

This will generate some files and alter your existing package.json file.

Create your files in the src folder and corresponding tests in the test folder (Mocha and Chai work great), and ensure everything works fine by running npm test. Finalize your README.md and package.json and commit and push to GitHub.

Run Tests Locally

To run all tests locally

$ npm t

and in debug mode with

$ npm t -- --debug

All Mocha options can be passed using double dash. E.g. to run individual tests

$ npm run test-simple -- -g "Partial Test Description Here"

To auto fix fixable eslint problems run

$ node gardener.js --fix

Structure

Folders - Write your tests in the test and your code in the src folder. The lib folder is used as the build target. Test files must be of format *.spec.js.

Branches - You release branch is master. Develop against dev or feature branches. When you are ready for a release, merge your changes into master.

Coverage

Customize the nyc section in your package.json

To completely ignore files from coverage put them into the exclude section in nyc.

Options

logger

Type: logger
Default: fancy-log

Attach custom logger.

skip

Type: array
Default: []

Array of tasks to skip. Should not be necessary to use unless you really need to. Available tasks are:

  • robo: Apply robo-config configuration file.
  • package: Alter package.json
  • structure: Enforce that test file structure matches lib content
  • audit: Runs npm audit and throws errors for old or important issues.
  • eslint: Ensure code is according to eslint definitions.
  • yamllint: Ensure yaml files are passing lint
  • depcheck: Ensure dependencies are installed as specified in package.json
  • depused: Ensure all installed dependencies are used

cwd

Type: string
Default: process.cwd()

Specify the directory to run the tests against. Useful if you have multiple packages that you manage centralized from a parent folder.

docker

Type: boolean
Default: false

Execution will fail if not inside docker container, when set to true.

Ignore Files

.eslintignore

Define files which should be excluded for eslint. Always excluded files can be found here.

.depunusedignore

Define packages that should be excluded from usage check. Useful when a false negative is detected, e.g. for plugins where usage is defined in configuration. Always excluded packages can be found here.

.structignore

Define test files that should not be checked for structure. Usually not necessary. Always excluded test files can be found here.

Example Projects

This project utilizes itself for testing - how cool is that? All other projects published under blackflux also utilize this framework.

Example project using js-gardener and lambda-tdd can be found here.

All blackflux npm packages also utilize Gardener.

Current Tags

  • 2.0.157                                ...           latest (3 days ago)

331 Versions

  • 2.0.157                                ...           3 days ago
  • 2.0.156                                ...           3 days ago
  • 2.0.155                                ...           20 days ago
  • 2.0.154                                ...           a month ago
  • 2.0.153                                ...           a month ago
  • 2.0.152                                ...           2 months ago
  • 2.0.151                                ...           2 months ago
  • 2.0.150                                ...           2 months ago
  • 2.0.149                                ...           2 months ago
  • 2.0.148                                ...           2 months ago
  • 2.0.147                                ...           2 months ago
  • 2.0.146                                ...           2 months ago
  • 2.0.145                                ...           2 months ago
  • 2.0.144                                ...           2 months ago
  • 2.0.143                                ...           2 months ago
  • 2.0.142                                ...           2 months ago
  • 2.0.141                                ...           2 months ago
  • 2.0.140                                ...           2 months ago
  • 2.0.139                                ...           2 months ago
  • 2.0.138                                ...           2 months ago
  • 2.0.137                                ...           3 months ago
  • 2.0.136                                ...           3 months ago
  • 2.0.135                                ...           3 months ago
  • 2.0.134                                ...           3 months ago
  • 2.0.133                                ...           3 months ago
  • 2.0.132                                ...           3 months ago
  • 2.0.131                                ...           4 months ago
  • 2.0.130                                ...           5 months ago
  • 2.0.129                                ...           5 months ago
  • 2.0.128                                ...           5 months ago
  • 2.0.127                                ...           5 months ago
  • 2.0.126                                ...           5 months ago
  • 2.0.125                                ...           5 months ago
  • 2.0.124                                ...           5 months ago
  • 2.0.123                                ...           5 months ago
  • 2.0.122                                ...           5 months ago
  • 2.0.121                                ...           5 months ago
  • 2.0.120                                ...           5 months ago
  • 2.0.119                                ...           5 months ago
  • 2.0.118                                ...           6 months ago
  • 2.0.117                                ...           6 months ago
  • 2.0.116                                ...           6 months ago
  • 2.0.115                                ...           6 months ago
  • 2.0.114                                ...           6 months ago
  • 2.0.113                                ...           7 months ago
  • 2.0.112                                ...           7 months ago
  • 2.0.111                                ...           7 months ago
  • 2.0.110                                ...           7 months ago
  • 2.0.109                                ...           7 months ago
  • 2.0.108                                ...           7 months ago
  • 2.0.107                                ...           8 months ago
  • 2.0.106                                ...           8 months ago
  • 2.0.105                                ...           8 months ago
  • 2.0.104                                ...           8 months ago
  • 2.0.103                                ...           8 months ago
  • 2.0.102                                ...           8 months ago
  • 2.0.101                                ...           8 months ago
  • 2.0.100                                ...           8 months ago
  • 2.0.99                                ...           8 months ago
  • 2.0.98                                ...           8 months ago
  • 2.0.97                                ...           8 months ago
  • 2.0.96                                ...           8 months ago
  • 2.0.95                                ...           8 months ago
  • 2.0.94                                ...           8 months ago
  • 2.0.93                                ...           8 months ago
  • 2.0.92                                ...           8 months ago
  • 2.0.91                                ...           8 months ago
  • 2.0.90                                ...           8 months ago
  • 2.0.89                                ...           8 months ago
  • 2.0.88                                ...           8 months ago
  • 2.0.87                                ...           8 months ago
  • 2.0.86                                ...           8 months ago
  • 2.0.85                                ...           8 months ago
  • 2.0.84                                ...           8 months ago
  • 2.0.83                                ...           9 months ago
  • 2.0.82                                ...           9 months ago
  • 2.0.81                                ...           9 months ago
  • 2.0.80                                ...           9 months ago
  • 2.0.79                                ...           9 months ago
  • 2.0.78                                ...           9 months ago
  • 2.0.77                                ...           9 months ago
  • 2.0.76                                ...           9 months ago
  • 2.0.75                                ...           9 months ago
  • 2.0.74                                ...           9 months ago
  • 2.0.73                                ...           9 months ago
  • 2.0.72                                ...           9 months ago
  • 2.0.71                                ...           9 months ago
  • 2.0.70                                ...           9 months ago
  • 2.0.69                                ...           9 months ago
  • 2.0.68                                ...           9 months ago
  • 2.0.67                                ...           9 months ago
  • 2.0.66                                ...           9 months ago
  • 2.0.65                                ...           9 months ago
  • 2.0.64                                ...           9 months ago
  • 2.0.63                                ...           9 months ago
  • 2.0.62                                ...           9 months ago
  • 2.0.61                                ...           9 months ago
  • 2.0.60                                ...           9 months ago
  • 2.0.59                                ...           9 months ago
  • 2.0.58                                ...           10 months ago
  • 2.0.57                                ...           10 months ago
  • 2.0.56                                ...           10 months ago
  • 2.0.55                                ...           10 months ago
  • 2.0.54                                ...           10 months ago
  • 2.0.53                                ...           10 months ago
  • 2.0.52                                ...           10 months ago
  • 2.0.51                                ...           10 months ago
  • 2.0.50                                ...           10 months ago
  • 2.0.49                                ...           10 months ago
  • 2.0.48                                ...           10 months ago
  • 2.0.47                                ...           10 months ago
  • 2.0.46                                ...           10 months ago
  • 2.0.45                                ...           10 months ago
  • 2.0.44                                ...           10 months ago
  • 2.0.43                                ...           10 months ago
  • 2.0.42                                ...           a year ago
  • 2.0.41                                ...           a year ago
  • 2.0.40                                ...           a year ago
  • 2.0.39                                ...           a year ago
  • 2.0.38                                ...           a year ago
  • 2.0.37                                ...           a year ago
  • 2.0.36                                ...           a year ago
  • 2.0.35                                ...           a year ago
  • 2.0.34                                ...           a year ago
  • 2.0.33                                ...           a year ago
  • 2.0.32                                ...           a year ago
  • 2.0.31                                ...           a year ago
  • 2.0.30                                ...           a year ago
  • 2.0.29                                ...           a year ago
  • 2.0.28                                ...           a year ago
  • 2.0.27                                ...           a year ago
  • 2.0.26                                ...           a year ago
  • 2.0.25                                ...           a year ago
  • 2.0.24                                ...           a year ago
  • 2.0.23                                ...           a year ago
  • 2.0.22                                ...           a year ago
  • 2.0.21                                ...           a year ago
  • 2.0.20                                ...           a year ago
  • 2.0.19                                ...           a year ago
  • 2.0.18                                ...           a year ago
  • 2.0.17                                ...           a year ago
  • 2.0.16                                ...           a year ago
  • 2.0.15                                ...           a year ago
  • 2.0.14                                ...           a year ago
  • 2.0.13                                ...           a year ago
  • 2.0.12                                ...           a year ago
  • 2.0.11                                ...           a year ago
  • 2.0.10                                ...           a year ago
  • 2.0.9                                ...           a year ago
  • 2.0.8                                ...           a year ago
  • 2.0.7                                ...           a year ago
  • 2.0.6                                ...           a year ago
  • 2.0.5                                ...           a year ago
  • 2.0.4                                ...           a year ago
  • 2.0.3                                ...           a year ago
  • 2.0.2                                ...           a year ago
  • 2.0.1                                ...           a year ago
  • 2.0.0                                ...           a year ago
  • 1.38.6                                ...           a year ago
  • 1.38.5                                ...           a year ago
  • 1.38.4                                ...           a year ago
  • 1.38.3                                ...           a year ago
  • 1.38.2                                ...           a year ago
  • 1.38.1                                ...           a year ago
  • 1.38.0                                ...           a year ago
  • 1.37.10                                ...           a year ago
  • 1.37.9                                ...           a year ago
  • 1.37.8                                ...           a year ago
  • 1.37.7                                ...           a year ago
  • 1.37.6                                ...           a year ago
  • 1.37.5                                ...           a year ago
  • 1.37.4                                ...           a year ago
  • 1.37.3                                ...           a year ago
  • 1.37.2                                ...           a year ago
  • 1.37.1                                ...           a year ago
  • 1.37.0                                ...           a year ago
  • 1.36.0                                ...           a year ago
  • 1.35.1                                ...           a year ago
  • 1.35.0                                ...           a year ago
  • 1.34.2                                ...           a year ago
  • 1.34.1                                ...           a year ago
  • 1.34.0                                ...           a year ago
  • 1.33.0                                ...           2 years ago
  • 1.32.0                                ...           2 years ago
  • 1.31.11                                ...           2 years ago
  • 1.31.10                                ...           2 years ago
  • 1.31.9                                ...           2 years ago
  • 1.31.8                                ...           2 years ago
  • 1.31.7                                ...           2 years ago
  • 1.31.6                                ...           2 years ago
  • 1.31.5                                ...           2 years ago
  • 1.31.4                                ...           2 years ago
  • 1.31.3                                ...           2 years ago
  • 1.31.2                                ...           2 years ago
  • 1.31.1                                ...           2 years ago
  • 1.31.0                                ...           2 years ago
  • 1.30.3                                ...           2 years ago
  • 1.30.2                                ...           2 years ago
  • 1.30.1                                ...           2 years ago
  • 1.30.0                                ...           2 years ago
  • 1.29.0                                ...           2 years ago
  • 1.28.0                                ...           2 years ago
  • 1.27.3                                ...           2 years ago
  • 1.27.2                                ...           2 years ago
  • 1.27.1                                ...           2 years ago
  • 1.27.0                                ...           2 years ago
  • 1.26.4                                ...           2 years ago
  • 1.26.3                                ...           2 years ago
  • 1.26.2                                ...           2 years ago
  • 1.26.1                                ...           2 years ago
  • 1.26.0                                ...           2 years ago
  • 1.25.0                                ...           2 years ago
  • 1.24.1                                ...           2 years ago
  • 1.24.0                                ...           2 years ago
  • 1.23.6                                ...           2 years ago
  • 1.23.5                                ...           2 years ago
  • 1.23.4                                ...           2 years ago
  • 1.23.3                                ...           2 years ago
  • 1.23.2                                ...           2 years ago
  • 1.23.1                                ...           2 years ago
  • 1.23.0                                ...           2 years ago
  • 1.22.15                                ...           2 years ago
  • 1.22.14                                ...           2 years ago
  • 1.22.13                                ...           2 years ago
  • 1.22.12                                ...           2 years ago
  • 1.22.11                                ...           2 years ago
  • 1.22.10                                ...           2 years ago
  • 1.22.9                                ...           2 years ago
  • 1.22.8                                ...           2 years ago
  • 1.22.7                                ...           2 years ago
  • 1.22.6                                ...           2 years ago
  • 1.22.5                                ...           2 years ago
  • 1.22.4                                ...           2 years ago
  • 1.22.3                                ...           2 years ago
  • 1.22.2                                ...           2 years ago
  • 1.22.1                                ...           2 years ago
  • 1.22.0                                ...           2 years ago
  • 1.21.4                                ...           2 years ago
  • 1.21.3                                ...           2 years ago
  • 1.21.2                                ...           2 years ago
  • 1.21.1                                ...           2 years ago
  • 1.21.0                                ...           2 years ago
  • 1.20.3                                ...           2 years ago
  • 1.20.2                                ...           2 years ago
  • 1.20.1                                ...           2 years ago
  • 1.20.0                                ...           2 years ago
  • 1.19.0                                ...           2 years ago
  • 1.18.0                                ...           2 years ago
  • 1.17.1                                ...           2 years ago
  • 1.17.0                                ...           2 years ago
  • 1.16.0                                ...           2 years ago
  • 1.15.0                                ...           2 years ago
  • 1.14.1                                ...           2 years ago
  • 1.14.0                                ...           2 years ago
  • 1.13.1                                ...           2 years ago
  • 1.13.0                                ...           2 years ago
  • 1.12.4                                ...           2 years ago
  • 1.12.3                                ...           2 years ago
  • 1.12.2                                ...           2 years ago
  • 1.12.1                                ...           2 years ago
  • 1.12.0                                ...           2 years ago
  • 1.11.27                                ...           2 years ago
  • 1.11.26                                ...           2 years ago
  • 1.11.25                                ...           2 years ago
  • 1.11.24                                ...           2 years ago
  • 1.11.23                                ...           2 years ago
  • 1.11.22                                ...           2 years ago
  • 1.11.21                                ...           2 years ago
  • 1.11.20                                ...           2 years ago
  • 1.11.19                                ...           2 years ago
  • 1.11.18                                ...           2 years ago
  • 1.11.17                                ...           2 years ago
  • 1.11.16                                ...           2 years ago
  • 1.11.15                                ...           2 years ago
  • 1.11.14                                ...           2 years ago
  • 1.11.13                                ...           2 years ago
  • 1.11.12                                ...           2 years ago
  • 1.11.11                                ...           2 years ago
  • 1.11.10                                ...           2 years ago
  • 1.11.9                                ...           2 years ago
  • 1.11.8                                ...           2 years ago
  • 1.11.7                                ...           2 years ago
  • 1.11.6                                ...           2 years ago
  • 1.11.5                                ...           2 years ago
  • 1.11.4                                ...           2 years ago
  • 1.11.3                                ...           2 years ago
  • 1.11.2                                ...           2 years ago
  • 1.11.1                                ...           2 years ago
  • 1.11.0                                ...           2 years ago
  • 1.10.21                                ...           2 years ago
  • 1.10.20                                ...           2 years ago
  • 1.10.19                                ...           2 years ago
  • 1.10.18                                ...           2 years ago
  • 1.10.17                                ...           2 years ago
  • 1.10.16                                ...           2 years ago
  • 1.10.15                                ...           2 years ago
  • 1.10.14                                ...           2 years ago
  • 1.10.13                                ...           2 years ago
  • 1.10.12                                ...           2 years ago
  • 1.10.11                                ...           2 years ago
  • 1.10.10                                ...           2 years ago
  • 1.10.9                                ...           2 years ago
  • 1.10.8                                ...           2 years ago
  • 1.10.7                                ...           2 years ago
  • 1.10.6                                ...           2 years ago
  • 1.10.5                                ...           2 years ago
  • 1.10.4                                ...           2 years ago
  • 1.10.3                                ...           2 years ago
  • 1.10.2                                ...           2 years ago
  • 1.10.1                                ...           2 years ago
  • 1.10.0                                ...           2 years ago
  • 1.9.1                                ...           2 years ago
  • 1.9.0                                ...           2 years ago
  • 1.8.3                                ...           2 years ago
  • 1.8.2                                ...           2 years ago
  • 1.8.1                                ...           2 years ago
  • 1.8.0                                ...           2 years ago
  • 1.7.2                                ...           2 years ago
  • 1.7.1                                ...           2 years ago
  • 1.7.0                                ...           3 years ago
  • 1.6.0                                ...           3 years ago
  • 1.5.4                                ...           3 years ago
  • 1.5.3                                ...           3 years ago
  • 1.5.2                                ...           3 years ago
  • 1.5.1                                ...           3 years ago
  • 1.5.0                                ...           3 years ago
  • 1.4.0                                ...           3 years ago
  • 1.3.0                                ...           3 years ago
  • 1.2.0                                ...           3 years ago
  • 1.1.0                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 5,293
Last Day 1
Last Week 380
Last Month 451
Dependencies (10)

Copyright 2014 - 2016 © taobao.org |