[update] migrate to pnpm from npm and format the code

This commit is contained in:
PrinOrange
2024-08-14 13:53:21 +08:00
parent 3854542343
commit 56d1e361aa
7 changed files with 9038 additions and 16653 deletions

View File

@@ -1,8 +1,8 @@
name: Update npm Dependencies name: Update pnpm Dependencies
on: on:
schedule: schedule:
- cron: "0 0 * * 4" - cron: "0 0 * * 1"
workflow_dispatch: workflow_dispatch:
jobs: jobs:
@@ -13,23 +13,27 @@ jobs:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Set up Node.js - name: Setup Node.js
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: "20.10.0" node-version: "20.10.0"
cache: "pnpm"
- name: Install latest npm - name: Install pnpm
run: npm install -g npm@latest run: npm install -g pnpm
- name: Update npm dependencies - name: Install dependencies
run: npm update run: pnpm install
- name: Update dependencies
run: pnpm update
- name: Commit and push changes - name: Commit and push changes
run: | run: |
git config --global user.name 'github-actions[bot]' git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com' git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add package-lock.json git add .
git commit -m 'chore: update npm dependencies' git commit -m 'chore: update dependencies'
git push git push
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -1,7 +1,3 @@
{ {
"recommendations": [ "recommendations": ["streetsidesoftware.code-spell-checker", "huacnlee.autocorrect", "biomejs.biome"]
"streetsidesoftware.code-spell-checker",
"huacnlee.autocorrect",
"biomejs.biome"
]
} }

View File

