Skip to content

Commit 1aee66f

Browse files
authored
Feat: README files for Debug, Adapter and Serializer (emberjs#8533)
* chore: update licence year * feat: ReadMe for the Adapter Package * feat: readme for the serializer package * fix: ensure readme and license assets are published * nicer description * add readme for debug package * better description
1 parent e316aec commit 1aee66f

31 files changed

+295
-70
lines changed

LICENSE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (C) 2017-2022 Ember.js contributors
3+
Copyright (C) 2017-2023 Ember.js contributors
44
Portions Copyright (C) 2011-2017 Tilde, Inc. and contributors.
55
Portions Copyright (C) 2011 LivingSocial Inc.
66

packages/-ember-data/LICENSE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (C) 2017-2022 Ember.js contributors
3+
Copyright (C) 2017-2023 Ember.js contributors
44
Portions Copyright (C) 2011-2017 Tilde, Inc. and contributors.
55
Portions Copyright (C) 2011 LivingSocial Inc.
66

packages/adapter/LICENSE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (C) 2017-2022 Ember.js contributors
3+
Copyright (C) 2017-2023 Ember.js contributors
44
Portions Copyright (C) 2011-2017 Tilde, Inc. and contributors.
55
Portions Copyright (C) 2011 LivingSocial Inc.
66

packages/adapter/README.md

+82-16
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,97 @@
1-
@ember-data/adapter
2-
==============================================================================
1+
<p align="center">
2+
<img
3+
class="project-logo"
4+
src="./ember-data-logo-dark.svg#gh-dark-mode-only"
5+
alt="EmberData Adapter"
6+
width="240px"
7+
title="EmberData Adapter"
8+
/>
9+
<img
10+
class="project-logo"
11+
src="./ember-data-logo-light.svg#gh-light-mode-only"
12+
alt="EmberData Adapter"
13+
width="240px"
14+
title="EmberData Adapter"
15+
/>
16+
</p>
317

4-
[Short description of the addon.]
18+
<p align="center">Provides REST and JSON:API Implementations of the legacy <a href="https://api.emberjs.com/ember-data/release/classes/%3CInterface%3E%20Adapter">Adapter Interface</a></p>
519

20+
> **Caution** ⚠️ **This is LEGACY documentation** for a feature that is no longer encouraged to be used.
21+
> If starting a new app or thinking of implementing a new adapter, consider writing a [Handler](https://api.emberjs.com/ember-data/release/classes/%3CInterface%3E%20Handler)
22+
> instead to be used with the [RequestManager](https://github.com/emberjs/data/tree/main/packages/request#readme)
623
7-
Compatibility
8-
------------------------------------------------------------------------------
24+
## Installation
925

10-
* Ember.js v3.4 or above
11-
* Ember CLI v2.13 or above
26+
This package is currently installed when installing `ember-data`.
1227

28+
If installing `@ember-data/` packages individually install using your javascript package manager of choice. For instance with [pnpm](https://pnpm.io/)
1329

14-
Installation
15-
------------------------------------------------------------------------------
30+
```no-highlight
31+
pnpm add @ember-data/adapter
32+
```
33+
34+
## 🚀 Setup
35+
36+
If using `ember-data` no additional setup is necesssary.
37+
38+
> **Note** When using [ember-data](https://github.com/emberjs/data/blob/main/packages/-ember-data) the below
39+
> configuration is handled for you automatically.
40+
41+
To use legacy adapters you will need to have installed and configured the LegacyNetworkHandler from [@ember-data/legacy-compat](https://github.com/emberjs/data/blob/main/packages/-ember-data)
42+
43+
```no-highlight
44+
pnpm add @ember-data/legacy-compat
45+
```
46+
47+
```ts
48+
import Store, { CacheHandler } from '@ember-data/store';
49+
import RequestManager from '@ember-data/request';
50+
import { LegacyNetworkHandler } from '@ember-data/legacy-compat';
51+
52+
export default class extends Store {
53+
requestManager = new RequestManager();
1654

55+
constructor(args) {
56+
super(args);
57+
this.requestManager.use([LegacyNetworkHandler]);
58+
this.requestManager.useCache(CacheHandler);
59+
}
60+
}
1761
```
18-
ember install @ember-data/adapter
62+
63+
64+
## Usage
65+
66+
To use as either a per-type or application adapter, export one of the
67+
implementations within the `adapters/` directory of your app as appropriate.
68+
69+
For instance, to configure an application adapter to use `JSON:API`
70+
71+
72+
*app/adapters/application.ts*
73+
```ts
74+
export { default } from '@ember-data/adapter/json-api';
1975
```
2076

77+
By default adapters are resolved by looking for an adapter with the same name in the adapters folder as the `type` given to `store.adapterFor(<type>)`, falling back to looking for an adapter named `application`.
78+
79+
**Overriding Resolution**
2180

22-
Usage
23-
------------------------------------------------------------------------------
81+
If you would like to avoid using resolver semantics and your application has only one or a few adapters, you may ovveride the `adapterFor` hook on the store.
2482

25-
[Longer description of how to use the addon in apps.]
83+
```ts
84+
import Store from '@ember-data/store';
85+
import Adapter from '@ember-data/adapter/json-api';
2686

87+
class extends Store {
88+
#adapter = new Adapter();
89+
90+
adapterFor() {
91+
return this.#adapter;
92+
}
93+
}
94+
```
2795

28-
License
29-
------------------------------------------------------------------------------
3096

31-
This project is licensed under the [MIT License](LICENSE.md).
97+
For the full list of APIs available read the code documentation for [@ember-data/adapter](https://api.emberjs.com/ember-data/release/modules/@ember-data%2Fadapter). You may also be interested in learning more about *Ember***Data**'s [Adapter Interface](https://api.emberjs.com/ember-data/release/classes/%3CInterface%3E%20Adapter).
+12
Loading

0 commit comments

Comments
 (0)