Change package manager to pnpm

This commit is contained in:
the1812 2022-10-12 22:35:20 +08:00
parent fb714d7f28
commit 74d4ab9202
8 changed files with 7470 additions and 5083 deletions

View File

@ -25,20 +25,20 @@ jobs:
uses: bahmutov/npm-install@v1
- name: Type check
run: yarn type
run: pnpm run type
- name: ESLint check
run: yarn lint
run: pnpm run lint
- name: Build core
run: yarn build-core
run: pnpm run build-core
- name: Build features
run: |
cd registry
yarn
pnpm run
cd ../
yarn build-features
pnpm run build-features
- name: Git commit
id: commit

View File

@ -23,16 +23,16 @@ jobs:
uses: bahmutov/npm-install@v1
- name: Type check
run: yarn type
run: pnpm run type
- name: ESLint check
run: yarn lint-check
run: pnpm run lint-check
- name: Build core
run: yarn build-core
run: pnpm run build-core
- name: Build features
run: yarn build-features
run: pnpm run build-features
- name: Log
run: echo Check complete.

View File

@ -68,6 +68,7 @@
"overscroll",
"pako",
"plusplus",
"pnpm",
"Popcap",
"popperjs",
"preload",
@ -106,7 +107,7 @@
"search.exclude": {
"**/dev": true,
"**/dist": true,
"**/yarn.lock": true
"**/pnpm-lock.yaml": true
},
"eslint.format.enable": true,
"editor.defaultFormatter": "dbaeumer.vscode-eslint",

32
.vscode/tasks.json vendored
View File

