From f80338de35229b4d7a602632a917d9d89c71f713 Mon Sep 17 00:00:00 2001
From: Shigma <shigma10826@gmail.com>
Date: Mon, 1 Aug 2022 03:41:13 +0800
Subject: [PATCH] chore: enhance build workflow

---
 .github/workflows/build.yml          |  4 ----
 build/template/koishi.yml            |  2 +-
 package.json                         | 24 +++++++++++++-----------
 packages/bootstrap/package.json      |  4 ++--
 packages/bootstrap/tsconfig.json     |  1 -
 packages/cli/package.json            |  2 +-
 packages/cli/tsconfig.json           |  1 -
 packages/core/package.json           |  6 +++---
 packages/create/package.json         |  5 ++---
 packages/koishi/package.json         |  2 +-
 packages/koishi/readme.md            |  2 +-
 packages/utils/package.json          |  6 +++---
 plugins/assets/git/package.json      |  2 +-
 plugins/assets/local/package.json    |  2 +-
 plugins/assets/s3/package.json       |  2 +-
 plugins/database/level/package.json  |  4 ++--
 plugins/database/memory/package.json |  4 ++--
 17 files changed, 34 insertions(+), 39 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index e106e336dd..56f664d3a9 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -23,13 +23,11 @@ jobs:
         with:
           path: yarn.lock
           key: yarn-lock-${{ github.sha }}
-          restore-keys: yarn-lock-
       - name: Restore Cache
         uses: actions/cache@v2
         with:
           path: ${{ steps.cache.outputs.value }}
           key: yarn-cache-${{ github.sha }}-node-16
-          restore-keys: yarn-cache-
       - name: Install
         run: yarn
 
@@ -131,8 +129,6 @@ jobs:
           restore-keys: yarn-cache-${{ github.sha }}-node
       - name: Install
         run: yarn
-      - name: Build JS
-        run: yarn compile
       - name: Unit Test
         run: yarn test:json
       - name: Report Coverage
diff --git a/build/template/koishi.yml b/build/template/koishi.yml
index b17527141e..da91d3e343 100644
--- a/build/template/koishi.yml
+++ b/build/template/koishi.yml
@@ -11,7 +11,7 @@ plugins:
     sandbox: null
     insight: null
     dataview: null
-    manager: null
+    market: null
     status: null
     logger: null
     chat: null
diff --git a/package.json b/package.json
index 3645e6332a..a7d623c6b9 100644
--- a/package.json
+++ b/package.json
@@ -31,6 +31,7 @@
     "satori": "yarn workspace @root/satori",
     "yakumo": "yarn workspace @root/yakumo",
     "clean": "node -r esbuild-register build/clean",
+    "compile": "yakumo esbuild",
     "build": "yakumo esbuild && yakumo tsc",
     "bump": "yakumo version",
     "dep": "yakumo upgrade",
@@ -41,7 +42,7 @@
     "test:html": "shx rm -rf coverage && c8 -r html yarn test",
     "test:text": "shx rm -rf coverage && c8 -r text yarn test",
     "scaffold": "shx rm -rf test && shx cp -rf build/template/ test/ && yarn",
-    "start": "yakumo esbuild && yarn workspace test dev",
+    "start": "yarn compile cli && yarn workspace test dev",
     "shiki": "yarn workspace bot-shiki"
   },
   "license": "MIT",
@@ -53,19 +54,19 @@
     "@types/cross-spawn": "^6.0.2",
     "@types/fs-extra": "^9.0.13",
     "@types/mocha": "^9.1.1",
-    "@types/node": "^17.0.35",
-    "@types/semver": "^7.3.9",
+    "@types/node": "^17.0.45",
+    "@types/semver": "^7.3.10",
     "@types/sinonjs__fake-timers": "^6.0.4",
     "@types/source-map-support": "^0.5.4",
-    "@typescript-eslint/eslint-plugin": "^5.26.0",
-    "@typescript-eslint/parser": "^5.26.0",
-    "c8": "^7.11.3",
+    "@typescript-eslint/eslint-plugin": "^5.31.0",
+    "@typescript-eslint/parser": "^5.31.0",
+    "c8": "^7.12.0",
     "cac": "^6.7.12",
     "chai": "^4.3.6",
     "chai-as-promised": "^7.1.1",
     "cross-env": "^7.0.3",
     "cross-spawn": "^7.0.3",
-    "esbuild": "^0.14.48",
+    "esbuild": "^0.14.51",
     "esbuild-register": "^3.3.3",
     "eslint": "^7.32.0",
     "eslint-config-standard": "^16.0.3",
@@ -76,8 +77,8 @@
     "eslint-plugin-promise": "^5.2.0",
     "fs-extra": "^10.1.0",
     "globby": "^11.1.0",
