Skip to content

Commit 33fa701

Browse files
authored
Merge pull request #820 from ember-fastboot/deprecations
Remove deprecated features for ember-cli-fastboot v3 release
2 parents e4d0b7c + c7f843c commit 33fa701

File tree

44 files changed

+832
-86
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+832
-86
lines changed

packages/ember-cli-fastboot/addon/services/fastboot.js

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/* global FastBoot */
2-
import { deprecate } from '@ember/application/deprecations';
32
import { computed, get } from '@ember/object';
4-
import { deprecatingAlias, readOnly } from '@ember/object/computed';
3+
import { readOnly } from '@ember/object/computed';
54
import { assert } from '@ember/debug';
65
import EObject from '@ember/object';
76
import Service from '@ember/service';
@@ -65,8 +64,6 @@ const Shoebox = EObject.extend({
6564
});
6665

6766
const FastBootService = Service.extend({
68-
cookies: deprecatingAlias('request.cookies', { id: 'fastboot.cookies-to-request', until: '0.9.9' }),
69-
headers: deprecatingAlias('request.headers', { id: 'fastboot.headers-to-request', until: '0.9.9' }),
7067
isFastBoot: typeof FastBoot !== 'undefined',
7168

7269
isFastboot: computed(function() {
@@ -83,16 +80,6 @@ const FastBootService = Service.extend({
8380
this.set('shoebox', shoebox);
8481
},
8582

86-
host: computed(function() {
87-
deprecate(
88-
'Usage of fastboot service\'s `host` property is deprecated. Please use `request.host` instead.',
89-
false,
90-
{ id: 'fastboot.host-to-request', until: '0.9.9' }
91-
);
92-
93-
return this._fastbootInfo.request.host();
94-
}),
95-
9683
response: readOnly('_fastbootInfo.response'),
9784
metadata: readOnly('_fastbootInfo.metadata'),
9885

packages/ember-cli-fastboot/lib/broccoli/fastboot-config.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ module.exports = class FastBootConfig extends Plugin {
8989
let ui = this.ui;
9090

9191
eachAddonPackage(this.project, pkg => {
92-
let deps = getFastBootDependencies(pkg, ui);
92+
let deps = getFastBootDependencies(pkg);
9393

9494
if (deps) {
9595
deps.forEach(dep => {
@@ -200,16 +200,14 @@ function eachAddonPackage(project, cb) {
200200
project.addons.map(addon => cb(addon.pkg));
201201
}
202202

203-
function getFastBootDependencies(pkg, ui) {
203+
function getFastBootDependencies(pkg) {
204204
let addon = pkg['ember-addon'];
205205
if (!addon) {
206206
return addon;
207207
}
208208

209-
let deps = addon.fastBootDependencies;
210-
if (deps) {
211-
ui.writeDeprecateLine('ember-addon.fastBootDependencies has been replaced with ember-addon.fastbootDependencies [addon: ' + pkg.name + ']');
212-
return deps;
209+
if (addon.fastBootDependencies) {
210+
throw new SilentError('ember-addon.fastBootDependencies has been replaced with ember-addon.fastbootDependencies [addon: ' + pkg.name + ']')
213211
}
214212

215213
return addon.fastbootDependencies;

packages/ember-cli-fastboot/lib/build-utilities/migrate-initializers.js

Lines changed: 7 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
const path = require('path');
44
const fs = require('fs-extra');
5+
const SilentError = require('silent-error');
56
const existsSync = fs.existsSync;
67

7-
const fastbootInitializerTypes = [ 'initializers', 'instance-initializers'];
8-
const FASTBOOT_DIR = 'fastboot';
8+
const fastbootInitializerTypes = ['initializers', 'instance-initializers'];
99

1010
/**
1111
* Helper function to check if there are any `(instance-)?intializers/[browser|fastboot]/` path under the
@@ -36,7 +36,7 @@ function _checkBrowserInitializers(rootPath) {
3636
if (isBrowserInitializersPresent) {
3737
const errorMsg = `FastBoot build no longer supports ${rootPath}/app/(instance-)?initializers/browser structure. ` +
3838
`Please refer to http://ember-fastboot.com/docs/addon-author-guide#browser-only-or-node-only-initializers for a migration path.`;
39-
throw new Error(errorMsg);
39+
throw new SilentError(errorMsg);
4040
}
4141
}
4242

@@ -45,41 +45,11 @@ function _checkBrowserInitializers(rootPath) {
4545
* @param {Object} project
4646
* @param {String} rootPath
4747
*/
48-
function _moveFastBootInitializers(project, rootPath) {
49-
48+
function _checkFastBootInitializers(project, rootPath) {
5049
// check to see if it is a fastboot complaint addon
5150
const isFastbootAddon = _checkInitializerTypeExists(rootPath, 'fastboot');
5251
if (isFastbootAddon) {
53-
project.ui.writeDeprecateLine(`Having fastboot specific code in app directory of ${rootPath} is deprecated. Please move it to fastboot/app directory.`);
54-
55-
const fastbootDirPath = path.join(rootPath, FASTBOOT_DIR);
56-
// check if fastboot/app exists
57-
if (!existsSync(fastbootDirPath)) {
58-
fs.mkdirsSync(fastbootDirPath);
59-
}
60-
61-
// copy over app/initializers/fastboot and app/instance/initializers/fastboot
62-
fastbootInitializerTypes.forEach((fastbootInitializerType) => {
63-
const srcFastbootPath = path.join(rootPath, 'app', fastbootInitializerType, 'fastboot');
64-
65-
if (existsSync(srcFastbootPath)) {
66-
const destFastbootPath = path.join(fastbootDirPath, fastbootInitializerType);
67-
if (!existsSync(destFastbootPath)) {
68-
fs.mkdirSync(destFastbootPath);
69-
}
70-
71-
// fastboot initializer type exists so we need to move this fastboot/app
72-
const fastbootFiles = fs.readdirSync(srcFastbootPath);
73-
fastbootFiles.forEach((fastbootFile) => {
74-
const srcPath = path.join(srcFastbootPath, fastbootFile);
75-
const destPath = path.join(destFastbootPath, fastbootFile);
76-
fs.copySync(srcPath, destPath);
77-
78-
// delete the original path files so that there are no two initializers with the same name
79-
fs.unlinkSync(srcPath);
80-
});
81-
}
82-
});
52+
throw new SilentError(`Having fastboot specific code in app directory of ${rootPath} is deprecated. Please move it to fastboot/app directory.`);
8353
}
8454
}
8555

@@ -93,7 +63,7 @@ function _migrateAddonInitializers(project) {
9363
const currentAddonPath = addon.root;
9464

9565
_checkBrowserInitializers(currentAddonPath);
96-
_moveFastBootInitializers(project, currentAddonPath);
66+
_checkFastBootInitializers(project, currentAddonPath);
9767
});
9868
}
9969

@@ -106,7 +76,7 @@ function _migrateHostAppInitializers(project) {
10676
const hostAppPath = path.join(project.root);
10777

10878
_checkBrowserInitializers(hostAppPath);
109-
_moveFastBootInitializers(project, hostAppPath);
79+
_checkFastBootInitializers(project, hostAppPath);
11080
}
11181

11282
/**

test-packages/basic-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
"test:mocha": "mocha"
2323
},
2424
"dependencies": {
25-
"ember-fastboot-build-example": "0.1.2",
2625
"rsvp": "^4.8.5"
2726
},
2827
"devDependencies": {
@@ -58,6 +57,7 @@
5857
"eslint-plugin-ember": "^8.6.0",
5958
"eslint-plugin-node": "^11.1.0",
6059
"execa": "^4.0.3",
60+
"example-addon": "*",
6161
"fake-addon": "*",
6262
"fake-addon-2": "*",
6363
"loader.js": "^4.7.0",

test-packages/basic-app/test/package-json-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ describe("generating package.json", function () {
6161
appFiles: [
6262
"assets/basic-app.js",
6363
"assets/basic-app-fastboot.js",
64-
"ember-fastboot-build-example/bar.js",
64+
"example-addon/bar.js",
6565
],
6666
htmlFile: "index.html",
6767
vendorFiles: [
68-
"ember-fastboot-build-example/foo.js",
68+
"example-addon/foo.js",
6969
"assets/vendor.js",
7070
"assets/auto-import-fastboot.js",
7171
"ember-fetch/fetch-fastboot.js",
@@ -127,7 +127,7 @@ describe("generating package.json", function () {
127127
});
128128
});
129129

130-
it("contains additional config from ember-fastboot-build-example addon", function () {
130+
it("contains additional config from example-addon", function () {
131131
let pkg = fs.readJSONSync("dist/package.json");
132132

133133
expect(pkg.fastboot.config["foo"]).to.equal("bar");
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
/**
3+
Ember CLI sends analytics information by default. The data is completely
4+
anonymous, but there are times when you might want to disable this behavior.
5+
6+
Setting `disableAnalytics` to true will prevent any data from being sent.
7+
*/
8+
"disableAnalytics": false
9+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# unconventional js
2+
/blueprints/*/files/
3+
/vendor/
4+
5+
# compiled output
6+
/dist/
7+
/tmp/
8+
9+
# dependencies
10+
/bower_components/
11+
/node_modules/
12+
13+
# misc
14+
/coverage/
15+
!.*
16+
17+
# ember-try
18+
/.node_modules.ember-try/
19+
/bower.json.ember-try
20+
/package.json.ember-try
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
'use strict';
2+
3+
module.exports = {
4+
root: true,
5+
parser: 'babel-eslint',
6+
parserOptions: {
7+
ecmaVersion: 2018,
8+
sourceType: 'module',
9+
ecmaFeatures: {
10+
legacyDecorators: true
11+
}
12+
},
13+
plugins: [
14+
'ember'
15+
],
16+
extends: [
17+
'eslint:recommended',
18+
'plugin:ember/recommended'
19+
],
20+
env: {
21+
browser: true
22+
},
23+
rules: {},
24+
overrides: [
25+
// node files
26+
{
27+
files: [
28+
'.eslintrc.js',
29+
'.template-lintrc.js',
30+
'ember-cli-build.js',
31+
'index.js',
32+
'testem.js',
33+
'blueprints/*/index.js',
34+
'config/**/*.js',
35+
'tests/dummy/config/**/*.js'
36+
],
37+
excludedFiles: [
38+
'addon/**',
39+
'addon-test-support/**',
40+
'app/**',
41+
'tests/dummy/app/**'
42+
],
43+
parserOptions: {
44+
sourceType: 'script'
45+
},
46+
env: {
47+
browser: false,
48+
node: true
49+
},
50+
plugins: ['node'],
51+
extends: ['plugin:node/recommended']
52+
}
53+
]
54+
};
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# See https://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# compiled output
4+
/dist/
5+
/tmp/
6+
7+
# dependencies
8+
/bower_components/
9+
/node_modules/
10+
11+
# misc
12+
/.env*
13+
/.pnp*
14+
/.sass-cache
15+
/connect.lock
16+
/coverage/
17+
/libpeerconnection.log
18+
/npm-debug.log*
19+
/testem.log
20+
/yarn-error.log
21+
22+
# ember-try
23+
/.node_modules.ember-try/
24+
/bower.json.ember-try
25+
/package.json.ember-try
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# compiled output
2+
/dist/
3+
/tmp/
4+
5+
# dependencies
6+
/bower_components/
7+
8+
# misc
9+
/.bowerrc
10+
/.editorconfig
11+
/.ember-cli
12+
/.env*
13+
/.eslintignore
14+
/.eslintrc.js
15+
/.git/
16+
/.gitignore
17+
/.template-lintrc.js
18+
/.travis.yml
19+
/.watchmanconfig
20+
/bower.json
21+
/config/ember-try.js
22+
/CONTRIBUTING.md
23+
/ember-cli-build.js
24+
/testem.js
25+
/tests/
26+
/yarn.lock
27+
.gitkeep
28+
29+
# ember-try
30+
/.node_modules.ember-try/
31+
/bower.json.ember-try
32+
/package.json.ember-try

0 commit comments

Comments
 (0)