Skip to content

Commit

Permalink
Introduce an Embroider test app
Browse files Browse the repository at this point in the history
  • Loading branch information
dfreeman committed Apr 8, 2020
1 parent b337c2a commit 41c96e9
Show file tree
Hide file tree
Showing 26 changed files with 1,658 additions and 195 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ jobs:
node-version: 12
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Embroider App
run: yarn workspace embroider-app test
- name: Sass App
run: yarn workspace sass-app test
- name: Dummy Addon
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"workspaces": [
"packages/ember-css-modules",
"test-packages/dummy-addon",
"test-packages/embroider-app",
"test-packages/plugin-addon",
"test-packages/sass-app"
]
Expand Down
9 changes: 9 additions & 0 deletions test-packages/embroider-app/.ember-cli
Original file line number Diff line number Diff line change
@@ -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
}
20 changes: 20 additions & 0 deletions test-packages/embroider-app/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# unconventional js
/blueprints/*/files/
/vendor/

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/
/node_modules/

# misc
/coverage/
!.*

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try
56 changes: 56 additions & 0 deletions test-packages/embroider-app/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
'use strict';

module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
legacyDecorators: true
}
},
plugins: [
'ember'
],
extends: [
'eslint:recommended',
'plugin:ember/recommended'
],
env: {
browser: true
},
rules: {
'ember/no-jquery': 'error'
},
overrides: [
// node files
{
files: [
'.eslintrc.js',
'.template-lintrc.js',
'ember-cli-build.js',
'testem.js',
'blueprints/*/index.js',
'config/**/*.js',
'lib/*/index.js',
'server/**/*.js'
],
parserOptions: {
sourceType: 'script'
},
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

// this can be removed once the following is fixed
// https://github.com/mysticatea/eslint-plugin-node/issues/77
'node/no-unpublished-require': 'off'
})
}
]
};
25 changes: 25 additions & 0 deletions test-packages/embroider-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/
/node_modules/

# misc
/.env*
/.pnp*
/.sass-cache
/connect.lock
/coverage/
/libpeerconnection.log
/npm-debug.log*
/testem.log
/yarn-error.log

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try
3 changes: 3 additions & 0 deletions test-packages/embroider-app/.watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ignore_dirs": ["tmp", "dist"]
}
5 changes: 5 additions & 0 deletions test-packages/embroider-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# embroider-app

This is a test package ensuring that ECM operates correctly in an Embroider compatibility build.

Note that the `staticHelpers` and `staticComponents` flags are currently known to be unsupported.
12 changes: 12 additions & 0 deletions test-packages/embroider-app/app/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Application from '@ember/application';
import Resolver from 'ember-resolver';
import loadInitializers from 'ember-load-initializers';
import config from './config/environment';

export default class App extends Application {
modulePrefix = config.modulePrefix;
podModulePrefix = config.podModulePrefix;
Resolver = Resolver;
}

loadInitializers(App, config.modulePrefix);
3 changes: 3 additions & 0 deletions test-packages/embroider-app/app/components/test-component.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.test-component {
font-family: TestComponent;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div local-class="test-component">{{yield}}</div>
25 changes: 25 additions & 0 deletions test-packages/embroider-app/app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>EmbroiderApp</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">

{{content-for "head"}}

<link integrity="" rel="stylesheet" href="{{rootURL}}assets/vendor.css">
<link integrity="" rel="stylesheet" href="{{rootURL}}assets/embroider-app.css">

{{content-for "head-footer"}}
</head>
<body>
{{content-for "body"}}

<script src="{{rootURL}}assets/vendor.js"></script>
<script src="{{rootURL}}assets/embroider-app.js"></script>

{{content-for "body-footer"}}
</body>
</html>
10 changes: 10 additions & 0 deletions test-packages/embroider-app/app/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import EmberRouter from '@ember/routing/router';
import config from './config/environment';

export default class Router extends EmberRouter {
location = config.locationType;
rootURL = config.rootURL;
}

Router.map(function() {
});
1 change: 1 addition & 0 deletions test-packages/embroider-app/app/templates/application.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{outlet}}
51 changes: 51 additions & 0 deletions test-packages/embroider-app/config/environment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
'use strict';

