-
-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
386 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,5 @@ | |
/.node_modules.ember-try/ | ||
/bower.json.ember-try | ||
/package.json.ember-try | ||
|
||
test/fixtures |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
'use strict'; | ||
const chai = require('chai'); | ||
const expect = chai.expect; | ||
chai.use(require('chai-fs')); | ||
|
||
const glob = require('glob'); | ||
|
||
const AddonTestApp = require('ember-cli-addon-tests').AddonTestApp; | ||
|
||
describe('it builds with ember-cli-fastboot', function() { | ||
this.timeout(300000); | ||
|
||
let app; | ||
|
||
before(function() { | ||
app = new AddonTestApp(); | ||
|
||
return app | ||
.create('dummy', { skipNpm: true }) | ||
.then(app => | ||
app.editPackageJSON(pkg => { | ||
pkg.devDependencies['ember-cli-fastboot'] = '*'; | ||
}) | ||
) | ||
.then(() => app.run('npm', 'install')); | ||
}); | ||
|
||
it('builds into dist/ember-fetch/fetch-fastboot.js', function() { | ||
return app.runEmberCommand('build').then(function() { | ||
expect(app.filePath('dist/index.html')).to.be.a.file(); | ||
expect(app.filePath('dist/ember-fetch/fastboot-fetch.js')).to.be.a.file(); | ||
expect(app.filePath('dist/assets/dummy-fastboot.js')).to.be.a.file(); | ||
}); | ||
}); | ||
|
||
it('produces a production build with --environment=production', function() { | ||
return app | ||
.runEmberCommand('build', '--environment=production') | ||
.then(function() { | ||
expect(app.filePath('dist/index.html')).to.be.a.file(); | ||
expect(find('dist/ember-fetch/fastboot-fetch-*.js')).to.be.a.file(); | ||
expect(find('dist/ember-fetch/fastboot-fetch-*.js')).to.match( | ||
/fastboot-fetch-\w{32}/, | ||
'file name should contain MD5 fingerprint' | ||
); | ||
|
||
expect(find('dist/assets/dummy-fastboot-*.js')).to.be.a.file(); | ||
expect(find('dist/assets/dummy-fastboot-*.js')).to.match( | ||
/dummy-fastboot-\w{32}/, | ||
'file name should contain MD5 fingerprint' | ||
); | ||
}); | ||
}); | ||
|
||
function find(globPath) { | ||
globPath = app.filePath(globPath); | ||
let files = glob.sync(globPath); | ||
|
||
expect(files.length).to.equal(1, globPath); | ||
|
||
return files[0]; | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
'use strict'; | ||
const request = require('request'); | ||
const get = require('rsvp').denodeify(request); | ||
const chai = require('chai'); | ||
const expect = chai.expect; | ||
chai.use(require('chai-fs')); | ||
|
||
const AddonTestApp = require('ember-cli-addon-tests').AddonTestApp; | ||
|
||
describe('renders in fastboot build', function() { | ||
this.timeout(300000); | ||
|
||
let app; | ||
|
||
before(function() { | ||
app = new AddonTestApp(); | ||
|
||
return app | ||
.create('dummy', { skipNpm: true }) | ||
.then(app => | ||
app.editPackageJSON(pkg => { | ||
pkg.devDependencies['ember-cli-fastboot'] = '*'; | ||
// These 2 are in ember-fetch's package.json, symlinking to dummy won't help resolve | ||
pkg.devDependencies['abortcontroller-polyfill'] = '*'; | ||
pkg.devDependencies['node-fetch'] = '*'; | ||
}) | ||
) | ||
.then(function() { | ||
return app.run('npm', 'install'); | ||
}) | ||
.then(function() { | ||
return app.startServer({ | ||
command: 'serve' | ||
}); | ||
}); | ||
}); | ||
|
||
after(function() { | ||
return app.stopServer(); | ||
}); | ||
|
||
it('fetches in fastboot mode', function() { | ||
return get({ | ||
url: 'http://localhost:49741/', | ||
headers: { | ||
Accept: 'text/html' | ||
} | ||
}).then(function(response) { | ||
expect(response.body).to.contain('Hello World! fetch'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>Dummy</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/dummy.css"> | ||
|
||
{{content-for "head-footer"}} | ||
</head> | ||
<body> | ||
{{content-for "body"}} | ||
|
||
<script src="{{rootURL}}assets/vendor.js"></script> | ||
<script src="{{rootURL}}assets/dummy.js"></script> | ||
|
||
{{content-for "body-footer"}} | ||
</body> | ||
</html> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import Resolver from 'ember-resolver'; | ||
|
||
export default Resolver; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import Route from '@ember/routing/route'; | ||
import { hash } from 'rsvp'; | ||
import fetch from 'fetch'; | ||
import ajax from 'ember-fetch/ajax'; | ||
|
||
export default Route.extend({ | ||
model: function() { | ||
return hash({ | ||
fetch: fetch('/omg.json').then(function(request) { | ||
return request.json(); | ||
}), | ||
ajax: ajax('/omg.json') | ||
}); | ||
} | ||
}); |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<h2 id="title">Welcome to Ember</h2> | ||
|
||
{{outlet}} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<div class="fetch"> | ||
Hello {{model.fetch.name}}! fetch | ||
</div> | ||
|
||
<div class="ajax"> | ||
Hello {{model.ajax.name}}! ajax | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
'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 | ||
}, | ||
|
||
fastboot: { | ||
hostWhitelist: [/^localhost:\d+$/] | ||
} | ||
}; | ||
|
||
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; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
'use strict'; | ||
|
||
const EmberApp = require('ember-cli/lib/broccoli/ember-app'); | ||
|
||
module.exports = function(defaults) { | ||
let app = new EmberApp(defaults, { | ||
// Add options here | ||
'ember-fetch': { | ||
} | ||
}); | ||
return app.toTree(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"name": "World" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# http://www.robotstxt.org | ||
User-agent: * | ||
Disallow: |
Oops, something went wrong.