-    "jest-mock": "^28.1.0",
-    "kleur": "^4.1.4",
+    "jest-mock": "^28.1.3",
+    "kleur": "^4.1.5",
     "latest-version": "^5.1.0",
     "mocha": "^9.2.2",
     "ora": "^5.4.1",
@@ -85,12 +86,13 @@
     "semver": "^7.3.7",
     "shx": "^0.3.4",
     "source-map-support": "^0.5.21",
-    "typescript": "^4.7.2",
+    "typescript": "^4.7.4",
     "yakumo": "^0.3.1",
+    "yakumo-esbuild": "^0.3.3",
     "yakumo-mocha": "^0.3.0",
     "yakumo-publish": "^0.3.0",
     "yakumo-tsc": "^0.3.0",
-    "yakumo-upgrade": "^0.3.0",
+    "yakumo-upgrade": "^0.3.1",
     "yakumo-version": "^0.3.0",
     "yml-register": "^1.0.0"
   }
diff --git a/packages/bootstrap/package.json b/packages/bootstrap/package.json
index 8f6cbf2bd7..103e3a6804 100644
--- a/packages/bootstrap/package.json
+++ b/packages/bootstrap/package.json
@@ -35,8 +35,8 @@
   },
   "dependencies": {
     "@koishijs/loader": "^1.0.1",
-    "kleur": "^4.1.4",
+    "kleur": "^4.1.5",
     "which-pm-runs": "^1.1.0",
     "yargs-parser": "^21.0.1"
   }
-}
\ No newline at end of file
+}
diff --git a/packages/bootstrap/tsconfig.json b/packages/bootstrap/tsconfig.json
index 6f3da3eff7..e193a11f31 100644
--- a/packages/bootstrap/tsconfig.json
+++ b/packages/bootstrap/tsconfig.json
@@ -3,7 +3,6 @@
   "compilerOptions": {
     "rootDir": "src",
     "outDir": "lib",
-    "emitDeclarationOnly": false,
   },
   "include": [
     "src",
diff --git a/packages/cli/package.json b/packages/cli/package.json
index fe89b750a1..8afd79797a 100644
--- a/packages/cli/package.json
+++ b/packages/cli/package.json
@@ -44,7 +44,7 @@
     "chokidar": "^3.5.3",
     "dotenv": "^16.0.1",
     "ns-require": "^1.1.4",
-    "kleur": "^4.1.4",
+    "kleur": "^4.1.5",
     "prompts": "^2.4.2",
     "throttle-debounce": "^3.0.1"
   }
diff --git a/packages/cli/tsconfig.json b/packages/cli/tsconfig.json
index 6f3da3eff7..e193a11f31 100644
--- a/packages/cli/tsconfig.json
+++ b/packages/cli/tsconfig.json
@@ -3,7 +3,6 @@
   "compilerOptions": {
     "rootDir": "src",
     "outDir": "lib",
-    "emitDeclarationOnly": false,
   },
   "include": [
     "src",
diff --git a/packages/core/package.json b/packages/core/package.json
index 4588085734..846197f645 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -2,8 +2,8 @@
   "name": "@koishijs/core",
   "description": "Core Features for Koishi",
   "version": "4.8.3",
-  "main": "lib/node.js",
-  "module": "lib/browser.js",
+  "main": "lib/index.cjs",
+  "module": "lib/index.mjs",
   "typings": "lib/index.d.ts",
   "files": [
     "lib"
@@ -33,7 +33,7 @@
     "@koishijs/utils": "^6.0.0",
     "@satorijs/core": "^1.0.6",
     "cordis": "^2.0.6",
-    "fastest-levenshtein": "^1.0.12",
+    "fastest-levenshtein": "^1.0.14",
     "minato": "^1.2.3"
   }
 }
diff --git a/packages/create/package.json b/packages/create/package.json
index f41bdb2863..31be2072dc 100644
--- a/packages/create/package.json
+++ b/packages/create/package.json
@@ -2,7 +2,6 @@
   "name": "create-koishi",
   "description": "Setup a Koishi application",
   "version": "5.1.5",
-  "main": "lib/index.js",
   "engines": {
     "node": "^12 || >=14"
   },
@@ -35,10 +34,10 @@
   "dependencies": {
     "axios": "^0.24.0",
     "cross-spawn": "^7.0.3",
-    "kleur": "^4.1.4",
+    "kleur": "^4.1.5",
     "prompts": "^2.4.2",
     "tar": "^6.1.11",
     "which-pm-runs": "^1.1.0",
     "yargs-parser": "^21.0.1"
   }
