From 4f2ec5044b6a647c1c1f78f5f8d34cc4c2e02bef Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Tue, 6 Oct 2020 10:31:00 -0400 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=A4=96=20upgrade=20api=20addon?= =?UTF-8?q?=20to=20ember=20lts=203.20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/api/.eslintrc.js | 9 +-- addons/api/.travis.yml | 60 ------------------- addons/api/addon/adapters/application.js | 1 + addons/api/addon/mixins/adapter-build-url.js | 4 +- addons/api/addon/models/account.js | 2 +- addons/api/addon/models/base.js | 3 +- addons/api/addon/models/group.js | 2 +- addons/api/addon/models/target.js | 2 +- addons/api/config/ember-try.js | 24 ++++---- addons/api/package.json | 31 +++++----- addons/api/tests/dummy/app/app.js | 2 +- addons/api/tests/dummy/app/router.js | 2 +- .../tests/dummy/config/ember-cli-update.json | 20 +++++++ addons/api/tests/dummy/config/targets.js | 2 +- addons/api/tests/test-helper.js | 4 +- .../unit/mixins/adapter-build-url-test.js | 5 ++ 16 files changed, 66 insertions(+), 107 deletions(-) delete mode 100644 addons/api/.travis.yml create mode 100644 addons/api/tests/dummy/config/ember-cli-update.json diff --git a/addons/api/.eslintrc.js b/addons/api/.eslintrc.js index b705ae52d..928585995 100644 --- a/addons/api/.eslintrc.js +++ b/addons/api/.eslintrc.js @@ -20,10 +20,7 @@ module.exports = { env: { browser: true }, - rules: { - 'ember/no-jquery': 'error', - 'ember/no-new-mixins': 0 - }, + rules: {}, overrides: [ // node files { @@ -51,9 +48,7 @@ module.exports = { node: true }, plugins: ['node'], - rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, { - // add your custom rules and overrides for node files here - }) + extends: ['plugin:node/recommended'] } ] }; diff --git a/addons/api/.travis.yml b/addons/api/.travis.yml deleted file mode 100644 index b1b71a965..000000000 --- a/addons/api/.travis.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -language: node_js -node_js: - # we recommend testing addons with the same minimum supported node version as Ember CLI - # so that your addon works for all apps - - "10" - -dist: trusty - -addons: - chrome: stable - -cache: - directories: - - $HOME/.npm - -env: - global: - # See https://git.io/vdao3 for details. - - JOBS=1 - -branches: - only: - - master - # npm version tags - - /^v\d+\.\d+\.\d+/ - -jobs: - fast_finish: true - allow_failures: - - env: EMBER_TRY_SCENARIO=ember-canary - - include: - # runs linting and tests with current locked deps - - stage: "Tests" - name: "Tests" - script: - - npm run lint:hbs - - npm run lint:js - - npm test - - - stage: "Additional Tests" - name: "Floating Dependencies" - install: - - npm install --no-package-lock - script: - - npm test - - # we recommend new addons test the current and previous LTS - # as well as latest stable release (bonus points to beta/canary) - - env: EMBER_TRY_SCENARIO=ember-lts-3.12 - - env: EMBER_TRY_SCENARIO=ember-lts-3.16 - - env: EMBER_TRY_SCENARIO=ember-release - - env: EMBER_TRY_SCENARIO=ember-beta - - env: EMBER_TRY_SCENARIO=ember-canary - - env: EMBER_TRY_SCENARIO=ember-default-with-jquery - - env: EMBER_TRY_SCENARIO=ember-classic - -script: - - node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO diff --git a/addons/api/addon/adapters/application.js b/addons/api/addon/adapters/application.js index 944bfb2be..f78ed6c88 100644 --- a/addons/api/addon/adapters/application.js +++ b/addons/api/addon/adapters/application.js @@ -1,5 +1,6 @@ import RESTAdapter from '@ember-data/adapter/rest'; import { serializeIntoHash } from '@ember-data/adapter/-private'; +/* eslint-disable-next-line ember/no-mixins */ import AdapterBuildURLMixin from '../mixins/adapter-build-url'; import config from 'ember-get-config'; import { get, getWithDefault } from '@ember/object'; diff --git a/addons/api/addon/mixins/adapter-build-url.js b/addons/api/addon/mixins/adapter-build-url.js index 3437cb981..27bb0c5b8 100644 --- a/addons/api/addon/mixins/adapter-build-url.js +++ b/addons/api/addon/mixins/adapter-build-url.js @@ -1,5 +1,4 @@ import Mixin from '@ember/object/mixin'; -import { get } from '@ember/object'; /** * Overrides URL-building methods in an adpater for greater flexibility. @@ -12,6 +11,7 @@ import { get } from '@ember/object'; * way URLs are generated by default. Override methods in the adapter that * uses this mixin to alter generated URLs. */ +/* eslint-disable-next-line ember/no-new-mixins */ export default Mixin.create({ // =methods @@ -57,7 +57,7 @@ export default Mixin.create({ _buildPrefixedURL(modelName, id, snapshot) { let path; let url = []; - const host = get(this, 'host'); + const host = this.host; const prefix = this.urlPrefix(null, null, modelName, id, snapshot); if (modelName) { path = this.pathForType(modelName); diff --git a/addons/api/addon/models/account.js b/addons/api/addon/models/account.js index 71b337f44..012436ad2 100644 --- a/addons/api/addon/models/account.js +++ b/addons/api/addon/models/account.js @@ -16,7 +16,7 @@ export default class AccountModel extends GeneratedAccountModel { * Convenience for getting username in account. * @type {string} */ - @computed('type', 'attributes.{login_name}') + @computed('type', 'attributes.login_name') get username() { let username = ''; switch (this.type) { diff --git a/addons/api/addon/models/base.js b/addons/api/addon/models/base.js index d883c8846..60ed2faea 100644 --- a/addons/api/addon/models/base.js +++ b/addons/api/addon/models/base.js @@ -1,7 +1,6 @@ import Model from '@ember-data/model'; import { fragment } from 'ember-data-model-fragments/attributes'; import { computed } from '@ember/object'; -import { get } from '@ember/object'; /** * Base model class provides common functionality for all models. @@ -51,7 +50,7 @@ export default class BaseModel extends Model { */ @computed('scope.scope_id') get scopeID() { - return get(this, 'scope.scope_id'); + return this?.scope?.scope_id; } set scopeID(id) { if (!this.scope) this.scope = {}; diff --git a/addons/api/addon/models/group.js b/addons/api/addon/models/group.js index 87fff30c1..4b6535065 100644 --- a/addons/api/addon/models/group.js +++ b/addons/api/addon/models/group.js @@ -23,7 +23,7 @@ export default class GroupModel extends GeneratedGroupModel { * @type {[UserModel]} */ // TODO: Use fragments array to read cross scope members. - @computed('member_ids.[]') + @computed('member_ids.[]', 'store') get members() { return this.member_ids .map((id) => this.store.peekRecord('user', id)) diff --git a/addons/api/addon/models/target.js b/addons/api/addon/models/target.js index 25a67ea9b..086f95f79 100644 --- a/addons/api/addon/models/target.js +++ b/addons/api/addon/models/target.js @@ -26,7 +26,7 @@ export default class TargetModel extends GeneratedTargetModel { * instances). Unresolvable instances are excluded from the array. * @type {[{model: HostSetModel, hostCatalog: HostCatalogModel}]} */ - @computed('host_sets.[]') + @computed('host_sets.[]', 'store') get hostSets() { return this.host_sets .map(({ host_set_id, host_catalog_id }) => ({ diff --git a/addons/api/config/ember-try.js b/addons/api/config/ember-try.js index 5335365a8..2022058df 100644 --- a/addons/api/config/ember-try.js +++ b/addons/api/config/ember-try.js @@ -21,6 +21,14 @@ module.exports = async function () { }, }, }, + { + name: 'ember-lts-3.20', + npm: { + devDependencies: { + 'ember-source': '~3.20.5' + } + } + }, { name: 'ember-release', npm: { @@ -45,16 +53,6 @@ module.exports = async function () { }, }, }, - // The default `.travis.yml` runs this scenario via `npm test`, - // not via `ember try`. It's still included here so that running - // `ember try:each` manually or from a customized CI config will run it - // along with all the other scenarios. - { - name: 'ember-default', - npm: { - devDependencies: {}, - }, - }, { name: 'ember-default-with-jquery', env: { @@ -64,9 +62,9 @@ module.exports = async function () { }, npm: { devDependencies: { - '@ember/jquery': '^0.5.1', - }, - }, + '@ember/jquery': '^1.1.0' + } + } }, { name: 'ember-classic', diff --git a/addons/api/package.json b/addons/api/package.json index 5fd59e232..370bb7694 100644 --- a/addons/api/package.json +++ b/addons/api/package.json @@ -10,34 +10,32 @@ "scripts": { "build:development": "ember build", "build": "ember build --environment=production", - "lint": "yarn lint:js", + "lint": "npm-run-all --aggregate-output --continue-on-error --parallel lint:*", "lint:js": "eslint .", "format": "npm run format:js", "format:js": "prettier --write '{addon,app,config,stories,tests}/**/*.js' *.js", "start": "ember serve", "test": "ember test", - "test:all": "ember try:each", + "test:ember-compatibility": "ember try:each", "doc:toc": "doctoc README.md" }, "dependencies": { - "ember-cli-babel": "^7.17.2", - "ember-cli-htmlbars": "^4.2.2" + "ember-cli-babel": "^7.21.0", + "ember-cli-htmlbars": "^5.2.0" }, "devDependencies": { "@ember/optional-features": "^1.3.0", - "@glimmer/component": "^1.0.0", + "@glimmer/component": "^1.0.1", "@glimmer/tracking": "^1.0.0", - "babel-eslint": "^10.0.3", + "babel-eslint": "^10.1.0", "broccoli-asset-rev": "^3.0.0", "doctoc": "^1.4.0", - "ember-auto-import": "^1.5.3", - "ember-cli": "~3.16.1", + "ember-auto-import": "^1.6.0", + "ember-cli": "~3.20.2", "ember-cli-dependency-checker": "^3.2.0", - "ember-cli-eslint": "^5.1.0", "ember-cli-inject-live-reload": "^2.0.2", "ember-cli-mirage": "^1.1.7", "ember-cli-sri": "^2.1.1", - "ember-cli-template-lint": "^1.0.0-beta.3", "ember-cli-uglify": "^3.0.0", "ember-cli-update": "^0.54.6", "ember-copy": "^1.0.0", @@ -49,15 +47,18 @@ "ember-load-initializers": "^2.1.1", "ember-maybe-import-regenerator": "^0.1.6", "ember-qunit": "^4.6.0", - "ember-resolver": "^7.0.0", - "ember-source": "~3.16.0", + "ember-resolver": "^8.0.0", + "ember-source": "~3.20.2", "ember-source-channel-url": "^2.0.1", + "ember-template-lint": "^2.9.1", "ember-try": "^1.4.0", - "eslint-plugin-ember": "^7.7.2", - "eslint-plugin-node": "^11.0.0", + "eslint": "^7.5.0", + "eslint-plugin-ember": "^8.9.1", + "eslint-plugin-node": "^11.1.0", "loader.js": "^4.7.0", + "npm-run-all": "^4.1.5", "prettier": "^2.0.5", - "qunit-dom": "^1.0.0" + "qunit-dom": "^1.2.0" }, "engines": { "node": "10.* || >= 12" diff --git a/addons/api/tests/dummy/app/app.js b/addons/api/tests/dummy/app/app.js index d8e2088b6..523bad60c 100644 --- a/addons/api/tests/dummy/app/app.js +++ b/addons/api/tests/dummy/app/app.js @@ -1,7 +1,7 @@ import Application from '@ember/application'; import Resolver from 'ember-resolver'; import loadInitializers from 'ember-load-initializers'; -import config from './config/environment'; +import config from 'dummy/config/environment'; export default class App extends Application { modulePrefix = config.modulePrefix; diff --git a/addons/api/tests/dummy/app/router.js b/addons/api/tests/dummy/app/router.js index 818c8d496..64e543ab2 100644 --- a/addons/api/tests/dummy/app/router.js +++ b/addons/api/tests/dummy/app/router.js @@ -1,5 +1,5 @@ import EmberRouter from '@ember/routing/router'; -import config from './config/environment'; +import config from 'dummy/config/environment'; export default class Router extends EmberRouter { location = config.locationType; diff --git a/addons/api/tests/dummy/config/ember-cli-update.json b/addons/api/tests/dummy/config/ember-cli-update.json new file mode 100644 index 000000000..3c0c55fdb --- /dev/null +++ b/addons/api/tests/dummy/config/ember-cli-update.json @@ -0,0 +1,20 @@ +{ + "schemaVersion": "1.0.0", + "packages": [ + { + "name": "ember-cli", + "version": "3.20.2", + "blueprints": [ + { + "name": "addon", + "outputRepo": "https://github.com/ember-cli/ember-addon-output", + "codemodsSource": "ember-addon-codemods-manifest@1", + "isBaseBlueprint": true, + "options": [ + "--no-welcome" + ] + } + ] + } + ] +} diff --git a/addons/api/tests/dummy/config/targets.js b/addons/api/tests/dummy/config/targets.js index cc5539285..4b33327e8 100644 --- a/addons/api/tests/dummy/config/targets.js +++ b/addons/api/tests/dummy/config/targets.js @@ -6,7 +6,7 @@ const browsers = [ 'last 1 Safari versions', ]; -const isCI = !!process.env.CI; +const isCI = Boolean(process.env.CI); const isProduction = process.env.EMBER_ENV === 'production'; if (isCI || isProduction) { diff --git a/addons/api/tests/test-helper.js b/addons/api/tests/test-helper.js index 0382a848d..4eae06f81 100644 --- a/addons/api/tests/test-helper.js +++ b/addons/api/tests/test-helper.js @@ -1,5 +1,5 @@ -import Application from '../app'; -import config from '../config/environment'; +import Application from 'dummy/app'; +import config from 'dummy/config/environment'; import { setApplication } from '@ember/test-helpers'; import { start } from 'ember-qunit'; diff --git a/addons/api/tests/unit/mixins/adapter-build-url-test.js b/addons/api/tests/unit/mixins/adapter-build-url-test.js index 734d0d161..49d49029a 100644 --- a/addons/api/tests/unit/mixins/adapter-build-url-test.js +++ b/addons/api/tests/unit/mixins/adapter-build-url-test.js @@ -1,4 +1,5 @@ import RESTAdapter from '@ember-data/adapter/rest'; +/* eslint-disable-next-line ember/no-mixins */ import AdapterBuildURLMixin from 'api/mixins/adapter-build-url'; import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; @@ -8,6 +9,7 @@ module('Unit | Mixin | build-url', function (hooks) { test('it does not interfere with basic URLs', function (assert) { assert.expect(1); + /* eslint-disable-next-line ember/no-new-mixins */ const Adapter = RESTAdapter.extend(AdapterBuildURLMixin); this.owner.register('adapter:adapter', Adapter); const adapter = this.owner.lookup('adapter:adapter'); @@ -17,6 +19,7 @@ module('Unit | Mixin | build-url', function (hooks) { test('it does not interfere with namespaced URLs', function (assert) { assert.expect(1); + /* eslint-disable-next-line ember/no-new-mixins */ const Adapter = RESTAdapter.extend(AdapterBuildURLMixin, { namespace: 'api/v1', }); @@ -28,6 +31,7 @@ module('Unit | Mixin | build-url', function (hooks) { test('it can prepend a prefix', function (assert) { assert.expect(1); + /* eslint-disable-next-line ember/no-new-mixins */ const Adapter = RESTAdapter.extend(AdapterBuildURLMixin, { urlPrefix() { return '/foo/bars'; @@ -41,6 +45,7 @@ module('Unit | Mixin | build-url', function (hooks) { test('it can append a suffix', function (assert) { assert.expect(1); + /* eslint-disable-next-line ember/no-new-mixins */ const Adapter = RESTAdapter.extend(AdapterBuildURLMixin, { urlSuffix() { return ':method';