diff --git a/.eslintignore b/.eslintignore index 72df373..9221655 100644 --- a/.eslintignore +++ b/.eslintignore @@ -13,6 +13,7 @@ # misc /coverage/ !.* +.eslintcache # ember-try /.node_modules.ember-try/ diff --git a/.eslintrc.js b/.eslintrc.js index 70d88da..07053f3 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -14,7 +14,11 @@ module.exports = { }, }, plugins: ['ember'], - extends: ['eslint:recommended', 'plugin:ember/recommended'], + extends: [ + 'eslint:recommended', + 'plugin:ember/recommended', + 'plugin:prettier/recommended', + ], env: { browser: true, }, @@ -26,6 +30,7 @@ module.exports = { { files: [ '.eslintrc.js', + '.prettierrc.js', '.template-lintrc.js', 'ember-cli-build.js', 'index.js', diff --git a/.gitignore b/.gitignore index c40a1b2..7e0f7dd 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ /.env* /.pnp* /.sass-cache +/.eslintcache /connect.lock /coverage/ /libpeerconnection.log diff --git a/.npmignore b/.npmignore index bd09adf..1556c4d 100644 --- a/.npmignore +++ b/.npmignore @@ -10,10 +10,13 @@ /.editorconfig /.ember-cli /.env* +/.eslintcache /.eslintignore /.eslintrc.js /.git/ /.gitignore +/.prettierignore +/.prettierrc.js /.template-lintrc.js /.travis.yml /.watchmanconfig diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..9221655 --- /dev/null +++ b/.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/.prettierrc.js b/.prettierrc.js index e340799..534e6d3 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -1,3 +1,5 @@ +'use strict'; + module.exports = { singleQuote: true, }; diff --git a/.template-lintrc.js b/.template-lintrc.js index f387370..3b0b9af 100644 --- a/.template-lintrc.js +++ b/.template-lintrc.js @@ -1,5 +1,5 @@ 'use strict'; module.exports = { - extends: 'octane' + extends: 'octane', }; diff --git a/.travis.yml b/.travis.yml index 26f8b6b..bd6e060 100644 --- a/.travis.yml +++ b/.travis.yml @@ -55,7 +55,8 @@ jobs: - env: EMBER_TRY_SCENARIO=ember-canary - env: EMBER_TRY_SCENARIO=ember-default-with-jquery - env: EMBER_TRY_SCENARIO=ember-classic - - env: EMBER_TRY_SCENARIO=embroider-tests + - env: EMBER_TRY_SCENARIO=embroider-safe + - env: EMBER_TRY_SCENARIO=embroider-optimized script: - node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 751ece5..0b36c4b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,9 +8,8 @@ ## Linting -* `npm run lint:hbs` -* `npm run lint:js` -* `npm run lint:js -- --fix` +* `npm run lint` +* `npm run lint:fix` ## Running tests diff --git a/config/ember-try.js b/config/ember-try.js index d39257e..2ab59e5 100644 --- a/config/ember-try.js +++ b/config/ember-try.js @@ -1,6 +1,7 @@ 'use strict'; const getChannelURL = require('ember-source-channel-url'); +const { embroiderSafe, embroiderOptimized } = require('@embroider/test-setup'); module.exports = async function () { return { @@ -73,16 +74,8 @@ module.exports = async function () { }, }, }, - { - name: 'embroider-tests', - npm: { - devDependencies: { - '@embroider/core': '*', - '@embroider/webpack': '*', - '@embroider/compat': '*', - }, - }, - }, + embroiderSafe(), + embroiderOptimized(), ], }; }; diff --git a/config/environment.js b/config/environment.js index 86e84d2..9b5d25d 100644 --- a/config/environment.js +++ b/config/environment.js @@ -1,6 +1,6 @@ /* eslint-env node */ 'use strict'; -module.exports = function(/* environment, appConfig */) { - return { }; -}; \ No newline at end of file +module.exports = function (/* environment, appConfig */) { + return {}; +}; diff --git a/ember-cli-build.js b/ember-cli-build.js index f789762..0e60f0d 100644 --- a/ember-cli-build.js +++ b/ember-cli-build.js @@ -18,16 +18,11 @@ module.exports = function (defaults) { behave. You most likely want to be modifying `./index.js` or app's build file */ - if ('@embroider/webpack' in app.dependencies()) { - const { Webpack } = require('@embroider/webpack'); // eslint-disable-line - return require('@embroider/compat') // eslint-disable-line - .compatBuild(app, Webpack, { - staticAddonTestSupportTrees: true, - staticAddonTrees: true, - staticHelpers: true, - staticComponents: true, - }); - } - - return app.toTree(); + const { maybeEmbroider } = require('@embroider/test-setup'); + return maybeEmbroider(app, { + staticAddonTestSupportTrees: true, + staticAddonTrees: true, + staticHelpers: true, + staticComponents: true, + }); }; diff --git a/index.js b/index.js index 81a73de..35a69a3 100644 --- a/index.js +++ b/index.js @@ -5,17 +5,17 @@ const writeFile = require('broccoli-file-creator'); module.exports = { name: require('./package').name, - + /** * Store `ember-cli-build.js` options */ - included: function(app/*, parentAddon*/) { + included: function (app /*, parentAddon*/) { this._super.included.apply(this, arguments); this._options = app.options.newVersion || {}; if (this._options.enabled === true) { this._options.fileName = this._options.fileName || 'VERSION.txt'; - this._options.prepend = this._options.prepend || ''; + this._options.prepend = this._options.prepend || ''; this._options.useAppVersion = this._options.useAppVersion || false; } }, @@ -23,7 +23,7 @@ module.exports = { /** * Copy version from `ember-cli-app-version` */ - config: function(env, baseConfig) { + config: function (env, baseConfig) { this._appVersion = baseConfig.APP.version || null; }, @@ -34,7 +34,7 @@ module.exports = { * - ember-cli-app-version if installed * - package.json of consuming application or */ - treeForPublic: function() { + treeForPublic: function () { let detectedVersion; if (this._options.useAppVersion && this._appVersion) { @@ -51,5 +51,5 @@ module.exports = { this.ui.writeLine(`Created ${fileName} with ${detectedVersion}`); return writeFile(fileName, detectedVersion); } - } + }, }; diff --git a/package.json b/package.json index 1e50030..0eaad44 100644 --- a/package.json +++ b/package.json @@ -4,11 +4,14 @@ "description": "A convention based update notification for Ember. With this addon, you can detect a new version and notify the user to refresh the page", "scripts": { "build": "ember build --environment=production", + "lint:fix": "npm-run-all --aggregate-output --continue-on-error --parallel lint:*:fix", "lint:hbs": "ember-template-lint .", - "lint:js": "eslint .", - "lint": "npm-run-all --aggregate-output --continue-on-error --parallel lint:*", + "lint:hbs:fix": "ember-template-lint . --fix", + "lint:js": "eslint . --cache", + "lint": "npm-run-all --aggregate-output --continue-on-error --parallel 'lint:!(fix)'", + "lint:js:fix": "eslint . --fix", "start": "ember server", - "test": "npm-run-all lint:* test:*", + "test": "npm-run-all lint test:*", "test:ember": "ember test", "test:ember-compatibility": "ember try:each", "release": "standard-version" @@ -18,36 +21,43 @@ }, "devDependencies": { "@ember/optional-features": "^2.0.0", - "@glimmer/component": "^1.0.2", - "@glimmer/tracking": "^1.0.2", + "@ember/test-helpers": "^2.2.5", + "@embroider/test-setup": "^0.37.0", + "@glimmer/component": "^1.0.4", + "@glimmer/tracking": "^1.0.4", "babel-eslint": "^10.1.0", "broccoli-asset-rev": "^3.0.0", - "ember-auto-import": "^1.6.0", - "ember-cli": "~3.22.0", + "ember-auto-import": "^1.11.2", + "ember-cli": "~3.26.1", "ember-cli-dependency-checker": "^3.2.0", "ember-cli-inject-live-reload": "^2.0.2", "ember-cli-mirage": "^1.1.2", "ember-cli-sri": "^2.1.1", - "ember-cli-terser": "^4.0.0", + "ember-cli-terser": "^4.0.1", "ember-concurrency-test-waiter": "^0.3.1", "ember-disable-prototype-extensions": "^1.1.3", "ember-export-application-global": "^2.0.1", "ember-fetch": "^8.0.4", - "ember-load-initializers": "^2.1.1", + "ember-load-initializers": "^2.1.2", "ember-maybe-import-regenerator": "^0.1.6", - "ember-qunit": "^4.6.0", + "ember-page-title": "^6.2.1", + "ember-qunit": "^5.1.4", "ember-resolver": "^8.0.2", - "ember-source": "~3.22.0", + "ember-source": "~3.26.1", "ember-source-channel-url": "^3.0.0", - "ember-template-lint": "^2.14.0", + "ember-template-lint": "^3.2.0", "ember-try": "^1.4.0", - "eslint": "^7.11.0", - "eslint-plugin-ember": "^9.3.0", + "eslint": "^7.23.0", + "eslint-config-prettier": "^8.1.0", + "eslint-plugin-ember": "^10.3.0", "eslint-plugin-node": "^11.1.0", + "eslint-plugin-prettier": "^3.3.1", "loader.js": "^4.7.0", "mirage": "0.0.7", "npm-run-all": "^4.1.5", - "qunit-dom": "^1.5.0", + "prettier": "^2.2.1", + "qunit": "^2.14.1", + "qunit-dom": "^1.6.0", "standard-version": "^8.0.1" }, "keywords": [ @@ -69,8 +79,8 @@ }, "dependencies": { "broccoli-file-creator": "^2.1.1", - "ember-cli-babel": "^7.22.1", - "ember-cli-htmlbars": "^5.3.1", + "ember-cli-babel": "^7.26.3", + "ember-cli-htmlbars": "^5.7.1", "ember-concurrency": "^1.0.0 || ^2.0.2" }, "ember": { diff --git a/tests/dummy/app/templates/application.hbs b/tests/dummy/app/templates/application.hbs index 4ed92b4..c2662c0 100644 --- a/tests/dummy/app/templates/application.hbs +++ b/tests/dummy/app/templates/application.hbs @@ -1,5 +1,9 @@ -

