How to use the @microsoft/web-library-build.subTask function in @microsoft/web-library-build

To help you get started, we’ve selected a few @microsoft/web-library-build examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OfficeDev / office-ui-fabric-react / apps / fabric-examples / gulpfile.js View on Github external
const sourceMatch = [];

projectMatch.forEach(project => sourceMatch.push(
  `${project}/src/**/*.{ts,tsx,scss,js,txt,html}`,
  `!${project}/src/**/*.scss.ts`
));

let rushBuild = build.subTask('rushBuild', (gulp, options, done) => {
  let child = exec(`rush build --to ${pkg.name} ${isProduction ? '--production' : ''}`);

  child.stdout.on('data', data => process.stdout.write(data));
  child.on('close', done);
});

let customWatch = build.subTask('customWatch', (gulp, options, done) => {
  let gaze = require('gaze');
  let isBuilding = false;
  let buildEnqueued = false;

  function startRun() {
    if (!isBuilding) {
      isBuilding = true;
      buildEnqueued = false;

      console.log('Starting build...');

      rushBuild.execute(build.getConfig()).then(() => {
        isBuilding = false;

        // After build is complete, trigger reload.
        build.reload.execute(build.getConfig());
github OfficeDev / office-ui-fabric-react / apps / todo-app / gulpfile.js View on Github external
// Configure TypeScript.
build.TypeScriptConfiguration.setTypescriptCompiler(require('typescript'));

// Use css modules.
build.sass.setConfig({
  useCSSModules: true,
  moduleExportName: ''
});

// Set up a "rushBuild" subTask that will spawn rush build
let fs = require('fs');
let spawn = require('child_process').spawn;
let rawStdout = new fs.SyncWriteStream(1, { autoClose: false });

let rushBuild = build.subTask('rushbuild', (gulp, options, done) => {
  let child = spawn(
    'rush',
    ['build', '--to', 'todo-app']
  );

  child.stdout.on('data', data => rawStdout.write(data));
  child.on('close', done);
});

const sourceMatch = [
  'src/**/*.{ts,tsx,scss,js,txt,html}',
  '!src/**/*.scss.ts'
];

build.task('serve', serial(
  build.serve,
github OfficeDev / office-ui-fabric-react / apps / fabric-examples / gulpfile.js View on Github external
const projectMatch = [
  'apps/fabric-examples',
  'packages/office-ui-fabric-react',
  'packages/example-app-base',
  'packages/utilities'
];

const sourceMatch = [];

projectMatch.forEach(project => sourceMatch.push(
  `${project}/src/**/*.{ts,tsx,scss,js,txt,html}`,
  `!${project}/src/**/*.scss.ts`
));

let rushBuild = build.subTask('rushBuild', (gulp, options, done) => {
  let child = exec(`rush build --to ${pkg.name} ${isProduction ? '--production' : ''}`);

  child.stdout.on('data', data => process.stdout.write(data));
  child.on('close', done);
});

let customWatch = build.subTask('customWatch', (gulp, options, done) => {
  let gaze = require('gaze');
  let isBuilding = false;
  let buildEnqueued = false;

  function startRun() {
    if (!isBuilding) {
      isBuilding = true;
      buildEnqueued = false;