forked from alibaba/hooks
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: refactor the build toolchain with gulp and remove father
- Loading branch information
Showing
23 changed files
with
13,775 additions
and
25,147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"presets": [ | ||
[ | ||
"@babel/env", | ||
{ | ||
"loose": true, | ||
"modules": false | ||
} | ||
], | ||
"@babel/react" | ||
], | ||
"include": "**/*.js", | ||
"exclude": "**/*.ts", | ||
"plugins": [ | ||
"babel-plugin-transform-async-to-promises" | ||
] | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
const gulp = require('gulp'); | ||
const babel = require('gulp-babel'); | ||
const ts = require('gulp-typescript'); | ||
const del = require('del'); | ||
|
||
gulp.task('clean', async function () { | ||
await del('lib/**'); | ||
await del('es/**'); | ||
await del('dist/**'); | ||
}); | ||
|
||
gulp.task('cjs', function () { | ||
const tsProject = ts.createProject('tsconfig.json', { | ||
module: 'CommonJS', | ||
}); | ||
return tsProject | ||
.src() | ||
.pipe(tsProject()) | ||
.pipe( | ||
babel({ | ||
configFile: '../../.babelrc', | ||
}), | ||
) | ||
.pipe(gulp.dest('lib/')); | ||
}); | ||
|
||
gulp.task('es', function () { | ||
const tsProject = ts.createProject('tsconfig.json', { | ||
module: 'ESNext', | ||
}); | ||
return tsProject | ||
.src() | ||
.pipe(tsProject()) | ||
.pipe( | ||
babel({ | ||
configFile: '../../.babelrc', | ||
}), | ||
) | ||
.pipe(gulp.dest('es/')); | ||
}); | ||
|
||
gulp.task('declaration', function () { | ||
const tsProject = ts.createProject('tsconfig.json', { | ||
declaration: true, | ||
emitDeclarationOnly: true, | ||
}); | ||
return tsProject.src().pipe(tsProject()).pipe(gulp.dest('es/')).pipe(gulp.dest('lib/')); | ||
}); | ||
|
||
exports.default = gulp.series('clean', 'cjs', 'es', 'declaration'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module.exports = { | ||
preset: 'ts-jest/presets/js-with-ts', | ||
clearMocks: true, | ||
globals: { | ||
'ts-jest': { | ||
tsConfig: 'tsconfig.json', | ||
}, | ||
}, | ||
}; |
Oops, something went wrong.