Ember New Version

+{{page-title 'Ember New Version'}} + +

+ Ember New Version +

{{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 fca02e1..3a4ab32 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": "3.22.0", + "version": "3.26.1", "blueprints": [ { "name": "addon", diff --git a/tests/dummy/config/environment.js b/tests/dummy/config/environment.js index 30aa5ad..8ef990a 100644 --- a/tests/dummy/config/environment.js +++ b/tests/dummy/config/environment.js @@ -1,7 +1,7 @@ /* eslint-env node */ 'use strict'; -module.exports = function(environment) { +module.exports = function (environment) { let ENV = { modulePrefix: 'dummy', environment, @@ -14,8 +14,8 @@ module.exports = function(environment) { }, EXTEND_PROTOTYPES: { // Prevent Ember Data from overriding Date.parse. - Date: false - } + Date: false, + }, }, APP: { @@ -24,9 +24,8 @@ module.exports = function(environment) { }, 'ember-cli-mirage': { - enabled: false + enabled: false, }, - }; if (environment === 'development') { diff --git a/tests/dummy/config/targets.js b/tests/dummy/config/targets.js index 228a078..4b33327 100644 --- a/tests/dummy/config/targets.js +++ b/tests/dummy/config/targets.js @@ -3,7 +3,7 @@ const browsers = [ 'last 1 Chrome versions', 'last 1 Firefox versions', - 'last 1 Safari versions' + 'last 1 Safari versions', ]; const isCI = Boolean(process.env.CI); @@ -14,5 +14,5 @@ if (isCI || isProduction) { } module.exports = { - browsers + browsers, }; diff --git a/tests/index.html b/tests/index.html index 33cbc8c..bfb62ea 100644 --- a/tests/index.html +++ b/tests/index.html @@ -21,6 +21,13 @@ {{content-for "body"}} {{content-for "test-body"}} +
+
+
+
+
+
+ diff --git a/tests/test-helper.js b/tests/test-helper.js index 4eae06f..4efd6e5 100644 --- a/tests/test-helper.js +++ b/tests/test-helper.js @@ -1,8 +1,12 @@ import Application from 'dummy/app'; import config from 'dummy/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();