From 0c406335f51985040d68784005c25854f5a51c77 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 2 Apr 2019 12:14:10 -0700 Subject: [PATCH] Upgrade deps (#3038) * Upgrade deps * Revert workbox back to 3 * Fix var name --- gulp/tasks/gen-icons.js | 12 +- gulp/tasks/translations.js | 357 +- package.json | 142 +- .../util/time-cache-function-promise.ts | 4 +- src/html/authorize.html.template | 2 +- src/html/index.html.template | 2 +- src/html/onboarding.html.template | 2 +- .../lovelace/components/hui-yaml-editor.ts | 38 +- src/panels/lovelace/hui-root.ts | 4 +- test-mocha/common/entity/entity_filter.ts | 2 +- tsconfig.json | 4 +- yarn.lock | 4743 ++++++++--------- 12 files changed, 2564 insertions(+), 2748 deletions(-) diff --git a/gulp/tasks/gen-icons.js b/gulp/tasks/gen-icons.js index 18a5bb42c4..b0afecb43a 100644 --- a/gulp/tasks/gen-icons.js +++ b/gulp/tasks/gen-icons.js @@ -104,9 +104,15 @@ function genHassIcons() { fs.writeFileSync(HASS_OUTPUT_PATH, generateIconset("hass", iconNames)); } -gulp.task("gen-icons-mdi", () => genMDIIcons()); -gulp.task("gen-icons-hass", () => genHassIcons()); -gulp.task("gen-icons", ["gen-icons-hass", "gen-icons-mdi"], () => {}); +gulp.task("gen-icons-mdi", (done) => { + genMDIIcons(); + done(); +}); +gulp.task("gen-icons-hass", (done) => { + genHassIcons(); + done(); +}); +gulp.task("gen-icons", gulp.series("gen-icons-hass", "gen-icons-mdi")); module.exports = { findIcons, diff --git a/gulp/tasks/translations.js b/gulp/tasks/translations.js index 898ee60cff..3cf30958b1 100755 --- a/gulp/tasks/translations.js +++ b/gulp/tasks/translations.js @@ -118,198 +118,219 @@ tasks.push(taskName); * the Lokalise update to translations/en.json will not happen immediately. */ taskName = "build-master-translation"; -gulp.task(taskName, ["clean-translations"], function() { - return gulp - .src("src/translations/en.json") - .pipe( - transform(function(data, file) { - return lokalise_transform(data, data); - }) - ) - .pipe(rename("translationMaster.json")) - .pipe(gulp.dest(workDir)); -}); +gulp.task( + taskName, + gulp.series("clean-translations", function() { + return gulp + .src("src/translations/en.json") + .pipe( + transform(function(data, file) { + return lokalise_transform(data, data); + }) + ) + .pipe(rename("translationMaster.json")) + .pipe(gulp.dest(workDir)); + }) +); tasks.push(taskName); taskName = "build-merged-translations"; -gulp.task(taskName, ["build-master-translation"], function() { - return gulp.src(inDir + "/*.json").pipe( - foreach(function(stream, file) { - // For each language generate a merged json file. It begins with the master - // translation as a failsafe for untranslated strings, and merges all parent - // tags into one file for each specific subtag - // - // TODO: This is a naive interpretation of BCP47 that should be improved. - // Will be OK for now as long as we don't have anything more complicated - // than a base translation + region. - const tr = path.basename(file.history[0], ".json"); - const subtags = tr.split("-"); - const src = [workDir + "/translationMaster.json"]; - for (let i = 1; i <= subtags.length; i++) { - const lang = subtags.slice(0, i).join("-"); - src.push(inDir + "/" + lang + ".json"); - } - return gulp - .src(src) - .pipe(transform((data) => emptyFilter(data))) - .pipe( - merge({ - fileName: tr + ".json", - }) - ) - .pipe(gulp.dest(fullDir)); - }) - ); -}); +gulp.task( + taskName, + gulp.series("build-master-translation", function() { + return gulp.src(inDir + "/*.json").pipe( + foreach(function(stream, file) { + // For each language generate a merged json file. It begins with the master + // translation as a failsafe for untranslated strings, and merges all parent + // tags into one file for each specific subtag + // + // TODO: This is a naive interpretation of BCP47 that should be improved. + // Will be OK for now as long as we don't have anything more complicated + // than a base translation + region. + const tr = path.basename(file.history[0], ".json"); + const subtags = tr.split("-"); + const src = [workDir + "/translationMaster.json"]; + for (let i = 1; i <= subtags.length; i++) { + const lang = subtags.slice(0, i).join("-"); + src.push(inDir + "/" + lang + ".json"); + } + return gulp + .src(src, { allowEmpty: true }) + .pipe(transform((data) => emptyFilter(data))) + .pipe( + merge({ + fileName: tr + ".json", + }) + ) + .pipe(gulp.dest(fullDir)); + }) + ); + }) +); tasks.push(taskName); const splitTasks = []; TRANSLATION_FRAGMENTS.forEach((fragment) => { taskName = "build-translation-fragment-" + fragment; - gulp.task(taskName, ["build-merged-translations"], function() { - // Return only the translations for this fragment. - return gulp - .src(fullDir + "/*.json") - .pipe( - transform((data) => ({ - ui: { - panel: { - [fragment]: data.ui.panel[fragment], + gulp.task( + taskName, + gulp.series("build-merged-translations", function() { + // Return only the translations for this fragment. + return gulp + .src(fullDir + "/*.json") + .pipe( + transform((data) => ({ + ui: { + panel: { + [fragment]: data.ui.panel[fragment], + }, }, - }, - })) - ) - .pipe(gulp.dest(workDir + "/" + fragment)); - }); + })) + ) + .pipe(gulp.dest(workDir + "/" + fragment)); + }) + ); tasks.push(taskName); splitTasks.push(taskName); }); taskName = "build-translation-core"; -gulp.task(taskName, ["build-merged-translations"], function() { - // Remove the fragment translations from the core translation. - return gulp - .src(fullDir + "/*.json") - .pipe( - transform((data) => { - TRANSLATION_FRAGMENTS.forEach((fragment) => { - delete data.ui.panel[fragment]; - }); - return data; - }) - ) - .pipe(gulp.dest(coreDir)); -}); +gulp.task( + taskName, + gulp.series("build-merged-translations", function() { + // Remove the fragment translations from the core translation. + return gulp + .src(fullDir + "/*.json") + .pipe( + transform((data) => { + TRANSLATION_FRAGMENTS.forEach((fragment) => { + delete data.ui.panel[fragment]; + }); + return data; + }) + ) + .pipe(gulp.dest(coreDir)); + }) +); tasks.push(taskName); splitTasks.push(taskName); taskName = "build-flattened-translations"; -gulp.task(taskName, splitTasks, function() { - // Flatten the split versions of our translations, and move them into outDir - return gulp - .src( - TRANSLATION_FRAGMENTS.map( - (fragment) => workDir + "/" + fragment + "/*.json" - ).concat(coreDir + "/*.json"), - { base: workDir } - ) - .pipe( - transform(function(data) { - // Polymer.AppLocalizeBehavior requires flattened json - return flatten(data); - }) - ) - .pipe(minify()) - .pipe(hashFilename()) - .pipe( - rename((filePath) => { - if (filePath.dirname === "core") { - filePath.dirname = ""; - } - }) - ) - .pipe(gulp.dest(outDir)); -}); +gulp.task( + taskName, + gulp.series(...splitTasks, function() { + // Flatten the split versions of our translations, and move them into outDir + return gulp + .src( + TRANSLATION_FRAGMENTS.map( + (fragment) => workDir + "/" + fragment + "/*.json" + ).concat(coreDir + "/*.json"), + { base: workDir } + ) + .pipe( + transform(function(data) { + // Polymer.AppLocalizeBehavior requires flattened json + return flatten(data); + }) + ) + .pipe(minify()) + .pipe(hashFilename()) + .pipe( + rename((filePath) => { + if (filePath.dirname === "core") { + filePath.dirname = ""; + } + }) + ) + .pipe(gulp.dest(outDir)); + }) +); tasks.push(taskName); taskName = "build-translation-fingerprints"; -gulp.task(taskName, ["build-flattened-translations"], function() { - return gulp - .src(outDir + "/**/*.json") - .pipe( - rename({ - extname: "", - }) - ) - .pipe( - hash({ - algorithm: "md5", - hashLength: 32, - template: "<%= name %>.json", - }) - ) - .pipe(hash.manifest("translationFingerprints.json")) - .pipe( - transform(function(data) { - // After generating fingerprints of our translation files, consolidate - // all translation fragment fingerprints under the translation name key - const newData = {}; - Object.entries(data).forEach(([key, value]) => { - const [path, _md5] = key.rsplit("-", 1); - // let translation = key; - let translation = path; - const parts = translation.split("/"); - if (parts.length === 2) { - translation = parts[1]; - } - if (!(translation in newData)) { - newData[translation] = { - fingerprints: {}, - }; - } - newData[translation].fingerprints[path] = value; - }); - return newData; - }) - ) - .pipe(gulp.dest(workDir)); -}); +gulp.task( + taskName, + gulp.series("build-flattened-translations", function() { + return gulp + .src(outDir + "/**/*.json") + .pipe( + rename({ + extname: "", + }) + ) + .pipe( + hash({ + algorithm: "md5", + hashLength: 32, + template: "<%= name %>.json", + }) + ) + .pipe(hash.manifest("translationFingerprints.json")) + .pipe( + transform(function(data) { + // After generating fingerprints of our translation files, consolidate + // all translation fragment fingerprints under the translation name key + const newData = {}; + Object.entries(data).forEach(([key, value]) => { + const [path, _md5] = key.rsplit("-", 1); + // let translation = key; + let translation = path; + const parts = translation.split("/"); + if (parts.length === 2) { + translation = parts[1]; + } + if (!(translation in newData)) { + newData[translation] = { + fingerprints: {}, + }; + } + newData[translation].fingerprints[path] = value; + }); + return newData; + }) + ) + .pipe(gulp.dest(workDir)); + }) +); tasks.push(taskName); taskName = "build-translations"; -gulp.task(taskName, ["build-translation-fingerprints"], function() { - return gulp - .src([ - "src/translations/translationMetadata.json", - workDir + "/translationFingerprints.json", - ]) - .pipe(merge({})) - .pipe( - transform(function(data) { - const newData = {}; - Object.entries(data).forEach(([key, value]) => { - // Filter out translations without native name. - if (data[key].nativeName) { - newData[key] = data[key]; - } else { - console.warn( - `Skipping language ${key}. Native name was not translated.` - ); - } - if (data[key]) newData[key] = value; - }); - return newData; - }) - ) - .pipe( - transform((data) => ({ - fragments: TRANSLATION_FRAGMENTS, - translations: data, - })) - ) - .pipe(rename("translationMetadata.json")) - .pipe(gulp.dest(workDir)); -}); +gulp.task( + taskName, + gulp.series("build-translation-fingerprints", function() { + return gulp + .src([ + "src/translations/translationMetadata.json", + workDir + "/translationFingerprints.json", + ]) + .pipe(merge({})) + .pipe( + transform(function(data) { + const newData = {}; + Object.entries(data).forEach(([key, value]) => { + // Filter out translations without native name. + if (data[key].nativeName) { + newData[key] = data[key]; + } else { + console.warn( + `Skipping language ${key}. Native name was not translated.` + ); + } + if (data[key]) newData[key] = value; + }); + return newData; + }) + ) + .pipe( + transform((data) => ({ + fragments: TRANSLATION_FRAGMENTS, + translations: data, + })) + ) + .pipe(rename("translationMetadata.json")) + .pipe(gulp.dest(workDir)); + }) +); tasks.push(taskName); module.exports = tasks; diff --git a/package.json b/package.json index 4898fc98b7..2005ae97d1 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "@material/mwc-button": "^0.5.0", "@material/mwc-ripple": "^0.5.0", "@mdi/svg": "3.5.95", - "@polymer/app-layout": "^3.0.1", + "@polymer/app-layout": "^3.0.2", "@polymer/app-localize-behavior": "^3.0.1", "@polymer/app-route": "^3.0.2", "@polymer/app-storage": "^3.0.2", @@ -39,14 +39,14 @@ "@polymer/iron-resizable-behavior": "^3.0.1", "@polymer/neon-animation": "^3.0.1", "@polymer/paper-card": "^3.0.1", - "@polymer/paper-checkbox": "^3.0.1", + "@polymer/paper-checkbox": "^3.1.0", "@polymer/paper-dialog": "^3.0.1", "@polymer/paper-dialog-behavior": "^3.0.1", "@polymer/paper-dialog-scrollable": "^3.0.1", "@polymer/paper-drawer-panel": "^3.0.1", "@polymer/paper-dropdown-menu": "^3.0.1", "@polymer/paper-fab": "^3.0.1", - "@polymer/paper-icon-button": "^3.0.1", + "@polymer/paper-icon-button": "^3.0.2", "@polymer/paper-input": "^3.0.1", "@polymer/paper-item": "^3.0.1", "@polymer/paper-listbox": "^3.0.1", @@ -57,115 +57,115 @@ "@polymer/paper-ripple": "^3.0.1", "@polymer/paper-scroll-header-panel": "^3.0.1", "@polymer/paper-slider": "^3.0.1", - "@polymer/paper-spinner": "^3.0.1", + "@polymer/paper-spinner": "^3.0.2", "@polymer/paper-styles": "^3.0.1", "@polymer/paper-tabs": "^3.0.1", "@polymer/paper-toast": "^3.0.1", "@polymer/paper-toggle-button": "^3.0.1", "@polymer/paper-tooltip": "^3.0.1", - "@polymer/polymer": "^3.0.5", - "@vaadin/vaadin-combo-box": "^4.2.0", - "@vaadin/vaadin-date-picker": "^3.3.1", + "@polymer/polymer": "^3.2.0", + "@vaadin/vaadin-combo-box": "^4.2.8", + "@vaadin/vaadin-date-picker": "^3.3.3", "@webcomponents/shadycss": "^1.9.0", - "@webcomponents/webcomponentsjs": "^2.2.6", - "chart.js": "~2.7.2", - "chartjs-chart-timeline": "^0.2.1", - "codemirror": "^5.43.0", + "@webcomponents/webcomponentsjs": "^2.2.7", + "chart.js": "~2.8.0", + "chartjs-chart-timeline": "^0.3.0", + "codemirror": "^5.45.0", "deep-clone-simple": "^1.1.1", "es6-object-assign": "^1.1.0", - "fecha": "^3.0.0", - "hls.js": "^0.12.3", + "fecha": "^3.0.2", + "hls.js": "^0.12.4", "home-assistant-js-websocket": "^3.4.0", "intl-messageformat": "^2.2.0", "jquery": "^3.3.1", - "js-yaml": "^3.12.0", - "leaflet": "^1.3.4", + "js-yaml": "^3.13.0", + "leaflet": "^1.4.0", "lit-element": "^2.1.0", "lit-html": "^1.0.0", - "marked": "^0.6.0", - "mdn-polyfills": "^5.12.0", - "memoize-one": "^5.0.0", - "moment": "^2.22.2", - "preact": "^8.3.1", + "marked": "^0.6.1", + "mdn-polyfills": "^5.16.0", + "memoize-one": "^5.0.2", + "moment": "^2.24.0", + "preact": "^8.4.2", "preact-compat": "^3.18.4", - "react-big-calendar": "^0.19.2", - "regenerator-runtime": "^0.12.1", - "round-slider": "^1.3.2", - "superstruct": "^0.6.0", - "unfetch": "^4.0.1", + "react-big-calendar": "^0.20.4", + "regenerator-runtime": "^0.13.2", + "round-slider": "^1.3.3", + "superstruct": "^0.6.1", + "unfetch": "^4.1.0", "web-animations-js": "^2.3.1", - "xss": "^1.0.3" + "xss": "^1.0.6" }, "devDependencies": { - "@babel/core": "^7.1.2", - "@babel/plugin-external-helpers": "^7.0.0", - "@babel/plugin-proposal-class-properties": "^7.3.0", - "@babel/plugin-proposal-decorators": "^7.3.0", - "@babel/plugin-proposal-object-rest-spread": "^7.0.0", - "@babel/plugin-syntax-dynamic-import": "^7.0.0", - "@babel/plugin-transform-react-jsx": "^7.0.0", - "@babel/preset-env": "^7.1.0", - "@babel/preset-typescript": "^7.1.0", - "@gfx/zopfli": "^1.0.9", + "@babel/core": "^7.4.0", + "@babel/plugin-external-helpers": "^7.2.0", + "@babel/plugin-proposal-class-properties": "^7.4.0", + "@babel/plugin-proposal-decorators": "^7.4.0", + "@babel/plugin-proposal-object-rest-spread": "^7.4.0", + "@babel/plugin-syntax-dynamic-import": "^7.2.0", + "@babel/plugin-transform-react-jsx": "^7.3.0", + "@babel/preset-env": "^7.4.2", + "@babel/preset-typescript": "^7.3.3", + "@gfx/zopfli": "^1.0.11", "@types/chai": "^4.1.7", - "@types/codemirror": "^0.0.71", - "@types/hls.js": "^0.12.2", + "@types/codemirror": "^0.0.72", + "@types/hls.js": "^0.12.3", "@types/leaflet": "^1.4.3", - "@types/memoize-one": "^4.1.0", - "@types/mocha": "^5.2.5", + "@types/memoize-one": "^4.1.1", + "@types/mocha": "^5.2.6", "babel-eslint": "^10", - "babel-loader": "^8.0.4", + "babel-loader": "^8.0.5", "chai": "^4.2.0", "compression-webpack-plugin": "^2.0.0", - "copy-webpack-plugin": "^4.5.2", - "del": "^3.0.0", - "eslint": "^5.6.0", + "copy-webpack-plugin": "^5.0.2", + "del": "^4.0.0", + "eslint": "^5.15.3", "eslint-config-airbnb-base": "^13.1.0", - "eslint-config-prettier": "^4.0.0", - "eslint-import-resolver-webpack": "^0.10.1", - "eslint-plugin-import": "^2.14.0", - "eslint-plugin-prettier": "^3.0.0", - "eslint-plugin-react": "^7.11.1", - "gulp": "^3.9.1", + "eslint-config-prettier": "^4.1.0", + "eslint-import-resolver-webpack": "^0.11.0", + "eslint-plugin-import": "^2.16.0", + "eslint-plugin-prettier": "^3.0.1", + "eslint-plugin-react": "^7.12.4", + "gulp": "^4.0.0", "gulp-foreach": "^0.1.0", "gulp-hash": "^4.2.2", "gulp-hash-filename": "^2.0.1", "gulp-insert": "^0.5.0", - "gulp-json-transform": "^0.4.5", + "gulp-json-transform": "^0.4.6", "gulp-jsonminify": "^1.1.0", "gulp-merge-json": "^1.3.1", "gulp-rename": "^1.4.0", "html-loader": "^0.5.5", "html-webpack-plugin": "^3.2.0", - "husky": "^1.1.0", - "lint-staged": "^8.0.2", + "husky": "^1.3.1", + "lint-staged": "^8.1.5", "merge-stream": "^1.0.1", - "mocha": "^5.2.0", + "mocha": "^6.0.2", "parse5": "^5.1.0", - "polymer-cli": "^1.8.0", - "prettier": "^1.14.3", - "raw-loader": "^0.5.1", + "polymer-cli": "^1.9.7", + "prettier": "^1.16.4", + "raw-loader": "^2.0.0", "reify": "^0.18.1", - "require-dir": "^1.0.0", - "sinon": "^7.1.1", + "require-dir": "^1.2.0", + "sinon": "^7.3.1", "terser-webpack-plugin": "^1.2.3", - "ts-mocha": "^2.0.0", - "tslint": "^5.11.0", - "tslint-config-prettier": "^1.15.0", + "ts-mocha": "^6.0.0", + "tslint": "^5.14.0", + "tslint-config-prettier": "^1.18.0", "tslint-eslint-rules": "^5.4.0", "tslint-plugin-prettier": "^2.0.1", - "typescript": "^3.1.4", - "uglifyjs-webpack-plugin": "^2.1.1", - "wct-browser-legacy": "^1.0.1", - "web-component-tester": "^6.8.0", - "webpack": "^4.19.1", - "webpack-cli": "^3.1.0", - "webpack-dev-server": "^3.1.8", + "typescript": "^3.4.1", + "uglifyjs-webpack-plugin": "^2.1.2", + "wct-browser-legacy": "^1.0.2", + "web-component-tester": "^6.9.2", + "webpack": "^4.29.6", + "webpack-cli": "^3.3.0", + "webpack-dev-server": "^3.2.1", "workbox-webpack-plugin": "^3.5.0" }, "resolutions": { - "@polymer/polymer": "3.1.0", - "@webcomponents/webcomponentsjs": "^2.2.6", + "@polymer/polymer": "3.2.0", + "@webcomponents/webcomponentsjs": "^2.2.7", "@webcomponents/shadycss": "^1.9.0", "@vaadin/vaadin-overlay": "3.2.2", "@vaadin/vaadin-lumo-styles": "1.3.0", diff --git a/src/common/util/time-cache-function-promise.ts b/src/common/util/time-cache-function-promise.ts index 8dc8abcd3f..c11a901884 100644 --- a/src/common/util/time-cache-function-promise.ts +++ b/src/common/util/time-cache-function-promise.ts @@ -10,11 +10,11 @@ export const timeCachePromiseFunc = async ( func: ( hass: HomeAssistant, entityId: string, - ...args: Array + ...args: unknown[] ) => Promise, hass: HomeAssistant, entityId: string, - ...args: Array + ...args: unknown[] ): Promise => { let cache: ResultCache | undefined = (hass as any)[cacheKey]; diff --git a/src/html/authorize.html.template b/src/html/authorize.html.template index 83133b6e0e..a8feb6560b 100644 --- a/src/html/authorize.html.template +++ b/src/html/authorize.html.template @@ -4,7 +4,7 @@ Home Assistant - <%= require('raw-loader!./_header.html.template') %> + <%= require('raw-loader!./_header.html.template').default %>