https://github.com/gravity-ui/gulp-utils
https://github.com/gravity-ui/gulp-utils
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/gravity-ui/gulp-utils
- Owner: gravity-ui
- License: mit
- Created: 2025-01-13T16:08:21.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-27T09:10:07.000Z (over 1 year ago)
- Last Synced: 2025-06-05T07:55:37.865Z (about 1 year ago)
- Language: TypeScript
- Size: 290 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# gulp-utils · [](https://www.npmjs.com/package/@gravity-ui/gulp-utils) [](https://github.com/gravity-ui/gulp-utils/actions/workflows/ci.yml?query=branch:main)
Gulp utils for handling typescript compilation workflow.
## Usage
```ts
import {src, dest} from 'gulp';
import {createTypescriptProject, addVirtualFile} from '@gravity-ui/gulp-utils';
async function compile() {
const tsProject = await createTypescriptProject({
projectPath: 'path/to/project', // default, process.cwd
configName: 'tsconfig.build.json', // default, tsconfig.json
compilerOptions: {
// allows rewrite compiler options from tsconfig.json, default {}
declaration: true,
},
ts: await import('my-typescript-package'), // default, 'typescript'
});
return new Promise((resolve) => {
src('src/**/*.ts')
.pipe(
tsProject({
customTransformers: {
before: [...Object.values(tsProject.customTransformers)],
afterDeclarations: [...Object.values(tsProject.customTransformers)],
},
}),
)
.pipe(
addVirtualFile({
fileName: 'package.json',
text: JSON.stringify({type: 'commonjs'}),
}),
)
.pipe(dest('build'))
.on('end', resolve);
});
}
```