-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathgulpfile.js
More file actions
72 lines (61 loc) · 1.86 KB
/
Copy pathgulpfile.js
File metadata and controls
72 lines (61 loc) · 1.86 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import { execSync } from 'child_process';
/**
* 1. 入口、文档侧边栏相关文件生成
* 2. 代码格式化
* 3. 函数库 || 文档打包
*/
/**
* 代码格式化
*/
const codeFormatting = async () => {
await execSync('npx prettier --write .', {
stdio: 'inherit',
});
};
/**
* 构建包相关入口文件
*/
const buildPackage = async () => {
await execSync('npx esno ./build/packages/index.ts', { stdio: 'inherit' });
};
/**
* 构建文档相关入口文件
*/
const buildDocs = async () => {
await execSync('npx esno ./build/docs/Sidebar.ts', { stdio: 'inherit' });
await execSync('npx esno ./build/docs/Navbar.ts', { stdio: 'inherit' });
await execSync('npx esno ./build/docs/Version.ts', { stdio: 'inherit' });
};
export const dev = async () => {
await buildPackage();
await codeFormatting();
await execSync('cross-env NODE_ENV=dev tsup --watch', { stdio: 'inherit' });
};
export const build = async () => {
await buildPackage();
await codeFormatting();
await execSync('cross-env NODE_ENV=build tsup', { stdio: 'inherit' });
};
export const docsDev = async () => {
await buildPackage();
await buildDocs();
await codeFormatting();
await execSync('pnpm run --filter=docs dev', { stdio: 'inherit' });
};
export const docsBuild = async () => {
await buildPackage();
await execSync('cross-env NODE_ENV=build tsup', { stdio: 'inherit' });
await buildDocs();
await codeFormatting();
await execSync('pnpm run --filter=docs build', { stdio: 'inherit' });
};
export const docsServe = async () => {
await execSync('pnpm run --filter=docs serve', { stdio: 'inherit' });
};
export const newFunction = async () => {
await execSync('npx esno ./build/packages/new.ts', { stdio: 'inherit' });
await codeFormatting();
};
export const release = async () => {
await execSync('npx esno ./build/packages/release.ts', { stdio: 'inherit' });
};