Skip to content

Commit

Permalink
Merge pull request #8 from tohjustin/development-v1.1.0
Browse files Browse the repository at this point in the history
v1.1.0 Release
  • Loading branch information
tohjustin authored Jan 3, 2017
2 parents 1a2665c + 868c1a5 commit 4f93579
Show file tree
Hide file tree
Showing 13 changed files with 208 additions and 32 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<a href="https://circleci.com/gh/tohjustin/pomodori/tree/master"><img src="https://circleci.com/gh/tohjustin/pomodori/tree/master.svg?style=shield" alt="CircleCI Build Status"/></a>
<a href="https://codecov.io/gh/tohjustin/pomodori"><img src="https://codecov.io/gh/tohjustin/pomodori/branch/master/graph/badge.svg" alt="Codecov" /></a>
<a href="https://www.codacy.com/app/tohjustin/pomodori?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=tohjustin/pomodori&amp;utm_campaign=Badge_Grade"><img src="https://api.codacy.com/project/badge/Grade/ab08c87aa6a3467496591b87ad77f8e8"/></a>
<a href="https://github.com/tohjustin/pomodori/blob/master/docs/LighthouseReport.pdf"><img src="https://img.shields.io/badge/lighthouse-100%2F100-ff69b4.svg"/></a>
<a href="https://github.com/tohjustin/pomodori/blob/master/LICENSE"><img src="https://img.shields.io/github/license/mashape/apistatus.svg"/></a>
</p>
<p align="center">
Expand Down
13 changes: 12 additions & 1 deletion build/webpack.base.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ var path = require('path')
var config = require('../config')
var utils = require('./utils')
var projectRoot = path.resolve(__dirname, '../')
var CopyWebpackPlugin = require('copy-webpack-plugin')
var ManifestPlugin = require('webpack-manifest-plugin')

var env = process.env.NODE_ENV
// check env & config/index.js to decide whether to enable CSS source maps for the
Expand Down Expand Up @@ -90,5 +92,14 @@ module.exports = {
browsers: ['last 2 versions']
})
]
}
},
plugins: [
new ManifestPlugin({
fileName: 'asset-manifest.json'
}),
new CopyWebpackPlugin([
{ from: './src/sw.js' },
{ from: './src/manifest.json' },
]),
]
}
Binary file added docs/LighthouseReport.pdf
Binary file not shown.
23 changes: 0 additions & 23 deletions docs/user-stories.txt

This file was deleted.

3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<!-- Not all browsers implement the manifest yet, however the <meta> tags will help bridge that gap -->
<link rel="manifest" href="./static/manifest.json">
<link rel="manifest" href="./manifest.json">

