From 1c111ef48c5bfd76f162d5521294d27cf5a839f7 Mon Sep 17 00:00:00 2001 From: "Ronald A. Richardson" Date: Thu, 7 Dec 2023 15:02:34 +0800 Subject: [PATCH] preparing for upgrade to ember 5.4 --- .ember-cli | 12 +- .eslintignore | 12 -- .eslintrc.js | 18 +- .github/workflows/ci.yml | 10 +- .gitignore | 9 +- .npmignore | 9 +- .prettierignore | 14 +- .prettierrc.js | 2 +- .stylelintignore | 8 + .stylelintrc.js | 5 + .watchmanconfig | 2 +- README.md | 6 +- config/ember-try.js | 72 -------- ember-cli-build.js | 6 +- package.json | 212 +++++++++++----------- tests/dummy/app/styles/app.css | 1 + tests/dummy/app/templates/application.hbs | 4 +- tests/dummy/config/ember-cli-update.json | 2 +- tests/dummy/config/ember-try.js | 54 ++++++ tests/dummy/config/environment.js | 3 +- tests/helpers/index.js | 2 +- tsconfig.declarations.json | 10 + vendor/.gitkeep | 0 23 files changed, 222 insertions(+), 251 deletions(-) create mode 100644 .stylelintignore create mode 100644 .stylelintrc.js delete mode 100644 config/ember-try.js create mode 100644 tests/dummy/config/ember-try.js create mode 100644 tsconfig.declarations.json delete mode 100644 vendor/.gitkeep diff --git a/.ember-cli b/.ember-cli index 4ccb4bf..465c405 100644 --- a/.ember-cli +++ b/.ember-cli @@ -1,15 +1,7 @@ { /** - Ember CLI sends analytics information by default. The data is completely - anonymous, but there are times when you might want to disable this behavior. - - Setting `disableAnalytics` to true will prevent any data from being sent. - */ - "disableAnalytics": false, - - /** - Setting `isTypeScriptProject` to true will force the blueprint generators to generate TypeScript - rather than JavaScript by default, when a TypeScript version of a given blueprint is available. + Setting `isTypeScriptProject` to true will force the blueprint generators to generate TypeScript + rather than JavaScript by default, when a TypeScript version of a given blueprint is available. */ "isTypeScriptProject": false } diff --git a/.eslintignore b/.eslintignore index d474a40..9385391 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,25 +1,13 @@ # 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 -/npm-shrinkwrap.json.ember-try -/package.json.ember-try -/package-lock.json.ember-try -/yarn.lock.ember-try diff --git a/.eslintrc.js b/.eslintrc.js index 7bf2736..08dad08 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -2,12 +2,13 @@ module.exports = { root: true, - parser: 'babel-eslint', + parser: '@babel/eslint-parser', parserOptions: { - ecmaVersion: 2018, + ecmaVersion: 'latest', sourceType: 'module', - ecmaFeatures: { - legacyDecorators: true, + requireConfigFile: false, + babelOptions: { + plugins: [['@babel/plugin-proposal-decorators', { decoratorsBeforeExport: true }]], }, }, plugins: ['ember'], @@ -27,6 +28,7 @@ module.exports = { files: [ './.eslintrc.js', './.prettierrc.js', + './.stylelintrc.js', './.template-lintrc.js', './ember-cli-build.js', './index.js', @@ -42,13 +44,7 @@ module.exports = { browser: false, node: true, }, - plugins: ['node'], - extends: ['plugin:node/recommended'], - }, - { - // test files - files: ['tests/**/*-test.{js,ts}'], - extends: ['plugin:qunit/recommended'], + extends: ['plugin:n/recommended'], }, ], }; diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6b7df46..8769d39 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: - node-version: [16.x] # Build on Node.js 16 + node-version: [18.x] # Build on Node.js 18 steps: - uses: actions/checkout@v2 @@ -42,10 +42,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Setup Node.js 16.x + - name: Setup Node.js 18.x uses: actions/setup-node@v2 with: - node-version: 16.x + node-version: 18.x - name: Setup pnpm uses: pnpm/action-setup@v2.0.1 @@ -71,10 +71,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Setup Node.js 16.x + - name: Setup Node.js 18.x uses: actions/setup-node@v2 with: - node-version: 16.x + node-version: 18.x - name: Setup pnpm uses: pnpm/action-setup@v2.0.1 diff --git a/.gitignore b/.gitignore index f1e859b..71ad79d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,28 +1,21 @@ -# See https://help.github.com/ignore-files/ for more about ignoring files. - # compiled output /dist/ -/tmp/ +/declarations/ # dependencies -/bower_components/ /node_modules/ # misc /.env* /.pnp* -/.sass-cache /.eslintcache -/connect.lock /coverage/ -/libpeerconnection.log /npm-debug.log* /testem.log /yarn-error.log # ember-try /.node_modules.ember-try/ -/bower.json.ember-try /npm-shrinkwrap.json.ember-try /package.json.ember-try /package-lock.json.ember-try diff --git a/.npmignore b/.npmignore index 3aac244..69beb28 100644 --- a/.npmignore +++ b/.npmignore @@ -2,11 +2,7 @@ /dist/ /tmp/ -# dependencies -/bower_components/ - # misc -/.bowerrc /.editorconfig /.ember-cli /.env* @@ -18,11 +14,11 @@ /.gitignore /.prettierignore /.prettierrc.js +/.stylelintignore +/.stylelintrc.js /.template-lintrc.js /.travis.yml /.watchmanconfig -/bower.json -/config/ember-try.js /CONTRIBUTING.md /ember-cli-build.js /testem.js @@ -33,7 +29,6 @@ # ember-try /.node_modules.ember-try/ -/bower.json.ember-try /npm-shrinkwrap.json.ember-try /package.json.ember-try /package-lock.json.ember-try diff --git a/.prettierignore b/.prettierignore index 4178fd5..9385391 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,25 +1,13 @@ # unconventional js /blueprints/*/files/ -/vendor/ # compiled output /dist/ -/tmp/ - -# dependencies -/bower_components/ -/node_modules/ # misc /coverage/ !.* -.eslintcache -.lint-todo/ +.*/ # ember-try /.node_modules.ember-try/ -/bower.json.ember-try -/npm-shrinkwrap.json.ember-try -/package.json.ember-try -/package-lock.json.ember-try -/yarn.lock.ember-try diff --git a/.prettierrc.js b/.prettierrc.js index cd88cc9..bf64a90 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -8,7 +8,7 @@ module.exports = { printWidth: 190, overrides: [ { - files: '*.hbs', + files: '*.{hbs,js,ts}', options: { singleQuote: false, }, diff --git a/.stylelintignore b/.stylelintignore new file mode 100644 index 0000000..a0cf71c --- /dev/null +++ b/.stylelintignore @@ -0,0 +1,8 @@ +# unconventional files +/blueprints/*/files/ + +# compiled output +/dist/ + +# addons +/.node_modules.ember-try/ diff --git a/.stylelintrc.js b/.stylelintrc.js new file mode 100644 index 0000000..021c539 --- /dev/null +++ b/.stylelintrc.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = { + extends: ['stylelint-config-standard', 'stylelint-prettier/recommended'], +}; diff --git a/.watchmanconfig b/.watchmanconfig index e7834e3..f9c3d8f 100644 --- a/.watchmanconfig +++ b/.watchmanconfig @@ -1,3 +1,3 @@ { - "ignore_dirs": ["tmp", "dist"] + "ignore_dirs": ["dist"] } diff --git a/README.md b/README.md index d2952aa..f73d06a 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,9 @@ ## Compatibility -* Ember.js v3.24 or above -* Ember CLI v3.24 or above -* Node.js v14 or above +* Ember.js v4.8 or above +* Ember CLI v4.8 or above +* Node.js v18 or above ## Installation diff --git a/config/ember-try.js b/config/ember-try.js deleted file mode 100644 index 4753bcc..0000000 --- a/config/ember-try.js +++ /dev/null @@ -1,72 +0,0 @@ -'use strict'; - -const getChannelURL = require('ember-source-channel-url'); -const { embroiderSafe, embroiderOptimized } = require('@embroider/test-setup'); - -module.exports = async function () { - return { - useYarn: true, - scenarios: [ - { - name: 'ember-lts-3.24', - npm: { - devDependencies: { - 'ember-source': '~3.24.3', - }, - }, - }, - { - name: 'ember-lts-3.28', - npm: { - devDependencies: { - 'ember-source': '~3.28.0', - }, - }, - }, - { - name: 'ember-release', - npm: { - devDependencies: { - 'ember-source': await getChannelURL('release'), - }, - }, - }, - { - name: 'ember-beta', - npm: { - devDependencies: { - 'ember-source': await getChannelURL('beta'), - }, - }, - }, - { - name: 'ember-canary', - npm: { - devDependencies: { - 'ember-source': await getChannelURL('canary'), - }, - }, - }, - { - name: 'ember-classic', - env: { - EMBER_OPTIONAL_FEATURES: JSON.stringify({ - 'application-template-wrapper': true, - 'default-async-observers': false, - 'template-only-glimmer-components': false, - }), - }, - npm: { - devDependencies: { - 'ember-source': '~3.28.0', - }, - ember: { - edition: 'classic', - }, - }, - }, - embroiderSafe(), - embroiderOptimized(), - ], - }; -}; diff --git a/ember-cli-build.js b/ember-cli-build.js index eb1549e..6a05f8d 100644 --- a/ember-cli-build.js +++ b/ember-cli-build.js @@ -3,9 +3,9 @@ const EmberAddon = require('ember-cli/lib/broccoli/ember-addon'); module.exports = function (defaults) { - let app = new EmberAddon(defaults, { - // Add options here - }); + const app = new EmberAddon(defaults, { + // Add options here + }); /* This build file specifies the options for the dummy test app of this diff --git a/package.json b/package.json index 2609115..02d0228 100644 --- a/package.json +++ b/package.json @@ -1,103 +1,113 @@ { - "name": "@fleetbase/fleetops-data", - "version": "0.1.6", - "description": "Fleetbase Fleet-Ops based models, serializers, transforms, adapters and GeoJson utility functions.", - "keywords": [ - "fleetbase-data", - "fleetops-data", - "fleetbase-fleet-ops", - "fleetbase", - "ember-addon", - "ember-engine" - ], - "repository": "https://github.com/fleetbase/fleetops-data", - "license": "MIT", - "author": "Fleetbase Pte Ltd ", - "directories": { - "app": "app", - "addon": "addon", - "tests": "tests" - }, - "scripts": { - "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": "ember-template-lint .", - "lint:hbs:fix": "ember-template-lint . --fix", - "lint:js": "eslint . --cache", - "lint:js:fix": "eslint . --fix", - "start": "ember serve", - "test": "npm-run-all lint test:*", - "test:ember": "ember test", - "test:ember-compatibility": "ember try:each", - "publish:npm": "npm config set registry https://registry.npmjs.org/ && npm publish", - "publish:github": "npm config set '@fleetbase:registry' https://npm.pkg.github.com/ && npm publish" - }, - "dependencies": { - "date-fns": "^2.29.3", - "ember-cli-babel": "^7.26.11", - "ember-cli-htmlbars": "^6.1.0" - }, - "devDependencies": { - "@ember/optional-features": "^2.0.0", - "@ember/test-helpers": "^2.8.1", - "@embroider/test-setup": "^1.8.3", - "@fleetbase/ember-core": "^0.1.6", - "@glimmer/component": "^1.1.2", - "@glimmer/tracking": "^1.1.2", - "babel-eslint": "^10.1.0", - "broccoli-asset-rev": "^3.0.0", - "ember-auto-import": "^2.4.2", - "ember-cli": "~4.6.0", - "ember-cli-dependency-checker": "^3.3.1", - "ember-cli-inject-live-reload": "^2.1.0", - "ember-cli-sri": "^2.1.1", - "ember-cli-terser": "^4.0.2", - "ember-data": "^5.3.0", - "ember-disable-prototype-extensions": "^1.1.3", - "ember-load-initializers": "^2.1.2", - "ember-page-title": "^7.0.0", - "ember-qunit": "^5.1.5", - "ember-resolver": "^8.0.3", - "ember-source": "~4.6.0", - "ember-source-channel-url": "^3.0.0", - "ember-template-lint": "^4.10.1", - "ember-try": "^2.0.0", - "eslint": "^7.32.0", - "eslint-config-prettier": "^8.5.0", - "eslint-plugin-ember": "^11.0.2", - "eslint-plugin-node": "^11.1.0", - "eslint-plugin-prettier": "^4.2.1", - "eslint-plugin-qunit": "^7.3.1", - "loader.js": "^4.7.0", - "npm-run-all": "^4.1.5", - "prettier": "^2.7.1", - "qunit": "^2.19.1", - "qunit-dom": "^2.0.0", - "webpack": "^5.74.0" - }, - "engines": { - "node": "14.* || >= 16" - }, - "ember": { - "edition": "octane" - }, - "ember-addon": { - "configPath": "tests/dummy/config" - }, - "prettier": { - "trailingComma": "es5", - "tabWidth": 4, - "semi": true, - "singleQuote": true, - "printWidth": 190, - "overrides": [ - { - "files": "*.hbs", - "options": { - "singleQuote": false - } - } - ] - } + "name": "@fleetbase/fleetops-data", + "version": "0.1.6", + "description": "Fleetbase Fleet-Ops based models, serializers, transforms, adapters and GeoJson utility functions.", + "keywords": [ + "fleetbase-data", + "fleetops-data", + "fleetbase-fleet-ops", + "fleetbase", + "ember-addon", + "ember-engine" + ], + "repository": "https://github.com/fleetbase/fleetops-data", + "license": "MIT", + "author": "Fleetbase Pte Ltd ", + "directories": { + "app": "app", + "addon": "addon", + "tests": "tests" + }, + "scripts": { + "build": "ember build --environment=production", + "lint": "concurrently \"npm:lint:*(!fix)\" --names \"lint:\"", + "lint:css": "stylelint \"**/*.css\"", + "lint:css:fix": "concurrently \"npm:lint:css -- --fix\"", + "lint:fix": "concurrently \"npm:lint:*:fix\" --names \"fix:\"", + "lint:hbs": "ember-template-lint .", + "lint:hbs:fix": "ember-template-lint . --fix", + "lint:js": "eslint . --cache", + "lint:js:fix": "eslint . --fix", + "start": "ember serve", + "test": "concurrently \"npm:lint\" \"npm:test:*\" --names \"lint,test:\"", + "test:ember": "ember test", + "test:ember-compatibility": "ember try:each", + "publish:npm": "npm config set registry https://registry.npmjs.org/ && npm publish", + "publish:github": "npm config set '@fleetbase:registry' https://npm.pkg.github.com/ && npm publish" + }, + "dependencies": { + "@babel/core": "^7.23.2", + "date-fns": "^2.29.3", + "ember-cli-babel": "^8.2.0", + "ember-cli-htmlbars": "^6.3.0" + }, + "devDependencies": { + "@babel/eslint-parser": "^7.22.15", + "@babel/plugin-proposal-decorators": "^7.23.2", + "@ember/optional-features": "^2.0.0", + "@ember/test-helpers": "^3.2.0", + "@embroider/test-setup": "^3.0.2", + "@fleetbase/ember-core": "^0.1.6", + "@glimmer/component": "^1.1.2", + "@glimmer/tracking": "^1.1.2", + "broccoli-asset-rev": "^3.0.0", + "concurrently": "^8.2.2", + "ember-auto-import": "^2.6.3", + "ember-cli": "~5.4.1", + "ember-cli-clean-css": "^3.0.0", + "ember-cli-dependency-checker": "^3.3.2", + "ember-cli-inject-live-reload": "^2.1.0", + "ember-cli-sri": "^2.1.1", + "ember-cli-terser": "^4.0.2", + "ember-data": "^5.3.0", + "ember-load-initializers": "^2.1.2", + "ember-page-title": "^8.0.0", + "ember-qunit": "^8.0.1", + "ember-resolver": "^11.0.1", + "ember-source": "~5.4.0", + "ember-source-channel-url": "^3.0.0", + "ember-template-lint": "^5.11.2", + "ember-try": "^3.0.0", + "eslint": "^8.52.0", + "eslint-config-prettier": "^9.0.0", + "eslint-plugin-ember": "^11.11.1", + "eslint-plugin-n": "^16.2.0", + "eslint-plugin-prettier": "^5.0.1", + "eslint-plugin-qunit": "^8.0.1", + "loader.js": "^4.7.0", + "prettier": "^3.0.3", + "qunit": "^2.20.0", + "qunit-dom": "^2.0.0", + "stylelint": "^15.11.0", + "stylelint-config-standard": "^34.0.0", + "stylelint-prettier": "^4.0.2", + "webpack": "^5.89.0" + }, + "peerDependencies": { + "ember-source": ">= 4.0.0" + }, + "engines": { + "node": ">= 18" + }, + "ember": { + "edition": "octane" + }, + "ember-addon": { + "configPath": "tests/dummy/config" + }, + "prettier": { + "trailingComma": "es5", + "tabWidth": 4, + "semi": true, + "singleQuote": true, + "printWidth": 190, + "overrides": [ + { + "files": "*.hbs", + "options": { + "singleQuote": false + } + } + ] + } } diff --git a/tests/dummy/app/styles/app.css b/tests/dummy/app/styles/app.css index e69de29..2763afa 100644 --- a/tests/dummy/app/styles/app.css +++ b/tests/dummy/app/styles/app.css @@ -0,0 +1 @@ +/* Ember supports plain CSS out of the box. More info: https://cli.emberjs.com/release/advanced-use/stylesheets/ */ diff --git a/tests/dummy/app/templates/application.hbs b/tests/dummy/app/templates/application.hbs index 1001d14..8e7f167 100644 --- a/tests/dummy/app/templates/application.hbs +++ b/tests/dummy/app/templates/application.hbs @@ -1,5 +1,7 @@ {{page-title "Dummy"}} -

