Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make MirageJS peer dependency #2417

Merged
merged 5 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ A client-side server to develop, test and prototype your Ember CLI app.
ember install ember-cli-mirage
```

Has a peer dependency on [MirageJS](https://miragejs.com/) which is added to your projects `package.json` during installation.

## Feature requests

Please open an issue and add a :+1: emoji reaction. We will use the number of reactions as votes to indicate community interest, which will in turn help us prioritize feature development.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ To install Mirage, run
ember install ember-cli-mirage
```

Ember should install the addon and add a `/mirage` directory to the root of your project.
Ember should install the addon and add a `/mirage` directory to the root of your project.
Ember-cli-mirage depends on [MirageJS](https://miragejs.com/) as a peer dependency and will add it to your applications `package.json`.

Check out the {{docs-link 'upgrade guide' 'docs.getting-started.upgrade-guide'}} if you're coming from a previous version of Mirage.

Expand Down
15 changes: 3 additions & 12 deletions packages/ember-cli-mirage/blueprints/ember-cli-mirage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
'use strict';

var path = require('path');
var fs = require('fs');

module.exports = {
normalizeEntityName: function () {
Expand All @@ -30,17 +29,9 @@ module.exports = {
};
},

insertShutdownIntoDestroyApp: function () {
if (fs.existsSync('tests/helpers/destroy-app.js')) {
var shutdownText =
' if (window.server) {\n window.server.shutdown();\n }';
return this.insertIntoFile('tests/helpers/destroy-app.js', shutdownText, {
after: "run(application, 'destroy');\n",
});
}
},

afterInstall: function () {
return this.insertShutdownIntoDestroyApp();
Comment on lines -33 to -44
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was removed as destoy-app.js was removed in 3.0.0

return this.addPackagesToProject([
{ name: 'miragejs' },
]);
},
};
6 changes: 3 additions & 3 deletions packages/ember-cli-mirage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@
"ember-destroyable-polyfill": "^2.0.3",
"ember-get-config": "0.2.4 - 0.5.0 || ^1.0.0",
"ember-inflector": "^2.0.0 || ^3.0.0 || ^4.0.2",
"lodash-es": "^4.17.11",
"miragejs": "^0.1.43"
"lodash-es": "^4.17.11"
},
"devDependencies": {
"@ember/jquery": "^2.0.0",
Expand Down Expand Up @@ -101,7 +100,8 @@
"peerDependencies": {
"@ember/test-helpers": "*",
"ember-data": "*",
"ember-qunit": "*"
"ember-qunit": "*",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these be *?

"miragejs": "~0.1.43"
},
"peerDependenciesMeta": {
"@ember/test-helpers": {
Expand Down
1 change: 1 addition & 0 deletions test-packages/01-basic-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"fastboot": "^3.3.0",
"jsdom": "^19.0.0",
"loader.js": "^4.7.0",
"miragejs": "^0.1.43",
"npm-run-all": "^4.1.5",
"prettier": "^2.5.1",
"qunit": "^2.17.2",
Expand Down
1 change: 1 addition & 0 deletions test-packages/02-app-that-excludes-mirage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-qunit": "^7.2.0",
"loader.js": "^4.7.0",
"miragejs": "^0.1.43",
"npm-run-all": "^4.1.5",
"prettier": "^2.5.1",
"qunit": "^2.17.2",
Expand Down