diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..fd20a38 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,19 @@ +# unconventional js +/blueprints/*/files/ +/vendor/ + +# compiled output +/dist/ +/tmp/ + +# dependencies +/bower_components/ + +# 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..4c662f0 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -4,10 +4,48 @@ 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: [ + '.template-lintrc.js', + 'ember-cli-build.js', + 'index.js', + 'testem.js', + 'blueprints/*/index.js', + 'config/**/*.js', + 'tests/dummy/config/**/*.js' + ], + excludedFiles: [ + 'addon/**', + 'addon-test-support/**', + 'app/**', + 'tests/dummy/app/**' + ], + parserOptions: { + sourceType: 'script', + ecmaVersion: 2015 + }, + env: { + browser: false, + node: true + }, + plugins: ['node'], + rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, { + // add your custom rules and overrides for node files here + }) + } + ] }; diff --git a/.gitignore b/.gitignore index 8fa39a6..29c9bc6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,23 +1,23 @@ # 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 /.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/.npmignore b/.npmignore index e07b078..6032b25 100644 --- a/.npmignore +++ b/.npmignore @@ -1,21 +1,29 @@ -/bower_components +# compiled output +/dist/ +/tmp/ + +# dependencies +/bower_components/ + +# misc +/.bowerrc +/.editorconfig +/.ember-cli +/.eslintignore +/.eslintrc.js +/.gitignore +/.template-lintrc.js +/.travis.yml +/.watchmanconfig +/bower.json /config/ember-try.js -/dist -/tests -/tmp -**/.gitkeep -.bowerrc -.editorconfig -.ember-cli -.gitignore -.eslintrc.js -.watchmanconfig -.travis.yml -bower.json -ember-cli-build.js -testem.js +/ember-cli-build.js +/testem.js +/tests/ +/yarn.lock +.gitkeep # 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 38b4be7..f904298 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ 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 - - "4" + - "6" sudo: false dist: trusty @@ -19,20 +19,31 @@ env: global: # See https://git.io/vdao3 for details. - JOBS=1 - matrix: + +jobs: + fail_fast: 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 + # we recommend new addons test the current and previous LTS # as well as latest stable release (bonus points to beta/canary) - - EMBER_TRY_SCENARIO=ember-lts-2.12 - - EMBER_TRY_SCENARIO=ember-lts-2.16 - - EMBER_TRY_SCENARIO=ember-release - - EMBER_TRY_SCENARIO=ember-beta - - EMBER_TRY_SCENARIO=ember-canary - - EMBER_TRY_SCENARIO=ember-default - -matrix: - fast_finish: true - allow_failures: + - stage: "Additional Tests" + env: EMBER_TRY_SCENARIO=ember-lts-2.16 + - env: EMBER_TRY_SCENARIO=ember-lts-2.18 + - 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 before_install: - npm config set spin false @@ -40,6 +51,4 @@ before_install: - npm --version script: - # Usually, it's ok to finish the test scenario without reverting - # to the addon's original dependency state, skipping "cleanup". - - node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO --skip-cleanup + - node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO diff --git a/LICENSE.md b/LICENSE.md index 0d5e3ef..198f6da 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2017 +Copyright (c) 2018 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/config/ember-try.js b/config/ember-try.js index 3eea72b..7742969 100644 --- a/config/ember-try.js +++ b/config/ember-try.js @@ -1,75 +1,83 @@ -/* eslint-env node */ -module.exports = { - scenarios: [ - { - name: 'ember-lts-2.12', - npm: { - devDependencies: { - 'ember-source': '~2.12.0' - } - } - }, - { - name: 'ember-lts-2.16', - npm: { - devDependencies: { - 'ember-source': '~2.16.0' - } - } - }, - { - name: 'ember-release', - bower: { - dependencies: { - 'ember': 'components/ember#release' +'use strict'; + +const getChannelURL = require('ember-source-channel-url'); + +module.exports = function() { + return Promise.all([ + getChannelURL('release'), + getChannelURL('beta'), + getChannelURL('canary') + ]).then((urls) => { + return { + scenarios: [ + { + name: 'ember-lts-2.16', + env: { + EMBER_OPTIONAL_FEATURES: JSON.stringify({ 'jquery-integration': true }), + }, + npm: { + devDependencies: { + '@ember/jquery': '^0.5.1', + 'ember-source': '~2.16.0' + } + } }, - resolutions: { - 'ember': 'release' - } - }, - npm: { - devDependencies: { - 'ember-source': null - } - } - }, - { - name: 'ember-beta', - bower: { - dependencies: { - 'ember': 'components/ember#beta' + { + name: 'ember-lts-2.18', + env: { + EMBER_OPTIONAL_FEATURES: JSON.stringify({ 'jquery-integration': true }), + }, + npm: { + devDependencies: { + '@ember/jquery': '^0.5.1', + 'ember-source': '~2.18.0' + } + } }, - resolutions: { - 'ember': 'beta' - } - }, - npm: { - devDependencies: { - 'ember-source': null - } - } - }, - { - name: 'ember-canary', - bower: { - dependencies: { - 'ember': 'components/ember#canary' + { + name: 'ember-release', + npm: { + devDependencies: { + 'ember-source': urls[0] + } + } }, - resolutions: { - 'ember': 'canary' - } - }, - npm: { - devDependencies: { - 'ember-source': null + { + name: 'ember-beta', + npm: { + devDependencies: { + 'ember-source': urls[1] + } + } + }, + { + name: 'ember-canary', + npm: { + devDependencies: { + 'ember-source': urls[2] + } + } + }, + { + name: 'ember-default', + npm: { + devDependencies: {} + } + }, + { + name: 'ember-default-with-jquery', + env: { + EMBER_OPTIONAL_FEATURES: JSON.stringify({ + 'jquery-integration': true + }) + }, + npm: { + devDependencies: { + '@ember/jquery': '^0.5.1' + } + } } - } - }, - { - name: 'ember-default', - npm: { - devDependencies: {} - } - } - ] + ] + }; + }); }; diff --git a/config/environment.js b/config/environment.js index 012a412..0dfaed4 100644 --- a/config/environment.js +++ b/config/environment.js @@ -1,4 +1,3 @@ -/* eslint-env node */ 'use strict'; module.exports = function(/* environment, appConfig */) { diff --git a/ember-cli-build.js b/ember-cli-build.js index 156e23f..dc5a39e 100644 --- a/ember-cli-build.js +++ b/ember-cli-build.js @@ -1,4 +1,3 @@ -/* eslint-env node */ 'use strict'; const EmberAddon = require('ember-cli/lib/broccoli/ember-addon'); diff --git a/index.js b/index.js index 60ce296..f673a7b 100644 --- a/index.js +++ b/index.js @@ -1,8 +1,7 @@ -/* eslint-env node */ 'use strict'; module.exports = { - name: 'ember-cli-github-pages', + name: require('./package').name, includedCommands: function() { return { diff --git a/package.json b/package.json index a8d7186..10c54ec 100644 --- a/package.json +++ b/package.json @@ -10,43 +10,53 @@ "static", "emberjs" ], + "repository": "https://github.com/poetic/ember-cli-github-pages", "license": "MIT", "author": "Jake Craige ", "directories": { "doc": "doc", "test": "tests" }, - "repository": "https://github.com/poetic/ember-cli-github-pages", "scripts": { "build": "ember build", + "lint:hbs": "ember-template-lint .", + "lint:js": "eslint .", "start": "ember serve", - "test": "ember try:each" + "test": "ember test", + "test:all": "ember try:each" }, "dependencies": { "ember-cli-version-checker": "^2.1.0", "rsvp": "^4.7.0" }, "devDependencies": { - "broccoli-asset-rev": "^2.4.5", - "ember-cli": "~2.17.1", - "ember-cli-dependency-checker": "^2.0.0", - "ember-cli-eslint": "^4.2.1", - "ember-cli-htmlbars": "^2.0.1", - "ember-cli-htmlbars-inline-precompile": "^1.0.0", - "ember-cli-inject-live-reload": "^1.4.1", - "ember-cli-qunit": "^4.1.1", - "ember-cli-shims": "^1.2.0", - "ember-cli-sri": "^2.1.0", - "ember-cli-uglify": "^2.0.0", - "ember-disable-prototype-extensions": "^1.1.2", + "@ember/optional-features": "^0.6.3", + "broccoli-asset-rev": "^2.7.0", + "ember-cli": "~3.5.0", + "ember-cli-dependency-checker": "^3.0.0", + "ember-cli-eslint": "^4.2.3", + "ember-cli-htmlbars": "^3.0.0", + "ember-cli-htmlbars-inline-precompile": "^1.0.3", + "ember-cli-inject-live-reload": "^1.8.2", + "ember-cli-sri": "^2.1.1", + "ember-cli-template-lint": "^1.0.0-beta.1", + "ember-cli-uglify": "^2.1.0", + "ember-disable-prototype-extensions": "^1.1.3", "ember-export-application-global": "^2.0.0", - "ember-load-initializers": "^1.0.0", - "ember-resolver": "^4.0.0", - "ember-source": "~2.17.0", - "loader.js": "^4.2.3" + "ember-load-initializers": "^1.1.0", + "ember-maybe-import-regenerator": "^0.1.6", + "ember-qunit": "^3.4.1", + "ember-resolver": "^5.0.1", + "ember-source": "~3.5.0", + "ember-source-channel-url": "^1.1.0", + "ember-try": "^1.0.0", + "eslint-plugin-ember": "^5.2.0", + "eslint-plugin-node": "^7.0.1", + "loader.js": "^4.7.0", + "qunit-dom": "^0.8.0" }, "engines": { - "node": "^4.5 || 6.* || >= 7.*" + "node": "6.* || 8.* || >= 10.*" }, "ember-addon": { "configPath": "tests/dummy/config" diff --git a/testem.js b/testem.js index 63d1edf..726d187 100644 --- a/testem.js +++ b/testem.js @@ -1,4 +1,3 @@ -/* eslint-env node */ module.exports = { test_page: 'tests/index.html?hidepassed', disable_watching: true, @@ -10,13 +9,17 @@ module.exports = { ], browser_args: { Chrome: { - mode: 'ci', - args: [ - '--disable-gpu', + 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) } } }; diff --git a/tests/.eslintrc.js b/tests/.eslintrc.js deleted file mode 100644 index fbf2555..0000000 --- a/tests/.eslintrc.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - env: { - embertest: true - } -}; diff --git a/tests/dummy/config/environment.js b/tests/dummy/config/environment.js index 2bd80fe..1460909 100644 --- a/tests/dummy/config/environment.js +++ b/tests/dummy/config/environment.js @@ -1,4 +1,3 @@ -/* eslint-env node */ 'use strict'; module.exports = function(environment) { @@ -41,6 +40,7 @@ module.exports = function(environment) { ENV.APP.LOG_VIEW_LOOKUPS = false; ENV.APP.rootElement = '#ember-testing'; + ENV.APP.autoboot = false; } if (environment === 'production') { diff --git a/tests/dummy/config/optional-features.json b/tests/dummy/config/optional-features.json new file mode 100644 index 0000000..b190262 --- /dev/null +++ b/tests/dummy/config/optional-features.json @@ -0,0 +1,3 @@ +{ + "jquery-integration": false +} diff --git a/tests/dummy/config/targets.js b/tests/dummy/config/targets.js index df7664c..8ffae36 100644 --- a/tests/dummy/config/targets.js +++ b/tests/dummy/config/targets.js @@ -1,9 +1,18 @@ -/* eslint-env node */ +'use strict'; + +const browsers = [ + 'last 1 Chrome versions', + 'last 1 Firefox versions', + 'last 1 Safari versions' +]; + +const isCI = !!process.env.CI; +const isProduction = process.env.EMBER_ENV === 'production'; + +if (isCI || isProduction) { + browsers.push('ie 11'); +} + module.exports = { - browsers: [ - 'ie 9', - 'last 1 Chrome versions', - 'last 1 Firefox versions', - 'last 1 Safari versions' - ] + browsers }; diff --git a/tests/dummy/public/crossdomain.xml b/tests/dummy/public/crossdomain.xml deleted file mode 100644 index 0c16a7a..0000000 --- a/tests/dummy/public/crossdomain.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - diff --git a/tests/helpers/.gitkeep b/tests/helpers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/tests/helpers/destroy-app.js b/tests/helpers/destroy-app.js deleted file mode 100644 index e7f983b..0000000 --- a/tests/helpers/destroy-app.js +++ /dev/null @@ -1,5 +0,0 @@ -import { run } from '@ember/runloop'; - -export default function destroyApp(application) { - run(application, 'destroy'); -} diff --git a/tests/helpers/module-for-acceptance.js b/tests/helpers/module-for-acceptance.js deleted file mode 100644 index 90a93ba..0000000 --- a/tests/helpers/module-for-acceptance.js +++ /dev/null @@ -1,21 +0,0 @@ -import { module } from 'qunit'; -import { resolve } from 'rsvp'; -import startApp from '../helpers/start-app'; -import destroyApp from '../helpers/destroy-app'; - -export default function(name, options = {}) { - module(name, { - beforeEach() { - this.application = startApp(); - - if (options.beforeEach) { - return options.beforeEach.apply(this, arguments); - } - }, - - afterEach() { - let afterEach = options.afterEach && options.afterEach.apply(this, arguments); - return resolve(afterEach).then(() => destroyApp(this.application)); - } - }); -} diff --git a/tests/helpers/start-app.js b/tests/helpers/start-app.js deleted file mode 100644 index 681aa01..0000000 --- a/tests/helpers/start-app.js +++ /dev/null @@ -1,16 +0,0 @@ -import Application from '../../app'; -import config from '../../config/environment'; -import { merge } from '@ember/polyfills'; -import { run } from '@ember/runloop'; - -export default function startApp(attrs) { - let attributes = merge({}, config.APP); - attributes = merge(attributes, attrs); // use defaults, but you can override; - - return run(() => { - let application = Application.create(attributes); - application.setupForTesting(); - application.injectTestHelpers(); - return application; - }); -} diff --git a/tests/test-helper.js b/tests/test-helper.js index edc8122..0382a84 100644 --- a/tests/test-helper.js +++ b/tests/test-helper.js @@ -1,7 +1,8 @@ import Application from '../app'; +import config from '../config/environment'; import { setApplication } from '@ember/test-helpers'; import { start } from 'ember-qunit'; -setApplication(Application.create({ autoboot: false })); +setApplication(Application.create(config.APP)); start();