-}
\ No newline at end of file
+}
diff --git a/packages/koishi/package.json b/packages/koishi/package.json
index c642c8e709..e580f1720c 100644
--- a/packages/koishi/package.json
+++ b/packages/koishi/package.json
@@ -36,7 +36,7 @@
     "@koishijs/core": "^4.8.3",
     "@koishijs/utils": "^6.0.0",
     "@satorijs/satori": "^1.0.6",
-    "file-type": "^16.5.3",
+    "file-type": "^16.5.4",
     "ns-require": "^1.1.4"
   }
 }
diff --git a/packages/koishi/readme.md b/packages/koishi/readme.md
index c4115d6db1..1f7bbcb45f 100644
--- a/packages/koishi/readme.md
+++ b/packages/koishi/readme.md
@@ -25,7 +25,7 @@ Koishi 是一个现代化跨平台机器人框架,目前可支持 [QQ](https:/
 - 支持 QQ,Telegram,Discord 等主流聊天平台,支持多账户和跨平台数据互通
 - 随时随地通过控制面板监控运行状态,控制机器人的行为,甚至上号聊天
 
-参见:[模板项目](https://koishi.js.org/manual/starter/installation.html)
+参见:[创建模板项目](https://koishi.js.org/manual/starter/boilerplate.html)
 
 ### 功能强大的 API
 
diff --git a/packages/utils/package.json b/packages/utils/package.json
index a7f464abdb..5099d378fa 100644
--- a/packages/utils/package.json
+++ b/packages/utils/package.json
@@ -2,8 +2,8 @@
   "name": "@koishijs/utils",
   "description": "Utilities for Koishi",
   "version": "6.0.0",
-  "main": "lib/node.js",
-  "module": "lib/browser.js",
+  "main": "lib/index.cjs",
+  "module": "lib/index.mjs",
   "typings": "lib/index.d.ts",
   "files": [
     "lib"
@@ -32,6 +32,6 @@
   "dependencies": {
     "cosmokit": "^1.2.1",
     "reggol": "^1.0.3",
-    "schemastery": "^3.5.0"
+    "schemastery": "^3.5.1"
   }
 }
diff --git a/plugins/assets/git/package.json b/plugins/assets/git/package.json
index 3dfb5a261b..f9c24aa219 100644
--- a/plugins/assets/git/package.json
+++ b/plugins/assets/git/package.json
@@ -46,6 +46,6 @@
     "koishi": "^4.8.3"
   },
   "dependencies": {
-    "simple-git": "^3.7.1"
+    "simple-git": "^3.11.0"
   }
 }
diff --git a/plugins/assets/local/package.json b/plugins/assets/local/package.json
index 06fdf4eba9..c8858008cb 100644
--- a/plugins/assets/local/package.json
+++ b/plugins/assets/local/package.json
@@ -41,6 +41,6 @@
     "koishi": "^4.8.3"
   },
   "dependencies": {
-    "file-type": "^16.5.3"
+    "file-type": "^16.5.4"
   }
 }
diff --git a/plugins/assets/s3/package.json b/plugins/assets/s3/package.json
index af9b8c1df2..c553676a0a 100644
--- a/plugins/assets/s3/package.json
+++ b/plugins/assets/s3/package.json
@@ -45,6 +45,6 @@
     "koishi": "^4.8.3"
   },
   "dependencies": {
-    "@aws-sdk/client-s3": "^3.95.0"
+    "@aws-sdk/client-s3": "^3.137.0"
   }
 }
diff --git a/plugins/database/level/package.json b/plugins/database/level/package.json
index ef87f73240..747b51859b 100644
--- a/plugins/database/level/package.json
+++ b/plugins/database/level/package.json
@@ -2,8 +2,8 @@
   "name": "@koishijs/plugin-database-level",
   "description": "LevelDB implementation for Koishi",
   "version": "1.4.1",
-  "main": "lib/node.js",
-  "module": "lib/browser.js",
+  "main": "lib/index.cjs",
+  "module": "lib/index.mjs",
   "typings": "lib/index.d.ts",
   "files": [
     "lib"
diff --git a/plugins/database/memory/package.json b/plugins/database/memory/package.json
index cce0f13245..5d4fde493a 100644
--- a/plugins/database/memory/package.json
+++ b/plugins/database/memory/package.json
@@ -2,8 +2,8 @@
   "name": "@koishijs/plugin-database-memory",
   "description": "A in-memory database implementation for Koishi",
   "version": "1.4.1",
-  "main": "lib/node.js",
-  "module": "lib/browser.js",
+  "main": "lib/index.cjs",
+  "module": "lib/index.mjs",
   "typings": "lib/index.d.ts",
   "files": [
     "lib"