Skip to content

Commit cb22e57

Browse files
authored
Merge pull request #141 from GoogleChrome/develop
Release 1.0.0-beta3
2 parents 85ce961 + cfb36f3 commit cb22e57

File tree

15 files changed

+227
-65
lines changed

15 files changed

+227
-65
lines changed

.eslintrc.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@
3232
"src/js/utils/generateApi.js"
3333
]
3434
}
35+
],
36+
"import/no-unresolved": [
37+
"error", {
38+
"ignore": [
39+
"../public/api.json"
40+
]
41+
}
3542
]
3643
}
3744
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Copyright 2021 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Cron Schedule
16+
17+
on:
18+
schedule:
19+
- cron: '20 6 * * 1'
20+
21+
jobs:
22+
23+
lint-js:
24+
name: Lint JS
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v2
29+
with:
30+
ref: develop
31+
32+
- name: Get npm cache directory
33+
id: npm-cache
34+
run: echo "::set-output name=dir::$(npm config get cache)"
35+
36+
- name: Configure npm cache
37+
uses: actions/cache@v2
38+
with:
39+
path: ${{ steps.npm-cache.outputs.dir }}
40+
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
41+
restore-keys: |
42+
${{ runner.os }}-npm-
43+
44+
- name: Install Node dependencies
45+
run: npm ci
46+
47+
- name: Detect coding standard violations
48+
run: npm run lint
49+
50+
deploy-staging:
51+
needs: [lint-js]
52+
name: Deploy Staging
53+
runs-on: ubuntu-latest
54+
steps:
55+
- name: Checkout repository
56+
uses: actions/checkout@v2
57+
with:
58+
ref: develop
59+
60+
- name: Get npm cache directory
61+
id: npm-cache
62+
run: echo "::set-output name=dir::$(npm config get cache)"
63+
64+
- name: Configure npm cache
65+
uses: actions/cache@v2
66+
with:
67+
path: ${{ steps.npm-cache.outputs.dir }}
68+
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
69+
restore-keys: |
70+
${{ runner.os }}-npm-
71+
72+
- name: Install Node dependencies
73+
run: npm ci
74+
75+
- name: Build Assets
76+
run: npm run build
77+
78+
- name: Deploy to Firebase
79+
uses: FirebaseExtended/action-hosting-deploy@v0
80+
with:
81+
repoToken: "${{ secrets.GITHUB_TOKEN }}"
82+
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT }}"
83+
expires: 30d
84+
projectId: "${{ secrets.FIREBASE_PROJECT_ID }}"
85+
channelId: staging

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Kino
44

5-
This is a sample media (VOD) app to demonstrate media functionality in the context of a Progressive Web App.
5+
This is a sample Video on demand (VOD) app to demonstrate media functionality in the context of a Progressive Web App (PWA).
66

77
## Running the site locally
88

@@ -14,7 +14,7 @@ Start by creating a new project from the [Firebase Console](https://console.fire
1414

1515
Clone this repository:
1616

17-
git clone [email protected]:xwp/kino.git
17+
git clone [email protected]:GoogleChrome/kino.git
1818

1919
Go to the project folder:
2020

cors.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{
33
"origin": [
44
"https://kinoweb-dev.web.app",
5-
"https://kinoweb-dev--staging-5ooakhlz.web.app",
5+
"https://kinoweb-dev--staging-2ra3ji0i.web.app",
66
"https://kinoweb.dev",
77
"http://localhost:5000"
88
],

package-lock.json

Lines changed: 10 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "kino",
3-
"version": "1.0.0-beta2",
3+
"version": "1.0.0-beta3",
44
"description": "A sample offline streaming video PWA built for web.dev/media",
55
"main": "src/index.js",
66
"author": "Google",
@@ -19,6 +19,7 @@
1919
"@babel/eslint-parser": "^7.14.4",
2020
"@babel/eslint-plugin": "^7.13.16",
2121
"@babel/preset-env": "^7.14.4",
22+
"@rollup/plugin-json": "^4.1.0",
2223
"chokidar-cli": "^2.1.0",
2324
"eslint": "^7.27.0",
2425
"eslint-config-airbnb-base": "^14.2.1",

public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
</clipPath>
9999
</defs>
100100
</svg>
101-
<a target="_blank" href="https://github.com/xwp/kino/">See the source code</a>
101+
<a target="_blank" href="https://github.com/GoogleChrome/kino/">See the source code</a>
102102
</p>
103103
</div>
104104
</div>

rollup.config.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,8 @@
1616

1717
import css from 'rollup-plugin-import-css';
1818
import generateApi from './src/js/utils/generateApi.js';
19-
import generateAssetsToCache from './src/js/utils/generateAssetsToCache';
20-
21-
async function setupApi() {
22-
try {
23-
const api = await generateApi();
24-
await generateAssetsToCache(api);
25-
} catch (err) {
26-
console.error(err);
27-
}
28-
}
19+
import generateCache from './src/js/utils/generateCache';
20+
import json from '@rollup/plugin-json';
2921

3022
export default [
3123
{
@@ -35,6 +27,8 @@ export default [
3527
format: 'cjs',
3628
},
3729
plugins: [
30+
generateApi(),
31+
json(),
3832
css(),
3933
],
4034
},
@@ -45,7 +39,7 @@ export default [
4539
format: 'cjs',
4640
},
4741
plugins: [
48-
setupApi(),
42+
generateCache(),
4943
],
5044
},
5145
];

src/api/streaming/06-adaptive-streaming.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,4 @@ PWA and building more features and writing new content. If you want to contribut
8787
to the code that runs this site, make a suggestion, request a feature, or just
8888
want to see how it was built go check out the [source code].
8989

90-
[source code]: https://github.com/xwp/kino/
90+
[source code]: https://github.com/GoogleChrome/kino/

src/index.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import Router from './js/classes/Router';
2121
import VideoDownloaderRegistry from './js/classes/VideoDownloaderRegistry';
2222
import ConnectionStatus from './js/classes/ConnectionStatus';
23+
import api from '../public/api.json';
2324

2425
/**
2526
* Web Components implementation.
@@ -39,6 +40,7 @@ import VideoPage from './js/pages/Video';
3940
import CategoryPage from './js/pages/Category';
4041
import DownloadsPage from './js/pages/Downloads';
4142
import SettingsPage from './js/pages/Settings';
43+
import ErrorPage from './js/pages/Error';
4244

4345
/**
4446
* Settings
@@ -118,15 +120,24 @@ const router = new Router({
118120
videoDownloaderRegistry,
119121
connectionStatus,
120122
});
121-
router.route('^/settings/?', SettingsPage);
122-
router.route('^/downloads/?', DownloadsPage);
123-
router.route('^/category/([^/]*)/?', CategoryPage);
124123
router.route('^/?$', HomePage);
124+
router.route('^/downloads/$', DownloadsPage);
125+
router.route('^/settings/$', SettingsPage);
125126

126127
/**
127-
* Consider all else a single video page.
128+
* Add the category pages.
128129
*/
129-
router.route('.*', VideoPage);
130+
api.categories.forEach((category) => router.route(`^/category/${category.slug}/$`, CategoryPage));
131+
132+
/**
133+
* Add the video pages.
134+
*/
135+
api.videos.forEach((video) => router.route(`^/${video.id}/$`, VideoPage));
136+
137+
/**
138+
* Consider all else an error.
139+
*/
140+
router.route('.*', ErrorPage);
130141

131142
/**
132143
* Register Service Worker.

0 commit comments

Comments
 (0)