tachybase_todo/packages/core/build/src/buildDeclaration.ts
Zeke Zhang 3b7c1345cc
test(e2e): add tests for client (#3144)
* test: add tests for lazy loading of association fields

* refactor: migrate

* test: add tests for page

* test: add tests for page menu

* test: add tests for tabs

* test: add tests for detail block

* test: add tests for list block

* test: add tests for grid card block

* test: add tests for filter collapse block

* test: add tests for markdown block

* test: add tests for table block

* test: add tests for table block

* test: add tests for lazy loading of association fields

* test: add tests for data scope

* test: add tests for filter block

* test: add tests for block template

* test: add tests for drag and sorting

* test: add tests for sorting rules

* test: make testing more stable

* Revert "test: make testing more stable"

This reverts commit 78b7badeb65bfc603fb746efbdb8e242a763ae6a.

* perf: remove enableToConfig

* test: make testing more stable

* test: make testing more stable

* test: delete newly created records to make tests more stable

* fix: fix error when deleting records

* test: make testing more stable

* test: make testing more stable

* test: fix tests

* refactor: optimize file structure

* test: fix tests

* test: fix tests

* refactor: optimize description

* refactor: optimize description

* refactor: use __e2e__ as the root directory for test files

* fix: fix build

* test: make testing more stable
2023-12-13 14:14:33 +08:00

34 lines
1.3 KiB
TypeScript

import gulp from 'gulp';
import gulpTs from 'gulp-typescript';
import path from 'path';
import { ROOT_PATH } from './constant';
export const buildDeclaration = (cwd: string, targetDir: string) => {
return new Promise((resolve, reject) => {
const srcPath = path.join(cwd, 'src');
const targetPath = path.join(cwd, targetDir);
const tsConfig = gulpTs.createProject(path.join(ROOT_PATH, 'tsconfig.json'));
delete tsConfig.config.compilerOptions.paths;
const patterns = [
path.join(srcPath, '**/*.{ts,tsx}'),
`!${path.join(srcPath, '**/fixtures{,/**}')}`,
`!${path.join(srcPath, '**/demos{,/**}')}`,
`!${path.join(srcPath, '**/__test__{,/**}')}`,
`!${path.join(srcPath, '**/__tests__{,/**}')}`,
`!${path.join(srcPath, '**/__e2e__{,/**}')}`,
`!${path.join(srcPath, '**/*.mdx')}`,
`!${path.join(srcPath, '**/*.md')}`,
`!${path.join(srcPath, '**/*.+(test|e2e|spec).+(js|jsx|ts|tsx)')}`,
`!${path.join(srcPath, '**/tsconfig{,.*}.json')}`,
`!${path.join(srcPath, '.umi{,-production,-test}{,/**}')}`,
];
gulp
.src(patterns, { base: srcPath, allowEmpty: true })
.pipe(gulpTs(tsConfig.config.compilerOptions))
.dts.pipe(gulp.dest(targetPath))
.on('end', resolve)
.on('error', reject);
});
};