Skip to content

Commit

Permalink
Feat: README files for Debug, Adapter and Serializer (emberjs#8533)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
runspired authored Apr 2, 2023
1 parent e316aec commit 1aee66f
Show file tree
Hide file tree
Showing 31 changed files with 295 additions and 70 deletions.
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (C) 2017-2022 Ember.js contributors
Copyright (C) 2017-2023 Ember.js contributors
Portions Copyright (C) 2011-2017 Tilde, Inc. and contributors.
Portions Copyright (C) 2011 LivingSocial Inc.

Expand Down
2 changes: 1 addition & 1 deletion packages/-ember-data/LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (C) 2017-2022 Ember.js contributors
Copyright (C) 2017-2023 Ember.js contributors
Portions Copyright (C) 2011-2017 Tilde, Inc. and contributors.
Portions Copyright (C) 2011 LivingSocial Inc.

Expand Down
2 changes: 1 addition & 1 deletion packages/adapter/LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (C) 2017-2022 Ember.js contributors
Copyright (C) 2017-2023 Ember.js contributors
Portions Copyright (C) 2011-2017 Tilde, Inc. and contributors.
Portions Copyright (C) 2011 LivingSocial Inc.

Expand Down
98 changes: 82 additions & 16 deletions packages/adapter/README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,97 @@
@ember-data/adapter
==============================================================================
<p align="center">
<img
class="project-logo"
src="./ember-data-logo-dark.svg#gh-dark-mode-only"
alt="EmberData Adapter"
width="240px"
title="EmberData Adapter"
/>
<img
class="project-logo"
src="./ember-data-logo-light.svg#gh-light-mode-only"
alt="EmberData Adapter"
width="240px"
title="EmberData Adapter"
/>
</p>

[Short description of the addon.]
<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>

> **Caution** ⚠️ **This is LEGACY documentation** for a feature that is no longer encouraged to be used.
> 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)
> instead to be used with the [RequestManager](https://github.com/emberjs/data/tree/main/packages/request#readme)
Compatibility
------------------------------------------------------------------------------
## Installation

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

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

Installation
------------------------------------------------------------------------------
```no-highlight
pnpm add @ember-data/adapter
```

## 🚀 Setup

If using `ember-data` no additional setup is necesssary.

> **Note** When using [ember-data](https://github.com/emberjs/data/blob/main/packages/-ember-data) the below
> configuration is handled for you automatically.
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)

```no-highlight
pnpm add @ember-data/legacy-compat
```

```ts
import Store, { CacheHandler } from '@ember-data/store';
import RequestManager from '@ember-data/request';
import { LegacyNetworkHandler } from '@ember-data/legacy-compat';

export default class extends Store {
requestManager = new RequestManager();

constructor(args) {
super(args);
this.requestManager.use([LegacyNetworkHandler]);
this.requestManager.useCache(CacheHandler);
}
}
```
ember install @ember-data/adapter


## Usage

To use as either a per-type or application adapter, export one of the
implementations within the `adapters/` directory of your app as appropriate.

For instance, to configure an application adapter to use `JSON:API`


*app/adapters/application.ts*
```ts
export { default } from '@ember-data/adapter/json-api';
```

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`.

**Overriding Resolution**

Usage
------------------------------------------------------------------------------
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.

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

class extends Store {
#adapter = new Adapter();

adapterFor() {
return this.#adapter;
}
}
```

License
------------------------------------------------------------------------------

This project is licensed under the [MIT License](LICENSE.md).
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 changes: 12 additions & 0 deletions packages/adapter/ember-data-logo-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 1aee66f

Please sign in to comment.