How to use the @microsoft/sp-build-web.task function in @microsoft/sp-build-web

To help you get started, we’ve selected a few @microsoft/sp-build-web 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 SharePoint / sp-dev-build-extensions / tools / gulp-tasks / deploy-app-package / gulpfile-deploy-app-package.js View on Github external
'use strict';

const build = require('@microsoft/sp-build-web');
const sppkgDeploy = require('node-sppkg-deploy');

const environmentInfo = {
  "username": "",
  "password": "",
  "tenant": "",
  "catalogSite": ""
};

build.task('deploy-sppkg', {
  execute: (config) => {
    environmentInfo.username = config.args['username'] || environmentInfo.username;
    environmentInfo.password = config.args['password'] || environmentInfo.password;
    environmentInfo.tenant = config.args['tenant'] || environmentInfo.tenant;
    environmentInfo.catalogSite = config.args['catalogsite'] || environmentInfo.catalogSite;

    const pkgFile = require('./config/package-solution.json');
    if (pkgFile) {
      // Retrieve the filename from the package solution config file
      let filename = pkgFile.paths.zippedPackage;
      // Remove the solution path from the filename
      filename = filename.split('/').pop();
      // Retrieve the skip feature deployment setting from the package solution config file
      const skipFeatureDeployment = pkgFile.solution.skipFeatureDeployment ? pkgFile.solution.skipFeatureDeployment : false;
      // Deploy the SharePoint package
      return sppkgDeploy.deploy({
github SharePoint / sp-dev-fx-extensions / samples / js-field-taskpriority / gulpfile-serve-info.js View on Github external
'use strict';

const build = require('@microsoft/sp-build-web');

build.task('serve-info', {
  execute: (config) => {
    return new Promise((resolve, reject) => {
      var serveTask = config.uniqueTasks.find((task) => {
        return task.name === 'serve';
      });
      var url = `http${serveTask.taskConfig.https ? 's' : ''}://${serveTask.taskConfig.hostname}:${serveTask.taskConfig.port}/temp/manifests.js`;

      for (var key in config.properties.manifests) {
        var manifest = config.properties.manifests[key];
        if (manifest.componentType !== 'Extension') {
          continue;
        }

        console.log(`${manifest.alias}:`);
        console.log();
        console.log(`Copy the querystring parameters on the next line.`);
github SharePoint / sp-dev-fx-webparts / samples / vuejs-todo-single-file-component / gulpfile.js View on Github external
esModule: true
                                }
                            }]
                    }]
            },
        };

        return merge(config, vueConfig);
    }
});

let copyOtherFiles = build.subTask('copy-other-files', function(gulp, buildOptions, done){
    return gulp.src(['src/**/*.vue', 'src/**/*.scss'])
               .pipe(gulp.dest(buildOptions.libFolder))
});
build.task('copy-other-files', copyOtherFiles);
build.rig.addPostTypescriptTask(copyOtherFiles);

build.initialize(gulp);
github SharePoint / sp-dev-build-extensions / tools / gulp-tasks / upload-to-sharepoint / gulpfile-upload-to-sharepoint.js View on Github external
'use strict';

const gulp = require('gulp');
const build = require('@microsoft/sp-build-web');
const spsync = require('gulp-spsync-creds').sync;

const environmentInfo = {
  "username": "",
  "password": "",
  "tenant": "",
  "cdnSite": "",
  "cdnLib": ""
}

build.task('upload-to-sharepoint', {
  execute: (config) => {
    environmentInfo.username = config.args['username'] || environmentInfo.username;
    environmentInfo.password = config.args['password'] || environmentInfo.password;
    environmentInfo.tenant = config.args['tenant'] || environmentInfo.tenant;
    environmentInfo.cdnSite = config.args['cdnsite'] || environmentInfo.cdnSite;
    environmentInfo.cdnLib = config.args['cdnlib'] || environmentInfo.cdnLib;

    return new Promise((resolve, reject) => {
      const deployFolder = require('./config/copy-assets.json');
      const folderLocation = `./${deployFolder.deployCdnPath}/**/*.*`;

      return gulp.src(folderLocation)
        .pipe(spsync({
          "username": environmentInfo.username,
          "password": environmentInfo.password,
          "site": `https://${environmentInfo.tenant}.sharepoint.com/${environmentInfo.cdnSite}`,
github SharePoint / sp-dev-build-extensions / tools / gulp-tasks / upload-app-package / gulpfile-upload-app-package.js View on Github external
'use strict';

const gulp = require('gulp');
const build = require('@microsoft/sp-build-web');
const spsync = require('gulp-spsync-creds').sync;

const environmentInfo = {
  "username": "",
  "password": "",
  "tenant": "",
  "catalogSite": ""
}


build.task('upload-app-pkg', {
  execute: (config) => {
    environmentInfo.username = config.args['username'] || environmentInfo.username;
    environmentInfo.password = config.args['password'] || environmentInfo.password;
    environmentInfo.tenant = config.args['tenant'] || environmentInfo.tenant;
    environmentInfo.catalogSite = config.args['catalogsite'] || environmentInfo.catalogSite;

    return new Promise((resolve, reject) => {
      const pkgFile = require('./config/package-solution.json');
      const folderLocation = `./sharepoint/${pkgFile.paths.zippedPackage}`;

      return gulp.src(folderLocation)
        .pipe(spsync({
          "username": environmentInfo.username,
          "password": environmentInfo.password,
          "site": `https://${environmentInfo.tenant}.sharepoint.com/${environmentInfo.catalogSite}`,
          "libraryPath": "AppCatalog",
github SharePoint / sp-dev-build-extensions / tools / gulp-tasks / update-manifest / gulpfile-update-manifest.js View on Github external
'use strict';

const build = require('@microsoft/sp-build-web');
const fs = require('fs');

build.task('update-manifest', {
    execute: (config) => {
        return new Promise((resolve, reject) => {
            const cdnPath = config.args['cdnpath'] || "";
            let json = JSON.parse(fs.readFileSync('./config/write-manifests.json'));
            json.cdnBasePath = cdnPath;
            fs.writeFileSync('./config/write-manifests.json', JSON.stringify(json));
            resolve();
        });
    }
});