Skip to content

Commit

Permalink
支持npm安装
Browse files Browse the repository at this point in the history
  • Loading branch information
HCLonely committed Jul 30, 2020
1 parent e45608a commit 1e1628d
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 125 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/npmpublish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: Node.js Package

on:
release:
types: [created]

jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
screenshot/
.github/
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,39 @@

## Installation

### hexo >= 4.0

```shell
git clone https://github.com/HCLonely/hexo-theme-webstack themes/webstack
```

### hexo >= 5.0

```shell
npm install hexo-theme-webstack -S
```

or

```shell
cnpm install hexo-theme-webstack -S
```

## Configuration

### hexo >= 4.0

Copy the `_config.yml` file in the `themes/webstack/` directory to the `rootDir/source/_data/` directory and rename it to `webstack.yml`.

Configure it by editing `webstack.yml`.

### hexo >= 5.0

- If this theme is newly installed, a `_config.webstack.yml` file will be generated in the root directory after the installation is complete, and you can directly edit the `_config.webstack.yml` file for configuration.
- If it is a theme upgrade, you can use the configuration method of hexo >= 4.0, or you can move the original configuration file to the root directory and rename it to `_config.webstack.yml`.

> Note: Please keep only one of `rootDir/_config.webstack.yml` and `rootDir/source/_data/webstack.yml`!
### favicon

> Website icon.
Expand Down
23 changes: 23 additions & 0 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,39 @@

## 安装

### hexo >= 4.0

```shell
git clone https://github.com/HCLonely/hexo-theme-webstack themes/webstack
```

### hexo >= 5.0

```shell
npm install hexo-theme-webstack -S
```

or

```shell
cnpm install hexo-theme-webstack -S
```

## 配置

### hexo >= 4.0

`themes/webstack/`目录内的`_config.yml`文件复制到`博客根目录/source/_data/`目录内,并重命名为`webstack.yml`.

通过编辑`webstack.yml`进行配置。

### hexo >= 5.0

- 如果是新安装本主题,安装完成后会在根目录生成一个`_config.webstack.yml`文件,直接编辑`_config.webstack.yml`文件进行配置即可。
- 如果是主题升级,可以使用 hexo >= 4.0 的配置方法,也可以将原来的配置文件移动到根目录,并重命名为`_config.webstack.yml`.

> 注意:`博客根目录/_config.webstack.yml``博客根目录/source/_data/webstack.yml`请只保留一个!
### favicon

> 网站图标
Expand Down
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// 这个文件用来防止 hexo 5.0.0 使用 "hexo clean" 命令报错。
// This file is used to prevent hexo 5.0.0 from using "hexo clean" command error.
13 changes: 13 additions & 0 deletions move_config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const fs = require('fs')

if (fs.existsSync('../hexo/package.json')){
const version = JSON.parse(fs.readFileSync('../hexo/package.json')).version
if (version.split('.')[0] === '5') {
const oldConfigPath = '../../source/_data/webstack.yml'
const configPath = '../../_config.webstack.yml'
if (!fs.existsSync(configPath) && !fs.existsSync(oldConfigPath)) {
fs.writeFileSync(configPath, fs.readFileSync('./_config.yml'))
}
fs.unlinkSync('./_config.yml')
}
}
19 changes: 16 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
{
"name": "hexo-theme-webstack",
"version": "1.1.4",
"version": "2.0.0",
"description": "A hexo theme based on webstack.",
"keywords": [
"hexo",
"theme",
"webstack"
],
"main": "index.js",
"scripts": {
"test": "ejslint",
"mincss": "cleancss",
"min": "uglifyjs ./source/js/xenon-toggles.js -o ./source/js/xenon-toggles.min.js"
"postinstall": "node ./move_config.js"
},
"author": "HCLonely",
"author": "HCLonely <h1606051253@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/HCLonely/hexo-theme-webstack/issues",
"email": "h1606051253@gmail.com"
},
"repository": {
"type": "git",
"url": "https://github.com/HCLonely/hexo-theme-webstack.git"
},
"devDependencies": {
"clean-css-cli": "^4.3.0",
"ejs-lint": "^1.1.0",
Expand Down
122 changes: 0 additions & 122 deletions source/js/resizeable.js

This file was deleted.

0 comments on commit 1e1628d

Please sign in to comment.