module.exports = function(environment) {
let ENV = {
modulePrefix: 'embroider-app',
environment,
rootURL: '/',
locationType: 'auto',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. EMBER_NATIVE_DECORATOR_SUPPORT: 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;
};
6 changes: 6 additions & 0 deletions test-packages/embroider-app/config/optional-features.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"application-template-wrapper": false,
"default-async-observers": true,
"jquery-integration": false,
"template-only-glimmer-components": true
}
18 changes: 18 additions & 0 deletions test-packages/embroider-app/config/targets.js
Original file line number Diff line number Diff line change
@@ -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
};
18 changes: 18 additions & 0 deletions test-packages/embroider-app/ember-cli-build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use strict';

const EmberApp = require('ember-cli/lib/broccoli/ember-app');
const { Webpack } = require('@embroider/webpack');
const { compatBuild } = require('@embroider/compat');

module.exports = function(defaults) {
let app = new EmberApp(defaults, {
// Add options here
});

return compatBuild(app, Webpack, {
staticAddonTestSupportTrees: true,
staticAddonTrees: true,
// staticHelpers: true,
// staticComponents: true,
});
};
58 changes: 58 additions & 0 deletions test-packages/embroider-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"name": "embroider-app",
"version": "0.0.0",
"private": true,
"description": "Small description for embroider-app goes here",
"repository": "",
"license": "MIT",
"author": "",
"directories": {
"doc": "doc",
"test": "tests"
},
"scripts": {
"build": "ember build --environment=production",
"lint": "npm-run-all --aggregate-output --continue-on-error --parallel lint:*",
"lint:hbs": "ember-template-lint .",
"lint:js": "eslint .",
"start": "ember serve",
"test": "npm-run-all lint:* test:*",
"test:ember": "ember test"
},
"devDependencies": {
"@ember/optional-features": "^1.3.0",
"@embroider/compat": "^0.13.0",
"@embroider/core": "^0.13.0",
"@embroider/webpack": "^0.13.0",
"@glimmer/component": "^1.0.0",
"@glimmer/tracking": "^1.0.0",
"babel-eslint": "^10.1.0",
"ember-auto-import": "^1.5.3",
"ember-cli": "~3.17.0",
"ember-cli-babel": "^7.18.0",
"ember-cli-dependency-checker": "^3.2.0",
"ember-cli-htmlbars": "^4.2.3",
"ember-cli-inject-live-reload": "^2.0.2",
"ember-css-modules": "link:../../packages/ember-css-modules",
"ember-data": "~3.17.0",
"ember-export-application-global": "^2.0.1",
"ember-fetch": "^7.0.1",
"ember-load-initializers": "^2.1.1",
"ember-maybe-import-regenerator": "^0.1.6",
"ember-qunit": "^4.6.0",
"ember-resolver": "^7.0.0",
"ember-source": "~3.17.0",
"eslint": "^6.8.0",
"eslint-plugin-ember": "^7.10.1",
"eslint-plugin-node": "^11.0.0",
"loader.js": "^4.7.0",
"npm-run-all": "^4.1.5",
"qunit-dom": "^1.1.0"
},
"engines": {
"node": "10.* || >= 12"
},
"ember": {
"edition": "octane"
}
}
3 changes: 3 additions & 0 deletions test-packages/embroider-app/public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# http://www.robotstxt.org
User-agent: *
Disallow:
27 changes: 27 additions & 0 deletions test-packages/embroider-app/testem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
'use strict';

module.exports = {
test_page: 'tests/index.html?hidepassed',
disable_watching: true,
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-dev-shm-usage',
'--disable-software-rasterizer',
'--mute-audio',
'--remote-debugging-port=0',
'--window-size=1440,900'
].filter(Boolean)
}
}
};
Loading

0 comments on commit 41c96e9

Please sign in to comment.