From 5d7122c953a5e25cb623f10657301affc4066e4f Mon Sep 17 00:00:00 2001 From: Abraham Williams <4braham@gmail.com> Date: Sun, 22 Mar 2020 22:57:33 -0500 Subject: [PATCH] Convert to TypeScript --- .babelrc.json | 4 +- .eslintrc.json | 5 +- .gitignore | 1 + .travis.yml | 2 + build-utils.js | 1 + data/resources.json | 2 +- docs/tutorials/01-configure-app.md | 4 +- index.html | 11 +- package-lock.json | 329 +++++++++++++++++- package.json | 23 +- rollup.config.js | 3 +- src/{console.js => console.ts} | 0 ...parent-scroll.js => transparent-scroll.ts} | 0 .../{about-block.js => about-block.ts} | 0 ...izer-block.js => about-organizer-block.ts} | 6 +- .../{auth-required.js => auth-required.ts} | 22 +- .../{content-loader.js => content-loader.ts} | 18 + .../{dialog-styles.js => dialog-styles.ts} | 0 ...{feedback-dialog.js => feedback-dialog.ts} | 0 ...details.js => previous-speaker-details.ts} | 10 +- ...{session-details.js => session-details.ts} | 26 +- .../{signin-dialog.js => signin-dialog.ts} | 6 +- ...{speaker-details.js => speaker-details.ts} | 17 +- ...ubscribe-dialog.js => subscribe-dialog.ts} | 6 +- ...{featured-videos.js => featured-videos.ts} | 32 +- .../{feedback-block.js => feedback-block.ts} | 29 +- .../{filter-menu.js => filter-menu.ts} | 11 +- ...lex-layout-attr.js => flex-layout-attr.ts} | 0 .../{footer-block.js => footer-block.ts} | 0 src/elements/{footer-nav.js => footer-nav.ts} | 0 src/elements/{footer-rel.js => footer-rel.ts} | 0 .../{footer-social.js => footer-social.ts} | 0 .../{fork-me-block.js => fork-me-block.ts} | 0 .../{gallery-block.js => gallery-block.ts} | 25 +- ...om-toolbar.js => header-bottom-toolbar.ts} | 26 +- .../{header-toolbar.js => header-toolbar.ts} | 55 ++- src/elements/{hero-block.js => hero-block.ts} | 0 ...d-analytics.js => hoverboard-analytics.ts} | 7 +- ...overboard-icons.js => hoverboard-icons.ts} | 0 ...t-posts-block.js => latest-posts-block.ts} | 27 +- src/elements/{map-block.js => map-block.ts} | 6 +- src/elements/{md-content.js => md-content.ts} | 9 +- .../{my-schedule.js => my-schedule.ts} | 8 + .../{partners-block.js => partners-block.ts} | 36 +- .../{polymer-helmet.js => polymer-helmet.ts} | 16 + src/elements/{posts-list.js => posts-list.ts} | 0 ...rs-block.js => previous-speakers-block.ts} | 16 +- .../{schedule-day.js => schedule-day.ts} | 15 +- ...{session-element.js => session-element.ts} | 21 +- ...red-animations.js => shared-animations.ts} | 0 .../{shared-styles.js => shared-styles.ts} | 0 .../{speakers-block.js => speakers-block.ts} | 18 +- .../{sticky-element.js => sticky-element.ts} | 7 +- ...{subscribe-block.js => subscribe-block.ts} | 20 +- ...orm-footer.js => subscribe-form-footer.ts} | 18 +- .../{text-truncate.js => text-truncate.ts} | 16 +- .../{tickets-block.js => tickets-block.ts} | 15 +- .../{toast-element.js => toast-element.ts} | 11 +- .../{video-dialog.js => video-dialog.ts} | 0 src/{hoverboard-app.js => hoverboard-app.ts} | 37 +- src/mixins/redux-mixin.js | 4 - src/mixins/redux-mixin.ts | 4 + src/mixins/sessions-hoc.js | 60 ---- src/mixins/sessions-hoc.ts | 42 +++ src/mixins/speakers-hoc.js | 56 --- src/mixins/speakers-hoc.ts | 39 +++ .../{blog-list-page.js => blog-list-page.ts} | 21 +- src/pages/{blog-page.js => blog-page.ts} | 5 + src/pages/{coc-page.js => coc-page.ts} | 0 src/pages/{faq-page.js => faq-page.ts} | 0 src/pages/{home-page.js => home-page.ts} | 12 +- src/pages/{post-page.js => post-page.ts} | 20 +- ...kers-page.js => previous-speakers-page.ts} | 34 +- .../{schedule-page.js => schedule-page.ts} | 65 ++-- .../{speakers-page.js => speakers-page.ts} | 10 +- src/pages/{team-page.js => team-page.ts} | 17 +- src/redux/{actions.js => actions.ts} | 79 +++-- src/redux/{constants.js => constants.ts} | 0 .../{initial-state.js => initial-state.ts} | 1 + src/redux/{reducer.js => reducer.ts} | 0 src/redux/store.js | 11 - src/redux/store.ts | 13 + ...tion.js => service-worker-registration.ts} | 6 +- src/utils/{functions.js => functions.ts} | 17 +- src/utils/{scrolling.js => scrolling.ts} | 0 src/utils/{share.js => share.ts} | 0 tsconfig.json | 66 ++++ 87 files changed, 1075 insertions(+), 484 deletions(-) rename src/{console.js => console.ts} (100%) rename src/effects/{transparent-scroll.js => transparent-scroll.ts} (100%) rename src/elements/{about-block.js => about-block.ts} (100%) rename src/elements/{about-organizer-block.js => about-organizer-block.ts} (97%) rename src/elements/{auth-required.js => auth-required.ts} (76%) rename src/elements/{content-loader.js => content-loader.ts} (91%) rename src/elements/dialogs/{dialog-styles.js => dialog-styles.ts} (100%) rename src/elements/dialogs/{feedback-dialog.js => feedback-dialog.ts} (100%) rename src/elements/dialogs/{previous-speaker-details.js => previous-speaker-details.ts} (97%) rename src/elements/dialogs/{session-details.js => session-details.ts} (93%) rename src/elements/dialogs/{signin-dialog.js => signin-dialog.ts} (98%) rename src/elements/dialogs/{speaker-details.js => speaker-details.ts} (94%) rename src/elements/dialogs/{subscribe-dialog.js => subscribe-dialog.ts} (98%) rename src/elements/{featured-videos.js => featured-videos.ts} (94%) rename src/elements/{feedback-block.js => feedback-block.ts} (90%) rename src/elements/{filter-menu.js => filter-menu.ts} (96%) rename src/elements/{flex-layout-attr.js => flex-layout-attr.ts} (100%) rename src/elements/{footer-block.js => footer-block.ts} (100%) rename src/elements/{footer-nav.js => footer-nav.ts} (100%) rename src/elements/{footer-rel.js => footer-rel.ts} (100%) rename src/elements/{footer-social.js => footer-social.ts} (100%) rename src/elements/{fork-me-block.js => fork-me-block.ts} (100%) rename src/elements/{gallery-block.js => gallery-block.ts} (91%) rename src/elements/{header-bottom-toolbar.js => header-bottom-toolbar.ts} (90%) rename src/elements/{header-toolbar.js => header-toolbar.ts} (91%) rename src/elements/{hero-block.js => hero-block.ts} (100%) rename src/elements/{hoverboard-analytics.js => hoverboard-analytics.ts} (94%) rename src/elements/{hoverboard-icons.js => hoverboard-icons.ts} (100%) rename src/elements/{latest-posts-block.js => latest-posts-block.ts} (91%) rename src/elements/{map-block.js => map-block.ts} (97%) rename src/elements/{md-content.js => md-content.ts} (97%) rename src/elements/{my-schedule.js => my-schedule.ts} (91%) rename src/elements/{partners-block.js => partners-block.ts} (85%) rename src/elements/{polymer-helmet.js => polymer-helmet.ts} (87%) rename src/elements/{posts-list.js => posts-list.ts} (100%) rename src/elements/{previous-speakers-block.js => previous-speakers-block.ts} (89%) rename src/elements/{schedule-day.js => schedule-day.ts} (92%) rename src/elements/{session-element.js => session-element.ts} (93%) rename src/elements/{shared-animations.js => shared-animations.ts} (100%) rename src/elements/{shared-styles.js => shared-styles.ts} (100%) rename src/elements/{speakers-block.js => speakers-block.ts} (95%) rename src/elements/{sticky-element.js => sticky-element.ts} (93%) rename src/elements/{subscribe-block.js => subscribe-block.ts} (87%) rename src/elements/{subscribe-form-footer.js => subscribe-form-footer.ts} (86%) rename src/elements/{text-truncate.js => text-truncate.ts} (77%) rename src/elements/{tickets-block.js => tickets-block.ts} (95%) rename src/elements/{toast-element.js => toast-element.ts} (92%) rename src/elements/{video-dialog.js => video-dialog.ts} (100%) rename src/{hoverboard-app.js => hoverboard-app.ts} (93%) delete mode 100644 src/mixins/redux-mixin.js create mode 100644 src/mixins/redux-mixin.ts delete mode 100644 src/mixins/sessions-hoc.js create mode 100644 src/mixins/sessions-hoc.ts delete mode 100644 src/mixins/speakers-hoc.js create mode 100644 src/mixins/speakers-hoc.ts rename src/pages/{blog-list-page.js => blog-list-page.ts} (92%) rename src/pages/{blog-page.js => blog-page.ts} (95%) rename src/pages/{coc-page.js => coc-page.ts} (100%) rename src/pages/{faq-page.js => faq-page.ts} (100%) rename src/pages/{home-page.js => home-page.ts} (96%) rename src/pages/{post-page.js => post-page.ts} (91%) rename src/pages/{previous-speakers-page.js => previous-speakers-page.ts} (91%) rename src/pages/{schedule-page.js => schedule-page.ts} (86%) rename src/pages/{speakers-page.js => speakers-page.ts} (98%) rename src/pages/{team-page.js => team-page.ts} (94%) rename src/redux/{actions.js => actions.ts} (95%) rename src/redux/{constants.js => constants.ts} (100%) rename src/redux/{initial-state.js => initial-state.ts} (98%) rename src/redux/{reducer.js => reducer.ts} (100%) delete mode 100644 src/redux/store.js create mode 100644 src/redux/store.ts rename src/{service-worker-registration.js => service-worker-registration.ts} (89%) rename src/utils/{functions.js => functions.ts} (74%) rename src/utils/{scrolling.js => scrolling.ts} (100%) rename src/utils/{share.js => share.ts} (100%) create mode 100644 tsconfig.json diff --git a/.babelrc.json b/.babelrc.json index 1f540be39f..7157942aaa 100644 --- a/.babelrc.json +++ b/.babelrc.json @@ -1,5 +1,6 @@ { "presets": [ + "@babel/preset-typescript", [ "@babel/preset-env", { @@ -8,5 +9,6 @@ } } ] - ] + ], + "plugins": [["@babel/plugin-proposal-class-properties", { "loose": true }]] } diff --git a/.eslintrc.json b/.eslintrc.json index fea17cecec..e7c0851f26 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,6 +1,7 @@ { "root": true, "extends": ["eslint:recommended", "google", "plugin:polymer/polymer-3", "prettier"], + "parser": "@typescript-eslint/parser", "parserOptions": { "sourceType": "module", "ecmaVersion": 2018 @@ -9,8 +10,8 @@ "browser": true, "es6": true }, - "plugins": ["html", "polymer"], - "ignorePatterns": ["node_modules/", "dist/"], + "plugins": ["@typescript-eslint", "html", "polymer"], + "ignorePatterns": ["node_modules/", "dist/", "out-tsc"], "rules": { "brace-style": "off", "new-cap": "off", diff --git a/.gitignore b/.gitignore index 660bd25bbf..1a3bfb3eea 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ dist/ +out-tsc/ node_modules/ .idea/ .vscode/ diff --git a/.travis.yml b/.travis.yml index 84c7dff6b9..f07dd874e7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,8 @@ jobs: script: NODE_ENV=development npm run build - name: Production script: npm run build + - name: Compile + script: npm run compile - name: Lint script: npm run lint - name: Security diff --git a/build-utils.js b/build-utils.js index 7bf0c5f287..a54bfdbeb3 100644 --- a/build-utils.js +++ b/build-utils.js @@ -50,6 +50,7 @@ const isTemplate = ({ url, contentType }) => { 'application/json', 'text/html', 'text/markdown', + 'video/mp2t', // TypeScript ]; if (isNodeModule({ url })) { diff --git a/data/resources.json b/data/resources.json index 894b241d86..a86bfc471e 100644 --- a/data/resources.json +++ b/data/resources.json @@ -277,7 +277,7 @@ "unsubscribe": "Unsubscribe", "enable": { "label": "Enable", - "link": "https://pushassist.com/knowledgebase/how-to-enable-or-disable-push-notifications-on-chrome-firefox-safari-b/" + "link": "https://support.google.com/chrome/answer/3220216" }, "toast": { "title": "Open" diff --git a/docs/tutorials/01-configure-app.md b/docs/tutorials/01-configure-app.md index 3051dd5589..c93cf85447 100644 --- a/docs/tutorials/01-configure-app.md +++ b/docs/tutorials/01-configure-app.md @@ -61,11 +61,11 @@ in `hoverboard-app.html` ```html - + ``` diff --git a/index.html b/index.html index e02c597247..bb387a240d 100644 --- a/index.html +++ b/index.html @@ -84,6 +84,15 @@ + + {% if loadDevelopmentScripts %} - + {% endif %}