Skip to content

Commit

Permalink
chore: refactor the build toolchain with gulp and remove father
Browse files Browse the repository at this point in the history
  • Loading branch information
awmleer committed Jun 8, 2020
1 parent 1f81d75 commit 0167926
Show file tree
Hide file tree
Showing 23 changed files with 13,775 additions and 25,147 deletions.
17 changes: 17 additions & 0 deletions .babelrc
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"
]
}
18 changes: 0 additions & 18 deletions .fatherrc.ts

This file was deleted.

50 changes: 50 additions & 0 deletions gulpfile.js
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');
9 changes: 9 additions & 0 deletions jest.config.js
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',
},
},
};
Loading

0 comments on commit 0167926

Please sign in to comment.