yoteams-build-core

1.8.0 • Public • Published

yoteams-build-core

npm version npm MIT

Library with Gulp task for the Microsoft Teams Apps generator yo teams

Documentation

The yoteams-build-core package is set of Gulp tasks that is used by projects scaffolded using the yo teams Microsoft Teams Apps generator.

Using the package

To use the Gulp tasks, add the following to your gulpfile.js file:

const gulp = require("gulp");
const core = require("yoteams-build-core");
const config = {};
// Initialize core build
core.setup(gulp, config);

Configuration

The configuration object can be used to include additional/optional configuration to the Gulp tasks

Configuration Description
watches An array of additional file paths to monitor for server side webpack configuration
clientWatches An array of additional file paths to monitor for client side webpack configuration
staticFiles An array of additional file paths to monitor static file copy
injectSources An array of additional file paths to monitor for static file injections of JavaScript and CSS
injectOptions An object to set options for gulp-inject
htmlFiles An array of additional file paths to monitor for static file injections of environment variables

Default Gulp tasks

The following Gulp tasks are defined by the package:

  • build - build the solution. Runs the following tasks in series: webpack, styles, static:copy and static:inject
  • manifest - packages the manifests. The validate-manifest task is run as a part of this task
  • serve - builds and runs the solution on the local machine, background re-compilation when files are changed
  • ngrok-serve - builds and runs the solution on the local machine with ngrok support, see below
  • codespaces-serve - builds, packages and runs the solution when using inside Github Codespaces
  • webpack - runs webpack on the solution by running webpack:client and webpack:server in parallel
  • nuke - clears all build and temp files
  • static:copy - copies all static files to the dist folder
  • static:inject - injects generated JavaScript and CSS files into the static files
  • styles - compiles SASS to CSS

Flags

  • --no-schema-validation - skips validation of schemas for the manifest task

Internally used tasks

  • watch - internal watcher task
  • nodemon - internal task for running nodemon
  • start-ngrok - internal task to start ngrok

Using ngrok

The ngrok-serve command starts the ngrok client and by default assigns a random URL. By using process.env properties the ngrok client can be configured:

  • NGROK_SUBDOMAIN use a predefined ngrok subdomain
  • NGROK_REGION use a specific ngrok region
  • NGROK_AUTH user ngrok authentication token
  • PORT use a specific port for the local server (default 3007)

Using Github Codespaces

No additional configuration is required for Github Codespaces, except by configuring the exposed port (default 3007) to be Public (default is Private).

Custom tasks

Custom tasks can be added to the gulpfile.js to support any additional build or deploy steps you need.

Overriding tasks

Existing tasks can be overwritten in gulpfile.js by adding a new Gulp task with the name of the task you want to overwrite, by adding the task override at the end of the file:

// Add your custom tasks below

gulp.task("webpack", () => {
    console.log("My custom webpack task");
    return Promise.resolve();
});

Or adding an additional task for the servecommand:

// Add your custom tasks below

gulp.task("serve", gulp.series("nuke", "build", "nodemon", () => {
    console.log("Hello world!");
    return Promise.resolve();
}, "watch"));

Plugins

This package supports plugins. Plugins has to be added as devDependencies to the Teams application project and their name must start with yoteams-. When a plugin is found it is expected to export a setup function that takes two arguments - the Gulp object and the configuration object.

Available plugins

  • yoteams-deploy - contains additional tasks for automatic deployment to a Microsoft Teams environment.

Contributing

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Readme

Keywords

none

Package Sidebar

Install

npm i yoteams-build-core

Weekly Downloads

598

Version

1.8.0

License

MIT

Unpacked Size

48.8 kB

Total Files

18

Last publish

Collaborators

  • wictorwilen
  • officedevpnp
  • rickvanrousselt
  • stephanbisser