From fc5f73f10c49242ee51b5a6364c3a386fa2986a5 Mon Sep 17 00:00:00 2001 From: Stefan Penner Date: Sat, 16 Feb 2019 19:00:00 -0800 Subject: [PATCH] upgrades --- .eslintignore | 20 + .eslintrc.js | 32 +- .gitignore | 23 +- .template-lintrc.js | 5 + .travis.yml | 2 + app/components/basic-tree.js | 15 +- app/components/flame-graph.js | 11 +- app/components/slow-node-times.js | 10 +- app/controllers/application.js | 3 +- app/controllers/flame.js | 2 +- app/controllers/graph.js | 6 +- app/controllers/graph/index.js | 3 +- app/controllers/graph/node.js | 3 +- app/controllers/selected-node.js | 3 +- app/controllers/slow-nodes.js | 3 +- app/helpers/includes.js | 4 +- app/helpers/ns-to-ms.js | 4 +- app/helpers/stats-iterator.js | 4 +- app/index.html | 1 - app/services/graph.js | 9 +- app/templates/application.hbs | 26 +- app/templates/components/slow-node-times.hbs | 22 +- app/templates/graph.hbs | 6 +- .../d3-flame-graphs-v4/d3-flame-graph.js | 9 +- config/environment.js | 1 + config/optional-features.json | 3 + config/targets.js | 22 +- ember-cli-build.js | 32 +- package.json | 13 +- testem.js | 17 +- tests/test-helper.js | 12 +- vendor/d3/d3.v5.js | 18293 ++++++++++++++++ yarn.lock | 659 +- 33 files changed, 19124 insertions(+), 154 deletions(-) create mode 100644 .eslintignore create mode 100644 .template-lintrc.js create mode 100644 config/optional-features.json create mode 100644 vendor/d3/d3.v5.js diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..72df373 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,20 @@ +# unconventional js +/blueprints/*/files/ +/vendor/ + +# compiled output +/dist/ +/tmp/ + +# dependencies +/bower_components/ +/node_modules/ + +# misc +/coverage/ +!.* + +# ember-try +/.node_modules.ember-try/ +/bower.json.ember-try +/package.json.ember-try diff --git a/.eslintrc.js b/.eslintrc.js index 2873e2f..dd6462b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -4,10 +4,38 @@ module.exports = { ecmaVersion: 2017, sourceType: 'module' }, - extends: 'eslint:recommended', + plugins: [ + 'ember' + ], + extends: [ + 'eslint:recommended', + 'plugin:ember/recommended' + ], env: { browser: true }, rules: { - } + }, + overrides: [ + // node files + { + files: [ + '.eslintrc.js', + '.template-lintrc.js', + 'ember-cli-build.js', + 'testem.js', + 'blueprints/*/index.js', + 'config/**/*.js', + 'lib/*/index.js' + ], + parserOptions: { + sourceType: 'script', + ecmaVersion: 2015 + }, + env: { + browser: false, + node: true + } + } + ] }; diff --git a/.gitignore b/.gitignore index 8fa39a6..f18e5fa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,23 +1,24 @@ # See https://help.github.com/ignore-files/ for more about ignoring files. # compiled output -/dist -/tmp +/dist/ +/tmp/ # dependencies -/node_modules -/bower_components +/bower_components/ +/node_modules/ # misc +/.env* /.sass-cache /connect.lock -/coverage/* +/coverage/ /libpeerconnection.log -npm-debug.log* -yarn-error.log -testem.log +/npm-debug.log* +/testem.log +/yarn-error.log # ember-try -.node_modules.ember-try/ -bower.json.ember-try -package.json.ember-try +/.node_modules.ember-try/ +/bower.json.ember-try +/package.json.ember-try diff --git a/.template-lintrc.js b/.template-lintrc.js new file mode 100644 index 0000000..b45e96f --- /dev/null +++ b/.template-lintrc.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = { + extends: 'recommended' +}; diff --git a/.travis.yml b/.travis.yml index 224eafc..025451e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,4 +25,6 @@ install: - yarn install --non-interactive script: + - yarn lint:hbs + - yarn lint:js - yarn test diff --git a/app/components/basic-tree.js b/app/components/basic-tree.js index 3abad81..1adc058 100644 --- a/app/components/basic-tree.js +++ b/app/components/basic-tree.js @@ -2,19 +2,16 @@ import Ember from 'ember'; const { select, - partition, hierarchy, - min, - max, - range, - scaleLinear, - scaleQuantize, cluster, zoom, zoomIdentity } = self.d3; -const { run, get, inject } = Ember; +const { inject } = Ember; +import { run } from '@ember/runloop'; +import { get } from '@ember/object'; +import Component from '@ember/component'; const DURATION = 500; @@ -26,7 +23,7 @@ const NODE_OFFSET_SIZE = 50; // copied these functions temporarily from `broccoli-viz` here: // https://github.com/ember-cli/broccoli-viz/blob/master/lib/node-by-id.js -export default Ember.Component.extend({ +export default Component.extend({ classNames: ['basic-tree'], graph: inject.service(), @@ -281,7 +278,7 @@ export default Ember.Component.extend({ .attr("d", function(d) { let sourceExitY = d.source.y + d.source.computedWidth + NODE_OFFSET_SIZE; let targetEntranceY = d.target.y - NODE_OFFSET_SIZE; - + return "M" + d.target.y + "," + d.target.x + "L" + targetEntranceY + "," + d.target.x + " " + sourceExitY + "," + d.target.x diff --git a/app/components/flame-graph.js b/app/components/flame-graph.js index 19935da..ee6b79a 100644 --- a/app/components/flame-graph.js +++ b/app/components/flame-graph.js @@ -1,13 +1,18 @@ import Ember from 'ember'; import FlameGraph from '../utils/d3-flame-graphs-v4/d3-flame-graph'; -const { run, get, inject } = Ember; +import { run } from '@ember/runloop'; +import { get } from '@ember/object'; +import Component from '@ember/component'; +import { readOnly } from '@ember/object/computed'; -export default Ember.Component.extend({ +const { inject } = Ember; + +export default Component.extend({ classNames: ['flame-graph'], graph: inject.service(), flameGraph: null, - totalTime: Ember.computed.alias('graph.data.summary.totalTime'), + totalTime: readOnly('graph.data.summary.totalTime'), init() { this._super(...arguments); diff --git a/app/components/slow-node-times.js b/app/components/slow-node-times.js index 97c7a86..5529842 100644 --- a/app/components/slow-node-times.js +++ b/app/components/slow-node-times.js @@ -1,9 +1,9 @@ import Ember from 'ember'; +import { get, set } from '@ember/object'; +import { computed } from '@ember/object'; +import Component from '@ember/component'; const { - get, - set, - computed, inject } = Ember; @@ -32,13 +32,13 @@ function computeNodeTimes(node) { } } - Ember.set(node._stats.time, 'plugin', total); + set(node._stats.time, 'plugin', total); return total; } -export default Ember.Component.extend({ +export default Component.extend({ graph: inject.service(), init() { diff --git a/app/controllers/application.js b/app/controllers/application.js index 6095d94..2905404 100644 --- a/app/controllers/application.js +++ b/app/controllers/application.js @@ -1,11 +1,12 @@ import Ember from 'ember'; import fetch from "fetch"; +import Controller from '@ember/controller'; const { inject } = Ember; -export default Ember.Controller.extend({ +export default Controller.extend({ graph: inject.service(), actions: { diff --git a/app/controllers/flame.js b/app/controllers/flame.js index 95fea6a..914224b 100644 --- a/app/controllers/flame.js +++ b/app/controllers/flame.js @@ -1,7 +1,7 @@ import Ember from 'ember'; +import Controller from '@ember/controller'; const { - Controller, inject } = Ember; diff --git a/app/controllers/graph.js b/app/controllers/graph.js index 03743af..ed6d443 100644 --- a/app/controllers/graph.js +++ b/app/controllers/graph.js @@ -1,9 +1,9 @@ import Ember from 'ember'; +import Controller from '@ember/controller'; +import { getOwner } from '@ember/application'; +import { computed } from '@ember/object'; const { - Controller, - getOwner, - computed, inject } = Ember; diff --git a/app/controllers/graph/index.js b/app/controllers/graph/index.js index 02720cc..d44d742 100644 --- a/app/controllers/graph/index.js +++ b/app/controllers/graph/index.js @@ -1,9 +1,10 @@ import Ember from 'ember'; +import Controller from '@ember/controller'; const { inject } = Ember; -export default Ember.Controller.extend({ +export default Controller.extend({ graph: inject.service() }); diff --git a/app/controllers/graph/node.js b/app/controllers/graph/node.js index 02720cc..515ad5a 100644 --- a/app/controllers/graph/node.js +++ b/app/controllers/graph/node.js @@ -1,9 +1,10 @@ +import Controller from '@ember/controller'; import Ember from 'ember'; const { inject } = Ember; -export default Ember.Controller.extend({ +export default Controller.extend({ graph: inject.service() }); diff --git a/app/controllers/selected-node.js b/app/controllers/selected-node.js index 041dfb3..56e467c 100644 --- a/app/controllers/selected-node.js +++ b/app/controllers/selected-node.js @@ -1,9 +1,10 @@ import Ember from 'ember'; +import Controller from '@ember/controller'; const { inject } = Ember; -export default Ember.Controller.extend({ +export default Controller.extend({ graph: inject.service() }) diff --git a/app/controllers/slow-nodes.js b/app/controllers/slow-nodes.js index b962b63..593b5ee 100644 --- a/app/controllers/slow-nodes.js +++ b/app/controllers/slow-nodes.js @@ -1,10 +1,11 @@ +import Controller from '@ember/controller'; import Ember from 'ember'; const { inject } = Ember; -export default Ember.Controller.extend({ +export default Controller.extend({ graph: inject.service(), actions: { diff --git a/app/helpers/includes.js b/app/helpers/includes.js index 80c2d14..fe61691 100644 --- a/app/helpers/includes.js +++ b/app/helpers/includes.js @@ -1,5 +1,5 @@ -import Ember from 'ember'; +import { helper as buildHelper } from '@ember/component/helper'; -export default Ember.Helper.helper(function([haystack, needle]) { +export default buildHelper(function([haystack, needle]) { return haystack && haystack.includes && haystack.includes(needle); }); diff --git a/app/helpers/ns-to-ms.js b/app/helpers/ns-to-ms.js index d8af177..00223d4 100644 --- a/app/helpers/ns-to-ms.js +++ b/app/helpers/ns-to-ms.js @@ -1,7 +1,7 @@ -import Ember from 'ember'; +import { helper as buildHelper } from '@ember/component/helper'; export function nsToMs([time]) { return (time / 1000000).toFixed(2); } -export default Ember.Helper.helper(nsToMs); +export default buildHelper(nsToMs); diff --git a/app/helpers/stats-iterator.js b/app/helpers/stats-iterator.js index bd9f87e..ecee3f9 100644 --- a/app/helpers/stats-iterator.js +++ b/app/helpers/stats-iterator.js @@ -1,6 +1,6 @@ -import Ember from 'ember'; +import { helper as buildHelper } from '@ember/component/helper'; -export default Ember.Helper.helper(function([node]) { +export default buildHelper(function([node]) { let stats = {}; for (let [name, value] of node.statsIterator()) { diff --git a/app/index.html b/app/index.html index 273fa5d..f43a867 100644 --- a/app/index.html +++ b/app/index.html @@ -9,7 +9,6 @@ {{content-for "head"}} - diff --git a/app/services/graph.js b/app/services/graph.js index f9eceff..8da8b80 100644 --- a/app/services/graph.js +++ b/app/services/graph.js @@ -1,15 +1,12 @@ -import Ember from 'ember'; import config from '../config/environment'; import heimdallGraph from 'heimdalljs-graph'; - -const { - getOwner -} = Ember; +import { getOwner } from '@ember/application'; +import Service from '@ember/service'; const DATA_STORAGE_KEY = `${config.storageVersion}_graph-data`; const SELECTED_NODE_STORAGE_KEY = `${config.storageVersion}_selected-node-id`; -export default Ember.Service.extend({ +export default Service.extend({ init() { this._super(...arguments); diff --git a/app/templates/application.hbs b/app/templates/application.hbs index ed00887..d9d4e43 100644 --- a/app/templates/application.hbs +++ b/app/templates/application.hbs @@ -1,9 +1,9 @@ -