<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
Expand Down Expand Up @@ -35,6 +35,7 @@
<title>Pomodori</title>
</head>
<body>
<noscript>Pomodori requires JavaScript to be enabled in your browser to work!</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"vue": "^2.1.0"
},
"devDependencies": {
"assets-webpack-plugin": "^3.5.0",
"autoprefixer": "^6.4.0",
"babel-core": "^6.0.0",
"babel-eslint": "^7.0.0",
Expand All @@ -28,6 +29,7 @@
"chalk": "^1.1.3",
"chromedriver": "^2.21.2",
"connect-history-api-fallback": "^1.1.0",
"copy-webpack-plugin": "^4.0.1",
"cross-spawn": "^4.0.2",
"css-loader": "^0.25.0",
"eslint": "^3.7.1",
Expand Down Expand Up @@ -55,6 +57,7 @@
"karma-sourcemap-loader": "^0.3.7",
"karma-spec-reporter": "0.0.26",
"karma-webpack": "^1.7.0",
"keycode": "^2.1.8",
"less": "^2.7.1",
"less-loader": "^2.2.3",
"lodash": "^4.17.2",
Expand All @@ -79,6 +82,7 @@
"webpack": "^1.13.2",
"webpack-dev-middleware": "^1.8.3",
"webpack-hot-middleware": "^2.12.2",
"webpack-manifest-plugin": "^1.1.0",
"webpack-merge": "^0.14.1"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div id="app">
<div class="MainView">
<div class="top">
<img class="logo" src="/static/logo.png">
<img class="logo" src="/static/logo.png" alt="Pomodori Logo">
<mu-icon-button v-on:click="switchToSettingsView" icon="settings"/>
</div>
<div class="middle">
Expand Down
18 changes: 18 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
// import swURL from 'file?name=sw.js!babel!./sw' // eslint-disable-line no-unused-vars

// Register Service Worker
if ('serviceWorker' in navigator) {
window.addEventListener('load', function () {
// navigator.serviceWorker.register(swURL).then(function (registration) {
navigator.serviceWorker.register('./sw.js').then(function (registration) {
// Registration was successful
console.log('ServiceWorker registration successful with scope: ', registration.scope)
}).catch(function (err) {
// registration failed :(
console.log('ServiceWorker registration failed: ', err)
})
})
} else {
console.log('Service worker not supported')
}

// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
Expand Down
File renamed without changes.
82 changes: 82 additions & 0 deletions src/sw.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/* eslint-disable no-undef */
const CACHE_NAME = 'pomodori-pwa'

const urlsToCache = [
'/',
'/sw.js',
'/index.html',
'/manifest.json',
'/static/alarm.mp3',
'/static/logo.png',
'https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons',
'https://fonts.gstatic.com/s/materialicons/v19/2fcrYFNaTjcS6g4U3t-Y5UEw0lE80llgEseQY3FEmqw.woff2'
]

let generatePrecacheList = (assetJson, urlArray) => {
return urlArray.concat(Object.keys(assetJson).map(function (val) { return assetJson[val] }))
}

self.addEventListener('install', event => {
console.log('Installed')

event.waitUntil(
caches.open(CACHE_NAME)
.then(cache =>
fetch('asset-manifest.json')
.then(response => response.json())
.then(assets => {
cache.addAll(generatePrecacheList(assets, urlsToCache))
// let listOfItemsToCache = _.chain(assets).values().join(urlsToCache).uniq()
// cache.addAll(listOfItemsToCache)
// cache.addAll([
// '/',
// '/sw.js',
// '/index.html',
// '/manifest.json',
// '/static/alarm.mp3',
// '/static/logo.png',
// 'https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons'
// ])
})
.catch(response => {
console.log('Fail to fetch asset-manifest.json!')
console.log(response)
})
).then(() => self.skipWaiting())
)
})

self.addEventListener('activate', event => {
event.waitUntil(self.clients.claim())
})

self.addEventListener('fetch', event => {
// Don't intercept requests to google analytics
if (event.request.url.startsWith('https://www.google-analytics.com/')) {
return fetch(event.request)
} else {
// Return cached content if there's a cache hit
event.respondWith(
caches.open(CACHE_NAME)
.then(cache => cacheableRequestFailingToCacheStrategy({ event, cache }))
)
}
})

let cacheableRequestFailingToCacheStrategy = ({ event, cache }) => {
return fetch(event.request)
.then(throwOnError) // do not cache errors
.then(response => {
cache.put(event.request, response.clone())
return response
})
.catch(() => cache.match(event.request))
}

// Prevent cache being polluted with failure responses
let throwOnError = response => {
if (response.status < 200 || response.status >= 300) {
throw new Error(response.statusText)
}
return response
}
Empty file removed static/.gitkeep
Empty file.
2 changes: 1 addition & 1 deletion test/unit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ testsContext.keys().forEach(testsContext)
// require all src files except main.js for coverage.
// you can also change this to match only the subset of files that
// you want coverage for.
const srcContext = require.context('src', true, /^\.\/(?!main(\.js)?$)/)
const srcContext = require.context('src', true, /^\.\/(?!main|sw(\.js)?$)/)
srcContext.keys().forEach(srcContext)
92 changes: 87 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,16 @@ assertion-error@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.0.2.tgz#13ca515d86206da0bac66e834dd397d87581094c"

assets-webpack-plugin@^3.5.0:
version "3.5.0"
resolved "https://registry.yarnpkg.com/assets-webpack-plugin/-/assets-webpack-plugin-3.5.0.tgz#933b16bf679c7510dd3475e4df9ba495d9dc0368"
dependencies:
camelcase "^1.2.1"
escape-string-regexp "^1.0.3"
lodash.assign "^3.2.0"
lodash.merge "^3.3.2"
mkdirp "^0.5.1"

ast-traverse@~0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/ast-traverse/-/ast-traverse-0.1.1.tgz#69cf2b8386f19dcda1bb1e05d68fe359d8897de6"
Expand Down Expand Up @@ -894,6 +904,10 @@ block-stream@*:
dependencies:
inherits "~2.0.0"

bluebird@^2.10.2:
version "2.11.0"
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-2.11.0.tgz#534b9033c022c9579c56ba3b3e5a5caafbb650e1"

bluebird@^3.0.5, bluebird@^3.1.1, bluebird@^3.3.0, bluebird@^3.4.6:
version "3.4.6"
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.4.6.tgz#01da8d821d87813d158967e743d5fe6c62cf8c0f"
Expand Down Expand Up @@ -1362,6 +1376,19 @@ [email protected]:
version "0.3.1"
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb"

copy-webpack-plugin@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/copy-webpack-plugin/-/copy-webpack-plugin-4.0.1.tgz#9728e383b94316050d0c7463958f2b85c0aa8200"
dependencies:
bluebird "^2.10.2"
fs-extra "^0.26.4"
glob "^6.0.4"
is-glob "^3.1.0"
loader-utils "^0.2.15"
lodash "^4.3.0"
minimatch "^3.0.0"
node-dir "^0.1.10"

core-js@^2.2.0, core-js@^2.4.0:
version "2.4.1"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.4.1.tgz#4de911e667b0eae9124e34254b53aea6fc618d3e"
Expand Down Expand Up @@ -1867,7 +1894,7 @@ [email protected]:
version "1.0.2"
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.2.tgz#4dbc2fe674e71949caf3fb2695ce7f2dc1d9a8d1"

[email protected], escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
[email protected], escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.3, escape-string-regexp@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"

Expand Down Expand Up @@ -2250,6 +2277,26 @@ [email protected]:
version "0.3.0"
resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.3.0.tgz#651f838e22424e7566de161d8358caa199f83d4f"

fs-extra@^0.26.4:
version "0.26.7"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-0.26.7.tgz#9ae1fdd94897798edab76d0918cf42d0c3184fa9"
dependencies:
graceful-fs "^4.1.2"
jsonfile "^2.1.0"
klaw "^1.0.0"
path-is-absolute "^1.0.0"
rimraf "^2.2.8"

fs-extra@^0.30.0:
version "0.30.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-0.30.0.tgz#f233ffcc08d4da7d432daa449776989db1df93f0"
dependencies:
graceful-fs "^4.1.2"
jsonfile "^2.1.0"
klaw "^1.0.0"
path-is-absolute "^1.0.0"
rimraf "^2.2.8"

fs-extra@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-1.0.0.tgz#cd3ce5f7e7cb6145883fcae3191e9877f8587950"
Expand Down Expand Up @@ -2408,6 +2455,16 @@ glob@^5.0.15:
once "^1.3.0"
path-is-absolute "^1.0.0"

glob@^6.0.4:
version "6.0.4"
resolved "https://registry.yarnpkg.com/glob/-/glob-6.0.4.tgz#0f08860f6a155127b2fadd4f9ce24b1aab6e4d22"
dependencies:
inflight "^1.0.4"
inherits "2"
minimatch "2 || 3"
once "^1.3.0"
path-is-absolute "^1.0.0"

glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@~7.1.1:
version "7.1.1"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8"
Expand Down Expand Up @@ -3187,6 +3244,10 @@ kew@~0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/kew/-/kew-0.7.0.tgz#79d93d2d33363d6fdd2970b335d9141ad591d79b"

keycode@^2.1.8:
version "2.1.8"
resolved "https://registry.yarnpkg.com/keycode/-/keycode-2.1.8.tgz#94d2b7098215eff0e8f9a8931d5a59076c4532fb"

kind-of@^3.0.2:
version "3.1.0"
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.1.0.tgz#475d698a5e49ff5e53d14e3e732429dc8bf4cf47"
Expand Down Expand Up @@ -3353,6 +3414,14 @@ lodash._root@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/lodash._root/-/lodash._root-3.0.1.tgz#fba1c4524c19ee9a5f8136b4609f017cf4ded692"

lodash.assign@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/lodash.assign/-/lodash.assign-3.2.0.tgz#3ce9f0234b4b2223e296b8fa0ac1fee8ebca64fa"
dependencies:
lodash._baseassign "^3.0.0"
lodash._createassigner "^3.0.0"
lodash.keys "^3.0.0"

lodash.assign@^4.0.3, lodash.assign@^4.0.6, lodash.assign@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/lodash.assign/-/lodash.assign-4.2.0.tgz#0d99f3ccd7a6d261d19bdaeb9245005d285808e7"
Expand Down Expand Up @@ -3494,14 +3563,14 @@ lodash.words@^3.0.0:
dependencies:
lodash._root "^3.0.0"

"lodash@>=3.5 <5", lodash@^4.0.0, lodash@^4.0.1, lodash@^4.14.0, lodash@^4.16.4, lodash@^4.17.2, lodash@^4.2.0, lodash@^4.3.0, lodash@^4.5.0:
version "4.17.2"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.2.tgz#34a3055babe04ce42467b607d700072c7ff6bf42"

lodash@^3.8.0:
version "3.10.1"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6"

lodash@^4.0.0, lodash@^4.0.1, lodash@^4.14.0, lodash@^4.16.4, lodash@^4.17.2, lodash@^4.2.0, lodash@^4.3.0, lodash@^4.5.0:
version "4.17.2"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.2.tgz#34a3055babe04ce42467b607d700072c7ff6bf42"

lodash@~4.16.4:
version "4.16.6"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.16.6.tgz#d22c9ac660288f3843e16ba7d2b5d06cca27d777"
Expand Down Expand Up @@ -3809,6 +3878,12 @@ no-case@^2.2.0:
dependencies:
lower-case "^1.1.1"

node-dir@^0.1.10:
version "0.1.16"
resolved "https://registry.yarnpkg.com/node-dir/-/node-dir-0.1.16.tgz#d2ef583aa50b90d93db8cdd26fcea58353957fe4"
dependencies:
minimatch "^3.0.2"

node-gyp@^3.3.1:
version "3.4.0"
resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-3.4.0.tgz#dda558393b3ecbbe24c9e6b8703c71194c63fa36"
Expand Down Expand Up @@ -5692,6 +5767,13 @@ webpack-hot-middleware@^2.12.2:
querystring "^0.2.0"
strip-ansi "^3.0.0"

webpack-manifest-plugin@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/webpack-manifest-plugin/-/webpack-manifest-plugin-1.1.0.tgz#6b6c718aade8a2537995784b46bd2e9836057caa"
dependencies:
fs-extra "^0.30.0"
lodash ">=3.5 <5"

webpack-merge@^0.14.1:
version "0.14.1"
resolved "https://registry.yarnpkg.com/webpack-merge/-/webpack-merge-0.14.1.tgz#d6bfe6d9360a024e1e7f8e6383ae735f1737cd23"
Expand Down

0 comments on commit 4f93579

Please sign in to comment.