Skip to content

Commit 6258aba

Browse files
committed
build: cleanup build tasks
1 parent a78f2b3 commit 6258aba

File tree

5 files changed

+126
-2432
lines changed

5 files changed

+126
-2432
lines changed

.eslintignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
node_modules
22
types
3-
demo
43
dist
54
swc_build

config/base.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,13 @@ export interface BaseConfig {
44
entry: string
55
srcPath: string
66
bundlePath: string
7-
demoPath: string
8-
bundleInDemoPath: string
97
typesPath: string
108
swcBuildPath: string
119
tsConfigPath: string
1210
}
1311

1412
const srcPath = path.resolve(__dirname, '../src')
1513
const bundlePath = path.resolve(__dirname, '../dist')
16-
const demoPath = path.resolve(__dirname, '../demo')
17-
const bundleInDemoPath = path.resolve(demoPath, './computed')
1814
const swcBuildPath = path.resolve(__dirname, '../swc_build')
1915
const typesPath = path.resolve(__dirname, '../types')
2016
const tsConfigPath = path.resolve(__dirname, '../tsconfig.json')
@@ -23,8 +19,6 @@ export const baseConfig: BaseConfig = {
2319
entry: 'index',
2420
srcPath, // 源码路径
2521
bundlePath, // 编译产物路径
26-
demoPath, // demo 路径
27-
bundleInDemoPath, // 编译产物在 demo 里的路径
2822
typesPath, // .d.ts 类型声明路径
2923
swcBuildPath, // swc 转译生成路径
3024
tsConfigPath, // tsc 配置文件

gulpfile.ts

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@ import tsc from 'gulp-typescript'
44
import path from 'path'
55
import swc from 'gulp-swc'
66
import esbuild from 'gulp-esbuild'
7-
import watch from 'gulp-watch'
87

98
import config from './config'
109

1110
const {
1211
srcPath,
1312
esbuildOptions,
1413
swcOptions,
15-
bundleInDemoPath,
1614
bundlePath,
1715
typesPath,
1816
tsConfigPath,
@@ -24,14 +22,6 @@ const genTsc = () => {
2422
return tsc.createProject(tsConfigPath)
2523
}
2624

27-
gulp.task('clean-dev-bundle', () => {
28-
return gulp.src(bundleInDemoPath, { allowEmpty: true }).pipe(clean())
29-
})
30-
31-
gulp.task('clean-demo-dev-bundle', () => {
32-
return gulp.src(bundleInDemoPath, { allowEmpty: true }).pipe(clean())
33-
})
34-
3525
gulp.task('clean-bundle', () => {
3626
return gulp.src(bundlePath, { allowEmpty: true }).pipe(clean())
3727
})
@@ -63,27 +53,17 @@ gulp.task('esbuild-bundle-dev', () => {
6353
.pipe(gulp.dest(bundlePath))
6454
})
6555

66-
gulp.task('copy-2-demo', () => {
67-
return gulp.src(path.resolve(swcBuildPath, '*.js')).pipe(gulp.dest(bundleInDemoPath))
68-
})
69-
7056
gulp.task('watch', () => {
7157
const tsFile = path.resolve(srcPath, '*.ts')
72-
const watcher = watch(tsFile, gulp.series('dev'))
73-
watcher.on('change', function (path, stats) {
74-
console.log(`File ${path} was changed`)
75-
})
58+
gulp.watch(tsFile, undefined, gulp.series('dev'))
7659
})
7760

7861
// build for develop
7962
gulp.task(
8063
'dev',
8164
gulp.series(
82-
'clean-dev-bundle',
83-
'clean-demo-dev-bundle',
8465
'swc-ts-2-js',
8566
'esbuild-bundle-dev',
86-
'copy-2-demo',
8767
),
8868
)
8969

0 commit comments

Comments
 (0)