git clone https://github.com/Alesion30/obniz-node-template.git
cd obniz-node-template
rm -rf .git
yarn install
touch .env
- .envの値をセットする
OBNIZ_ID=(obniz上に表示されているID)
yarn dev or yarn build && yarn start
yarn init
yarn add obniz express
yarn add -D typescript @types/node @types/express ts-node dotenv tsconfig-paths
touch tsconfig.json
touch .env
OBNIZ_ID=(obniz上に表示されているID)
yarn add -D eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin prettier eslint-config-prettier
touch tsconfig.eslint.json
{
"extends": "./tsconfig.json",
"include": [
"src/**/*.ts",
".eslintrc.js"
],
"exclude": [
"node_modules",
"dist"
]
}
touch .eslintrc.js
module.exports = {
root: true,
env: {
es6: true,
node: true,
},
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020,
tsconfigRootDir: __dirname,
project: ['./tsconfig.eslint.json']
},
plugins: [
'@typescript-eslint',
],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'prettier',
'prettier/@typescript-eslint',
],
rules: {
},
};
touch .eslintignore
echo "{}"> .prettierrc.json
touch .prettierignore
- npmスクリプトの設定
"scripts": {
"start": "ts-node --files -r tsconfig-paths/register src/main.ts",
"lint": "eslint --ext .js,.ts .",
"format": "prettier --write \"*.{js,ts,json}\" && prettier --write \"src/**/*.{js,ts,json}\""
},
{ "compilerOptions": { "sourceMap": true, "esModuleInterop": true, "baseUrl": "./", "paths": { "@/*": ["src/*"] }, "outDir": "dist", "target": "es6", "module": "commonjs", "moduleResolution": "node", "lib": ["es2018", "dom"] } }