git clone https://github.com/eunchurn/nodejs-babel-starter
rm -rf .git
change package.json
to your own
npm install
or
yarn
done.
yarn flow:install
yarn flow:check
yarn test
import something from 'libs/module'
instead of
import something from '../../../../../libs/module'
src
:./src
libs
:./src/libs
build
:./build/Release
(for C/C++ Addons with N-API)
Edit .eslintrc
{
"settings": {
"import/resolver": {
"alias": {
"map": [
["src", "./src/"],
["libs", "./src/libs/"],
["build", "./build/Release/"]
],
"extensions": [".js", ".json"]
}
}
},
}
{
"plugins": [
[
"module-resolver",
{
"root": ["./"],
"alias": {
"@src": "./src",
"@libs": "./src/libs",
"@build": "./build/Release"
}
}
]
]
}
Edit .vscode/jsconfig.json
{
"compilerOptions": {
"baseUrl": "./",
"paths": {
"src/*": ["src/*"],
"libs/*": ["src/libs/*"],
"build/*": ["build/Release/*"]
}
}
}
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'