Skip to content

Commit

Permalink
🦄 refactor: 调整项目结构
Browse files Browse the repository at this point in the history
  • Loading branch information
malun committed Aug 24, 2023
1 parent 3f8f6e0 commit 0584a7b
Show file tree
Hide file tree
Showing 167 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
run: |
yarn lib:build
mkdir -p ./demo/themes/async
cp -RT ./package/hexo-theme-async ./demo/themes/async
cp -RT ./packages/hexo-theme-async ./demo/themes/async
yarn build
echo ${{ secrets.CNAME }} > docs/.vitepress/dist/CNAME
chmod 600 docs/.vitepress/dist/CNAME
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,26 @@ jobs:

- name: Build
run: |
cp ./README_zh-CN.md ./package/hexo-theme-async
cp ./README.md ./package/hexo-theme-async
node ./script/publish
cp ./README_zh-CN.md ./packages/hexo-theme-async
cp ./README.md ./packages/hexo-theme-async
node ./scripts/publish
yarn lib:build
zip -r hexo-theme-async ./package/hexo-theme-async
zip -r hexo-theme-async ./packages/hexo-theme-async
env:
RELEASE_VERSION: ${{ github.ref }}

- name: Beta Publish
if: ${{ contains(github.ref,'beta') }}
run: |
cd ./package/hexo-theme-async
cd ./packages/hexo-theme-async
npm publish --tag beta
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish
if: ${{ !contains(github.ref,'beta') }}
run: |
cd ./package/hexo-theme-async
cd ./packages/hexo-theme-async
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion docs/.vitepress/components/DemoSites.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { ref } from "vue";
import sites from "../assets/sites.json";
const siteUseThemes = sites.filter((item) => item.type === undefined);
const siteUseThemes = sites.filter((item) => !item.type);
const numOfRow = ref(6);
</script>

Expand Down
4 changes: 2 additions & 2 deletions docs/en/guide/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ With convention over configuration, you only need to customize the languages you

For details, see the following example:

