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
50 lines (39 loc) · 1.32 KB
/
build.js
File metadata and controls
50 lines (39 loc) · 1.32 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
46
47
48
49
50
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
const {series} = require('gulp');
const execa = require('execa');
const fse = require('fs-extra');
const upath = require('upath');
const {build_packages} = require('./build-packages');
// 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** build_lerna_bootstrap.
async function build_update_cdn_details() {
const cdnDetails = await fse.readJSON(upath.join(
__dirname, '..', 'cdn-details.json',
));
const workboxBuildPath = upath.join(
__dirname, '..', 'packages', 'workbox-build');
const workboxBuildCdnDetailsPath = upath.join(
workboxBuildPath, 'src', 'cdn-details.json');
const workboxBuildPkg = await fse.readJSON(upath.join(
workboxBuildPath, 'package.json'));
cdnDetails.latestVersion = workboxBuildPkg.version;
await fse.writeJson(workboxBuildCdnDetailsPath, cdnDetails, {
spaces: 2,
});
}
async function build_lerna_bootstrap() {
await execa('lerna', ['bootstrap'], {preferLocal: true});
}
module.exports = {
build: series(
build_update_cdn_details,
build_lerna_bootstrap,
build_packages,
),
};