diff --git a/blueprints/addon/index.js b/blueprints/addon/index.js index 967777558ed..e21e16c6a4f 100644 --- a/blueprints/addon/index.js +++ b/blueprints/addon/index.js @@ -37,7 +37,7 @@ module.exports = { let contents = JSON.parse(content); contents.name = this.locals(this.options).addonName; - contents.description = description; + contents.description = this.description; delete contents.private; contents.scripts = contents.scripts || {}; contents.keywords = contents.keywords || []; @@ -139,7 +139,6 @@ module.exports = { files() { let appFiles = this.lookupBlueprint('app').files(); - let addonFilesPath = this.filesPath(this.options); let addonFiles = walkSync(addonFilesPath); diff --git a/blueprints/module-unification-addon/files/.editorconfig b/blueprints/module-unification-addon/files/.editorconfig new file mode 100644 index 00000000000..219985c2289 --- /dev/null +++ b/blueprints/module-unification-addon/files/.editorconfig @@ -0,0 +1,20 @@ +# EditorConfig helps developers define and maintain consistent +# coding styles between different editors and IDEs +# editorconfig.org + +root = true + + +[*] +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +indent_style = space +indent_size = 2 + +[*.hbs] +insert_final_newline = false + +[*.{diff,md}] +trim_trailing_whitespace = false diff --git a/blueprints/module-unification-addon/files/.ember-cli b/blueprints/module-unification-addon/files/.ember-cli new file mode 100644 index 00000000000..ee64cfed2a8 --- /dev/null +++ b/blueprints/module-unification-addon/files/.ember-cli @@ -0,0 +1,9 @@ +{ + /** + 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 +} diff --git a/blueprints/module-unification-addon/files/.eslintrc.js b/blueprints/module-unification-addon/files/.eslintrc.js new file mode 100644 index 00000000000..0520a189ce5 --- /dev/null +++ b/blueprints/module-unification-addon/files/.eslintrc.js @@ -0,0 +1,47 @@ +module.exports = { + root: true, + parserOptions: { + ecmaVersion: 2017, + sourceType: 'module' + }, + plugins: [ + 'ember' + ], + extends: [ + 'eslint:recommended', + 'plugin:ember/recommended' + ], + env: { + browser: true + }, + rules: { + }, + overrides: [ + // node files + { + files: [ + 'index.js', + 'testem.js', + 'ember-cli-build.js', + 'config/**/*.js', + 'tests/dummy/config/**/*.js' + ], + excludedFiles: [ + 'src/**', + '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/blueprints/module-unification-addon/files/.travis.yml b/blueprints/module-unification-addon/files/.travis.yml new file mode 100644 index 00000000000..c9db7e0ddf2 --- /dev/null +++ b/blueprints/module-unification-addon/files/.travis.yml @@ -0,0 +1,47 @@ +--- +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" + +sudo: false +dist: trusty + +addons: + chrome: stable + +cache: + directories: + - $HOME/.npm + +env: + global: + # See https://git.io/vdao3 for details. + - JOBS=1 + matrix: + # 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-lts-2.18 + - 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: + - env: EMBER_TRY_SCENARIO=ember-canary + +before_install: + - npm config set spin false + - npm install -g npm@4 + - npm --version + +script: + - npm run lint:js + # 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 diff --git a/blueprints/module-unification-addon/files/LICENSE.md b/blueprints/module-unification-addon/files/LICENSE.md new file mode 100644 index 00000000000..f5799851dc1 --- /dev/null +++ b/blueprints/module-unification-addon/files/LICENSE.md @@ -0,0 +1,9 @@ +The MIT License (MIT) + +Copyright (c) <%= year %> + +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: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/blueprints/module-unification-addon/files/README.md b/blueprints/module-unification-addon/files/README.md new file mode 100644 index 00000000000..77161cb398f --- /dev/null +++ b/blueprints/module-unification-addon/files/README.md @@ -0,0 +1,50 @@ +<%= addonName %> +============================================================================== + +[Short description of the addon.] + +Installation +------------------------------------------------------------------------------ + +``` +ember install <%= addonName %> +``` + + +Usage +------------------------------------------------------------------------------ + +[Longer description of how to use the addon in apps.] + + +Contributing +------------------------------------------------------------------------------ + +### Installation + +* `git clone ` +* `cd <%= addonName %>` +* `<% if (yarn) { %>yarn<% } else { %>npm<% } %> install` + +### Linting + +* `<% if (yarn) { %>yarn lint:js<% } else { %>npm run lint:js<% } %>` +* `<% if (yarn) { %>yarn lint:js --fix<% } else { %>npm run lint:js -- --fix<% } %>` + +### Running tests + +* `ember test` – Runs the test suite on the current Ember version +* `ember test --server` – Runs the test suite in "watch mode" +* `ember try:each` – Runs the test suite against multiple Ember versions + +### Running the dummy application + +* `ember serve` +* Visit the dummy application at [http://localhost:4200](http://localhost:4200). + +For more information on using ember-cli, visit [https://ember-cli.com/](https://ember-cli.com/). + +License +------------------------------------------------------------------------------ + +This project is licensed under the [MIT License](LICENSE.md). diff --git a/blueprints/module-unification-addon/files/addon-config/ember-try.js b/blueprints/module-unification-addon/files/addon-config/ember-try.js new file mode 100644 index 00000000000..f607ff6ad21 --- /dev/null +++ b/blueprints/module-unification-addon/files/addon-config/ember-try.js @@ -0,0 +1,71 @@ +'use strict'; + +const getChannelURL = require('ember-source-channel-url'); + +module.exports = function() { + return Promise.all([ + getChannelURL('release'), + getChannelURL('beta'), + getChannelURL('canary'), + ]).then((urls) => { + return { + <% if (yarn) { %>useYarn: true, + <% } %>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-lts-2.18', + npm: { + devDependencies: { + 'ember-source': '~2.18.0' + } + } + }, + { + name: 'ember-release', + npm: { + devDependencies: { + 'ember-source': urls[0] + } + } + }, + { + name: 'ember-beta', + npm: { + devDependencies: { + 'ember-source': urls[1] + } + } + }, + { + name: 'ember-canary', + npm: { + devDependencies: { + 'ember-source': urls[2] + } + } + }, + { + name: 'ember-default', + npm: { + devDependencies: {} + } + } + ] + }; + }); +}; diff --git a/blueprints/module-unification-addon/files/addon-config/environment.js b/blueprints/module-unification-addon/files/addon-config/environment.js new file mode 100644 index 00000000000..0dfaed4728b --- /dev/null +++ b/blueprints/module-unification-addon/files/addon-config/environment.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function(/* environment, appConfig */) { + return { }; +}; diff --git a/blueprints/module-unification-addon/files/ember-cli-build.js b/blueprints/module-unification-addon/files/ember-cli-build.js new file mode 100644 index 00000000000..ba0649dc935 --- /dev/null +++ b/blueprints/module-unification-addon/files/ember-cli-build.js @@ -0,0 +1,18 @@ +'use strict'; + +const EmberAddon = require('ember-cli/lib/broccoli/ember-addon'); + +module.exports = function (defaults) { + let app = new EmberAddon(defaults, { + // Add options here + }); + + /* + This build file specifies the options for the dummy test app of this + addon, located in `/tests/dummy` + This build file does *not* influence how the addon or the app using it + behave. You most likely want to be modifying `./index.js` or app's build file + */ + + return app.toTree(); +}; diff --git a/blueprints/module-unification-addon/files/index.js b/blueprints/module-unification-addon/files/index.js new file mode 100644 index 00000000000..8a2000367bc --- /dev/null +++ b/blueprints/module-unification-addon/files/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = { + name: '<%= addonName %>' +}; diff --git a/blueprints/module-unification-addon/files/npmignore b/blueprints/module-unification-addon/files/npmignore new file mode 100644 index 00000000000..135c7b1f27a --- /dev/null +++ b/blueprints/module-unification-addon/files/npmignore @@ -0,0 +1,21 @@ +/bower_components +/config/ember-try.js +/dist +/tests +/tmp +**/.gitkeep +.bowerrc +.editorconfig +.ember-cli +.eslintrc.js +.gitignore +.watchmanconfig +.travis.yml +bower.json +ember-cli-build.js +testem.js + +# ember-try +.node_modules.ember-try/ +bower.json.ember-try +package.json.ember-try diff --git a/blueprints/module-unification-addon/files/src/.gitkeep b/blueprints/module-unification-addon/files/src/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/blueprints/module-unification-addon/files/tests/dummy/.gitkeep b/blueprints/module-unification-addon/files/tests/dummy/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/blueprints/module-unification-addon/files/tests/index.html b/blueprints/module-unification-addon/files/tests/index.html new file mode 100644 index 00000000000..5209b852321 --- /dev/null +++ b/blueprints/module-unification-addon/files/tests/index.html @@ -0,0 +1,33 @@ + + + + + + Dummy Tests + + + + {{content-for "head"}} + {{content-for "test-head"}} + + + + + + {{content-for "head-footer"}} + {{content-for "test-head-footer"}} + + + {{content-for "body"}} + {{content-for "test-body"}} + + + + + + + + {{content-for "body-footer"}} + {{content-for "test-body-footer"}} + + diff --git a/blueprints/module-unification-addon/files/tests/test-helper.js b/blueprints/module-unification-addon/files/tests/test-helper.js new file mode 100644 index 00000000000..0382a848dd0 --- /dev/null +++ b/blueprints/module-unification-addon/files/tests/test-helper.js @@ -0,0 +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(config.APP)); + +start(); diff --git a/blueprints/module-unification-addon/files/vendor/.gitkeep b/blueprints/module-unification-addon/files/vendor/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/blueprints/module-unification-addon/index.js b/blueprints/module-unification-addon/index.js new file mode 100644 index 00000000000..c0d812c1307 --- /dev/null +++ b/blueprints/module-unification-addon/index.js @@ -0,0 +1,6 @@ +'use strict'; +const addonBlueprint = require('../addon'); + +module.exports = Object.assign({}, addonBlueprint, { + description: 'Generates an Ember addon with a module unification layout.', +}); diff --git a/lib/commands/new.js b/lib/commands/new.js index a79e6cfda69..da20acb7801 100644 --- a/lib/commands/new.js +++ b/lib/commands/new.js @@ -37,8 +37,12 @@ module.exports = Command.extend({ beforeRun: mergeBlueprintOptions, run(commandOptions, rawArgs) { - if (process.env.MODULE_UNIFICATION === 'true' && commandOptions.blueprint === 'app') { - commandOptions.blueprint = 'module-unification-app'; + if (process.env.MODULE_UNIFICATION === 'true') { + if (commandOptions.blueprint === 'app') { + commandOptions.blueprint = 'module-unification-app'; + } else if (commandOptions.blueprint === 'addon') { + commandOptions.blueprint = 'module-unification-addon'; + } } let packageName = rawArgs[0], diff --git a/tests/acceptance/help-test.js b/tests/acceptance/help-test.js index 449ea8f8065..01871642c85 100644 --- a/tests/acceptance/help-test.js +++ b/tests/acceptance/help-test.js @@ -54,7 +54,6 @@ describe('Acceptance: ember help', function() { let fixturePath = path.join(__dirname, '..', 'fixtures', 'help', 'help.txt'); let expected = loadTextFixture(fixturePath); - expect(output).to.equal(expected); }); diff --git a/tests/acceptance/new-test.js b/tests/acceptance/new-test.js index 52a073f525b..3935dd78bbc 100644 --- a/tests/acceptance/new-test.js +++ b/tests/acceptance/new-test.js @@ -322,6 +322,22 @@ describe('Acceptance: ember new', function() { expect(pkgJson.name).to.equal('foo', 'uses app name for package name'); })); + it('MODULE_UNIFICATION=true ember addon foo works', co.wrap(function *() { + process.env.MODULE_UNIFICATION = 'true'; + yield ember([ + 'addon', + 'foo', + '--skip-npm', + '--skip-bower', + ]); + + let expectedFiles = walkSync(path.join(__dirname, '../fixtures', 'module-unification-addon')) + .sort() + .filter(e => e !== '.DS_Store'); + let actualFiles = walkSync('.').sort().filter(e => e !== '.DS_Store'); + expect(actualFiles).to.deep.equal(expectedFiles); + })); + it('ember addon with --directory uses given directory name and has correct package name', co.wrap(function *() { let workdir = process.cwd(); diff --git a/tests/fixtures/help/generate-with-addon.txt b/tests/fixtures/help/generate-with-addon.txt index 4afd4a88d27..fc29b929a88 100644 --- a/tests/fixtures/help/generate-with-addon.txt +++ b/tests/fixtures/help/generate-with-addon.txt @@ -44,6 +44,8 @@ ember generate \u001b[33m\u001b[39m \u001b[36m\u001b[39m \u001b[90mThe blueprint for addon in repo ember-cli addons.\u001b[39m lib \u001b[33m\u001b[39m \u001b[90mGenerates a lib directory for in-repo addons.\u001b[39m + module-unification-addon \u001b[33m\u001b[39m + \u001b[90mGenerates an Ember addon with a module unification layout.\u001b[39m module-unification-app \u001b[33m\u001b[39m \u001b[90mGenerates an Ember application with a module unification layout.\u001b[39m server \u001b[33m\u001b[39m diff --git a/tests/fixtures/help/generate.txt b/tests/fixtures/help/generate.txt index 0d458f97456..0656d2dd0f8 100644 --- a/tests/fixtures/help/generate.txt +++ b/tests/fixtures/help/generate.txt @@ -17,6 +17,8 @@ \u001b[90mThe blueprint for addon in repo ember-cli addons.\u001b[39m lib \u001b[33m\u001b[39m \u001b[90mGenerates a lib directory for in-repo addons.\u001b[39m + module-unification-addon \u001b[33m\u001b[39m + \u001b[90mGenerates an Ember addon with a module unification layout.\u001b[39m module-unification-app \u001b[33m\u001b[39m \u001b[90mGenerates an Ember application with a module unification layout.\u001b[39m server \u001b[33m\u001b[39m diff --git a/tests/fixtures/help/help.js b/tests/fixtures/help/help.js index d7973a1a9b5..c977204e286 100644 --- a/tests/fixtures/help/help.js +++ b/tests/fixtures/help/help.js @@ -304,6 +304,13 @@ module.exports = { anonymousOptions: ['name'], overridden: false }, + { + name: 'module-unification-addon', + description: 'Generates an Ember addon with a module unification layout.', + availableOptions: [], + anonymousOptions: ['name'], + overridden: false + }, { name: 'module-unification-app', description: 'Generates an Ember application with a module unification layout.', diff --git a/tests/fixtures/help/with-addon-blueprints.js b/tests/fixtures/help/with-addon-blueprints.js index 2595c9f004d..ee7b18eed0b 100644 --- a/tests/fixtures/help/with-addon-blueprints.js +++ b/tests/fixtures/help/with-addon-blueprints.js @@ -336,6 +336,13 @@ module.exports = { anonymousOptions: ['name'], overridden: false }, + { + name: 'module-unification-addon', + description: 'Generates an Ember addon with a module unification layout.', + availableOptions: [], + anonymousOptions: ['name'], + overridden: false + }, { name: 'module-unification-app', description: 'Generates an Ember application with a module unification layout.', diff --git a/tests/fixtures/help/with-addon-commands.js b/tests/fixtures/help/with-addon-commands.js index 415558d352c..9de66d0b336 100644 --- a/tests/fixtures/help/with-addon-commands.js +++ b/tests/fixtures/help/with-addon-commands.js @@ -304,6 +304,13 @@ module.exports = { anonymousOptions: ['name'], overridden: false }, + { + name: 'module-unification-addon', + description: 'Generates an Ember addon with a module unification layout.', + availableOptions: [], + anonymousOptions: ['name'], + overridden: false + }, { name: 'module-unification-app', description: 'Generates an Ember application with a module unification layout.', diff --git a/tests/fixtures/module-unification-addon/.editorconfig b/tests/fixtures/module-unification-addon/.editorconfig new file mode 100644 index 00000000000..219985c2289 --- /dev/null +++ b/tests/fixtures/module-unification-addon/.editorconfig @@ -0,0 +1,20 @@ +# EditorConfig helps developers define and maintain consistent +# coding styles between different editors and IDEs +# editorconfig.org + +root = true + + +[*] +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +indent_style = space +indent_size = 2 + +[*.hbs] +insert_final_newline = false + +[*.{diff,md}] +trim_trailing_whitespace = false diff --git a/tests/fixtures/module-unification-addon/.ember-cli b/tests/fixtures/module-unification-addon/.ember-cli new file mode 100644 index 00000000000..ee64cfed2a8 --- /dev/null +++ b/tests/fixtures/module-unification-addon/.ember-cli @@ -0,0 +1,9 @@ +{ + /** + 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 +} diff --git a/tests/fixtures/module-unification-addon/.eslintrc.js b/tests/fixtures/module-unification-addon/.eslintrc.js new file mode 100644 index 00000000000..0520a189ce5 --- /dev/null +++ b/tests/fixtures/module-unification-addon/.eslintrc.js @@ -0,0 +1,47 @@ +module.exports = { + root: true, + parserOptions: { + ecmaVersion: 2017, + sourceType: 'module' + }, + plugins: [ + 'ember' + ], + extends: [ + 'eslint:recommended', + 'plugin:ember/recommended' + ], + env: { + browser: true + }, + rules: { + }, + overrides: [ + // node files + { + files: [ + 'index.js', + 'testem.js', + 'ember-cli-build.js', + 'config/**/*.js', + 'tests/dummy/config/**/*.js' + ], + excludedFiles: [ + 'src/**', + '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/tests/fixtures/module-unification-addon/.gitignore b/tests/fixtures/module-unification-addon/.gitignore new file mode 100644 index 00000000000..8fa39a63ca5 --- /dev/null +++ b/tests/fixtures/module-unification-addon/.gitignore @@ -0,0 +1,23 @@ +# See https://help.github.com/ignore-files/ for more about ignoring files. + +# compiled output +/dist +/tmp + +# dependencies +/node_modules +/bower_components + +# misc +/.sass-cache +/connect.lock +/coverage/* +/libpeerconnection.log +npm-debug.log* +yarn-error.log +testem.log + +# ember-try +.node_modules.ember-try/ +bower.json.ember-try +package.json.ember-try diff --git a/tests/fixtures/module-unification-addon/.npmignore b/tests/fixtures/module-unification-addon/.npmignore new file mode 100644 index 00000000000..135c7b1f27a --- /dev/null +++ b/tests/fixtures/module-unification-addon/.npmignore @@ -0,0 +1,21 @@ +/bower_components +/config/ember-try.js +/dist +/tests +/tmp +**/.gitkeep +.bowerrc +.editorconfig +.ember-cli +.eslintrc.js +.gitignore +.watchmanconfig +.travis.yml +bower.json +ember-cli-build.js +testem.js + +# ember-try +.node_modules.ember-try/ +bower.json.ember-try +package.json.ember-try diff --git a/tests/fixtures/module-unification-addon/.travis.yml b/tests/fixtures/module-unification-addon/.travis.yml new file mode 100644 index 00000000000..c9db7e0ddf2 --- /dev/null +++ b/tests/fixtures/module-unification-addon/.travis.yml @@ -0,0 +1,47 @@ +--- +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" + +sudo: false +dist: trusty + +addons: + chrome: stable + +cache: + directories: + - $HOME/.npm + +env: + global: + # See https://git.io/vdao3 for details. + - JOBS=1 + matrix: + # 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-lts-2.18 + - 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: + - env: EMBER_TRY_SCENARIO=ember-canary + +before_install: + - npm config set spin false + - npm install -g npm@4 + - npm --version + +script: + - npm run lint:js + # 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 diff --git a/tests/fixtures/module-unification-addon/.watchmanconfig b/tests/fixtures/module-unification-addon/.watchmanconfig new file mode 100644 index 00000000000..e7834e3e4f3 --- /dev/null +++ b/tests/fixtures/module-unification-addon/.watchmanconfig @@ -0,0 +1,3 @@ +{ + "ignore_dirs": ["tmp", "dist"] +} diff --git a/tests/fixtures/module-unification-addon/LICENSE.md b/tests/fixtures/module-unification-addon/LICENSE.md new file mode 100644 index 00000000000..198f6dacf45 --- /dev/null +++ b/tests/fixtures/module-unification-addon/LICENSE.md @@ -0,0 +1,9 @@ +The MIT License (MIT) + +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: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tests/fixtures/module-unification-addon/README.md b/tests/fixtures/module-unification-addon/README.md new file mode 100644 index 00000000000..c6a2848d140 --- /dev/null +++ b/tests/fixtures/module-unification-addon/README.md @@ -0,0 +1,50 @@ +foo +============================================================================== + +[Short description of the addon.] + +Installation +------------------------------------------------------------------------------ + +``` +ember install foo +``` + + +Usage +------------------------------------------------------------------------------ + +[Longer description of how to use the addon in apps.] + + +Contributing +------------------------------------------------------------------------------ + +### Installation + +* `git clone ` +* `cd foo` +* `npm install` + +### Linting + +* `npm run lint:js` +* `npm run lint:js -- --fix` + +### Running tests + +* `ember test` – Runs the test suite on the current Ember version +* `ember test --server` – Runs the test suite in "watch mode" +* `ember try:each` – Runs the test suite against multiple Ember versions + +### Running the dummy application + +* `ember serve` +* Visit the dummy application at [http://localhost:4200](http://localhost:4200). + +For more information on using ember-cli, visit [https://ember-cli.com/](https://ember-cli.com/). + +License +------------------------------------------------------------------------------ + +This project is licensed under the [MIT License](LICENSE.md). diff --git a/tests/fixtures/module-unification-addon/config/ember-try.js b/tests/fixtures/module-unification-addon/config/ember-try.js new file mode 100644 index 00000000000..08e0dd91841 --- /dev/null +++ b/tests/fixtures/module-unification-addon/config/ember-try.js @@ -0,0 +1,70 @@ +'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.12', + npm: { + devDependencies: { + 'ember-source': '~2.12.0' + } + } + }, + { + name: 'ember-lts-2.16', + npm: { + devDependencies: { + 'ember-source': '~2.16.0' + } + } + }, + { + name: 'ember-lts-2.18', + npm: { + devDependencies: { + 'ember-source': '~2.18.0' + } + } + }, + { + name: 'ember-release', + npm: { + devDependencies: { + 'ember-source': urls[0] + } + } + }, + { + name: 'ember-beta', + npm: { + devDependencies: { + 'ember-source': urls[1] + } + } + }, + { + name: 'ember-canary', + npm: { + devDependencies: { + 'ember-source': urls[2] + } + } + }, + { + name: 'ember-default', + npm: { + devDependencies: {} + } + } + ] + }; + }); +}; diff --git a/tests/fixtures/module-unification-addon/config/environment.js b/tests/fixtures/module-unification-addon/config/environment.js new file mode 100644 index 00000000000..0dfaed4728b --- /dev/null +++ b/tests/fixtures/module-unification-addon/config/environment.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function(/* environment, appConfig */) { + return { }; +}; diff --git a/tests/fixtures/module-unification-addon/ember-cli-build.js b/tests/fixtures/module-unification-addon/ember-cli-build.js new file mode 100644 index 00000000000..ba0649dc935 --- /dev/null +++ b/tests/fixtures/module-unification-addon/ember-cli-build.js @@ -0,0 +1,18 @@ +'use strict'; + +const EmberAddon = require('ember-cli/lib/broccoli/ember-addon'); + +module.exports = function (defaults) { + let app = new EmberAddon(defaults, { + // Add options here + }); + + /* + This build file specifies the options for the dummy test app of this + addon, located in `/tests/dummy` + This build file does *not* influence how the addon or the app using it + behave. You most likely want to be modifying `./index.js` or app's build file + */ + + return app.toTree(); +}; diff --git a/tests/fixtures/module-unification-addon/index.js b/tests/fixtures/module-unification-addon/index.js new file mode 100644 index 00000000000..0f25795b146 --- /dev/null +++ b/tests/fixtures/module-unification-addon/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = { + name: 'foo' +}; diff --git a/tests/fixtures/module-unification-addon/package.json b/tests/fixtures/module-unification-addon/package.json new file mode 100644 index 00000000000..97ce97c12b0 --- /dev/null +++ b/tests/fixtures/module-unification-addon/package.json @@ -0,0 +1,57 @@ +{ + "name": "foo", + "version": "0.0.0", + "description": "Generates an Ember addon with a module unification layout.", + "keywords": [ + "ember-addon" + ], + "license": "MIT", + "author": "", + "directories": { + "doc": "doc", + "test": "tests" + }, + "repository": "", + "scripts": { + "build": "ember build", + "lint:js": "eslint ./*.js addon addon-test-support app config lib server test-support tests", + "start": "ember serve", + "test": "ember test", + "test:all": "ember try:each" + }, + "dependencies": { + "ember-cli-babel": "^6.6.0" + }, + "devDependencies": { + "broccoli-asset-rev": "^2.4.5", + "ember-ajax": "^3.0.0", + "ember-cli": "~3.1.0-beta.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-export-application-global": "^2.0.0", + "ember-load-initializers": "^1.0.0", + "ember-maybe-import-regenerator": "^0.1.6", + "ember-resolver": "^4.0.0", + "ember-source": "~3.1.0-beta.1", + "ember-source-channel-url": "^1.0.1", + "ember-try": "^0.2.23", + "eslint-plugin-ember": "^5.0.0", + "eslint-plugin-node": "^5.2.1", + "loader.js": "^4.2.3", + "qunit-dom": "^0.5.0" + }, + "engines": { + "node": "^4.5 || 6.* || >= 7.*" + }, + "ember-addon": { + "configPath": "tests/dummy/config" + } +} diff --git a/tests/fixtures/module-unification-addon/src/.gitkeep b/tests/fixtures/module-unification-addon/src/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/fixtures/module-unification-addon/testem.js b/tests/fixtures/module-unification-addon/testem.js new file mode 100644 index 00000000000..d1755a4ea4a --- /dev/null +++ b/tests/fixtures/module-unification-addon/testem.js @@ -0,0 +1,24 @@ +module.exports = { + test_page: 'tests/index.html?hidepassed', + disable_watching: true, + launch_in_ci: [ + 'Chrome' + ], + launch_in_dev: [ + 'Chrome' + ], + browser_args: { + Chrome: { + mode: 'ci', + args: [ + // --no-sandbox is needed when running Chrome inside a container + process.env.TRAVIS ? '--no-sandbox' : null, + + '--disable-gpu', + '--headless', + '--remote-debugging-port=0', + '--window-size=1440,900' + ].filter(Boolean) + } + } +}; diff --git a/tests/fixtures/module-unification-addon/tests/dummy/.gitkeep b/tests/fixtures/module-unification-addon/tests/dummy/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/fixtures/module-unification-addon/tests/dummy/app/app.js b/tests/fixtures/module-unification-addon/tests/dummy/app/app.js new file mode 100644 index 00000000000..b3b2bd677e0 --- /dev/null +++ b/tests/fixtures/module-unification-addon/tests/dummy/app/app.js @@ -0,0 +1,14 @@ +import Application from '@ember/application'; +import Resolver from './resolver'; +import loadInitializers from 'ember-load-initializers'; +import config from './config/environment'; + +const App = Application.extend({ + modulePrefix: config.modulePrefix, + podModulePrefix: config.podModulePrefix, + Resolver +}); + +loadInitializers(App, config.modulePrefix); + +export default App; diff --git a/tests/fixtures/module-unification-addon/tests/dummy/app/components/.gitkeep b/tests/fixtures/module-unification-addon/tests/dummy/app/components/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/fixtures/module-unification-addon/tests/dummy/app/controllers/.gitkeep b/tests/fixtures/module-unification-addon/tests/dummy/app/controllers/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/fixtures/module-unification-addon/tests/dummy/app/helpers/.gitkeep b/tests/fixtures/module-unification-addon/tests/dummy/app/helpers/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/fixtures/module-unification-addon/tests/dummy/app/index.html b/tests/fixtures/module-unification-addon/tests/dummy/app/index.html new file mode 100644 index 00000000000..61400b20f56 --- /dev/null +++ b/tests/fixtures/module-unification-addon/tests/dummy/app/index.html @@ -0,0 +1,25 @@ + + + + + + Dummy + + + + {{content-for "head"}} + + + + + {{content-for "head-footer"}} + + + {{content-for "body"}} + + + + + {{content-for "body-footer"}} + + diff --git a/tests/fixtures/module-unification-addon/tests/dummy/app/models/.gitkeep b/tests/fixtures/module-unification-addon/tests/dummy/app/models/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/fixtures/module-unification-addon/tests/dummy/app/resolver.js b/tests/fixtures/module-unification-addon/tests/dummy/app/resolver.js new file mode 100644 index 00000000000..2fb563d6c04 --- /dev/null +++ b/tests/fixtures/module-unification-addon/tests/dummy/app/resolver.js @@ -0,0 +1,3 @@ +import Resolver from 'ember-resolver'; + +export default Resolver; diff --git a/tests/fixtures/module-unification-addon/tests/dummy/app/router.js b/tests/fixtures/module-unification-addon/tests/dummy/app/router.js new file mode 100644 index 00000000000..d0bb00952fd --- /dev/null +++ b/tests/fixtures/module-unification-addon/tests/dummy/app/router.js @@ -0,0 +1,12 @@ +import EmberRouter from '@ember/routing/router'; +import config from './config/environment'; + +const Router = EmberRouter.extend({ + location: config.locationType, + rootURL: config.rootURL +}); + +Router.map(function() { +}); + +export default Router; diff --git a/tests/fixtures/module-unification-addon/tests/dummy/app/routes/.gitkeep b/tests/fixtures/module-unification-addon/tests/dummy/app/routes/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/fixtures/module-unification-addon/tests/dummy/app/styles/app.css b/tests/fixtures/module-unification-addon/tests/dummy/app/styles/app.css new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/fixtures/module-unification-addon/tests/dummy/app/templates/application.hbs b/tests/fixtures/module-unification-addon/tests/dummy/app/templates/application.hbs new file mode 100644 index 00000000000..5230580f821 --- /dev/null +++ b/tests/fixtures/module-unification-addon/tests/dummy/app/templates/application.hbs @@ -0,0 +1,3 @@ +

Welcome to Ember

+ +{{outlet}} \ No newline at end of file diff --git a/tests/fixtures/module-unification-addon/tests/dummy/app/templates/components/.gitkeep b/tests/fixtures/module-unification-addon/tests/dummy/app/templates/components/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/fixtures/module-unification-addon/tests/dummy/config/environment.js b/tests/fixtures/module-unification-addon/tests/dummy/config/environment.js new file mode 100644 index 00000000000..182d3fcbfa0 --- /dev/null +++ b/tests/fixtures/module-unification-addon/tests/dummy/config/environment.js @@ -0,0 +1,51 @@ +'use strict'; + +module.exports = function(environment) { + let ENV = { + modulePrefix: 'dummy', + environment, + rootURL: '/', + locationType: 'auto', + EmberENV: { + FEATURES: { + // Here you can enable experimental features on an ember canary build + // e.g. 'with-controller': true + }, + EXTEND_PROTOTYPES: { + // Prevent Ember Data from overriding Date.parse. + Date: false + } + }, + + APP: { + // Here you can pass flags/options to your application instance + // when it is created + } + }; + + if (environment === 'development') { + // ENV.APP.LOG_RESOLVER = true; + // ENV.APP.LOG_ACTIVE_GENERATION = true; + // ENV.APP.LOG_TRANSITIONS = true; + // ENV.APP.LOG_TRANSITIONS_INTERNAL = true; + // ENV.APP.LOG_VIEW_LOOKUPS = true; + } + + if (environment === 'test') { + // Testem prefers this... + ENV.locationType = 'none'; + + // keep test console output quieter + ENV.APP.LOG_ACTIVE_GENERATION = false; + ENV.APP.LOG_VIEW_LOOKUPS = false; + + ENV.APP.rootElement = '#ember-testing'; + ENV.APP.autoboot = false; + } + + if (environment === 'production') { + // here you can enable a production-specific feature + } + + return ENV; +}; diff --git a/tests/fixtures/module-unification-addon/tests/dummy/config/targets.js b/tests/fixtures/module-unification-addon/tests/dummy/config/targets.js new file mode 100644 index 00000000000..8ffae36361e --- /dev/null +++ b/tests/fixtures/module-unification-addon/tests/dummy/config/targets.js @@ -0,0 +1,18 @@ +'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 +}; diff --git a/tests/fixtures/module-unification-addon/tests/dummy/public/robots.txt b/tests/fixtures/module-unification-addon/tests/dummy/public/robots.txt new file mode 100644 index 00000000000..f5916452e5f --- /dev/null +++ b/tests/fixtures/module-unification-addon/tests/dummy/public/robots.txt @@ -0,0 +1,3 @@ +# http://www.robotstxt.org +User-agent: * +Disallow: diff --git a/tests/fixtures/module-unification-addon/tests/helpers/.gitkeep b/tests/fixtures/module-unification-addon/tests/helpers/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/fixtures/module-unification-addon/tests/index.html b/tests/fixtures/module-unification-addon/tests/index.html new file mode 100644 index 00000000000..5209b852321 --- /dev/null +++ b/tests/fixtures/module-unification-addon/tests/index.html @@ -0,0 +1,33 @@ + + + + + + Dummy Tests + + + + {{content-for "head"}} + {{content-for "test-head"}} + + + + + + {{content-for "head-footer"}} + {{content-for "test-head-footer"}} + + + {{content-for "body"}} + {{content-for "test-body"}} + + + + + + + + {{content-for "body-footer"}} + {{content-for "test-body-footer"}} + + diff --git a/tests/fixtures/module-unification-addon/tests/integration/.gitkeep b/tests/fixtures/module-unification-addon/tests/integration/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/fixtures/module-unification-addon/tests/test-helper.js b/tests/fixtures/module-unification-addon/tests/test-helper.js new file mode 100644 index 00000000000..0382a848dd0 --- /dev/null +++ b/tests/fixtures/module-unification-addon/tests/test-helper.js @@ -0,0 +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(config.APP)); + +start(); diff --git a/tests/fixtures/module-unification-addon/tests/unit/.gitkeep b/tests/fixtures/module-unification-addon/tests/unit/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/fixtures/module-unification-addon/vendor/.gitkeep b/tests/fixtures/module-unification-addon/vendor/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d