0.0.3 • Published 5 years ago
toplogis-test-lib v0.0.3
環境
安裝 Node
> git clone ${project repo}
- 安裝 套件
> cd ${workspace folder}
> npm install
VSCODE 插件
.vscode/setting.json
工作區設定修正
"editor.detectIndentation": false,
"editor.insertSpaces": true,
"editor.tabSize": 2,
- 插件 Vetur,並在
.vscode/setting.json
工作區設定添加
"vetur.format.defaultFormatter.js": "none",
"vetur.format.defaultFormatter.html": "none",
"vetur.format.defaultFormatter.scss": "none",
"vetur.format.defaultFormatter.css": "none",
- 插件 Prettier,並在
.vscode/setting.json
工作區設定添加
"prettier.eslintIntegration": true,
"prettier.stylelintIntegration": true,
"prettier.disableLanguages": [],
- 插件 ESLint,並在
.vscode/setting.json
工作區設定添加
"eslint.packageManager": "npm", // or yarn
"eslint.alwaysShowStatus": true,
"eslint.trace.server": "verbose",
"eslint.nodePath": "./node_modules",
"eslint.autoFixOnSave": true,
"eslint.validate": [
"javascript",
{
"language": "vue",
"autoFix": true
},
],
- 插件 stylelint,並在
.vscode/setting.json
工作區設定添加此部分在修改 stylelint 設定檔後(.stylelintrc*),需重啟 vscode
"css.validate": false,
"scss.validate": false,
- 插件 EditorConfig for VS Code
Building frontend
using webpack
- 開發
> npm run client:dev
- 打包
> npm run client:build
A.I.O.( All-In-One backend
framework of Asynchronous I/O )
開發
- vscode 偵錯設定
.vscode/launch.json
- 使用 Node
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "啟動程式",
"program": "${workspaceRoot}/server/bin/www",
"env": {
"NODE_ENV": "development",
"SERVER_MANAGER": "VSCODE"
}
},
{
"type": "node",
"request": "attach",
"name": "附加至處理序",
"port": 5858
}
]
}
- 推薦使用 nodemon(自動重啟)
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "nodemon",
"runtimeExecutable": "nodemon",
"program": "${workspaceRoot}/server/bin/www",
"restart": true,
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"env": {
"NODE_ENV": "development",
"SERVER_MANAGER": "VSCODE"
}
},
{
"type": "node",
"request": "attach",
"name": "附加至處理序",
"port": 5858
}
]
}
正式環境使用
- (可選)安裝 PM2( Process Manager )
> npm install pm2 -g
> pm2 install pm2-logrotate # 安裝日誌管理套件
> pm2 set pm2-logrotate:max_size 500M # 設置日誌文件大小
> pm2 set pm2-logrotate:workerInterval 60 # 每分鐘檢查日誌文件大小
> pm2 set pm2-logrotate:retain 30 # 要保留的日誌文件數
> pm2 set pm2-logrotate:compress true # 壓縮日誌文件
> pm2 set pm2-logrotate:dateFormat YYYYMMDD-HHmm # 日誌文件檔名
> pm2 set pm2-logrotate:rotateInterval '0 0 * * *' # 設置日誌文件週期