Skip to content

Commit ea2ee40

Browse files
authored
upgrade with Ember CLI 5.12 blueprints (#1095)
* upgrade with Ember CLI 5.12 blueprints * cannot depend on app's dependencies in Mirage configuration anymore * ember-fetch cannot resolve RSVP anymore
1 parent ab98772 commit ea2ee40

10 files changed

+39
-860
lines changed

.ember-cli

-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
11
{
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-
102
/**
113
Setting `isTypeScriptProject` to true will force the blueprint generators to generate TypeScript
124
rather than JavaScript by default, when a TypeScript version of a given blueprint is available.

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/blueprints/*/files/
33

44
# compiled output
5+
/declarations/
56
/dist/
67

78
# misc

config/deprecation-workflow.js

-14
This file was deleted.

config/ember-cli-update.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"packages": [
44
{
55
"name": "ember-cli",
6-
"version": "5.3.0",
6+
"version": "5.12.0",
77
"blueprints": [
88
{
99
"name": "app",

config/optional-features.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"application-template-wrapper": false,
33
"default-async-observers": true,
44
"jquery-integration": false,
5-
"template-only-glimmer-components": true
5+
"template-only-glimmer-components": true,
6+
"no-implicit-route-model": true
67
}

ember-cli-build.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ module.exports = function (defaults) {
1717
'ember-cli-babel': {
1818
enableTypeScriptTransform: true,
1919
},
20+
'ember-fetch': {
21+
nativePromise: true,
22+
},
2023
autoprefixer: {
2124
browsers: ['last 2 ios version'],
2225
cascade: false,
@@ -38,10 +41,7 @@ module.exports = function (defaults) {
3841
staticHelpers: true,
3942
staticModifiers: true,
4043
staticComponents: true,
41-
// `ember-cli-deprecation-workflow` does not support `staticEmberSource = true`
42-
// yet. See https://github.com/mixonic/ember-cli-deprecation-workflow/issues/156
43-
// for details.
44-
staticEmberSource: false,
44+
staticEmberSource: true,
4545
skipBabel: [
4646
{
4747
package: 'qunit',

mirage/serializers/application.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { RestSerializer } from 'miragejs';
2-
import { dasherize } from '@ember/string';
2+
import { dasherize } from '../utils/ember-string';
33
import { pluralize } from 'ember-inflector';
44

55
export default RestSerializer.extend({

mirage/utils/ember-string.js

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// The following implementation is taken from @ember/string:
2+
// https://github.com/emberjs/ember-string/blob/16fffa2a565f21c177f9cfa41751ba60b9634863/src/index.ts#L26-L30
3+
// https://github.com/emberjs/ember-string/blob/16fffa2a565f21c177f9cfa41751ba60b9634863/src/index.ts#L91-L95
4+
//
5+
// @ember/string is licensed under MIT:
6+
// https://github.com/emberjs/ember-string/blob/16fffa2a565f21c177f9cfa41751ba60b9634863/LICENSE.md
7+
//
8+
// Code needed to be copied as we couldn't rely on the package directly.
9+
// ember-cli-mirage pulls the application's serializers (and other
10+
// configuration) in the build as if it would be its own code. This triggered
11+
// an error in Webpack's build as ember-cli-mirage is not depending on
12+
// `@ember/string`:
13+
//
14+
// > Module not found: Error: ember-cli-mirage is trying to import the app's
15+
// > @ember/string package, but it seems to be missing
16+
17+
const STRING_DECAMELIZE_REGEXP = /([a-z\d])([A-Z])/g;
18+
const STRING_DASHERIZE_REGEXP = /[ _]/g;
19+
20+
function decamelize(str) {
21+
return str.replace(STRING_DECAMELIZE_REGEXP, '$1_$2').toLowerCase();
22+
}
23+
24+
function dasherize(str) {
25+
return decamelize(str).replace(STRING_DASHERIZE_REGEXP, '-');
26+
}
27+
28+
export { dasherize };

0 commit comments

Comments
 (0)