Skip to content

Commit

Permalink
Merge pull request #2417 from bgantzler/miragejs-as-peer
Browse files Browse the repository at this point in the history
Make MirageJS peer dependency
  • Loading branch information
SergeAstapov committed Sep 13, 2023
2 parents 31ecb89 + 585d959 commit 4936f1a
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 19 deletions.
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
13 changes: 1 addition & 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,7 @@ 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();
return this.addPackagesToProject([{ name: 'miragejs' }]);
},
};
7 changes: 4 additions & 3 deletions packages/ember-cli-mirage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@
"ember-auto-import": "^2.6.1",
"ember-cli-babel": "^7.26.11",
"ember-get-config": "0.2.4 - 0.5.0 || ^1.0.0 || ^2.1.1",
"ember-inflector": "^2.0.0 || ^3.0.0 || ^4.0.2",
"miragejs": "^0.1.47"
"ember-inflector": "^2.0.0 || ^3.0.0 || ^4.0.2"
},
"devDependencies": {
"@babel/core": "^7.22.10",
Expand Down Expand Up @@ -91,6 +90,7 @@
"fastboot": "^3.3.0",
"js-yaml": "^4.0.0",
"loader.js": "^4.7.0",
"miragejs": "^0.1.47",
"prettier": "^2.8.7",
"qunit": "^2.19.4",
"qunit-dom": "^2.0.0",
Expand All @@ -101,7 +101,8 @@
"@ember/test-helpers": "*",
"ember-data": "*",
"ember-qunit": "*",
"ember-source": "^3.28.0 || ^4.0.0 || ^5.0.0"
"ember-source": "^3.28.0 || ^4.0.0 || ^5.0.0",
"miragejs": "^0.1.43"
},
"peerDependenciesMeta": {
"@ember/test-helpers": {
Expand Down
41 changes: 38 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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 @@ -64,6 +64,7 @@
"fastboot": "^3.3.0",
"jsdom": "^19.0.0",
"loader.js": "^4.7.0",
"miragejs": "^0.1.47",
"prettier": "^2.8.4",
"qunit": "^2.19.4",
"qunit-dom": "^2.0.0",
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 @@ -59,6 +59,7 @@
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-qunit": "^7.3.4",
"loader.js": "^4.7.0",
"miragejs": "^0.1.47",
"prettier": "^2.8.4",
"qunit": "^2.19.4",
"qunit-dom": "^2.0.0",
Expand Down

0 comments on commit 4936f1a

Please sign in to comment.