> See the corresponding language attributes and content [languages | hexo-theme-async](https://github.com/MaLuns/hexo-theme-async/blob/master/package/hexo-theme-async/languages/), covering the corresponding item.
> See the corresponding language attributes and content [languages | hexo-theme-async](https://github.com/MaLuns/hexo-theme-async/blob/master/packages/hexo-theme-async/languages/), covering the corresponding item.

```yaml
# Language to be covered
Expand Down Expand Up @@ -931,4 +931,4 @@ Manifest file structure

## More configuration

You can directly see [\_config.yml | hexo-theme-async](https://github.com/MaLuns/hexo-theme-async/blob/master/package/hexo-theme-async/_config.yml) file and related comments.
You can directly see [\_config.yml | hexo-theme-async](https://github.com/MaLuns/hexo-theme-async/blob/master/packages/hexo-theme-async/_config.yml) file and related comments.
2 changes: 1 addition & 1 deletion docs/en/guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ If you still want to use this method, clone the project and manually run `yarn`

::: details v1.1.0 to v2.0.0

Since v1.1.0, the entire repository file is no longer required due to project restructuring. After the clone project, just copy `package/hexo-theme-async` to the `themes/async` directory.
Since v1.1.0, the entire repository file is no longer required due to project restructuring. After the clone project, just copy `packages/hexo-theme-async` to the `themes/async` directory.

Your project structure should look like this

Expand Down
4 changes: 2 additions & 2 deletions docs/guide/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ language: zh-Hans

配置方式参考下例:

> 各语言对应属性和内容见 [languages | hexo-theme-async](https://github.com/MaLuns/hexo-theme-async/blob/master/package/hexo-theme-async/languages/),覆盖对应项即可。
> 各语言对应属性和内容见 [languages | hexo-theme-async](https://github.com/MaLuns/hexo-theme-async/blob/master/packages/hexo-theme-async/languages/),覆盖对应项即可。

```yaml
# 将要覆盖的语言
Expand Down Expand Up @@ -968,4 +968,4 @@ sw: true

## 更多配置

你可以直接查看 [\_config.yml | hexo-theme-async](https://github.com/MaLuns/hexo-theme-async/blob/master/package/hexo-theme-async/_config.yml) 文件及相关注释。
你可以直接查看 [\_config.yml | hexo-theme-async](https://github.com/MaLuns/hexo-theme-async/blob/master/packages/hexo-theme-async/_config.yml) 文件及相关注释。
2 changes: 1 addition & 1 deletion docs/guide/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ root: /

## 配置项不生效?

你可以参考查看 [\_config.yml | hexo-theme-async](https://github.com/MaLuns/hexo-theme-async/blob/master/package/hexo-theme-async/_config.yml) 文件及相关注释,确保你配置正确性。
你可以参考查看 [\_config.yml | hexo-theme-async](https://github.com/MaLuns/hexo-theme-async/blob/master/packages/hexo-theme-async/_config.yml) 文件及相关注释,确保你配置正确性。

- 初始安装后不生效?

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ npm i hexo-theme-async@latest

::: details v1.1.0 至 v2.0.0 版本

从 v1.1.0 后,由于项目结构调整,不再需要整个仓库文件了。clone 项目后,只需要将 `package/hexo-theme-async` 复制到 `themes/async` 目录下即可。
从 v1.1.0 后,由于项目结构调整,不再需要整个仓库文件了。clone 项目后,只需要将 `packages/hexo-theme-async` 复制到 `themes/async` 目录下即可。

您的项目结构应该是这样

Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
"scripts": {
"dev": "npm run lib:dev & npm run demo:dev",
"build": "npm run docs:build && npm run lib:build && npm run demo:build",
"lib:dev": "npm --prefix package/hexo-theme-async-ts run dev",
"lib:build": "npm --prefix package/hexo-theme-async-ts run build",
"lib:dev": "npm --prefix packages/hexo-theme-async-ts run dev",
"lib:build": "npm --prefix packages/hexo-theme-async-ts run build",
"demo:dev": "hexo --cwd ./demo clean && hexo server --cwd ./demo --debug",
"demo:build": "hexo --cwd ./demo clean && hexo --cwd ./demo generate",
"demo:down-plugin": "hexo --cwd ./demo plugin",
"docs:dev": "vitepress dev docs",
"docs:build": "vitepress build docs",
"docs:serve": "vitepress serve docs",
"generate:demo-sites": "node ./script/sites-check",
"soft-links": "node ./script/soft-links"
"generate:demo-sites": "node ./scripts/sites-check",
"soft-links": "node ./scripts/soft-links"
},
"bugs": {
"url": "https://github.com/MaLuns/hexo-theme-async/issues"
Expand All @@ -33,7 +33,7 @@
"typescript": "^4.8.4"
},
"workspaces": [
"package/*",
"packages/*",
"docs",
"demo"
]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions script/publish.js → scripts/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const path = require('path')
if (process.env.RELEASE_VERSION) {
const version = process.env.RELEASE_VERSION.split('/').reverse()[0]
console.log('当前版本:', version);
const pkg = require('../package/hexo-theme-async/package.json')
const pkg = require('../packages/hexo-theme-async/package.json')
pkg.version = version.replace('v', '')
fs.writeFileSync(path.resolve(__dirname, '../package/hexo-theme-async/package.json'), JSON.stringify(pkg, null, 4), 'utf-8')
fs.writeFileSync(path.resolve(__dirname, '../packages/hexo-theme-async/package.json'), JSON.stringify(pkg, null, 4), 'utf-8')
}

File renamed without changes.
4 changes: 2 additions & 2 deletions script/soft-links.js → scripts/soft-links.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { existsSync, mkdirsSync, symlink } = require("hexo-fs")
const log = require("hexo-log")()

const filePath = __dirname
const sourcePath = path.resolve(filePath, '../package/hexo-theme-async')
const sourcePath = path.resolve(filePath, '../packages/hexo-theme-async')
const targetPath = path.resolve(filePath, '../demo/themes/async')
const themePath = path.resolve(targetPath, '../')

Expand All @@ -13,7 +13,7 @@ if (!existsSync(themePath)) {

if (!existsSync(targetPath)) {
symlink(sourcePath, targetPath, 'dir').catch(err => {
log.i('软链接创建失败,请手动为 package/hexo-theme-async 目录创建软链接到 demo/themes/async');
log.i('软链接创建失败,请手动为 packages/hexo-theme-async 目录创建软链接到 demo/themes/async');
if (process.platform === "win32") {
log.i(`命令: mklink /j ${targetPath} ${sourcePath}`)
} else {
Expand Down

0 comments on commit 0584a7b

Please sign in to comment.