JSPM

@gravity-ui/gulp-utils

1.0.2
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 1711
    • Score
      100M100P100Q115473F
    • License MIT

    Utils for gulp

    Package Exports

    • @gravity-ui/gulp-utils
    • @gravity-ui/gulp-utils/package.json

    Readme

    gulp-utils · npm package CI

    Gulp utils for handling typescript compilation workflow.

    Usage

    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);
      });
    }