-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from universal-ember/sort-tree-and-json-c
Sort trees and json C
- Loading branch information
Showing
29 changed files
with
424 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import Route from '@ember/routing/route'; | ||
import { service } from '@ember/service'; | ||
|
||
export default class NotHere extends Route { | ||
@service router; | ||
|
||
beforeModel() { | ||
this.router.replaceWith('/usage/setup.md'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# `<APIDocs />` | ||
|
||
```hbs live | ||
```hbs live no-shadow | ||
<APIDocs @module="declarations/browser/re-exports" @name="APIDocs" @apiDocs="/docs/kolay.json" /> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"order": ["component-signature", "api-docs", "logs"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
// We want usage to be first, which breaks the | ||
// default sort order provided by the filesystem: Alphabetical | ||
"order": ["usage", "components", "plugins"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
# `createManifest(...)` | ||
|
||
```hbs live | ||
## Config | ||
|
||
either json or jsonc | ||
|
||
- set order | ||
- change name | ||
|
||
```hbs live no-shadow | ||
<APIDocs @module="declarations/plugins/vite" @name="createManifest" @apiDocs="/docs/kolay.json" /> | ||
``` | ||
|
||
```hbs live | ||
```hbs live no-shadow | ||
<APIDocs @module="src/plugins/types" @name="CreateManifestOptions" @apiDocs="/docs/kolay.json" /> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
currently, top level pages are not allowed - everything must be in a folder |
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"order": ["e-b", "e-a"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"order": ["c-b", "c-a"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"order": ["b", "a"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { reshape } from './hydrate.js'; | ||
|
||
/** | ||
* @typedef {object} Options | ||
* @property {string | undefined} [ include ] | ||
* @property {string[] | undefined} [ exclude ] | ||
* @property {string} cwd | ||
* @property {boolean | undefined} [ onlyDirectories ] | ||
* | ||
* @param {Options} options | ||
*/ | ||
export async function discover({ include, onlyDirectories, exclude, cwd }) { | ||
include ??= '**/*'; | ||
exclude ??= []; | ||
onlyDirectories ??= false; | ||
|
||
const { globbySync } = await import('globby'); | ||
|
||
let paths = globbySync(include, { | ||
cwd, | ||
expandDirectories: true, | ||
onlyDirectories, | ||
}); | ||
|
||
// Needs to be const, because TS thinks exclude can change while `filter` is running. | ||
const excludePattern = exclude; | ||
|
||
paths = paths.filter((path) => !excludePattern.some((pattern) => path.match(pattern))); | ||
|
||
const reshaped = await reshape(paths, cwd); | ||
|
||
return reshaped; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import path from 'node:path'; | ||
import url from 'node:url'; | ||
|
||
import { describe, expect, test } from 'vitest'; | ||
|
||
const __dirname = url.fileURLToPath(new URL('.', import.meta.url)); | ||
|
||
import { discover } from './discover.js'; | ||
|
||
const fixtures = path.join(__dirname, '../../../fixtures/discover'); | ||
|
||
describe('discover', () => { | ||
test('it works', async () => { | ||
let result = await discover({ cwd: fixtures }); | ||
|
||
expect(result.tree).toMatchInlineSnapshot(` | ||
{ | ||
"first": "/c/c-b.md", | ||
"name": "root", | ||
"pages": [ | ||
{ | ||
"first": "/c/c-b.md", | ||
"name": "c", | ||
"pages": [ | ||
{ | ||
"groupName": "c", | ||
"name": "c-b", | ||
"path": "/c/c-b.md", | ||
"tutorialName": "cb", | ||
}, | ||
{ | ||
"groupName": "c", | ||
"name": "c-a", | ||
"path": "/c/c-a.md", | ||
"tutorialName": "ca", | ||
}, | ||
{ | ||
"first": "/c/d/d-a.md", | ||
"name": "d", | ||
"pages": [ | ||
{ | ||
"groupName": "d", | ||
"name": "d-a", | ||
"path": "/c/d/d-a.md", | ||
"tutorialName": "da", | ||
}, | ||
{ | ||
"groupName": "d", | ||
"name": "d-b", | ||
"path": "/c/d/d-b.md", | ||
"tutorialName": "db", | ||
}, | ||
], | ||
}, | ||
{ | ||
"first": "/c/e/e-b.md", | ||
"name": "e", | ||
"pages": [ | ||
{ | ||
"groupName": "e", | ||
"name": "e-b", | ||
"path": "/c/e/e-b.md", | ||
"tutorialName": "eb", | ||
}, | ||
{ | ||
"groupName": "e", | ||
"name": "e-a", | ||
"path": "/c/e/e-a.md", | ||
"tutorialName": "ea", | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
], | ||
} | ||
`); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.