Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorMichael <michael@lyricalz.com>2018-03-16 23:46:58 +0300
committerXhmikosR <xhmikosr@gmail.com>2018-03-21 13:15:47 +0300
commit7dc41e299b62f88961d608515f7252cb05dcd51e (patch)
treed5564dc31f78b103499f96f3c41296d4a9c519a8 /build
parent1615a76f837771b5adaa0ab2eccbae0fb13266fb (diff)
Update to workbox 3.0 & fix breaking changes
Diffstat (limited to 'build')
-rw-r--r--build/workbox.js27
1 files changed, 19 insertions, 8 deletions
diff --git a/build/workbox.js b/build/workbox.js
index e51cf6dcbd..4694fb9097 100644
--- a/build/workbox.js
+++ b/build/workbox.js
@@ -16,17 +16,26 @@ const workboxSWDestMapPath = `${workboxSWDestPath}.map`
fs.createReadStream(workboxSWSrcPath).pipe(fs.createWriteStream(workboxSWDestPath))
fs.createReadStream(workboxSWSrcMapPath).pipe(fs.createWriteStream(workboxSWDestMapPath))
-const updateUrl = (manifestEntries) => manifestEntries.map((entry) => {
- if (entry.url.startsWith(buildPrefix)) {
- const regex = new RegExp(buildPrefix, 'g')
- entry.url = entry.url.replace(regex, '')
+const updateUrl = (manifestEntries) => {
+ const manifest = manifestEntries.map((entry) => {
+ if (entry.url.startsWith(buildPrefix)) {
+ const regex = new RegExp(buildPrefix, 'g')
+ entry.url = entry.url.replace(regex, '')
+ }
+ return entry
+ })
+ return {
+ manifest,
+ warnings: []
}
- return entry
-})
+}
config.manifestTransforms = [updateUrl]
-swBuild.injectManifest(config).then(() => {
+swBuild.injectManifest(config).then(({
+ count,
+ size
+}) => {
const wbSwRegex = /{fileName}/g
fs.readFile(config.swDest, 'utf8', (err, data) => {
if (err) {
@@ -34,7 +43,9 @@ swBuild.injectManifest(config).then(() => {
}
const swFileContents = data.replace(wbSwRegex, wbFileName)
fs.writeFile(config.swDest, swFileContents, () => {
- console.log('Pre-cache Manifest generated.')
+ console.log('Pre-cache Manifest generated.', `Pre-cached ${count} files, totalling ${size} bytes.`)
})
})
+}).catch((error) => {
+ console.error(`Something went wrong: ${error}`)
})