@ -5,112 +5,112 @@
"tasks": [
{
"type": "shell",
"command": "yarn ts-node ./dev-tools/dev-server/index.ts",
"command": "pnpm run ts-node ./dev-tools/dev-server/index.ts",
"group": "build",
"problemMatcher": [],
"label": "启动开发服务 dev-server"
},
{
"type": "shell",
"command": "yarn webpack --config ./webpack/webpack.dev.ts --progress",
"command": "pnpm run webpack --config ./webpack/webpack.dev.ts --progress",
"group": "build",
"problemMatcher": [],
"label": "本体:编译开发版本 dev:build-core"
},
{
"type": "shell",
"command": "yarn webpack --watch --config ./webpack/webpack.dev.ts --progress",
"command": "pnpm run webpack --watch --config ./webpack/webpack.dev.ts --progress",
"group": "build",
"problemMatcher": [],
"label": "本体:监视开发版本 dev:watch-core"
},
{
"type": "shell",
"command": "yarn serve dist -p ${input:serverPort}",
"command": "pnpm run serve dist -p ${input:serverPort}",
"group": "build",
"problemMatcher": [],
"label": "本体:启动服务器 dev:serve-core"
},
{
"type": "shell",
"command": "yarn serve registry/dist -p ${input:serverPort}",
"command": "pnpm run serve registry/dist -p ${input:serverPort}",
"group": "build",
"problemMatcher": [],
"label": "功能:启动服务器 dev:serve-features"
},
{
"type": "shell",
"command": "yarn webpack --watch --config ./registry/webpack/components.ts --progress --mode=development",
"command": "pnpm run webpack --watch --config ./registry/webpack/components.ts --progress --mode=development",
"group": "build",
"problemMatcher": [],
"label": "功能:监视组件 dev:watch-components"
},
{
"type": "shell",
"command": "yarn webpack --watch --config ./registry/webpack/plugins.ts --progress --mode=development",
"command": "pnpm run webpack --watch --config ./registry/webpack/plugins.ts --progress --mode=development",
"group": "build",
"problemMatcher": [],
"label": "功能:监视插件 dev:watch-plugins"
},
{
"type": "shell",
"command": "yarn tsc -p tsconfig.type-check.json --noEmit",
"command": "pnpm run tsc -p tsconfig.type-check.json --noEmit",
"group": "build",
"problemMatcher": [],
"label": "生产:类型检查 prod:type"
},
{
"type": "shell",
"command": "yarn --silent webpack --config ./webpack/webpack.prod.ts --profile --json > dist/profile.json && yarn webpack-bundle-analyzer dist/profile.json",
"command": "pnpm run --silent webpack --config ./webpack/webpack.prod.ts --profile --json > dist/profile.json && pnpm run webpack-bundle-analyzer dist/profile.json",
"group": "build",
"problemMatcher": [],
"label": "本体:打包分析 prod:analyze"
},
{
"type": "shell",
"command": "yarn eslint --cache --cache-location node_modules/.cache/eslint/ './**/*.@(js|ts|vue)'",
"command": "pnpm run eslint --cache --cache-location node_modules/.cache/eslint/ './**/*.@(js|ts|vue)'",
"group": "build",
"problemMatcher": [],
"label": "生产:代码检查 prod:lint"
},
{
"type": "shell",
"command": "yarn eslint --cache --cache-location node_modules/.cache/eslint/ --fix './**/*.@(js|ts|vue)'",
"command": "pnpm run eslint --cache --cache-location node_modules/.cache/eslint/ --fix './**/*.@(js|ts|vue)'",
"group": "build",
"problemMatcher": [],
"label": "生产:代码修复 prod:lint-fix"
},
{
"type": "shell",
"command": "yarn webpack --config ./webpack/webpack.prod.ts --progress",
"command": "pnpm run webpack --config ./webpack/webpack.prod.ts --progress",
"group": "build",
"problemMatcher": [],
"label": "本体:编译生产版本 prod:build-core"
},
{
"type": "shell",
"command": "yarn webpack --config ./registry/webpack/components.ts --progress",
"command": "pnpm run webpack --config ./registry/webpack/components.ts --progress",
"group": "build",
"problemMatcher": [],
"label": "功能:编译组件 prod:build-components"
},
{
"type": "shell",
"command": "yarn webpack --config ./registry/webpack/plugins.ts --progress",
"command": "pnpm run webpack --config ./registry/webpack/plugins.ts --progress",
"group": "build",
"problemMatcher": [],
"label": "功能:编译插件 prod:build-plugins"
},
{
"type": "shell",
"command": "yarn webpack --config ./registry/webpack/all.ts",
"command": "pnpm run webpack --config ./registry/webpack/all.ts",
"group": "build",
"problemMatcher": [],
"label": "功能:编译所有 prod:build-features"
},
{
"type": "shell",
"command": "yarn webpack --config ./registry/webpack/docs.ts --progress",
"command": "pnpm run webpack --config ./registry/webpack/docs.ts --progress",
"group": "build",
"problemMatcher": [],
"label": "功能:编译功能文档 prod:build-docs"

View File

@ -2,15 +2,15 @@
## 搭建开发环境
- 需要安装 [Node.js](https://nodejs.org/en/download/) (>= 14.0), [Visual Studio Code](https://code.visualstudio.com/) 和 [yarn](https://yarnpkg.com/getting-started/install#global-install).
- 需要安装 [Node.js](https://nodejs.org/en/download/) (>= 14.0), [Visual Studio Code](https://code.visualstudio.com/) 和 [pnpm](https://pnpm.io/installation).
- 将项目 Fork 至自己账户后, 克隆至本地
- 分支视情况切换或新建, 新功能以 `preview-features` 为基础分支, 功能修复以 `preview-fixes` 为基础分支.
- 安装依赖:
```powershell
yarn
pnpm install
cd registry
yarn
pnpm install
```
### 本体
@ -142,7 +142,7 @@ yarn
全局变量, 无需 `import` 就可以直接使用. (Tampermonkey API 这里不再列出了, 可根据代码提示使用)
- `Vue`: Vue 库的主对象, 在创建 `.vue` 组件时, 其中的 `<script>` 可以直接使用 `Vue.extend()`
> 出于历史原因, 项目中用的还是 Vue 2, 由于其糟糕的 TypeScript 支持, 在 VS Code + Vetur 的环境下浏览 `.vue` 文件可能会报各种奇奇怪怪的类型错误, 无视就好. (类型是否正确以 `yarn type` 的结果为准)
> 出于历史原因, 项目中用的还是 Vue 2, 由于其糟糕的 TypeScript 支持, 在 VS Code + Vetur 的环境下浏览 `.vue` 文件可能会报各种奇奇怪怪的类型错误, 无视就好. (类型是否正确以 `pnpm run type` 的结果为准)
- `lodash`: 包含所有 Lodash 库提供的方法
- `dq` / `dqa`: `document.querySelector``document.querySelectorAll` 的简写, `dqa` 会返回真实数组

View File

@ -33,7 +33,7 @@ CDN 配置位于 `webpack/cdn/`, 可在目录下新建一个文件, 导出一个
## 编译
运行 `本体:编译生产版本` 任务 (`yarn webpack --config ./webpack/webpack.prod.ts --progress`).
运行 `本体:编译生产版本` 任务 (`pnpm run webpack --config ./webpack/webpack.prod.ts --progress`).
会得到:
- 正式版: `dist\bilibili-evolved.user.js`

7438
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

5052
yarn.lock

File diff suppressed because it is too large Load Diff