Skip to content

Commit 544490e

Browse files
Remove ember-data and mirage (#1690)
* Remove ember-data and mirage * Remove more ember-data stuff
1 parent 301fe96 commit 544490e

57 files changed

Lines changed: 674 additions & 1129 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CLAUDE.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
ember-cli-addon-docs is an Ember addon that generates documentation sites for other Ember addons. It provides components for building doc sites, a build pipeline that extracts API docs and search indexes, and a deploy pipeline for GitHub Pages.
8+
9+
## Commands
10+
11+
- **Install:** `pnpm install`
12+
- **Dev server:** `pnpm start` (serves dummy app at http://localhost:4200)
13+
- **Build:** `pnpm build`
14+
- **Lint all:** `pnpm lint`
15+
- **Lint fix:** `pnpm lint:fix`
16+
- **Run all tests:** `pnpm test`
17+
- **Ember tests only:** `pnpm test:ember`
18+
- **Ember tests in watch mode:** `pnpm test:ember --server`
19+
- **Node tests only:** `pnpm test:node` (mocha, runs tests in `tests-node/`)
20+
- **Test app tests:** `pnpm test:test-apps` (runs tests in `test-apps/new-addon`)
21+
22+
Uses pnpm as the package manager. The workspace includes `test-apps/*`.
23+
24+
## Architecture
25+
26+
### Build Pipeline (lib/)
27+
28+
The core build logic lives in `index.js` and `lib/`. During Ember's build process:
29+
30+
1. **`index.js`** — Main addon entry point. Hooks into Ember CLI's `treeForApp`, `treeForAddon`, `treeForPublic`, and `treeForVendor`. Compiles markdown templates, extracts API docs via plugin registry, and builds a search index.
31+
32+
2. **`lib/broccoli/`** — Broccoli plugins for the build pipeline:
33+
- `docs-compiler.js` — Compiles extracted API documentation into JSON API format
34+
- `search-indexer.js` — Builds a lunr.js search index from docs and template content
35+
- `docs-filter.js` / `hbs-content-filter.js` — Broccoli filters for processing files
36+
37+
3. **`lib/preprocessors/`** — Template preprocessors:
38+
- `markdown-template-compiler.js` — Compiles `.md` files into Handlebars templates
39+
- `hbs-content-extractor.js` — Extracts content from HBS templates for search indexing
40+
41+
4. **`lib/deploy/`** — ember-cli-deploy plugin for deploying docs to GitHub Pages
42+
43+
5. **`lib/models/plugin-registry.js`** — Registry for doc generation plugins (e.g., `ember-cli-addon-docs-yuidoc`)
44+
45+
### Runtime Addon (addon/)
46+
47+
Ember Octane components and services that consuming addons use in their doc sites:
48+
49+
- **Components:** `docs-viewer`, `docs-header`, `docs-hero`, `docs-demo`, `docs-snippet`, `docs-code-highlight`, `api/` (API doc viewer components), etc.
50+
- **Services:** `docs-routes` (navigation), `docs-search` (lunr-based search), `project-version` (version management)
51+
- **Styles:** Uses Tailwind CSS 1.x compiled via PostCSS/Sass pipeline
52+
53+
### App Re-exports (app/)
54+
55+
Standard Ember addon pattern — re-exports addon modules into the consuming app's namespace.
56+
57+
### Blueprints (blueprints/)
58+
59+
- `ember-cli-addon-docs` — Default blueprint run on `ember install`
60+
- `docs-page` — Generator for new documentation pages
61+
62+
### Sandbox (sandbox/)
63+
64+
A "sandbox" addon used as a secondary documented project in the dummy app, demonstrating multi-project documentation support.
65+
66+
### Tests
67+
68+
- `tests/` — Ember tests (acceptance, integration, unit) using QUnit, run via testem in Chrome
69+
- `tests-node/` — Node.js unit tests using Mocha/Chai for the build pipeline code in `lib/`
70+
- `test-apps/new-addon` — Separate test app in the pnpm workspace
71+
72+
### Key Concepts
73+
74+
- **Plugin system:** API doc extraction is pluggable via addons with keyword `ember-cli-addon-docs-plugin`. The default plugin is `ember-cli-addon-docs-yuidoc`.
75+
- **`documentingAddonAt`:** Config option allowing a standalone app (not a dummy app) to document an addon at a specific path.
76+
- **Version support:** The addon manages doc versions for deployment, with a "latest" version concept (`-latest`).

addon/adapters/-addon-docs.js

Lines changed: 0 additions & 28 deletions
This file was deleted.

addon/adapters/class.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

addon/adapters/component.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

addon/adapters/module.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

addon/adapters/project.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

addon/components/api/x-class/index.js

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import Component from '@glimmer/component';
22
import { tracked } from '@glimmer/tracking';
3-
import { or } from '@ember/object/computed';
43
import { capitalize } from '../../../utils/string';
5-
import { memberFilter } from '../../../utils/computed';
4+
import { filterMembers } from '../../../utils/computed';
65
import { addonDocsConfig } from 'ember-cli-addon-docs/-private/config';
76

87
export default class XClass extends Component {
@@ -13,22 +12,27 @@ export default class XClass extends Component {
1312
@tracked showPrivate = false;
1413
@tracked showDeprecated = false;
1514

16-
@memberFilter('args.class', 'accessors')
17-
accessors;
15+
get accessors() {
16+
return filterMembers(this.args.class, 'accessors', this);
17+
}
1818

19-
@memberFilter('args.class', 'methods')
20-
methods;
19+
get methods() {
20+
return filterMembers(this.args.class, 'methods', this);
21+
}
2122

22-
@memberFilter('args.class', 'fields')
23-
fields;
23+
get fields() {
24+
return filterMembers(this.args.class, 'fields', this);
25+
}
2426

25-
@or(
26-
'component.hasInherited',
27-
'component.hasProtected',
28-
'component.hasPrivate',
29-
'component.hasDeprecated',
30-
)
31-
hasToggles;
27+
get hasToggles() {
28+
let klass = this.args.class;
29+
return !!(
30+
klass.hasInherited ||
31+
klass.hasProtected ||
32+
klass.hasPrivate ||
33+
klass.hasDeprecated
34+
);
35+
}
3236

3337
get hasContents() {
3438
let klass = this.args.class;

addon/components/api/x-component/index.js

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import Component from '@glimmer/component';
22
import { tracked } from '@glimmer/tracking';
33
import { action } from '@ember/object';
4-
import { alias, or } from '@ember/object/computed';
54
import { capitalize } from '../../../utils/string';
6-
import { memberFilter } from '../../../utils/computed';
5+
import { filterMembers } from '../../../utils/computed';
76

87
export default class XComponent extends Component {
98
@tracked showInherited = false;
@@ -12,29 +11,36 @@ export default class XComponent extends Component {
1211
@tracked showPrivate = false;
1312
@tracked showDeprecated = false;
1413

15-
@alias('args.component.overloadedYields')
16-
yields;
14+
get yields() {
15+
return this.args.component.overloadedYields;
16+
}
1717

18-
@memberFilter('args.component', 'arguments')
19-
arguments;
18+
get arguments() {
19+
return filterMembers(this.args.component, 'arguments', this);
20+
}
2021

21-
@memberFilter('args.component', 'accessors')
22-
accessors;
22+
get accessors() {
23+
return filterMembers(this.args.component, 'accessors', this);
24+
}
2325

24-
@memberFilter('args.component', 'methods')
25-
methods;
26+
get methods() {
27+
return filterMembers(this.args.component, 'methods', this);
28+
}
2629

27-
@memberFilter('args.component', 'fields')
28-
fields;
30+
get fields() {
31+
return filterMembers(this.args.component, 'fields', this);
32+
}
2933

30-
@or(
31-
'args.component.hasInherited',
32-
'args.component.hasInternal',
33-
'args.component.hasProtected',
34-
'args.component.hasPrivate',
35-
'args.component.hasDeprecated',
36-
)
37-
hasToggles;
34+
get hasToggles() {
35+
let c = this.args.component;
36+
return !!(
37+
c.hasInherited ||
38+
c.hasInternal ||
39+
c.hasProtected ||
40+
c.hasPrivate ||
41+
c.hasDeprecated
42+
);
43+
}
3844

3945
get hasContents() {
4046
let component = this.args.component;

addon/components/docs-header/search-box/index.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { formElementHasFocus } from 'ember-cli-addon-docs/keyboard-config';
66
import { addonDocsConfig } from 'ember-cli-addon-docs/-private/config';
77

88
export default class DocsHeaderSearchBox extends Component {
9-
@service store;
9+
@service docsStore;
1010

1111
constructor() {
1212
super(...arguments);
@@ -16,13 +16,8 @@ export default class DocsHeaderSearchBox extends Component {
1616

1717
@addonDocsConfig config;
1818

19-
// TODO: The searchbox doesn't work without the project being fetched.
20-
// We should move this logic (and everywhere else in the code that's fetching
21-
// the project) within a new addonDocs service that wires all that up together.
22-
// I think it's fine if our Docs-* components assume there is a single global
23-
// project.
2419
fetchProject = task(async () => {
25-
await this.store.findRecord('project', this.config.projectName);
20+
await this.docsStore.findRecord('project', this.config.projectName);
2621
});
2722

2823
@action

addon/components/docs-header/search-results/index.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { addonDocsConfig } from 'ember-cli-addon-docs/-private/config';
1010
export default class DocsHeaderSearchResults extends Component {
1111
@service docsSearch;
1212
@service router;
13-
@service store;
13+
@service docsStore;
1414

1515
@tracked selectedIndex = null;
1616
@tracked rawSearchResults = [];
@@ -25,7 +25,7 @@ export default class DocsHeaderSearchResults extends Component {
2525
}
2626

2727
get project() {
28-
return this.store.peekRecord('project', this.config.projectName);
28+
return this.docsStore.peekRecord('project', this.config.projectName);
2929
}
3030

3131
get trimmedQuery() {
@@ -91,12 +91,11 @@ export default class DocsHeaderSearchResults extends Component {
9191
}
9292
})
9393

94-
// Add a reference to the Ember Data model to each API item search result
94+
// Add a reference to the model to each API item search result
9595
.map((searchResult) => {
9696
let { document } = searchResult;
9797
if (document.type !== 'template') {
98-
let store = this.store;
99-
searchResult.model = store.peekRecord(
98+
searchResult.model = this.docsStore.peekRecord(
10099
document.type,
101100
document.item.id,
102101
);

0 commit comments

Comments
 (0)