Skip to content

Commit

Permalink
feat(store blueprint): add a blueprint for customizing the store pass…
Browse files Browse the repository at this point in the history
…ed to emeis engine
  • Loading branch information
velrest committed Jun 29, 2020
1 parent aa9d9c3 commit 2b434d6
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ Then add the following lines to your `app/styles/app.scss`:
@import "ember-emeis";
```

## Configuration
If you need to customize your store service passed to emeis, use:
`ember g emeis-store <your_name>`

This will generate a store service and an adapter for you. In those two files
you can then configure custom api endpoints or hosts and/or custom
authentication.

## Contributing

See the [Contributing](CONTRIBUTING.md) guide for details.
Expand Down
7 changes: 7 additions & 0 deletions blueprints/emeis-store/files/__root__/adapters/__name__.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import JSONAPIAdapter from "@ember-data/adapter/json-api";

export default class <%= classifiedModuleName %>Adapter extends JSONAPIAdapter {
// Configure this to your needs.
namespace = "/api/v1";
host = "https://api.example.com";
}
5 changes: 5 additions & 0 deletions blueprints/emeis-store/files/__root__/services/__name__.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Store from "@ember-data/store";

export default class <%= classifiedModuleName %>Store extends Store {
adapter = "<%= dasherizedModuleName %>";
}
12 changes: 12 additions & 0 deletions blueprints/emeis-store/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"use strict";

module.exports = {
description:
"Generate a seperate emeis store for backend / auth customization.",

afterInstall(options) {
this.ui.writeLine(
`\nFinished! To make your service avaliable in the engine add the following to your engine definitions dependencies in app.js: \`{"store": "${options.entity.name}"}\``
);
},
};

0 comments on commit 2b434d6

Please sign in to comment.