0.0.1-alpha.61 • Published 5 years ago

auth0-toolkit v0.0.1-alpha.61

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

Inspired by "Tools without config", "The Melting Pot of JavaScript", and kcd-scripts.

Usage

  1. Create a project:
    • npm init new-auth0-project
    • If it's a TypeScript project: add types into package.json. For example:
      • { "types": "lib/index" }
  2. Install auth-toolkit:
    • npm install --save-dev auth0-toolkit
  3. Run the initialization script:
    • npx auth0-toolkit init
  4. Use included scripts:
    • npm run build -- --watch
    • npm run build:doc
    • npm run validate
    • npm run format
    • npm run lint
    • ... etc.

Configuration

This toolkit exposes a bin called auth0-toolkit. All scripts are stored in lib/scripts and all configuration files are stored in lib/config.

The toolkit determines whether a project is a TypeScript project or JavaScript project depending on whether the types property exists in package.json.

All included tools can have their configuration overwritten by adding flags to the command or by including configuration files in the root of your project. For example: running auth0-toolkit format will run Prettier with the included configuration, but having a .prettierrc in your project will cause the toolkit to use that configuration instead.

Overriding Configuration

During the toolkit setup process, configuration files for the libraries used by the toolkit are created in the project root. Libraries natively supporting an "extend" feature will use those by default to allow for toolkit configuration to be used as a starting point.

All configuration can be overridden with configuration files, package.json properties, or arguments passed to the toolkit binary.

API

Modules

build

Properties

NameDefaultDescription
--out-dirlibOutput destination for built files. (Babel)
--outDirlibOutput destination for built files. (Typescript)
--no-cleanIf present, does not clean target directory.
OTHERSAll CLI options used by related binary. (tsc or babel)

Example

$ npm run build -- --watch --preserveWatchOutput
$ npx auth0-toolkit build
$ npx auth0-toolkit build --watch --preserveWatchOutput

doc

Properties

NameDescription
OTHERSAll CLI options used by related binary. (jsdoc2md)

Example

$ npm run build:doc
$ npx auth0-toolkit doc

format

Properties

NameDescription
--no-writeIf provided, files will not be written to disk. (Defaults to writing to disk)
OTHERSAll CLI options used by the related binary. (prettier)

Example

$ npm run format
$ npx auth0-scripts format

init

Properties

NameDescription
...filesFiles to lint
--no-cacheDisables ESLint --cache arg which is added by this script.
OTHERSAll CLI options used by the related binary. (eslint or tslint)

Example

$ npx auth0-toolkit init

lint

Properties

NameDescription
...filesA list of files to lint.
--no-cacheDisables ESLint's --cache arg.
OTHERSAll CLI options used by related binary. (TSLint or ESLint)

Example

$ npm run lint
$ npm run lint my-file.ts -- --config my-config.json
$ npx auth0-toolkit lint
$ npx auth0-toolkit lint --no-cache
$ npx auth0-toolkit lint my-file.ts

precommit

Properties

NameDescription
OTHERSAll CLI options used by the related binary. (lint-staged)

test

Properties

NameDescription
--no-watchIf provided, tests run once. (Default is watch mode)
OTHERSAll CLI options used by the related binary. (jest)

Example

$ npm run test
$ npx auth0-toolkit test

validate

Properties

NameDescription
...scriptsA list of scripts to specifically run.

Example

$ npm run validate custom-validator
$ npx auth0-toolkit validate
$ npx auth0-toolkit validate custom-validator,another-validator

Author

Auth0

License

This project is licensed under the MIT license. See the LICENSE file for more info.