forked from GoogleChrome/workbox
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.js
More file actions
45 lines (37 loc) · 1.23 KB
/
build.js
File metadata and controls
45 lines (37 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
const gulp = require('gulp');
const lernaWrapper = require('./utils/lerna-wrapper');
const fs = require('fs-extra');
const path = require('path');
gulp.task('lerna-bootstrap', () => {
// If it's a star, build all projects (I.e. bootstrap everything.)
if (global.packageOrStar === '*') {
return lernaWrapper.bootstrap();
}
// If it's not a star, we can scope the build to a specific project.
return lernaWrapper.bootstrap(
'--include-filtered-dependencies',
'--scope', global.packageOrStar
);
});
// This is needed for workbox-build but is also used by the rollup-helper
// to add CDN details to workbox-sw.
// Make sure this runs **before** lerna-bootstrap.
gulp.task('build:update-cdn-details', async function() {
const cdnDetails = await fs.readJSON(path.join(
__dirname, '..', 'cdn-details.json'
));
const lernaPkg = await fs.readJSON(path.join(
__dirname, '..', 'lerna.json'
));
cdnDetails.latestVersion = lernaPkg.version;
const workboxBuildPath = path.join(
__dirname, '..', 'packages', 'workbox-build', 'src', 'cdn-details.json'
);
await fs.writeJson(workboxBuildPath, cdnDetails, {
spaces: 2,
});
});
gulp.task('build', gulp.series(
'build:update-cdn-details',
'lerna-bootstrap',
));