-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathpublish.js
33 lines (27 loc) · 897 Bytes
/
publish.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const fs = require('fs-extra');
const path = require('path');
const { version } = require('./package.json')
async function main() {
const sourceDir = path.join(__dirname, 'apps/theme-cosy/build/hexo-theme-cosy');
const targetDir = path.join(__dirname, 'release/hexo-theme-cosy');
// 复制文件
await fs.copy(sourceDir, targetDir);
// 创建或更新 package.json
const packageJson = {
name: "hexo-theme-cosy",
version: version,
description: "Hexo Theme Cosy",
repository: "17px/hexo-theme-cosy",
keywords: [
"hexo",
"theme",
"cosy"
],
license: "LGPL-3.0-or-later"
};
// touch package.json
await fs.writeJson(path.join(targetDir, 'package.json'), packageJson, { spaces: 2 });
// touch README.md
await fs.copy(path.join(__dirname, 'README.md'), path.join(targetDir, 'README.md'));
}
main().catch(err => console.error(err));