@@ -51,8 +51,7 @@
- [感谢](#感谢) - [感谢](#感谢)
- [开源许可](#开源许可) - [开源许可](#开源许可)
## <!-- /TOC --> <!-- /TOC -->
### 快速上手 ### 快速上手
着手本项目之前,我在此假设你已经具备以下知识水平: 着手本项目之前,我在此假设你已经具备以下知识水平:
@@ -66,7 +65,7 @@
本项目要求的运行环境如下: 本项目要求的运行环境如下:
- node.js v18+ - node.js v18+
- npm v9+ - pnpm v9+
- Chromium 系浏览器Chrome、Edge或者 Firefox。 - Chromium 系浏览器Chrome、Edge或者 Firefox。
我推荐使用 Visual Studio Code 作为开发工具。 我推荐使用 Visual Studio Code 作为开发工具。
@@ -74,7 +73,7 @@
执行脚本以安装依赖, 执行脚本以安装依赖,
```bash ```bash
npm install pnpm install
``` ```
#### 创建博客 #### 创建博客
@@ -84,7 +83,7 @@ npm install
你应该使用脚本来创建帖子。 你应该使用脚本来创建帖子。
```bash ```bash
npm run newpost pnpm run newpost
``` ```
然后程序会问你一些问题,你只需要根据问题输入你的回答,程序会自动为你创建一个新帖子文件并打开它。 然后程序会问你一些问题,你只需要根据问题输入你的回答,程序会自动为你创建一个新帖子文件并打开它。
@@ -151,13 +150,13 @@ allowShare: true
在开发环境下执行项目。 在开发环境下执行项目。
```bash ```bash
npm run dev pnpm run dev
``` ```
当然你可以使用 Turbo Build 来执行开发模式,它在项目热刷新上有良好的性能。 当然你可以使用 Turbo Build 来执行开发模式,它在项目热刷新上有良好的性能。
```bash ```bash
npm run dev:turbo pnpm run dev:turbo
``` ```
#### 构建 #### 构建
@@ -165,13 +164,13 @@ npm run dev:turbo
构建项目,可执行 构建项目,可执行
```bash ```bash
npm run build pnpm run build
``` ```
或者使用 Turbo Build 构建项目,以提高性能 或者使用 Turbo Build 构建项目,以提高性能
```bash ```bash
npm run build:turbo pnpm run build:turbo
``` ```
### 数据与配置 ### 数据与配置
@@ -186,7 +185,7 @@ npm run build:turbo
本项目可以提供对博客文件、配置等用户数据的一键打包、还原功能,以便于项目升级时迁移或者备份、恢复数据,可以使用脚本工具 本项目可以提供对博客文件、配置等用户数据的一键打包、还原功能,以便于项目升级时迁移或者备份、恢复数据,可以使用脚本工具
```bash ```bash
npm run archive pnpm run archive
``` ```
来实现。运行脚本后,给你提供打包用户数据和还原用户数据两个选项:`Pack to archive the user data` 和 `Unpack and restore user data` ,分别用于打包归档用户数据和解包恢复用户数据。 来实现。运行脚本后,给你提供打包用户数据和还原用户数据两个选项:`Pack to archive the user data` 和 `Unpack and restore user data` ,分别用于打包归档用户数据和解包恢复用户数据。

View File

@@ -28,6 +28,7 @@ It is a responsive website with good support for most different screen sizes ava
<!-- TOC --> <!-- TOC -->
- [NEXT.JS LEXICAL](#nextjs-lexical) - [NEXT.JS LEXICAL](#nextjs-lexical)
- [](#)
- [Quick Start](#quick-start) - [Quick Start](#quick-start)
- [Initialize Project](#initialize-project) - [Initialize Project](#initialize-project)
- [Creating a Blog Post](#creating-a-blog-post) - [Creating a Blog Post](#creating-a-blog-post)
@@ -51,6 +52,7 @@ It is a responsive website with good support for most different screen sizes ava
- [Thanks](#thanks) - [Thanks](#thanks)
- [Open Source License](#open-source-license) - [Open Source License](#open-source-license)
<!-- /TOC -->
## <!-- /TOC --> ## <!-- /TOC -->
### Quick Start ### Quick Start
@@ -66,7 +68,7 @@ Before diving into this project, I assume you already have the following knowled
The required runtime environment for this project is as follows: The required runtime environment for this project is as follows:
- Node.js v18+ - Node.js v18+
- npm v9+ - pnpm v9+
- Chromium-based browser (Chrome, Edge) or Firefox. - Chromium-based browser (Chrome, Edge) or Firefox.
I recommend using Visual Studio Code as the development tool. I recommend using Visual Studio Code as the development tool.
@@ -74,7 +76,7 @@ I recommend using Visual Studio Code as the development tool.
Execute the following script to install dependencies: Execute the following script to install dependencies:
```bash ```bash
npm install pnpm install
``` ```
#### Creating a Blog Post #### Creating a Blog Post
@@ -84,7 +86,7 @@ All blog files should be written in Markdown and stored in the `/data/posts` dir
You should use a script to create the post. You should use a script to create the post.
```bash ```bash
npm run newpost pnpm run newpost
``` ```
Then, the program will ask you a series of questions. Simply input your answers according to the prompts, and the program will automatically create a new post file for you and open it. Then, the program will ask you a series of questions. Simply input your answers according to the prompts, and the program will automatically create a new post file for you and open it.
@@ -154,13 +156,13 @@ The `summary` field is a general summary of the article, which will be displayed
Run the project in development mode. Run the project in development mode.
```bash ```bash
npm run dev pnpm run dev
``` ```
Alternatively, you can use Turbo Build for development mode, which has good performance for hot reloading. Alternatively, you can use Turbo Build for development mode, which has good performance for hot reloading.
```bash ```bash
npm run dev:turbo pnpm run dev:turbo
``` ```
#### Build #### Build
@@ -168,13 +170,13 @@ npm run dev:turbo
Build the project by running: Build the project by running:
```bash ```bash
npm run build pnpm run build
``` ```
Or use Turbo Build for building the project to enhance performance: Or use Turbo Build for building the project to enhance performance:
```bash ```bash
npm run build:turbo pnpm run build:turbo
``` ```
### Data and Configuration ### Data and Configuration
@@ -189,7 +191,7 @@ The blog's configuration files are located in the `./data` directory, and there
This project offers a convenient feature for one-click packaging and restoration of user data, including blog files and configurations. This is particularly useful for data migration, backup, or restoration during project upgrades. You can use the following script tool for this purpose: This project offers a convenient feature for one-click packaging and restoration of user data, including blog files and configurations. This is particularly useful for data migration, backup, or restoration during project upgrades. You can use the following script tool for this purpose:
```bash ```bash
npm run archive pnpm run archive
``` ```
When you run this script, you'll be presented with two options: `Pack to archive the user data` and `Unpack and restore user data`. These options allow you to package your blog files, configuration files, and other data into a `*.tar.gz` file for archiving or to unpack and restore your user data from an archive. When you run this script, you'll be presented with two options: `Pack to archive the user data` and `Unpack and restore user data`. These options allow you to package your blog files, configuration files, and other data into a `*.tar.gz` file for archiving or to unpack and restore your user data from an archive.

16619
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -108,6 +108,5 @@
"tar": "^7.0.1", "tar": "^7.0.1",
"turbo": "^2.0.12", "turbo": "^2.0.12",
"webpack-obfuscator": "^3.5.1" "webpack-obfuscator": "^3.5.1"
}, }
"packageManager": "npm@10.2.3"
} }

9004
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff