# toplogis-test-lib

> ### 安裝 _[Node]_

Latest version **0.0.3** (published 2019-08-15) · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install toplogis-test-lib
pnpm add toplogis-test-lib
yarn add toplogis-test-lib
bun add toplogis-test-lib
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2019-08-15 |
| First published | 2019-08-15 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 10 |
| Unpacked size | 370.5 KB |
| Known vulnerabilities | 0 (+26 in 2 direct dependencies) |
| Install scripts | no |
| Maintainers | allen.xu |

## Links

- npm: https://www.npmjs.com/package/toplogis-test-lib
- npm.io page: https://npm.io/package/toplogis-test-lib

## Dependencies (10)

- [vue](https://npm.io/package/vue.md) ^2.6.10
- [vuex](https://npm.io/package/vuex.md) ^3.1.1
- [axios](https://npm.io/package/axios.md) ^0.19.0
- [moment](https://npm.io/package/moment.md) ^2.24.0
- [vue-i18n](https://npm.io/package/vue-i18n.md) ^8.12.0
- [vue-router](https://npm.io/package/vue-router.md) ^3.0.7
- [vuex-cache](https://npm.io/package/vuex-cache.md) ^3.1.0
- [vue-loaders](https://npm.io/package/vue-loaders.md) ^3.0.2
- [vuex-persistedstate](https://npm.io/package/vuex-persistedstate.md) ^2.5.4
- [babel-plugin-component](https://npm.io/package/babel-plugin-component.md) ^1.1.1

## Recent versions

- 0.0.3 (latest) — 2019-08-15
- 0.0.2 — 2019-08-15
- 0.0.1 — 2019-08-15

## README

# 環境

### 安裝 _[Node]_

- 建議先安裝 _[NVM]_，使用 NVM 安裝 Node，方便版本的切換
- 本專案使用版本為（`v8.12.0`）
- 使用 _[vscode]_ 開發
- git clone project

```sh
  > git clone ${project repo}
```

- 安裝 **套件**

```sh
  > cd ${workspace folder}
  > npm install
```

### VSCODE 插件

- 專案添加了 _[ESLint]_、_[stylelint]_ 檢查語法與格式
- 使用 _[husky]_ 於 commit 前檢查
- （可選）在開發中 watch 檔案異動做檢查 ，需安裝以下插件

1. `.vscode/setting.json` 工作區設定修正

```json
"editor.detectIndentation": false,
"editor.insertSpaces": true,
"editor.tabSize": 2,
```

2. 插件 Vetur，並在 `.vscode/setting.json` 工作區設定添加

```json
"vetur.format.defaultFormatter.js": "none",
"vetur.format.defaultFormatter.html": "none",
"vetur.format.defaultFormatter.scss": "none",
"vetur.format.defaultFormatter.css": "none",
```

3. 插件 Prettier，並在 `.vscode/setting.json` 工作區設定添加

```json
"prettier.eslintIntegration": true,
"prettier.stylelintIntegration": true,
"prettier.disableLanguages": [],
```

4. 插件 ESLint，並在 `.vscode/setting.json` 工作區設定添加

```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
  },
],
```

5. 插件 stylelint，並在 `.vscode/setting.json` 工作區設定添加
   > 此部分在修改 stylelint 設定檔後（.stylelintrc\*），需重啟 vscode

```json
"css.validate": false,
"scss.validate": false,
```

6. 插件 EditorConfig for VS Code

---

---

# Building `frontend` using _[webpack]_

- 開發

```sh
  > npm run client:dev
```

- 打包

```sh
  > npm run client:build
```

---

---

# A.I.O.（ All-In-One `backend` framework of Asynchronous I/O ）

### 開發

- vscode 偵錯設定 `.vscode/launch.json`

1. 使用 Node

```json
{
  "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
    }
  ]
}
```

2. 推薦使用 _[nodemon]_（自動重啟）

```json
{
  "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 ）

```sh
  > 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 * * *' # 設置日誌文件週期
```

[pm2]: http://pm2.keymetrics.io/
[node]: https://nodejs.org/en/
[nodemon]: https://nodemon.io/
[nvm]: https://github.com/creationix/nvm/blob/master/README.md
[vscode]: https://code.visualstudio.com/
[eslint]: https://eslint.org/
[stylelint]: https://stylelint.io/
[husky]: https://github.com/typicode/husky#readme
[webpack]: https://webpack.js.org/

---
_Source: https://npm.io/package/toplogis-test-lib · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
