@docfy/ember 0.4.1 → 0.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,9 +4,9 @@ Ember integration with Docfy.
4
4
 
5
5
  ## Compatibility
6
6
 
7
- * Ember.js v3.16 or above
8
- * Ember CLI v2.13 or above
9
- * Node.js v10 or above
7
+ - Ember.js v3.16 or above
8
+ - Ember CLI v2.13 or above
9
+ - Node.js v10 or above
10
10
 
11
11
  ## Installation
12
12
 
@@ -20,10 +20,25 @@ export default class DocfyService extends Service {
20
20
  return this.findByUrl(this.router.currentURL);
21
21
  }
22
22
 
23
- findNestedChildrenByName(name: string): NestedPageMetadata | undefined {
24
- return this.nested.children.find((item) => {
23
+ findNestedChildrenByName(
24
+ scope: string,
25
+ previousNested: NestedPageMetadata | undefined | null = null
26
+ ): NestedPageMetadata | undefined {
27
+ if (previousNested === null) {
28
+ previousNested = this.nested;
29
+ }
30
+ const parts = scope.split('/');
31
+ const name = parts.shift();
32
+
33
+ const foundScope = previousNested?.children.find((item) => {
25
34
  return item.name === name;
26
35
  });
36
+
37
+ if (parts.length > 0) {
38
+ return this.findNestedChildrenByName(parts.join('/'), foundScope);
39
+ }
40
+
41
+ return foundScope;
27
42
  }
28
43
 
29
44
  findByUrl(url: string, scopeByNestedName?: string): PageMetadata | undefined {
@@ -6,7 +6,6 @@ title: <DocfyDemo>
6
6
 
7
7
  # {{"<DocfyDemo>"}}
8
8
 
9
-
10
9
  This component is used internally to render demos. It's not meant to be used directly,
11
10
  although that's possible. The scope of what you want to understand is the CSS
12
11
  classes such that you can style the parts of the demo component yourself.
@@ -16,7 +15,6 @@ Make sure to look at [writing demos](../writing-demos.md), so you can understand
16
15
  Below is an example of how styling could look like. It uses
17
16
  [TailwindCSS](https://tailwindcss.com/) and [PostCSS Nested](https://github.com/postcss/postcss-nested).
18
17
 
19
-
20
18
  ```css
21
19
  .docfy-demo__example {
22
20
  @apply p-4 border rounded-t;
@@ -19,14 +19,13 @@ Ember doesn't have support for anchors.
19
19
  > markdown files. It gives a pleasant User Experience because it can use the
20
20
  > Ember Routing to make the page transition, removing the need for a full-page reload.
21
21
 
22
-
23
22
  Below you can see a simple example of this component; however, you can see more
24
23
  of its usage throughout the documentation.
25
24
 
26
25
  # API
27
26
 
28
27
  | Argument | Description | Type | Default Value |
29
- |----------------|-------------------------------------------------|-------------------------|---------------|
28
+ | -------------- | ----------------------------------------------- | ----------------------- | ------------- |
30
29
  | `@to` | The URL to link | `string` | |
31
30
  | `@anchor` | An anchor | `string` \| `undefined` | |
32
31
  | `@activeClass` | The classes to be added when the link is active | `string` \| `undefined` | |
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  order: 3
3
3
  ---
4
+
4
5
  # Edit this page
5
6
 
6
7
  This is another example using `@fromCurrentURL`, but here we build a "edit this
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  order: 2
3
3
  ---
4
+
4
5
  # On this page
5
6
 
6
7
  In this example, we are using the option `@fromCurrentURL`. It tells the component
@@ -11,7 +12,6 @@ can render their child for subheadings and their sub-subheadings. The depth of
11
12
  headings available here is default to 6 but can be changed using the configuration
12
13
  option `tocMaxDepth`.
13
14
 
14
-
15
15
  ```hbs template
16
16
  <DocfyOutput @fromCurrentURL={{true}} as |page|>
17
17
  <div class="mb-4 font-medium">
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  order: 1
3
3
  ---
4
+
4
5
  # Sidebar Navigation
5
6
 
6
7
  In this example, we are filtering the `NestedPageMetadata` by the scope name `docs`.
@@ -42,4 +43,3 @@ more deep into the tree or more shadow.
42
43
  </ul>
43
44
  </DocfyOutput>
44
45
  ```
45
-
@@ -8,7 +8,6 @@ Here is another example that builds a top nav that could be used for the entire
8
8
  application. It will link to any top-level pages as well as to the first page of
9
9
  every child.
10
10
 
11
-
12
11
  ```hbs template
13
12
  <DocfyOutput @type="nested" as |node|>
14
13
  <ul>
@@ -9,7 +9,6 @@ title: <DocfyOutput>
9
9
  This component exposes some of the result data from the build that you can use
10
10
  to render, for example, a sidebar navigation, "on this page" section, and more.
11
11
 
12
-
13
12
  Depending on the arguments you pass to the component, the output could be one of
14
13
  the following values:
15
14
 
@@ -28,7 +27,7 @@ This component has a few different options that are used to filter what the
28
27
  returning value should be. Here is the arguments this component accepts.
29
28
 
30
29
  | Argument | Description | Type | Default Value |
31
- |-------------------|-------------------------------------------------------|--------------------------|---------------|
30
+ | ----------------- | ----------------------------------------------------- | ------------------------ | ------------- |
32
31
  | `@type` | If the result should be a flat list or nested | `'flat'` \| `'nested'` | `'nested'` |
33
32
  | `@fromCurrentURL` | If the result should be filtered from the current URL | `boolean` \| `undefined` | |
34
33
  | `@url` | Find the page definition for the given URL | `string` \| `undefined` | |
@@ -16,6 +16,6 @@ would prevent linking to a page in tutorials from a documentation page.
16
16
 
17
17
  # API
18
18
 
19
- | Argument | Description | Type | Default Value |
20
- |----------------|--------------------------------|-------------------------|---------------|
21
- | `@scope` | Filter links by a scope name | `string` \| `undefined` | |
19
+ | Argument | Description | Type | Default Value |
20
+ | -------- | ---------------------------- | ----------------------- | ------------- |
21
+ | `@scope` | Filter links by a scope name | `string` \| `undefined` | |
@@ -1,10 +1,11 @@
1
1
  ---
2
2
  order: 2
3
3
  ---
4
+
4
5
  # Configuration
5
6
 
6
7
  Docfy has a set of options you can configure and might have read about them
7
- [here](../../../../docs/configuration.md). You might have been wondering how
8
+ [here](../../../docs/configuration.md). You might have been wondering how
8
9
  to set these options in the Ember app context.
9
10
 
10
11
  The Docfy integration with Ember reads a file named `.docfy-config.js` from the
@@ -24,10 +25,7 @@ const codeImport = require('remark-code-import');
24
25
 
25
26
  module.exports = {
26
27
  remarkPlugins: [
27
- [
28
- autolinkHeadings,
29
- { behavior: 'wrap' }
30
- ],
28
+ [autolinkHeadings, { behavior: 'wrap' }],
31
29
  codeImport,
32
30
  highlight
33
31
  ],
package/docs/index.md CHANGED
@@ -8,7 +8,6 @@ title: Getting Started
8
8
  Let's get started by creating a new Ember app and adding Docfy to it. For adding
9
9
  to existing apps, jump to the step after creating the app.
10
10
 
11
-
12
11
  ## Generate the App
13
12
 
14
13
  There isn't anything special here; just create the ember app and remove the
@@ -45,8 +44,8 @@ export default class Router extends EmberRouter {
45
44
  rootURL = config.rootURL;
46
45
  }
47
46
 
48
- Router.map(function() {
49
- addDocfyRoutes(this)
47
+ Router.map(function () {
48
+ addDocfyRoutes(this);
50
49
  });
51
50
  ```
52
51
 
@@ -103,7 +102,7 @@ for building design systems that use the styles from your design in your docs.
103
102
  We can add a `docs` template that will be used when rendering any documentation
104
103
  page because of Ember's routing and templating patterns.
105
104
 
106
- In your `app/templates/docs.hbs` add the follwoing:
105
+ In your `app/templates/docs.hbs` add the following:
107
106
 
108
107
  ```hbs
109
108
  <DocfyOutput @scope="docs" as |node|>
@@ -128,7 +127,6 @@ the simplest navigation component we can build, ignoring any nested sections
128
127
  you might define. You can learn more about these components and their capabilities
129
128
  in their respective documentation page.
130
129
 
131
-
132
130
  ## Add Previous and Next Page Links
133
131
 
134
132
  Documentation sites usually have a previous and next page link. Docfy provides a component that gives you the ability to add this feature.
@@ -13,6 +13,6 @@ This is my Demo: <DocfyLink @to={{this.url}}>My Link</DocfyLink>
13
13
  import Component from '@glimmer/component';
14
14
 
15
15
  export default class MyDemo extends Component {
16
- url = '/docs'
16
+ url = '/docs';
17
17
  }
18
18
  ```
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  order: 3
3
3
  ---
4
+
4
5
  # Writing Demos
5
6
 
6
7
  Docfy has a concept of "demo" markdown files. It allows you to write code in
@@ -18,6 +19,7 @@ template only components by only specifying the HBS template.
18
19
  Below you can see how a demo markdown file looks like.
19
20
 
20
21
  ```md file=writing-demos-demo/demo1.md
22
+
21
23
  ```
22
24
 
23
25
  The demo will be injected into the owner file as a new section called "Examples";
@@ -44,11 +46,11 @@ users can see the code.
44
46
 
45
47
  Below is an example of how it works:
46
48
 
47
- ~~~md
49
+ ````md
48
50
  ```hbs preview-template
49
51
  Click in the link to navigate to the home page: <DocfyLink @to="/">Home</DocfyLink>
50
52
  ```
51
- ~~~
53
+ ````
52
54
 
53
55
  And here you can see how it looks like when rendered:
54
56
 
@@ -5,11 +5,14 @@ This project is on GitHub.
5
5
  ![GitHub](./github-icon.png)
6
6
 
7
7
  ## h2 Heading
8
+
8
9
  ### h3 Heading
10
+
9
11
  #### h4 Heading
12
+
10
13
  ##### h5 Heading
11
- ###### h6 Heading
12
14
 
15
+ ###### h6 Heading
13
16
 
14
17
  ## Paragraphs
15
18
 
@@ -19,20 +22,18 @@ I think I'll use it to format all of my documents from now on.
19
22
 
20
23
  "Smartypants, double quotes" and 'single quotes'
21
24
 
22
-
23
25
  ## Emphasis
24
26
 
25
27
  **This is bold text**
26
28
 
27
- __This is bold text__
29
+ **This is bold text**
28
30
 
29
- *This is italic text*
31
+ _This is italic text_
30
32
 
31
33
  _This is italic text_
32
34
 
33
35
  ~~Strikethrough~~
34
36
 
35
-
36
37
  ## Blockquotes
37
38
 
38
39
  > Dorothy followed her through many of the beautiful rooms in her castle.
@@ -43,24 +44,23 @@ _This is italic text_
43
44
  >
44
45
  > The Witch bade her clean the pots and kettles and sweep the floor and keep the fire fed with wood.
45
46
 
46
-
47
47
  ### Nested Blockquotes
48
48
 
49
49
  > Dorothy followed her through many of the beautiful rooms in her castle.
50
50
  >
51
- >> The Witch bade her clean the pots and kettles and sweep the floor and keep the fire fed with wood.
51
+ > > The Witch bade her clean the pots and kettles and sweep the floor and keep the fire fed with wood.
52
52
 
53
53
  ## Lists
54
54
 
55
55
  Unordered
56
56
 
57
- + Create a list by starting a line with `+`, `-`, or `*`
58
- + Sub-lists are made by indenting 2 spaces:
57
+ - Create a list by starting a line with `+`, `-`, or `*`
58
+ - Sub-lists are made by indenting 2 spaces:
59
59
  - Marker character change forces new list start:
60
- * Ac tristique libero volutpat at
61
- + Facilisis in pretium nisl aliquet
60
+ - Ac tristique libero volutpat at
61
+ * Facilisis in pretium nisl aliquet
62
62
  - Nulla volutpat aliquam velit
63
- + Very easy!
63
+ - Very easy!
64
64
 
65
65
  Ordered
66
66
 
@@ -68,16 +68,14 @@ Ordered
68
68
  2. Consectetur adipiscing elit
69
69
  3. Integer molestie lorem at massa
70
70
 
71
-
72
- 1. You can use sequential numbers...
73
- 1. ...or keep all the numbers as `1.`
71
+ 4. You can use sequential numbers...
72
+ 5. ...or keep all the numbers as `1.`
74
73
 
75
74
  Start numbering with offset:
76
75
 
77
76
  57. foo
78
77
  1. bar
79
78
 
80
-
81
79
  ## Code
82
80
 
83
81
  Inline `code`
@@ -89,7 +87,6 @@ Indented code
89
87
  line 2 of code
90
88
  line 3 of code
91
89
 
92
-
93
90
  Block code "fences"
94
91
 
95
92
  ```
@@ -98,7 +95,7 @@ Sample text here...
98
95
 
99
96
  Syntax highlighting
100
97
 
101
- ``` js
98
+ ```js
102
99
  var foo = function (bar) {
103
100
  return bar++;
104
101
  };
@@ -108,30 +105,28 @@ console.log(foo(5));
108
105
 
109
106
  ## Tables
110
107
 
111
- | Option | Description |
112
- | ------ | ----------- |
108
+ | Option | Description |
109
+ | ------ | ------------------------------------------------------------------------- |
113
110
  | data | path to data files to supply the data that will be passed into templates. |
114
- | engine | engine to be used for processing templates. Handlebars is the default. |
115
- | ext | extension to be used for dest files. |
111
+ | engine | engine to be used for processing templates. Handlebars is the default. |
112
+ | ext | extension to be used for dest files. |
116
113
 
117
114
  Right aligned columns
118
115
 
119
- | Option | Description |
120
- | ------:| -----------:|
121
- | data | path to data files to supply the data that will be passed into templates. |
122
- | engine | engine to be used for processing templates. Handlebars is the default. |
123
- | ext | extension to be used for dest files. |
124
-
116
+ | Option | Description |
117
+ | -----: | ------------------------------------------------------------------------: |
118
+ | data | path to data files to supply the data that will be passed into templates. |
119
+ | engine | engine to be used for processing templates. Handlebars is the default. |
120
+ | ext | extension to be used for dest files. |
125
121
 
126
122
  ## Links
127
123
 
128
124
  [link text](http://dev.nodeca.com)
129
125
 
130
- [link with title](http://nodeca.github.io/pica/demo/ "title text!")
126
+ [link with title](http://nodeca.github.io/pica/demo/ 'title text!')
131
127
 
132
128
  Autoconverted link https://github.com/nodeca/pica (enable linkify to see)
133
129
 
134
-
135
130
  ## Images
136
131
 
137
132
  ![Minion](https://octodex.github.com/images/minion.png)
@@ -142,4 +137,4 @@ Like links, Images also have a footnote style syntax
142
137
 
143
138
  With a reference later in the document defining the URL location:
144
139
 
145
- [id]: https://octodex.github.com/images/dojocat.jpg "The Dojocat"
140
+ [id]: https://octodex.github.com/images/dojocat.jpg 'The Dojocat'
@@ -23,7 +23,7 @@ Byblis vobisque me venerisque possem **una** nihil volui desiderioque quam
23
23
  parilique quosque victor contingere urbem monendo. Meae est precor moenibus.
24
24
 
25
25
  1. Suis cum ille
26
- 3. Recipit precor in opus quam Philyreia potest
26
+ 2. Recipit precor in opus quam Philyreia potest
27
27
 
28
28
  ```js
29
29
  import Docfy from '@docfy/core';
@@ -5,7 +5,6 @@ subcategory: helpers
5
5
 
6
6
  # genereateFlatOutput
7
7
 
8
-
9
8
  Lorem markdownum animaeque obsedit adversam, saevi sed resupina tenuesque levius
10
9
  tenenti utque. Cornibus et opes crudelia primus procul alvum exit: dum frondes!
11
10
  Cornibus e, putat procul nostro erat cunctantem munus inventus quod.
@@ -21,6 +21,6 @@ This is a cool feature.
21
21
  import Component from '@glimmer/component';
22
22
 
23
23
  export default class MyDemo extends Component {
24
- url = '/docs/ember/'
24
+ url = '/docs/ember/';
25
25
  }
26
26
  ```
@@ -9,8 +9,7 @@ I can use markdown here.
9
9
  - Item 1
10
10
  - Item 2
11
11
 
12
- *Super Cool*
13
-
12
+ _Super Cool_
14
13
 
15
14
  ```hbs template
16
15
  <DocfyLink @to="/" class="font-bold" data-test-id="demo-2">
@@ -9,7 +9,6 @@ Lorem markdownum animaeque obsedit adversam, saevi sed resupina tenuesque levius
9
9
  tenenti utque. Cornibus et opes crudelia primus procul alvum exit: dum frondes!
10
10
  Cornibus e, putat procul nostro erat cunctantem munus inventus quod.
11
11
 
12
-
13
12
  ## Example of "On this page"
14
13
 
15
14
  ```hbs
@@ -0,0 +1,3 @@
1
+ ```hbs template
2
+ demo for ember folder
3
+ ```
@@ -2,7 +2,6 @@
2
2
 
3
3
  This is a simple markdown
4
4
 
5
-
6
5
  Where are a lot of cool features here. One of them is to preview a template.
7
6
 
8
7
  ```hbs preview-template
package/lib/index.js CHANGED
@@ -47,6 +47,10 @@ function hasBackingJS(chunks) {
47
47
  }
48
48
  return false;
49
49
  }
50
+ // eslint-disable-next-line
51
+ function isDeepAddonInstance(addon) {
52
+ return addon.parent !== addon.project;
53
+ }
50
54
  class DocfyBroccoli extends broccoli_plugin_1.default {
51
55
  constructor(inputNodes, options = {}) {
52
56
  super(inputNodes, options);
@@ -98,12 +102,17 @@ module.exports = {
98
102
  name: require('../package').name,
99
103
  docfyConfig: undefined,
100
104
  included(...args) {
101
- this.docfyConfig = get_config_1.default(this.project.root);
102
- this.bridge = new broccoli_bridge_1.default();
105
+ if (!isDeepAddonInstance(this)) {
106
+ this.docfyConfig = get_config_1.default(this.project.root);
107
+ this.bridge = new broccoli_bridge_1.default();
108
+ }
103
109
  this._super.included.apply(this, args);
104
110
  },
105
111
  treeForApp(tree) {
106
112
  const trees = [this._super.treeForApp.call(this, tree)];
113
+ if (isDeepAddonInstance(this)) {
114
+ return trees[0];
115
+ }
107
116
  const inputs = [new broccoli_source_1.UnwatchedDir(this.project.root)];
108
117
  this.docfyConfig.sources.forEach((item) => {
109
118
  if (item.root && item.root !== this.project.root) {
@@ -117,12 +126,18 @@ module.exports = {
117
126
  },
118
127
  treeForAddon(tree) {
119
128
  const trees = [this._super.treeForAddon.call(this, tree)];
129
+ if (isDeepAddonInstance(this)) {
130
+ return trees[0];
131
+ }
120
132
  const EmberApp = require('ember-cli/lib/broccoli/ember-app'); // eslint-disable-line
121
133
  const modulePrefix = this.project.config(EmberApp.env()).modulePrefix;
122
134
  trees.push(new broccoli_file_creator_1.default('output.js', docfy_output_template_1.default(modulePrefix)));
123
135
  return new broccoli_merge_trees_1.default(trees);
124
136
  },
125
137
  treeForPublic() {
138
+ if (isDeepAddonInstance(this)) {
139
+ return;
140
+ }
126
141
  return new broccoli_funnel_1.default(this.bridge.placeholderFor('docfy-tree'), {
127
142
  srcDir: 'public',
128
143
  destDir: './'
@@ -56,7 +56,10 @@ exports.default = plugin_1.default({
56
56
  });
57
57
  }
58
58
  });
59
- const componentName = utils_1.generateDemoComponentName(`docfy-demo-${path_1.default.basename(page.source).split('.')[0]}-${path_1.default.basename(demo.source).split('.')[0]}`, seenNames);
59
+ // 1. exclude extension
60
+ // 2. remove /index.md because of web conventions
61
+ const baseName = page.source.replace('/index.md', '').split('.')[0];
62
+ const componentName = utils_1.generateDemoComponentName(`docfy-demo-${baseName}-${path_1.default.basename(demo.source).split('.')[0]}`, seenNames);
60
63
  const demoTitle = unist_util_find_1.default(demo.ast, (node) => node.type === 'heading' && node.depth === 1);
61
64
  if (demoTitle) {
62
65
  demoTitle.depth = 3;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docfy/ember",
3
- "version": "0.4.1",
3
+ "version": "0.4.5",
4
4
  "description": "Ember integration with Docfy",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -30,7 +30,7 @@
30
30
  "test:ember-compatibility": "echo 'ember try:each TODO'"
31
31
  },
32
32
  "dependencies": {
33
- "@docfy/core": "^0.4.0",
33
+ "@docfy/core": "^0.4.4",
34
34
  "broccoli-bridge": "^1.0.0",
35
35
  "broccoli-file-creator": "^2.1.1",
36
36
  "broccoli-funnel": "^3.0.3",
@@ -44,13 +44,13 @@
44
44
  "ember-cli-typescript": "^4.0.0",
45
45
  "ember-get-config": "^0.3.0",
46
46
  "mdast-util-to-string": "^2.0.0",
47
- "remark-hbs": "^0.3.1",
47
+ "remark-hbs": "^0.4.0",
48
48
  "unist-builder": "^2.0.3",
49
49
  "unist-util-find": "^1.0.2",
50
50
  "unist-util-visit": "^2.0.2"
51
51
  },
52
52
  "devDependencies": {
53
- "@docfy/plugin-with-prose": "^0.4.0",
53
+ "@docfy/plugin-with-prose": "^0.4.4",
54
54
  "@ember/optional-features": "^2.0.0",
55
55
  "@ember/test-helpers": "^2.1.4",
56
56
  "@embroider/compat": "^0.36.0",
@@ -121,5 +121,5 @@
121
121
  "prember"
122
122
  ]
123
123
  },
124
- "gitHead": "2c2ece550922b7e701ad290c1351b562cfd747fc"
124
+ "gitHead": "000552c8389ba2104c9ad44f51dea4d5a1c1e51b"
125
125
  }
@@ -6,7 +6,7 @@ export default class DocfyService extends Service {
6
6
  get flat(): PageMetadata[];
7
7
  get nested(): NestedPageMetadata;
8
8
  get currentPage(): PageMetadata | undefined;
9
- findNestedChildrenByName(name: string): NestedPageMetadata | undefined;
9
+ findNestedChildrenByName(scope: string, previousNested?: NestedPageMetadata | undefined | null): NestedPageMetadata | undefined;
10
10
  findByUrl(url: string, scopeByNestedName?: string): PageMetadata | undefined;
11
11
  previousPage(scopeByNestedName?: string): PageMetadata | undefined;
12
12
  nextPage(scopeByNestedName?: string): PageMetadata | undefined;
package/src/index.ts CHANGED
@@ -41,6 +41,11 @@ function hasBackingJS(chunks: DemoComponentChunk[]): boolean {
41
41
  return false;
42
42
  }
43
43
 
44
+ // eslint-disable-next-line
45
+ function isDeepAddonInstance(addon: any): boolean {
46
+ return addon.parent !== addon.project;
47
+ }
48
+
44
49
  class DocfyBroccoli extends Plugin {
45
50
  config: DocfyConfig;
46
51
 
@@ -122,14 +127,18 @@ module.exports = {
122
127
  docfyConfig: undefined,
123
128
 
124
129
  included(...args: unknown[]): void {
125
- this.docfyConfig = getDocfyConfig(this.project.root);
126
-
127
- this.bridge = new BroccoliBridge();
130
+ if (!isDeepAddonInstance(this)) {
131
+ this.docfyConfig = getDocfyConfig(this.project.root);
132
+ this.bridge = new BroccoliBridge();
133
+ }
128
134
  this._super.included.apply(this, args);
129
135
  },
130
136
 
131
- treeForApp(tree: InputNode): Node {
132
- const trees: InputNode[] = [this._super.treeForApp.call(this, tree)];
137
+ treeForApp(tree: Node): Node {
138
+ const trees: Node[] = [this._super.treeForApp.call(this, tree)];
139
+ if (isDeepAddonInstance(this)) {
140
+ return trees[0];
141
+ }
133
142
 
134
143
  const inputs: InputNode[] = [new UnwatchedDir(this.project.root)];
135
144
 
@@ -147,8 +156,12 @@ module.exports = {
147
156
  return new MergeTrees(trees, { overwrite: true });
148
157
  },
149
158
 
150
- treeForAddon(tree: InputNode): Node {
151
- const trees: InputNode[] = [this._super.treeForAddon.call(this, tree)];
159
+ treeForAddon(tree: Node): Node {
160
+ const trees: Node[] = [this._super.treeForAddon.call(this, tree)];
161
+ if (isDeepAddonInstance(this)) {
162
+ return trees[0];
163
+ }
164
+
152
165
  const EmberApp = require('ember-cli/lib/broccoli/ember-app'); // eslint-disable-line
153
166
  const modulePrefix = this.project.config(EmberApp.env()).modulePrefix;
154
167
 
@@ -157,7 +170,11 @@ module.exports = {
157
170
  return new MergeTrees(trees);
158
171
  },
159
172
 
160
- treeForPublic(): Node {
173
+ treeForPublic(): Node | undefined {
174
+ if (isDeepAddonInstance(this)) {
175
+ return;
176
+ }
177
+
161
178
  return new Funnel(
162
179
  (this.bridge as BroccoliBridge).placeholderFor('docfy-tree'),
163
180
  {
@@ -71,8 +71,13 @@ export default plugin({
71
71
  });
72
72
  }
73
73
  });
74
+
75
+ // 1. exclude extension
76
+ // 2. remove /index.md because of web conventions
77
+ const baseName = page.source.replace('/index.md', '').split('.')[0];
78
+
74
79
  const componentName = generateDemoComponentName(
75
- `docfy-demo-${path.basename(page.source).split('.')[0]}-${
80
+ `docfy-demo-${baseName}-${
76
81
  path.basename(demo.source).split('.')[0]
77
82
  }`,
78
83
  seenNames