1.0.7 • Published 6 years ago

adonis-ts-arche v1.0.7

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

Adonis TS arche

This repo contains an archetype for builder. It is used by AdonisJs when developing packages.

The builder is a tool, which let you define your configuration inside an archetype and then all other projects can extend it. This way we ensure that we are using the latest/consistent configuration and hence no duplication is required.

Installation

Make sure to install it as a dev dependency

npm i --save-dev builder adonis-ts-arche

After installation you can execute commands using the builder binary installed inside ./node_modules/.bin/builder.

Setup

Run the following commands to setup your project. It is recommended to start from a blank slate

Setup builderrc file

echo "---\narchetypes:\n  - adonis-ts-arche" > .builderrc

Install required dependencies

npm i --save-dev husky@next pkg-ok

What's in the box

The repo contains npm scripts to lint your code and run tests using japa. You will not have to install any related dependencies, they are managed by this arche itself.

npm:init

Initiate the project by creating required files in the project root. The created files are:

  1. tslint.json
  2. tsconfig.json
  3. .gitignore
  4. .editorconfig
  5. .huskyrc.json
builder run npm:init

npm:test

Run tests using japa

builder run npm:test

npm:lint

Lint code using tslint.

builder run npm:lint

npm:build

Compile code from Typescript to Javascript and also generate API docs using typedoc.

builder run npm:build

Git hooks

A file is created .huskyrc.json with git hooks to make sure you always commit the compiled code and push the tested code.

pre-commit

Will build your code using builder run build.

pre-push

Runs all the tests using builder run test.

Config files

Also it is recommended to extend the config files provided by this repo.

tsconfig.json

{
  "extends": "./node_modules/adonis-ts-arche/_tsconfig"
}

tslint.json

{
  "extends": ["adonis-ts-arche/_tslint"],
  "rules": {}
}

Now your project is all ready to run Typescript, compile your code, run tests, generate docs and use a standard set of linter rules.

Directories

  1. All the source code is stored inside src directory.
  2. Compiled to Javascript inside build directory.