From 3495f8132dc443859dd3a0f7df6a7284cff0d049 Mon Sep 17 00:00:00 2001 From: "Andrey Mikhaylov (lolmaus)" Date: Mon, 4 Dec 2023 14:21:14 +0300 Subject: [PATCH] Upgrade the with-telemetry fixture app to Ember CLI 3.28 --- .../with-telemetry/input/.editorconfig | 1 - .../with-telemetry/input/.eslintignore | 6 ++ .../with-telemetry/input/.eslintrc.js | 57 +++++++++----- test/fixtures/with-telemetry/input/.gitignore | 1 + .../with-telemetry/input/.prettierignore | 21 ++++++ .../with-telemetry/input/.prettierrc.js | 5 ++ .../with-telemetry/input/.template-lintrc.js | 5 ++ .../fixtures/with-telemetry/input/.travis.yml | 18 +++-- test/fixtures/with-telemetry/input/README.md | 13 ++-- test/fixtures/with-telemetry/input/app/app.js | 16 ++-- .../with-telemetry/input/app/resolver.js | 3 - .../with-telemetry/input/app/router.js | 15 ++-- .../input/app/templates/components/.gitkeep | 0 .../input/config/ember-cli-update.json | 20 +++++ .../input/config/environment.js | 8 +- .../input/config/optional-features.json | 5 +- .../with-telemetry/input/config/targets.js | 24 ++++-- .../with-telemetry/input/ember-cli-build.js | 2 +- .../with-telemetry/input/package.json | 74 ++++++++++++------- test/fixtures/with-telemetry/input/testem.js | 20 +++-- .../with-telemetry/input/tests/index.html | 9 ++- .../with-telemetry/input/tests/test-helper.js | 8 +- 22 files changed, 220 insertions(+), 111 deletions(-) create mode 100644 test/fixtures/with-telemetry/input/.prettierignore create mode 100644 test/fixtures/with-telemetry/input/.prettierrc.js create mode 100644 test/fixtures/with-telemetry/input/.template-lintrc.js delete mode 100644 test/fixtures/with-telemetry/input/app/resolver.js delete mode 100644 test/fixtures/with-telemetry/input/app/templates/components/.gitkeep create mode 100644 test/fixtures/with-telemetry/input/config/ember-cli-update.json diff --git a/test/fixtures/with-telemetry/input/.editorconfig b/test/fixtures/with-telemetry/input/.editorconfig index 219985c22..c35a00240 100644 --- a/test/fixtures/with-telemetry/input/.editorconfig +++ b/test/fixtures/with-telemetry/input/.editorconfig @@ -4,7 +4,6 @@ root = true - [*] end_of_line = lf charset = utf-8 diff --git a/test/fixtures/with-telemetry/input/.eslintignore b/test/fixtures/with-telemetry/input/.eslintignore index d9807d3ab..701947ed3 100644 --- a/test/fixtures/with-telemetry/input/.eslintignore +++ b/test/fixtures/with-telemetry/input/.eslintignore @@ -8,9 +8,15 @@ # dependencies /bower_components/ +/node_modules/ # misc /coverage/ +!.* +.*/ +.eslintcache # ember-try /.node_modules.ember-try/ +/bower.json.ember-try +/package.json.ember-try diff --git a/test/fixtures/with-telemetry/input/.eslintrc.js b/test/fixtures/with-telemetry/input/.eslintrc.js index a522eb93a..41a1a43d8 100644 --- a/test/fixtures/with-telemetry/input/.eslintrc.js +++ b/test/fixtures/with-telemetry/input/.eslintrc.js @@ -1,39 +1,58 @@ +'use strict'; + module.exports = { root: true, + parser: 'babel-eslint', parserOptions: { - ecmaVersion: 2017, - sourceType: 'module' + ecmaVersion: 2018, + sourceType: 'module', + ecmaFeatures: { + legacyDecorators: true, + }, }, - plugins: [ - 'ember' - ], + plugins: ['ember'], extends: [ 'eslint:recommended', - 'plugin:ember/recommended' + 'plugin:ember/recommended', + 'plugin:prettier/recommended', ], env: { - browser: true - }, - rules: { + browser: true, }, + rules: {}, overrides: [ // node files { files: [ - 'ember-cli-build.js', - 'testem.js', - 'blueprints/*/index.js', - 'config/**/*.js', - 'lib/*/index.js' + './.eslintrc.js', + './.prettierrc.js', + './.template-lintrc.js', + './ember-cli-build.js', + './testem.js', + './blueprints/*/index.js', + './config/**/*.js', + './lib/*/index.js', + './server/**/*.js', ], parserOptions: { sourceType: 'script', - ecmaVersion: 2015 }, env: { browser: false, - node: true - } - } - ] + node: true, + }, + plugins: ['node'], + extends: ['plugin:node/recommended'], + rules: { + // this can be removed once the following is fixed + // https://github.com/mysticatea/eslint-plugin-node/issues/77 + 'node/no-unpublished-require': 'off', + }, + }, + { + // Test files: + files: ['tests/**/*-test.{js,ts}'], + extends: ['plugin:qunit/recommended'], + }, + ], }; diff --git a/test/fixtures/with-telemetry/input/.gitignore b/test/fixtures/with-telemetry/input/.gitignore index 29c9bc65a..81fbed4cd 100644 --- a/test/fixtures/with-telemetry/input/.gitignore +++ b/test/fixtures/with-telemetry/input/.gitignore @@ -10,6 +10,7 @@ # misc /.sass-cache +/.eslintcache /connect.lock /coverage/ /libpeerconnection.log diff --git a/test/fixtures/with-telemetry/input/.prettierignore b/test/fixtures/with-telemetry/input/.prettierignore new file mode 100644 index 000000000..922165552 --- /dev/null +++ b/test/fixtures/with-telemetry/input/.prettierignore @@ -0,0 +1,21 @@ +# unconventional js +/blueprints/*/files/ +/vendor/ + +# compiled output +/dist/ +/tmp/ + +# dependencies +/bower_components/ +/node_modules/ + +# misc +/coverage/ +!.* +.eslintcache + +# ember-try +/.node_modules.ember-try/ +/bower.json.ember-try +/package.json.ember-try diff --git a/test/fixtures/with-telemetry/input/.prettierrc.js b/test/fixtures/with-telemetry/input/.prettierrc.js new file mode 100644 index 000000000..534e6d35a --- /dev/null +++ b/test/fixtures/with-telemetry/input/.prettierrc.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = { + singleQuote: true, +}; diff --git a/test/fixtures/with-telemetry/input/.template-lintrc.js b/test/fixtures/with-telemetry/input/.template-lintrc.js new file mode 100644 index 000000000..f35f61c7b --- /dev/null +++ b/test/fixtures/with-telemetry/input/.template-lintrc.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = { + extends: 'recommended', +}; diff --git a/test/fixtures/with-telemetry/input/.travis.yml b/test/fixtures/with-telemetry/input/.travis.yml index 54dcdb2ab..d908403ee 100644 --- a/test/fixtures/with-telemetry/input/.travis.yml +++ b/test/fixtures/with-telemetry/input/.travis.yml @@ -1,26 +1,28 @@ --- language: node_js node_js: - - "6" + - "12" -sudo: false -dist: trusty +dist: xenial addons: chrome: stable cache: - directories: - - $HOME/.npm + yarn: true env: global: # See https://git.io/vdao3 for details. - JOBS=1 +branches: + only: + - master + before_install: - - npm config set spin false + - curl -o- -L https://yarnpkg.com/install.sh | bash + - export PATH=$HOME/.yarn/bin:$PATH script: - - npm run lint:js - - npm test + - yarn test diff --git a/test/fixtures/with-telemetry/input/README.md b/test/fixtures/with-telemetry/input/README.md index 01e693bdc..339e68bf1 100644 --- a/test/fixtures/with-telemetry/input/README.md +++ b/test/fixtures/with-telemetry/input/README.md @@ -1,4 +1,4 @@ -# input +# my-project This README outlines the details of collaborating on this Ember application. A short introduction of this app could easily go here. @@ -8,15 +8,16 @@ A short introduction of this app could easily go here. You will need the following things properly installed on your computer. * [Git](https://git-scm.com/) -* [Node.js](https://nodejs.org/) (with npm) +* [Node.js](https://nodejs.org/) +* [Yarn](https://yarnpkg.com/) * [Ember CLI](https://ember-cli.com/) * [Google Chrome](https://google.com/chrome/) ## Installation * `git clone ` this repository -* `cd input` -* `npm install` +* `cd my-project` +* `yarn install` ## Running / Development @@ -35,8 +36,8 @@ Make use of the many generators for code, try `ember help generate` for more det ### Linting -* `npm run lint:js` -* `npm run lint:js -- --fix` +* `yarn lint` +* `yarn lint:fix` ### Building diff --git a/test/fixtures/with-telemetry/input/app/app.js b/test/fixtures/with-telemetry/input/app/app.js index b3b2bd677..a42e9d339 100644 --- a/test/fixtures/with-telemetry/input/app/app.js +++ b/test/fixtures/with-telemetry/input/app/app.js @@ -1,14 +1,12 @@ import Application from '@ember/application'; -import Resolver from './resolver'; +import Resolver from 'ember-resolver'; import loadInitializers from 'ember-load-initializers'; -import config from './config/environment'; +import config from 'my-project/config/environment'; -const App = Application.extend({ - modulePrefix: config.modulePrefix, - podModulePrefix: config.podModulePrefix, - Resolver -}); +export default class App extends Application { + modulePrefix = config.modulePrefix; + podModulePrefix = config.podModulePrefix; + Resolver = Resolver; +} loadInitializers(App, config.modulePrefix); - -export default App; diff --git a/test/fixtures/with-telemetry/input/app/resolver.js b/test/fixtures/with-telemetry/input/app/resolver.js deleted file mode 100644 index 2fb563d6c..000000000 --- a/test/fixtures/with-telemetry/input/app/resolver.js +++ /dev/null @@ -1,3 +0,0 @@ -import Resolver from 'ember-resolver'; - -export default Resolver; diff --git a/test/fixtures/with-telemetry/input/app/router.js b/test/fixtures/with-telemetry/input/app/router.js index d0bb00952..d810d6d2b 100644 --- a/test/fixtures/with-telemetry/input/app/router.js +++ b/test/fixtures/with-telemetry/input/app/router.js @@ -1,12 +1,9 @@ import EmberRouter from '@ember/routing/router'; -import config from './config/environment'; +import config from 'my-project/config/environment'; -const Router = EmberRouter.extend({ - location: config.locationType, - rootURL: config.rootURL -}); +export default class Router extends EmberRouter { + location = config.locationType; + rootURL = config.rootURL; +} -Router.map(function() { -}); - -export default Router; +Router.map(function () {}); diff --git a/test/fixtures/with-telemetry/input/app/templates/components/.gitkeep b/test/fixtures/with-telemetry/input/app/templates/components/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/test/fixtures/with-telemetry/input/config/ember-cli-update.json b/test/fixtures/with-telemetry/input/config/ember-cli-update.json new file mode 100644 index 000000000..c4895e632 --- /dev/null +++ b/test/fixtures/with-telemetry/input/config/ember-cli-update.json @@ -0,0 +1,20 @@ +{ + "schemaVersion": "1.0.0", + "packages": [ + { + "name": "ember-cli", + "version": "3.28.6", + "blueprints": [ + { + "name": "app", + "outputRepo": "https://github.com/ember-cli/ember-new-output", + "codemodsSource": "ember-app-codemods-manifest@1", + "isBaseBlueprint": true, + "options": [ + "--yarn" + ] + } + ] + } + ] +} diff --git a/test/fixtures/with-telemetry/input/config/environment.js b/test/fixtures/with-telemetry/input/config/environment.js index 5fa181e61..439371d32 100644 --- a/test/fixtures/with-telemetry/input/config/environment.js +++ b/test/fixtures/with-telemetry/input/config/environment.js @@ -1,6 +1,6 @@ 'use strict'; -module.exports = function(environment) { +module.exports = function (environment) { let ENV = { modulePrefix: 'app', environment, @@ -13,14 +13,14 @@ module.exports = function(environment) { }, EXTEND_PROTOTYPES: { // Prevent Ember Data from overriding Date.parse. - Date: false - } + Date: false, + }, }, APP: { // Here you can pass flags/options to your application instance // when it is created - } + }, }; if (environment === 'development') { diff --git a/test/fixtures/with-telemetry/input/config/optional-features.json b/test/fixtures/with-telemetry/input/config/optional-features.json index 21f1dc719..b26286e2e 100644 --- a/test/fixtures/with-telemetry/input/config/optional-features.json +++ b/test/fixtures/with-telemetry/input/config/optional-features.json @@ -1,3 +1,6 @@ { - "jquery-integration": true + "application-template-wrapper": false, + "default-async-observers": true, + "jquery-integration": false, + "template-only-glimmer-components": true } diff --git a/test/fixtures/with-telemetry/input/config/targets.js b/test/fixtures/with-telemetry/input/config/targets.js index 8ffae3636..3cd797ab4 100644 --- a/test/fixtures/with-telemetry/input/config/targets.js +++ b/test/fixtures/with-telemetry/input/config/targets.js @@ -3,16 +3,24 @@ const browsers = [ 'last 1 Chrome versions', 'last 1 Firefox versions', - 'last 1 Safari versions' + 'last 1 Safari versions', ]; -const isCI = !!process.env.CI; -const isProduction = process.env.EMBER_ENV === 'production'; - -if (isCI || isProduction) { - browsers.push('ie 11'); -} +// Ember's browser support policy is changing, and IE11 support will end in +// v4.0 onwards. +// +// See https://deprecations.emberjs.com/v3.x#toc_3-0-browser-support-policy +// +// If you need IE11 support on a version of Ember that still offers support +// for it, uncomment the code block below. +// +// const isCI = Boolean(process.env.CI); +// const isProduction = process.env.EMBER_ENV === 'production'; +// +// if (isCI || isProduction) { +// browsers.push('ie 11'); +// } module.exports = { - browsers + browsers, }; diff --git a/test/fixtures/with-telemetry/input/ember-cli-build.js b/test/fixtures/with-telemetry/input/ember-cli-build.js index 1402bb2e5..d3bbd686b 100644 --- a/test/fixtures/with-telemetry/input/ember-cli-build.js +++ b/test/fixtures/with-telemetry/input/ember-cli-build.js @@ -2,7 +2,7 @@ const EmberApp = require('ember-cli/lib/broccoli/ember-app'); -module.exports = function(defaults) { +module.exports = function (defaults) { let app = new EmberApp(defaults, { 'ember-bootstrap': { 'bootstrapVersion': 4, diff --git a/test/fixtures/with-telemetry/input/package.json b/test/fixtures/with-telemetry/input/package.json index 335bdc211..fa38ae1c4 100644 --- a/test/fixtures/with-telemetry/input/package.json +++ b/test/fixtures/with-telemetry/input/package.json @@ -11,44 +11,62 @@ }, "repository": "", "scripts": { - "build": "ember build", - "lint:js": "eslint .", + "build": "ember build --environment=production", + "lint": "npm-run-all --aggregate-output --continue-on-error --parallel \"lint:!(fix)\"", + "lint:fix": "npm-run-all --aggregate-output --continue-on-error --parallel lint:*:fix", + "lint:hbs:fix": "ember-template-lint . --fix", + "lint:js": "eslint . --cache", + "lint:js:fix": "eslint . --fix", "start": "ember serve", - "test": "ember test" + "test": "npm-run-all lint test:*", + "test:ember": "ember test" }, "devDependencies": { - "@ember/jquery": "^0.6.0", - "@ember/optional-features": "^0.7.0", + "@ember/optional-features": "^2.0.0", + "@ember/test-helpers": "^2.6.0", + "@glimmer/component": "^1.0.4", + "@glimmer/tracking": "^1.0.4", + "babel-eslint": "^10.1.0", "bootstrap": "^4.3.1", "broccoli-asset-rev": "^3.0.0", - "ember-ajax": "^5.0.0", - "ember-bootstrap": "^2.8.1", - "ember-cli": "~3.10.1", - "ember-cli-app-version": "^3.2.0", - "ember-cli-babel": "^7.7.3", - "ember-cli-dependency-checker": "^3.1.0", - "ember-cli-eslint": "^5.1.0", - "ember-cli-htmlbars": "^3.0.1", - "ember-cli-htmlbars-inline-precompile": "^2.1.0", - "ember-cli-inject-live-reload": "^1.8.2", + "ember-auto-import": "^1.12.0", + "ember-bootstrap": "^4.0.0", + "ember-cli": "~3.28.6", + "ember-cli-app-version": "^5.0.0", + "ember-cli-babel": "^7.26.10", + "ember-cli-dependency-checker": "^3.2.0", + "ember-cli-htmlbars": "^5.7.2", + "ember-cli-inject-live-reload": "^2.1.0", "ember-cli-sri": "^2.1.1", "ember-cli-string-helpers": "^4.0.5", - "ember-cli-template-lint": "^1.0.0-beta.1", - "ember-cli-uglify": "^2.1.0", - "ember-data": "~3.10.0", - "ember-export-application-global": "^2.0.0", - "ember-load-initializers": "^2.0.0", + "ember-cli-terser": "^4.0.2", + "ember-data": "~3.28.6", + "ember-export-application-global": "^2.0.1", + "ember-fetch": "^8.1.1", + "ember-load-initializers": "^2.1.2", "ember-maybe-import-regenerator": "^0.1.6", - "ember-qunit": "^4.4.1", - "ember-resolver": "^5.0.1", - "ember-source": "~3.10.0", - "ember-welcome-page": "^4.0.0", - "eslint-plugin-ember": "^6.2.0", - "eslint-plugin-node": "^9.0.1", + "ember-page-title": "^6.2.2", + "ember-qunit": "^5.1.5", + "ember-resolver": "^8.0.3", + "ember-source": "~3.28.8", + "ember-template-lint": "^3.15.0", + "ember-welcome-page": "^4.1.0", + "eslint": "^7.32.0", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-ember": "^10.5.8", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-prettier": "^3.4.1", + "eslint-plugin-qunit": "^6.2.0", "loader.js": "^4.7.0", - "qunit-dom": "^0.8.4" + "npm-run-all": "^4.1.5", + "prettier": "^2.5.1", + "qunit": "^2.17.2", + "qunit-dom": "^1.6.0" }, "engines": { - "node": "6.* || 8.* || >= 10.*" + "node": "12.* || 14.* || >= 16" + }, + "ember": { + "edition": "octane" } } diff --git a/test/fixtures/with-telemetry/input/testem.js b/test/fixtures/with-telemetry/input/testem.js index 726d18799..ed2f37124 100644 --- a/test/fixtures/with-telemetry/input/testem.js +++ b/test/fixtures/with-telemetry/input/testem.js @@ -1,25 +1,23 @@ +'use strict'; + module.exports = { test_page: 'tests/index.html?hidepassed', disable_watching: true, - launch_in_ci: [ - 'Chrome' - ], - launch_in_dev: [ - 'Chrome' - ], + launch_in_ci: ['Chrome'], + launch_in_dev: ['Chrome'], + browser_start_timeout: 120, browser_args: { Chrome: { ci: [ // --no-sandbox is needed when running Chrome inside a container process.env.CI ? '--no-sandbox' : null, '--headless', - '--disable-gpu', '--disable-dev-shm-usage', '--disable-software-rasterizer', '--mute-audio', '--remote-debugging-port=0', - '--window-size=1440,900' - ].filter(Boolean) - } - } + '--window-size=1440,900', + ].filter(Boolean), + }, + }, }; diff --git a/test/fixtures/with-telemetry/input/tests/index.html b/test/fixtures/with-telemetry/input/tests/index.html index cd1f0c95d..6d60dd096 100644 --- a/test/fixtures/with-telemetry/input/tests/index.html +++ b/test/fixtures/with-telemetry/input/tests/index.html @@ -21,7 +21,14 @@ {{content-for "body"}} {{content-for "test-body"}} - +
+
+
+
+
+
+ + diff --git a/test/fixtures/with-telemetry/input/tests/test-helper.js b/test/fixtures/with-telemetry/input/tests/test-helper.js index 0382a848d..060849e3d 100644 --- a/test/fixtures/with-telemetry/input/tests/test-helper.js +++ b/test/fixtures/with-telemetry/input/tests/test-helper.js @@ -1,8 +1,12 @@ -import Application from '../app'; -import config from '../config/environment'; +import Application from 'my-project/app'; +import config from 'my-project/config/environment'; +import * as QUnit from 'qunit'; import { setApplication } from '@ember/test-helpers'; +import { setup } from 'qunit-dom'; import { start } from 'ember-qunit'; setApplication(Application.create(config.APP)); +setup(QUnit.assert); + start();