Welcome to Ember

+{{! The following component displays Ember's default welcome message. }} + +{{! Feel free to remove this! }} {{outlet}} \ No newline at end of file diff --git a/tests/dummy/config/ember-cli-update.json b/tests/dummy/config/ember-cli-update.json index 0692098..db2ac2e 100644 --- a/tests/dummy/config/ember-cli-update.json +++ b/tests/dummy/config/ember-cli-update.json @@ -3,7 +3,7 @@ "packages": [ { "name": "ember-cli", - "version": "4.6.0", + "version": "5.4.1", "blueprints": [ { "name": "addon", diff --git a/tests/dummy/config/ember-try.js b/tests/dummy/config/ember-try.js new file mode 100644 index 0000000..283e42a --- /dev/null +++ b/tests/dummy/config/ember-try.js @@ -0,0 +1,54 @@ +'use strict'; + +const getChannelURL = require('ember-source-channel-url'); +const { embroiderSafe, embroiderOptimized } = require('@embroider/test-setup'); + +module.exports = async function () { + return { + useYarn: true, + scenarios: [ + { + name: 'ember-lts-4.8', + npm: { + devDependencies: { + 'ember-source': '~4.8.0', + }, + }, + }, + { + name: 'ember-lts-4.12', + npm: { + devDependencies: { + 'ember-source': '~4.12.0', + }, + }, + }, + { + name: 'ember-release', + npm: { + devDependencies: { + 'ember-source': await getChannelURL('release'), + }, + }, + }, + { + name: 'ember-beta', + npm: { + devDependencies: { + 'ember-source': await getChannelURL('beta'), + }, + }, + }, + { + name: 'ember-canary', + npm: { + devDependencies: { + 'ember-source': await getChannelURL('canary'), + }, + }, + }, + embroiderSafe(), + embroiderOptimized(), + ], + }; +}; diff --git a/tests/dummy/config/environment.js b/tests/dummy/config/environment.js index a314e72..61f3a09 100644 --- a/tests/dummy/config/environment.js +++ b/tests/dummy/config/environment.js @@ -1,12 +1,13 @@ 'use strict'; module.exports = function (environment) { - let ENV = { + const ENV = { modulePrefix: 'dummy', environment, rootURL: '/', locationType: 'history', EmberENV: { + EXTEND_PROTOTYPES: false, FEATURES: { // Here you can enable experimental features on an ember canary build // e.g. EMBER_NATIVE_DECORATOR_SUPPORT: true diff --git a/tests/helpers/index.js b/tests/helpers/index.js index 4b9e23f..83a7e5c 100644 --- a/tests/helpers/index.js +++ b/tests/helpers/index.js @@ -1,6 +1,6 @@ import { setupApplicationTest as upstreamSetupApplicationTest, setupRenderingTest as upstreamSetupRenderingTest, setupTest as upstreamSetupTest } from 'ember-qunit'; -// This file exists to provide wrappers around ember-qunit's / ember-mocha's +// This file exists to provide wrappers around ember-qunit's // test setup functions. This way, you can easily extend the setup that is // needed per test type. diff --git a/tsconfig.declarations.json b/tsconfig.declarations.json new file mode 100644 index 0000000..5a21df7 --- /dev/null +++ b/tsconfig.declarations.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "declarationDir": "declarations", + "emitDeclarationOnly": true, + "noEmit": false, + "rootDir": "." + }, + "include": ["addon", "addon-test-support"] +} diff --git a/vendor/.gitkeep b/vendor/.gitkeep deleted file mode 100644 index e69de29..0000000