Skip to content
神代綺凜 edited this page May 18, 2020 · 45 revisions

不太建议您阅读或学习本项目的 vue 代码,这是我在初学的时候实践的成品,有很多使用频率不高的部分都没有组件化,为了直接传递数据也懒得组件化

单页 vue 文件十分长,HTML 层级很多,可能会让您看得头晕眼花,但 script 部分还是可以看的,大概

Project setup

yarn install

[IMPORTANT] Edit .env file

  • VUE_APP_GTAG - Google Analytics gtag ID, set to empty if you don't need it.
  • VUE_APP_CDN - Optional, CDN URL of static resources.

Compiles and hot-reloads for development

yarn run serve

Compiles and minifies for production

Normal

yarn run build

Use CDN

  • VUE_APP_CDN in .env must be setted before using this.
  • Different from the command above, it will let SW load and precache resources from CDN specified by VUE_APP_CDN.
  • Because of some limitations of PWA, some files will be specially processed to ensure that index.html, manifest.json, service-worker.js will not be loaded from CDN.
yarn run build:cdn

Lints and fixes files

yarn run lint

Customize configuration

See Configuration Reference.

Update Arknights game data

yarn run update-data

or

# Recommend in China
yarn run update-data:cdn

or

git clone https://github.com/Kengxxiao/ArknightsGameData ../ArknightsGameData
yarn run update-data:local

Github Actions

目前这块还在试探,坑比较多,用于自动构建和更新方舟数据,如果不需要请不用理会

当你 fork 本项目后可以前往 Actions 启用,并设置以下 secrets 来使用相应功能

  • 自动构建:当更新源码 src/** public/** 等(具体看 workflow 配置文件)后自动构建并发布到 GitHub Pages 或同步到其他远程仓库
    • ACCESS_TOKEN在此处创建,仅勾选 repo 即可
    • CNAME:GitHub Pages 的 CNAME
    • REMOTE_URL:填写后可以在构建时顺便将dist推送到该远程仓库(注意,为强制推送,填前请三思),用户名和密码自然要包含在 URL 中,如果用户名中有@需要替换成%40

自动更新方舟数据

利用了一些自动化白嫖技巧,以下是目前的更新策略流程图

+---++-------------------------------------+                 +---------+
|   ||                                     |   New Commits   |         |
|   ||     Kengxxiao/ArknightsGameData     +---------------->+  IFTTT  |
|   ||                                     |      Feed       |         |
| G |+-------------------------------------+                 +----+----+
| i |+-------------------------------------+     Create Issue     |
| t ||                                     +<---------------------+
| H ||  Tsuk1ko/arknights-toolbox-update   |
| u ||                                     +----+
| b |+-------------------------------------+    | Workflow: Check Issue
|   |+-------------------------------------+    |  Update Data & Push
|   ||                                     +<---+
|   ||      Tsuk1ko/arknights-toolbox      |
|   ||                                     |
+---++-----------------+-------------------+
                       |  Workflow: Build & Push
                       +--------------------------+
                       v                          v
+----------------------+------------+ +-----------+--------------------+
|                                   | |                                |
| GitHub Pages: arkn-gh.lolicon.app | | Coding Pages: arkn.lolicon.app |
|                                   | |                                |
+-----------------------------------+ +--------------------------------+
Clone this wiki locally