diff --git a/.ember-cli b/.ember-cli new file mode 100644 index 0000000..bc83a0c --- /dev/null +++ b/.ember-cli @@ -0,0 +1,3 @@ +{ + "blueprint": "@glimmer/blueprint" +} diff --git a/config/environment.js b/config/environment.js index 233907e..3cb8a52 100644 --- a/config/environment.js +++ b/config/environment.js @@ -4,7 +4,7 @@ module.exports = function(environment) { let ENV = { rootURL: '/api/', modulePrefix: 'glimmer-api-docs', - environment: environment, + environment, locationType: 'auto' }; diff --git a/config/targets.js b/config/targets.js index bdec11d..2f53a47 100644 --- a/config/targets.js +++ b/config/targets.js @@ -1,3 +1,5 @@ +'use strict'; + let browsers = [ '> 5%', 'last 2 Edge versions', diff --git a/package.json b/package.json index d3b7be1..d3c10b5 100644 --- a/package.json +++ b/package.json @@ -15,12 +15,13 @@ "devDependencies": { "@glimmer/application": "^0.8.0", "@glimmer/application-pipeline": "^0.9.0", - "@glimmer/blueprint": "^0.5.3", + "@glimmer/blueprint": "~0.6.4", "@glimmer/component": "^0.8.0", "@glimmer/inline-precompile": "^1.0.0", "@glimmer/resolver": "^0.4.1", "@glimmer/test-helpers": "^0.30.0", "@types/qunit": "^2.0.31", + "broccoli-asset-rev": "^2.5.0", "broccoli-funnel": "^2.0.1", "broccoli-json-module": "^1.0.0", "broccoli-merge-trees": "^2.0.0", @@ -29,6 +30,7 @@ "ember-cli-dependency-checker": "^2.0.1", "ember-cli-inject-live-reload": "^1.7.0", "ember-cli-sass": "^7.0.0", + "ember-cli-tslint": "^0.1.3", "ember-cli-uglify": "^2.0.0", "json-typescript-docs": "^0.5.0", "qunitjs": "^2.3.3", diff --git a/src/index.ts b/src/index.ts index b49e4aa..cc7167e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,5 @@ -import App from './main'; import { ComponentManager, setPropertyDidChange } from '@glimmer/component'; +import App from './main'; const app = new App(); const containerElement = document.getElementById('app'); @@ -14,9 +14,9 @@ app.registerInitializer({ } }); -app.boot(); - while(containerElement.firstChild) { containerElement.removeChild(containerElement.firstChild); } + app.renderComponent('GlimmerApiDocs', containerElement, null); +app.boot(); diff --git a/src/main.ts b/src/main.ts index e6f9ba2..58a8dba 100644 --- a/src/main.ts +++ b/src/main.ts @@ -9,8 +9,21 @@ export default class App extends Application { let resolver = new Resolver(resolverConfiguration, moduleRegistry); super({ - rootName: resolverConfiguration.app.rootName, - resolver + resolver, + rootName: resolverConfiguration.app.rootName }); } } + +if ('serviceWorker' in navigator) { + window.addEventListener('load', function() { + navigator.serviceWorker.register('/api/service.js') + .then(registration => { + // Registration was successful + console.log('ServiceWorker registration successful with scope: ', registration.scope); + }).catch(function(err) { + // registration failed :( + console.log('ServiceWorker registration failed: ', err); + }); + }); +} diff --git a/tslint.json b/tslint.json new file mode 100644 index 0000000..556a717 --- /dev/null +++ b/tslint.json @@ -0,0 +1,14 @@ +{ + "defaultSeverity": "error", + "extends": [ + "tslint:recommended" + ], + "jsRules": {}, + "rules": { + "quotemark": [true, "single"], + "trailing-comma": false, + "only-arrow-functions": false, + "prefer-const": false + }, + "rulesDirectory": [] +} diff --git a/workers/service.ts b/workers/service.ts index 698d1b2..0103385 100644 --- a/workers/service.ts +++ b/workers/service.ts @@ -11,12 +11,25 @@ var URLS_TO_CACHE = [ 'https://fonts.googleapis.com/css?family=Roboto|Robot+Mono' ]; +self.addEventListener('activate', function(event) { + event.waitUntil( + caches.keys().then(function(keys) { + return Promise.all( + keys.filter(function(key) { + return !URLS_TO_CACHE.includes(key); + }).map(function(key) { + return caches.delete(key); + }) + ); + }) + ); +}); + self.addEventListener('install', function(event) { // Perform install steps event.waitUntil( caches.open(CACHE_NAME) .then(function(cache) { - console.log('Opened cache'); return cache.addAll(URLS_TO_CACHE); }) ); @@ -33,6 +46,11 @@ self.addEventListener('fetch', function(event) { // fallback so we can ship new version of the app event.respondWith( fetch(request) + // Request succeeded - update cache + .then(function(response) { + cache.put(request, response); + return response; + }) // Request failed - fall back to cache .catch(function() { return caches.match(request); diff --git a/yarn.lock b/yarn.lock index a0877ed..5e27583 100644 --- a/yarn.lock +++ b/yarn.lock @@ -57,9 +57,9 @@ "@glimmer/runtime" "^0.29.8" "@glimmer/util" "^0.29.8" -"@glimmer/blueprint@^0.5.3": - version "0.5.3" - resolved "https://registry.yarnpkg.com/@glimmer/blueprint/-/blueprint-0.5.3.tgz#9aed2f9260ee5503436178b4dd3e2cc7d83b2cec" +"@glimmer/blueprint@~0.6.4": + version "0.6.4" + resolved "https://registry.yarnpkg.com/@glimmer/blueprint/-/blueprint-0.6.4.tgz#424a9ea67bbeb42d3dbebe008e38675b8b2cface" dependencies: ember-cli-string-utils "^1.1.0" @@ -490,7 +490,7 @@ aws4@^1.2.1, aws4@^1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e" -babel-code-frame@^6.26.0: +babel-code-frame@^6.22.0, babel-code-frame@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" dependencies: @@ -1101,7 +1101,7 @@ braces@^1.8.2: preserve "^0.2.0" repeat-element "^1.1.2" -broccoli-asset-rev@^2.4.3: +broccoli-asset-rev@^2.4.3, broccoli-asset-rev@^2.5.0: version "2.6.0" resolved "https://registry.yarnpkg.com/broccoli-asset-rev/-/broccoli-asset-rev-2.6.0.tgz#0633fc3a0b2ba0c2c1d56fa9feb7b331fc83be6d" dependencies: @@ -1341,7 +1341,7 @@ broccoli-node-info@1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/broccoli-node-info/-/broccoli-node-info-1.1.0.tgz#3aa2e31e07e5bdb516dd25214f7c45ba1c459412" -broccoli-persistent-filter@^1.1.5, broccoli-persistent-filter@^1.1.6, broccoli-persistent-filter@^1.2.13, broccoli-persistent-filter@^1.3.1, broccoli-persistent-filter@^1.4.0: +broccoli-persistent-filter@^1.1.5, broccoli-persistent-filter@^1.1.6, broccoli-persistent-filter@^1.2.0, broccoli-persistent-filter@^1.2.13, broccoli-persistent-filter@^1.3.1, broccoli-persistent-filter@^1.4.0: version "1.4.3" resolved "https://registry.yarnpkg.com/broccoli-persistent-filter/-/broccoli-persistent-filter-1.4.3.tgz#3511bc52fc53740cda51621f58a28152d9911bc1" dependencies: @@ -1459,6 +1459,14 @@ broccoli-test-helper@^1.1.0: rimraf "^2.5.4" walk-sync "^0.3.1" +broccoli-tslinter@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/broccoli-tslinter/-/broccoli-tslinter-3.0.0.tgz#50e2d0379cef48cb362757204777100f96d61551" + dependencies: + broccoli-persistent-filter "^1.2.0" + chalk "^1.1.1" + exists-sync "0.0.3" + broccoli-typescript-compiler@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/broccoli-typescript-compiler/-/broccoli-typescript-compiler-1.0.1.tgz#648055f23f4257a1ec434a455c77f5e43bd28d2f" @@ -1548,7 +1556,7 @@ bser@^2.0.0: dependencies: node-int64 "^0.4.0" -builtin-modules@^1.0.0, builtin-modules@^1.1.0: +builtin-modules@^1.0.0, builtin-modules@^1.1.0, builtin-modules@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" @@ -1792,7 +1800,7 @@ commander@2.9.0: dependencies: graceful-readlink ">= 1.0.0" -commander@^2.5.0, commander@^2.6.0, commander@~2.11.0: +commander@^2.5.0, commander@^2.6.0, commander@^2.9.0, commander@~2.11.0: version "2.11.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563" @@ -2190,6 +2198,15 @@ ember-cli-test-info@^1.0.0: dependencies: ember-cli-string-utils "^1.0.0" +ember-cli-tslint@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/ember-cli-tslint/-/ember-cli-tslint-0.1.3.tgz#772db5c77efd85a3b885964e5ac92c059c9aaaa5" + dependencies: + broccoli-tslinter "^3.0.0" + rsvp "^4.7.0" + tslint "^5.5.0" + walk-sync "^0.3.2" + ember-cli-uglify@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ember-cli-uglify/-/ember-cli-uglify-2.0.0.tgz#b096727d7d1718acc9bfe5d1bc81ce26cafdf6ca" @@ -2949,7 +2966,7 @@ glob@^5.0.10: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.0.0, glob@^7.0.3, glob@^7.0.4, glob@^7.0.5, glob@^7.1.2, glob@~7.1.1: +glob@^7.0.0, glob@^7.0.3, glob@^7.0.4, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2, glob@~7.1.1: version "7.1.2" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" dependencies: @@ -4885,6 +4902,12 @@ resolve@^1.1.6, resolve@^1.3.0, resolve@^1.4.0: dependencies: path-parse "^1.0.5" +resolve@^1.3.2: + version "1.5.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36" + dependencies: + path-parse "^1.0.5" + restore-cursor@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" @@ -4942,6 +4965,10 @@ rsvp@^3.0.14, rsvp@^3.0.16, rsvp@^3.0.17, rsvp@^3.0.18, rsvp@^3.0.21, rsvp@^3.0. version "3.6.2" resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-3.6.2.tgz#2e96491599a96cde1b515d5674a8f7a91452926a" +rsvp@^4.7.0: + version "4.7.0" + resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-4.7.0.tgz#dc1b0b1a536f7dec9d2be45e0a12ad4197c9fd96" + rsvp@~3.0.6: version "3.0.21" resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-3.0.21.tgz#49c588fe18ef293bcd0ab9f4e6756e6ac433359f" @@ -5502,6 +5529,32 @@ trim-right@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" +tslib@^1.7.1: + version "1.8.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.8.0.tgz#dc604ebad64bcbf696d613da6c954aa0e7ea1eb6" + +tslint@^5.5.0: + version "5.8.0" + resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.8.0.tgz#1f49ad5b2e77c76c3af4ddcae552ae4e3612eb13" + dependencies: + babel-code-frame "^6.22.0" + builtin-modules "^1.1.1" + chalk "^2.1.0" + commander "^2.9.0" + diff "^3.2.0" + glob "^7.1.1" + minimatch "^3.0.4" + resolve "^1.3.2" + semver "^5.3.0" + tslib "^1.7.1" + tsutils "^2.12.1" + +tsutils@^2.12.1: + version "2.12.2" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.12.2.tgz#ad58a4865d17ec3ddb6631b6ca53be14a5656ff3" + dependencies: + tslib "^1.7.1" + tunnel-agent@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd"