Files
workbox/gulp-tasks/utils/build-node-package.js
T
Jeffrey PosnickandGitHub 9d88f2abae The contents of v3, reconciled with master (#1357)
* The contents of v3, reconciled with master.

* Remove a few stray files.

* Another extra file.

* Two more deletions.

* Setting up for stable release

* v3.0.0

* Updating CDN and versions

* Doc repair for wf (#1358)

* Changing doc structure to work with WF

* Changing doc structure to work with WF
2018-03-13 15:20:33 -04:00

39 lines
1.1 KiB
JavaScript

const babel = require('gulp-babel');
const gulp = require('gulp');
const oneLine = require('common-tags').oneLine;
const path = require('path');
const constants = require('./constants');
const logHelper = require('../../infra/utils/log-helper');
const pkgPathToName = require('./pkg-path-to-name');
module.exports = (packagePath) => {
const packageName = pkgPathToName(packagePath);
const outputDirectory = path.join(packagePath,
constants.PACKAGE_BUILD_DIRNAME);
logHelper.log(oneLine`
Building Node Package for
${logHelper.highlight(packageName)}.
`);
return gulp.src(`${packagePath}/src/**`).pipe(babel({
only: /\.js$/,
presets: [
['env', {
targets: {
// Change this when our minimum required node version changes.
node: '4.0',
},
}],
],
plugins: [
// This ensures that the helpers used by Babel to accompany transpilation
// are only included in our Rollup bundles once, even if they're used
// in multiple source files.
// See https://github.com/rollup/rollup-plugin-babel#helpers
'transform-runtime',
],
})).pipe(gulp.dest(outputDirectory));
};