diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c51679852..21a06697a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -94,3 +94,5 @@ jobs: run: yarn install --ignore-engines --frozen-lockfile - name: Basic App run: yarn workspace basic-app test:mocha + - name: Custom App + run: yarn workspace custom-fastboot-app test:mocha diff --git a/packages/ember-cli-fastboot/test/custom-html-file-test.js b/packages/ember-cli-fastboot/test/custom-html-file-test.js deleted file mode 100644 index 8f2afa982..000000000 --- a/packages/ember-cli-fastboot/test/custom-html-file-test.js +++ /dev/null @@ -1,44 +0,0 @@ -'use strict'; - -const expect = require('chai').use(require('chai-string')).expect; -const RSVP = require('rsvp'); -const request = RSVP.denodeify(require('request')); - -const AddonTestApp = require('ember-cli-addon-tests').AddonTestApp; - -describe('custom htmlFile', function() { - this.timeout(400000); - - let app; - - before(function() { - app = new AddonTestApp(); - - return app.create('custom-html-file', { emberVersion: 'latest'}) - .then(function() { - return app.startServer({ - command: 'serve' - }); - }); - }); - - after(function() { - return app.stopServer(); - }); - - it('uses custom htmlFile', function() { - return request({ - url: 'http://localhost:49741/', - headers: { - 'Accept': 'text/html' - } - }) - .then(function(response) { - expect(response.statusCode).to.equal(200); - expect(response.headers["content-type"]).to.equalIgnoreCase("text/html; charset=utf-8"); - - expect(response.body).to.contain("custom index"); - expect(response.body).to.contain("

application template

"); - }); - }); -}); diff --git a/packages/ember-cli-fastboot/test/fixtures/custom-html-file/app/app.js b/packages/ember-cli-fastboot/test/fixtures/custom-html-file/app/app.js deleted file mode 100644 index 3770eba5a..000000000 --- a/packages/ember-cli-fastboot/test/fixtures/custom-html-file/app/app.js +++ /dev/null @@ -1,14 +0,0 @@ -import Ember from 'ember'; -import Resolver from 'ember-resolver'; -import loadInitializers from 'ember-load-initializers'; -import config from './config/environment'; - -var App = Ember.Application.extend({ - modulePrefix: config.modulePrefix, - podModulePrefix: config.podModulePrefix, - Resolver: Resolver -}); - -loadInitializers(App, config.modulePrefix); - -export default App; diff --git a/packages/ember-cli-fastboot/test/fixtures/custom-html-file/app/index.html b/packages/ember-cli-fastboot/test/fixtures/custom-html-file/app/index.html deleted file mode 100644 index a1ea63c63..000000000 --- a/packages/ember-cli-fastboot/test/fixtures/custom-html-file/app/index.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - Ignored Index.html - - - - {{content-for 'head'}} - - - - - {{content-for 'head-footer'}} - - - {{content-for 'body'}} - - - - - {{content-for 'body-footer'}} - - diff --git a/packages/ember-cli-fastboot/test/fixtures/custom-html-file/app/router.js b/packages/ember-cli-fastboot/test/fixtures/custom-html-file/app/router.js deleted file mode 100644 index cef554b3d..000000000 --- a/packages/ember-cli-fastboot/test/fixtures/custom-html-file/app/router.js +++ /dev/null @@ -1,11 +0,0 @@ -import Ember from 'ember'; -import config from './config/environment'; - -var Router = Ember.Router.extend({ - location: config.locationType -}); - -Router.map(function() { -}); - -export default Router; diff --git a/packages/ember-cli-fastboot/test/fixtures/custom-html-file/app/templates/application.hbs b/packages/ember-cli-fastboot/test/fixtures/custom-html-file/app/templates/application.hbs deleted file mode 100644 index 5c2ace982..000000000 --- a/packages/ember-cli-fastboot/test/fixtures/custom-html-file/app/templates/application.hbs +++ /dev/null @@ -1,3 +0,0 @@ -

application template

- -{{outlet}} diff --git a/packages/ember-cli-fastboot/test/fixtures/custom-html-file/config/environment.js b/packages/ember-cli-fastboot/test/fixtures/custom-html-file/config/environment.js deleted file mode 100644 index 2d64f85b2..000000000 --- a/packages/ember-cli-fastboot/test/fixtures/custom-html-file/config/environment.js +++ /dev/null @@ -1,16 +0,0 @@ -/* jshint node: true */ - -module.exports = function(environment) { - var ENV = { - modulePrefix: 'custom-html-file', - environment: environment, - baseURL: '/', - locationType: 'auto', - - fastboot: { - htmlFile: 'custom-index.html' - } - }; - - return ENV; -}; diff --git a/packages/ember-cli-fastboot/test/package-json-test.js b/packages/ember-cli-fastboot/test/package-json-test.js index b8322874d..890d8cf3a 100644 --- a/packages/ember-cli-fastboot/test/package-json-test.js +++ b/packages/ember-cli-fastboot/test/package-json-test.js @@ -11,49 +11,6 @@ chai.use(require('chai-fs')); describe('generating package.json', function() { this.timeout(300000); - describe('with customized fingerprinting options', function() { - // Tests an app with a custom `assetMapPath` set - let customApp = new AddonTestApp(); - - before(function() { - return customApp.create('customized-fingerprinting', { emberVersion: 'latest'}) - .then(function() { - return customApp.runEmberCommand('build', '--environment=production'); - }); - }); - - it('respects a custom asset map path and prepended URLs', function() { - expect(customApp.filePath('dist/totally-customized-asset-map.json')).to.be.a.file(); - - function p(filePath) { - return customApp.filePath(path.join('dist', filePath)); - } - - let pkg = fs.readJsonSync(customApp.filePath('/dist/package.json')); - let manifest = pkg.fastboot.manifest; - - manifest.appFiles.forEach(function(file) { - expect(p(file)).to.be.a.file(); - }); - expect(p(manifest.htmlFile)).to.be.a.file(); - manifest.vendorFiles.forEach(function(file) { - expect(p(file)).to.be.a.file(); - }); - }); - - it('respects individual files being excluded from fingerprinting', function() { - expect(customApp.filePath('dist/totally-customized-asset-map.json')).to.be.a.file(); - - let pkg = fs.readJsonSync(customApp.filePath('/dist/package.json')); - let manifest = pkg.fastboot.manifest; - - // customized-fingerprinting-fastboot.js is excluded from fingerprinting - expect(manifest.appFiles).to.include('assets/customized-fingerprinting-fastboot.js'); - // vendor.js is excluded from fingerprinting - expect(manifest.vendorFiles).to.include('assets/vendor.js'); - }); - }); - describe('with customized outputPaths options', function() { // Tests an app with a custom `outputPaths` set let customApp = new AddonTestApp(); @@ -85,30 +42,5 @@ describe('generating package.json', function() { }); }); }); - - describe('with custom htmlFile', function() { - this.timeout(300000); - - let customApp = new AddonTestApp(); - - before(function() { - return customApp.create('custom-html-file') - .then(function() { - return customApp.runEmberCommand('build', '--environment=production'); - }); - }); - - it('uses custom htmlFile in the manifest', function() { - function p(filePath) { - return customApp.filePath(path.join('dist', filePath)); - } - - let pkg = fs.readJsonSync(customApp.filePath('/dist/package.json')); - let manifest = pkg.fastboot.manifest; - - expect(manifest.htmlFile).to.equal('custom-index.html'); - expect(p(manifest.htmlFile)).to.be.a.file(); - }); - }); }); diff --git a/test-packages/custom-fastboot-app/.editorconfig b/test-packages/custom-fastboot-app/.editorconfig new file mode 100644 index 000000000..c35a00240 --- /dev/null +++ b/test-packages/custom-fastboot-app/.editorconfig @@ -0,0 +1,19 @@ +# 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/test-packages/custom-fastboot-app/.ember-cli b/test-packages/custom-fastboot-app/.ember-cli new file mode 100644 index 000000000..ee64cfed2 --- /dev/null +++ b/test-packages/custom-fastboot-app/.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/test-packages/custom-fastboot-app/.eslintignore b/test-packages/custom-fastboot-app/.eslintignore new file mode 100644 index 000000000..72df37307 --- /dev/null +++ b/test-packages/custom-fastboot-app/.eslintignore @@ -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 diff --git a/test-packages/custom-fastboot-app/.eslintrc.js b/test-packages/custom-fastboot-app/.eslintrc.js new file mode 100644 index 000000000..26d707835 --- /dev/null +++ b/test-packages/custom-fastboot-app/.eslintrc.js @@ -0,0 +1,53 @@ +'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: {}, + 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'], + extends: ['plugin:node/recommended'], + rules: { + // this can be removed once the following is fixed + // https://github.com/mysticatea/eslint-plugin-node/issues/77 + 'node/no-unpublished-require': 'off' + } + } + ] +}; diff --git a/test-packages/custom-fastboot-app/.gitignore b/test-packages/custom-fastboot-app/.gitignore new file mode 100644 index 000000000..c40a1b2ab --- /dev/null +++ b/test-packages/custom-fastboot-app/.gitignore @@ -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 diff --git a/test-packages/custom-fastboot-app/.template-lintrc.js b/test-packages/custom-fastboot-app/.template-lintrc.js new file mode 100644 index 000000000..f38737001 --- /dev/null +++ b/test-packages/custom-fastboot-app/.template-lintrc.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = { + extends: 'octane' +}; diff --git a/test-packages/custom-fastboot-app/.travis.yml b/test-packages/custom-fastboot-app/.travis.yml new file mode 100644 index 000000000..0472a953c --- /dev/null +++ b/test-packages/custom-fastboot-app/.travis.yml @@ -0,0 +1,31 @@ +--- +language: node_js +node_js: + - "10" + +dist: xenial + +addons: + chrome: stable + +cache: + yarn: true + +env: + global: + # See https://git.io/vdao3 for details. + - JOBS=1 + +branches: + only: + - master + +before_install: + - curl -o- -L https://yarnpkg.com/install.sh | bash + - export PATH=$HOME/.yarn/bin:$PATH + +install: + - yarn install --non-interactive + +script: + - yarn test diff --git a/test-packages/custom-fastboot-app/.watchmanconfig b/test-packages/custom-fastboot-app/.watchmanconfig new file mode 100644 index 000000000..e7834e3e4 --- /dev/null +++ b/test-packages/custom-fastboot-app/.watchmanconfig @@ -0,0 +1,3 @@ +{ + "ignore_dirs": ["tmp", "dist"] +} diff --git a/test-packages/custom-fastboot-app/README.md b/test-packages/custom-fastboot-app/README.md new file mode 100644 index 000000000..b164b4a8c --- /dev/null +++ b/test-packages/custom-fastboot-app/README.md @@ -0,0 +1,58 @@ +# custom-fastboot-app + +This README outlines the details of collaborating on this Ember application. +A short introduction of this app could easily go here. + +## Prerequisites + +You will need the following things properly installed on your computer. + +* [Git](https://git-scm.com/) +* [Node.js](https://nodejs.org/) +* [Yarn](https://yarnpkg.com/) +* [Ember CLI](https://ember-cli.com/) +* [Google Chrome](https://google.com/chrome/) + +## Installation + +* `git clone ` this repository +* `cd custom-fastboot-app` +* `yarn install` + +## Running / Development + +* `ember serve` +* Visit your app at [http://localhost:4200](http://localhost:4200). +* Visit your tests at [http://localhost:4200/tests](http://localhost:4200/tests). + +### Code Generators + +Make use of the many generators for code, try `ember help generate` for more details + +### Running Tests + +* `ember test` +* `ember test --server` + +### Linting + +* `yarn lint:hbs` +* `yarn lint:js` +* `yarn lint:js --fix` + +### Building + +* `ember build` (development) +* `ember build --environment production` (production) + +### Deploying + +Specify what it takes to deploy your app. + +## Further Reading / Useful Links + +* [ember.js](https://emberjs.com/) +* [ember-cli](https://ember-cli.com/) +* Development Browser Extensions + * [ember inspector for chrome](https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi) + * [ember inspector for firefox](https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/) diff --git a/test-packages/custom-fastboot-app/app/app.js b/test-packages/custom-fastboot-app/app/app.js new file mode 100644 index 000000000..d8e2088b6 --- /dev/null +++ b/test-packages/custom-fastboot-app/app/app.js @@ -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); diff --git a/test-packages/custom-fastboot-app/app/components/.gitkeep b/test-packages/custom-fastboot-app/app/components/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/test-packages/custom-fastboot-app/app/controllers/.gitkeep b/test-packages/custom-fastboot-app/app/controllers/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/test-packages/custom-fastboot-app/app/helpers/.gitkeep b/test-packages/custom-fastboot-app/app/helpers/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/test-packages/custom-fastboot-app/app/index.html b/test-packages/custom-fastboot-app/app/index.html new file mode 100644 index 000000000..c4d741640 --- /dev/null +++ b/test-packages/custom-fastboot-app/app/index.html @@ -0,0 +1,25 @@ + + + + + + CustomFastbootApp + + + + {{content-for "head"}} + + + + + {{content-for "head-footer"}} + + + {{content-for "body"}} + + + + + {{content-for "body-footer"}} + + diff --git a/test-packages/custom-fastboot-app/app/models/.gitkeep b/test-packages/custom-fastboot-app/app/models/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/test-packages/custom-fastboot-app/app/router.js b/test-packages/custom-fastboot-app/app/router.js new file mode 100644 index 000000000..224ca426a --- /dev/null +++ b/test-packages/custom-fastboot-app/app/router.js @@ -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() { +}); diff --git a/test-packages/custom-fastboot-app/app/routes/.gitkeep b/test-packages/custom-fastboot-app/app/routes/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/test-packages/custom-fastboot-app/app/styles/app.css b/test-packages/custom-fastboot-app/app/styles/app.css new file mode 100644 index 000000000..e69de29bb diff --git a/test-packages/custom-fastboot-app/app/templates/application.hbs b/test-packages/custom-fastboot-app/app/templates/application.hbs new file mode 100644 index 000000000..5230580f8 --- /dev/null +++ b/test-packages/custom-fastboot-app/app/templates/application.hbs @@ -0,0 +1,3 @@ +

Welcome to Ember

+ +{{outlet}} \ No newline at end of file diff --git a/test-packages/custom-fastboot-app/config/environment.js b/test-packages/custom-fastboot-app/config/environment.js new file mode 100644 index 000000000..9b4d9f887 --- /dev/null +++ b/test-packages/custom-fastboot-app/config/environment.js @@ -0,0 +1,56 @@ +'use strict'; + +module.exports = function(environment) { + let ENV = { + modulePrefix: 'custom-fastboot-app', + environment, + rootURL: '/', + locationType: 'auto', + + fastboot: { + htmlFile: 'custom-index.html' + }, + + 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; +}; diff --git a/test-packages/custom-fastboot-app/config/optional-features.json b/test-packages/custom-fastboot-app/config/optional-features.json new file mode 100644 index 000000000..b26286e2e --- /dev/null +++ b/test-packages/custom-fastboot-app/config/optional-features.json @@ -0,0 +1,6 @@ +{ + "application-template-wrapper": false, + "default-async-observers": true, + "jquery-integration": false, + "template-only-glimmer-components": true +} diff --git a/test-packages/custom-fastboot-app/config/targets.js b/test-packages/custom-fastboot-app/config/targets.js new file mode 100644 index 000000000..8ffae3636 --- /dev/null +++ b/test-packages/custom-fastboot-app/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/packages/ember-cli-fastboot/test/fixtures/customized-fingerprinting/ember-cli-build.js b/test-packages/custom-fastboot-app/ember-cli-build.js similarity index 52% rename from packages/ember-cli-fastboot/test/fixtures/customized-fingerprinting/ember-cli-build.js rename to test-packages/custom-fastboot-app/ember-cli-build.js index 52f3a4ce0..a7ad9f93b 100644 --- a/packages/ember-cli-fastboot/test/fixtures/customized-fingerprinting/ember-cli-build.js +++ b/test-packages/custom-fastboot-app/ember-cli-build.js @@ -1,12 +1,12 @@ -/*jshint node:true*/ -/* global require, module */ -var EmberApp = require('ember-cli/lib/broccoli/ember-app'); +'use strict'; + +const EmberApp = require('ember-cli/lib/broccoli/ember-app'); module.exports = function(defaults) { - var app = new EmberApp(defaults, { + let app = new EmberApp(defaults, { fingerprint: { prepend: 'https://totally-sick-cdn.example.com/', - exclude: ['vendor.js', 'customized-fingerprinting-fastboot.js'], + exclude: ['vendor.js', 'custom-fastboot-app.js'], generateAssetMap: true, assetMapPath: 'totally-customized-asset-map.json' } diff --git a/test-packages/custom-fastboot-app/package.json b/test-packages/custom-fastboot-app/package.json new file mode 100644 index 000000000..6b13ac988 --- /dev/null +++ b/test-packages/custom-fastboot-app/package.json @@ -0,0 +1,66 @@ +{ + "name": "custom-fastboot-app", + "version": "0.0.0", + "private": true, + "description": "Small description for custom-fastboot-app goes here", + "repository": "", + "license": "MIT", + "author": "", + "directories": { + "doc": "doc", + "test": "tests" + }, + "scripts": { + "build": "ember build", + "build:prod": "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", + "@glimmer/component": "^1.0.0", + "@glimmer/tracking": "^1.0.0", + "babel-eslint": "^10.1.0", + "broccoli-asset-rev": "^3.0.0", + "chai": "^4.2.0", + "chai-fs": "^2.0.0", + "chai-string": "^1.5.0", + "ember-auto-import": "^1.5.3", + "ember-cli": "~3.19.0", + "ember-cli-app-version": "^3.2.0", + "ember-cli-babel": "^7.20.5", + "ember-cli-dependency-checker": "^3.2.0", + "ember-cli-fastboot": "3.0.0-beta.2", + "ember-cli-htmlbars": "^5.1.2", + "ember-cli-inject-live-reload": "^2.0.2", + "ember-cli-sri": "^2.1.1", + "ember-cli-uglify": "^3.0.0", + "ember-data": "~3.19.0", + "ember-export-application-global": "^2.0.1", + "ember-fetch": "^8.0.1", + "ember-load-initializers": "^2.1.1", + "ember-maybe-import-regenerator": "^0.1.6", + "ember-qunit": "^4.6.0", + "ember-resolver": "^8.0.0", + "ember-source": "~3.19.0", + "ember-template-lint": "^2.8.0", + "ember-welcome-page": "^4.0.0", + "eslint": "^7.1.0", + "eslint-plugin-ember": "^8.6.0", + "eslint-plugin-node": "^11.1.0", + "loader.js": "^4.7.0", + "mocha": "^8.0.1", + "npm-run-all": "^4.1.5", + "qunit-dom": "^1.2.0" + }, + "engines": { + "node": "10.* || >= 12" + }, + "ember": { + "edition": "octane" + } +} diff --git a/packages/ember-cli-fastboot/test/fixtures/custom-html-file/public/custom-index.html b/test-packages/custom-fastboot-app/public/custom-index.html similarity index 100% rename from packages/ember-cli-fastboot/test/fixtures/custom-html-file/public/custom-index.html rename to test-packages/custom-fastboot-app/public/custom-index.html diff --git a/test-packages/custom-fastboot-app/public/robots.txt b/test-packages/custom-fastboot-app/public/robots.txt new file mode 100644 index 000000000..f5916452e --- /dev/null +++ b/test-packages/custom-fastboot-app/public/robots.txt @@ -0,0 +1,3 @@ +# http://www.robotstxt.org +User-agent: * +Disallow: diff --git a/test-packages/custom-fastboot-app/test/package-json-test.js b/test-packages/custom-fastboot-app/test/package-json-test.js new file mode 100644 index 000000000..4b0df782c --- /dev/null +++ b/test-packages/custom-fastboot-app/test/package-json-test.js @@ -0,0 +1,62 @@ +"use strict"; + +const chai = require("chai"); +const expect = chai.expect; +const fs = require("fs-extra"); +const execa = require("execa"); + +chai.use(require("chai-fs")); + +describe("generating package.json", function () { + this.timeout(300000); + + describe('with customized fingerprinting options', function() { + + before(async function () { + await execa("yarn", ["build:prod"]); + }); + + it("builds a package.json", async function () { + expect("dist/totally-customized-asset-map.json").to.be.a.file(); + expect("dist/package.json").to.be.a.file(); + }); + + it('respects a custom asset map path and prepended URLs', function() { + expect("dist/totally-customized-asset-map.json").to.be.a.file(); + let pkg = fs.readJSONSync("dist/package.json"); + let manifest = pkg.fastboot.manifest; + + manifest.appFiles.forEach((file) => { + expect(`dist/${file}`).to.be.a.file(); + }); + + expect(`dist/${manifest.htmlFile}`).to.be.a.file(); + + manifest.vendorFiles.forEach((file) => { + expect(`dist/${file}`).to.be.a.file(); + }); + }); + + it('respects individual files being excluded from fingerprinting', function() { + expect("dist/totally-customized-asset-map.json").to.be.a.file(); + + let pkg = fs.readJSONSync("dist/package.json"); + let manifest = pkg.fastboot.manifest; + + // custom-fastboot-app is excluded from fingerprinting + expect(manifest.appFiles).to.include('assets/custom-fastboot-app.js'); + // vendor.js is excluded from fingerprinting + expect(manifest.vendorFiles).to.include('assets/vendor.js'); + }); + + describe('with custom htmlFile', function() { + it('uses custom htmlFile in the manifest', function() { + let pkg = fs.readJSONSync("dist/package.json"); + let manifest = pkg.fastboot.manifest; + + expect(manifest.htmlFile).to.equal('custom-index.html'); + expect(`dist/${manifest.htmlFile}`).to.be.a.file(); + }); + }); + }); +}); diff --git a/test-packages/custom-fastboot-app/testem.js b/test-packages/custom-fastboot-app/testem.js new file mode 100644 index 000000000..49f53feed --- /dev/null +++ b/test-packages/custom-fastboot-app/testem.js @@ -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) + } + } +}; diff --git a/test-packages/custom-fastboot-app/tests/helpers/.gitkeep b/test-packages/custom-fastboot-app/tests/helpers/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/test-packages/custom-fastboot-app/tests/index.html b/test-packages/custom-fastboot-app/tests/index.html new file mode 100644 index 000000000..e7a170814 --- /dev/null +++ b/test-packages/custom-fastboot-app/tests/index.html @@ -0,0 +1,33 @@ + + + + + + CustomFastbootApp 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/test-packages/custom-fastboot-app/tests/integration/.gitkeep b/test-packages/custom-fastboot-app/tests/integration/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/test-packages/custom-fastboot-app/tests/test-helper.js b/test-packages/custom-fastboot-app/tests/test-helper.js new file mode 100644 index 000000000..0382a848d --- /dev/null +++ b/test-packages/custom-fastboot-app/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/test-packages/custom-fastboot-app/tests/unit/.gitkeep b/test-packages/custom-fastboot-app/tests/unit/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/test-packages/custom-fastboot-app/vendor/.gitkeep b/test-packages/custom-fastboot-app/vendor/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/yarn.lock b/yarn.lock index 053da4bd7..9a142c6d3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6495,7 +6495,7 @@ ember-cli-babel@^7.1.0, ember-cli-babel@^7.11.0, ember-cli-babel@^7.12.0, ember- rimraf "^3.0.1" semver "^5.5.0" -ember-cli-babel@^7.19.0: +ember-cli-babel@^7.19.0, ember-cli-babel@^7.4.1: version "7.23.0" resolved "https://registry.yarnpkg.com/ember-cli-babel/-/ember-cli-babel-7.23.0.tgz#ec580aa2c115d0810e454dd5c2fffce238284b92" integrity sha512-ix58DlRDAbGITtdJoRUPcAoQwKLYr/x/kIXjU9u1ATyhmuUjqb+0FDXghOWbkNihGiNOqBBR49+LBgK9AeBcNw== @@ -6595,7 +6595,7 @@ ember-cli-htmlbars-inline-precompile@^2.1.0: heimdalljs-logger "^0.1.9" silent-error "^1.1.0" -ember-cli-htmlbars@^3.0.0: +ember-cli-htmlbars@^3.0.0, ember-cli-htmlbars@^3.0.1: version "3.1.0" resolved "https://registry.yarnpkg.com/ember-cli-htmlbars/-/ember-cli-htmlbars-3.1.0.tgz#87806c2a0bca2ab52d4fb8af8e2215c1ca718a99" integrity sha512-cgvRJM73IT0aePUG7oQ/afB7vSRBV3N0wu9BrWhHX2zkR7A7cUBI7KC9VPk6tbctCXoM7BRGsCC4aIjF7yrfXA== @@ -7332,6 +7332,16 @@ ember-test-waiters@^1.1.1: ember-cli-babel "^7.11.0" semver "^6.3.0" +ember-welcome-page@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/ember-welcome-page/-/ember-welcome-page-4.0.0.tgz#14f5ef8b477f9480c39548d3ebd51f5c4ffb0a14" + integrity sha512-2lpElRFDjFVE0LohJn9j7FWYt5rGHZ7TmiPgknsS+9BYFFmaJnBQKAz9KZXxWRmS/mCjVUuUec1YhojtOJJ/Sg== + dependencies: + broccoli-funnel "^2.0.2" + ember-cli-babel "^7.4.1" + ember-cli-htmlbars "^3.0.1" + ember-compatibility-helpers "^1.1.2" + emoji-regex@^7.0.1: version "7.0.3" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156"