Skip to content

nodeJS apllication starter kit with babel, eslint(air-bnb with flowtype and prettier), prettier, jest, flowtype, travis, codecov, vscode configuration(modules resolver alias...).

License

Notifications You must be signed in to change notification settings

eunchurn/nodejs-babel-starter

Repository files navigation

NodeJS Babel Bolierplate

Actions Status Greenkeeper badge Build Status codecov

nodeJS apllication starter kit with babel, eslint(air-bnb with flowtype and prettier), jest, travis, codecov, husky, vscode configuration(clean modules resolve path alias like libs, build).

Files tree

.
├── LICENSE
├── README.md
├── package.json
├── src
│   ├── index.js
│   └── libs
│       └── index.js
├── test
│   └── index.test.js

Getting started

git clone https://github.com/eunchurn/nodejs-babel-starter
rm -rf .git

change package.json to your own

npm install

or

yarn

done.

Flow-typed install

yarn flow:install

Flow check

yarn flow:check

Test

yarn test

Module resolve path configuration

import something from 'libs/module'

instead of

import something from '../../../../../libs/module'

example configuration

ESLint

Edit .eslintrc

{
  "settings": {
    "import/resolver": {
      "alias": {
        "map": [
          ["src", "./src/"],
          ["libs", "./src/libs/"],
          ["build", "./build/Release/"]
        ],
        "extensions": [".js", ".json"]
      }
    }
  },
}

Babel

{
  "plugins": [
    [
      "module-resolver",
      {
        "root": ["./"],
        "alias": {
          "@src": "./src",
          "@libs": "./src/libs",
          "@build": "./build/Release"
        }
      }
    ]
  ]
}

VSCode

Edit .vscode/jsconfig.json

{
  "compilerOptions": {
    "baseUrl": "./",
    "paths": {
      "src/*": ["src/*"],
      "libs/*": ["src/libs/*"],
      "build/*": ["build/Release/*"]
    }
  }
}

Flow-type

Edit .flowconfig

[options]
module.file_ext=.node
module.name_mapper='build' ->
'<PROJECT_ROOT>/build/Release'
module.file_ext=.js
module.name_mapper='libs' ->
'<PROJECT_ROOT>/src/libs'
module.file_ext=.js
module.name_mapper='src' ->
'<PROJECT_ROOT>/src'

About

nodeJS apllication starter kit with babel, eslint(air-bnb with flowtype and prettier), prettier, jest, flowtype, travis, codecov, vscode configuration(modules resolver alias...).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published