From d1491df6f828c770f6d6764a4abbe0d0da5dbcac Mon Sep 17 00:00:00 2001
From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com>
Date: Tue, 13 Feb 2024 19:35:34 -0500
Subject: [PATCH 1/8] Add APIDocs / ComponentSignature / Typedoc generation and
rendering
Add note about https://github.com/embroider-build/embroider/issues/1789
to CI and add the fun env flag
---
.github/workflows/ci.yml | 16 +-
docs-app/.template-lintrc.js | 3 +
docs-app/app/router.js | 7 +-
docs-app/app/routes/application.ts | 13 +-
docs-app/app/templates/application.gjs | 33 +-
docs-app/app/templates/page.gjs | 19 +
docs-app/ember-cli-build.js | 9 +-
docs-app/package.json | 3 +-
docs-app/public/docs/components/api-docs.md | 1 +
.../public/docs/components/comment-query.md | 1 +
.../docs/components/component-signature.md | 1 +
docs-app/public/docs/components/logs.md | 1 +
docs-app/public/docs/plugins/api-docs.md | 1 +
.../docs/plugins/copy-file-to-public.md | 1 +
docs-app/public/docs/plugins/copy-file.md | 1 +
.../public/docs/plugins/create-manifest.md | 5 +
docs-app/public/docs/plugins/index.md | 11 +-
docs-app/public/docs/usage/setup.md | 82 +
package.json | 37 +
pnpm-lock.yaml | 1819 +++++++++++++----
src/plugins/create-manifest/index.js | 2 +-
src/plugins/create-manifest/types.ts | 1 +
src/plugins/helpers.js | 57 +
src/plugins/index.js | 1 +
src/plugins/typedoc.js | 132 ++
src/plugins/vite.js | 2 +
src/plugins/webpack.js | 2 +
ui/package.json | 9 +-
ui/src/components/logs.gts | 16 +-
ui/src/highlight.ts | 62 +
ui/src/index.ts | 3 +
ui/src/markdown/compiler.ts | 43 +
ui/src/markdown/import-map.ts | 14 +
ui/src/markdown/index.ts | 2 +
ui/src/markdown/typedoc/index.ts | 4 +
ui/src/markdown/typedoc/renderer.gts | 368 ++++
.../markdown/typedoc/signature/component.gts | 105 +
ui/src/markdown/typedoc/styles.css | 227 ++
ui/src/markdown/typedoc/utils.gts | 56 +
ui/src/router.ts | 9 +
ui/src/service-registry.ts | 0
ui/src/services/kolay/docs.ts | 113 +
ui/src/services/kolay/selected.ts | 100 +
ui/src/services/kolay/types.ts | 17 +
44 files changed, 3030 insertions(+), 379 deletions(-)
create mode 100644 docs-app/app/templates/page.gjs
create mode 100644 docs-app/public/docs/components/api-docs.md
create mode 100644 docs-app/public/docs/components/comment-query.md
create mode 100644 docs-app/public/docs/components/component-signature.md
create mode 100644 docs-app/public/docs/components/logs.md
create mode 100644 docs-app/public/docs/plugins/api-docs.md
create mode 100644 docs-app/public/docs/usage/setup.md
create mode 100644 src/plugins/helpers.js
create mode 100644 src/plugins/typedoc.js
create mode 100644 ui/src/highlight.ts
create mode 100644 ui/src/markdown/compiler.ts
create mode 100644 ui/src/markdown/import-map.ts
create mode 100644 ui/src/markdown/index.ts
create mode 100644 ui/src/markdown/typedoc/index.ts
create mode 100644 ui/src/markdown/typedoc/renderer.gts
create mode 100644 ui/src/markdown/typedoc/signature/component.gts
create mode 100644 ui/src/markdown/typedoc/styles.css
create mode 100644 ui/src/markdown/typedoc/utils.gts
create mode 100644 ui/src/router.ts
create mode 100644 ui/src/service-registry.ts
create mode 100644 ui/src/services/kolay/docs.ts
create mode 100644 ui/src/services/kolay/selected.ts
create mode 100644 ui/src/services/kolay/types.ts
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 9476a46a..35691f55 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -18,6 +18,20 @@ env:
TURBO_API: http://127.0.0.1:9080
TURBO_TOKEN: this-is-not-a-secret
TURBO_TEAM: myself
+ # We have a real case where the verification is incorrect,
+ # webpack appears to only ship one copy of ember-source
+ #
+ # We can deduce this without debugging too hard, because:
+ # - we know that ember-source includes `@glimmer/validator`
+ # (bundled, not as a dependency)
+ # - we know that `@glimmer/validator` has conniptions if it
+ # is included twice in the same app - an error is thrown.
+ #
+ # And right now, there is no error about `@glimmer/validator`
+ # being included twice.
+ #
+ # See: https://github.com/embroider-build/embroider/issues/1789
+ I_HAVE_BAD_PEER_DEPS_AND_WANT_A_BROKEN_BUILD: true
##############################################################
@@ -47,7 +61,7 @@ jobs:
- uses: wyvox/action@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- - run: pnpm lint
+ - run: pnpm turbo _:lint
##############################################################
diff --git a/docs-app/.template-lintrc.js b/docs-app/.template-lintrc.js
index f35f61c7..8d5233df 100644
--- a/docs-app/.template-lintrc.js
+++ b/docs-app/.template-lintrc.js
@@ -2,4 +2,7 @@
module.exports = {
extends: 'recommended',
+ rules: {
+ 'no-forbidden-elements': 'off',
+ },
};
diff --git a/docs-app/app/router.js b/docs-app/app/router.js
index 86d52b59..c436e288 100644
--- a/docs-app/app/router.js
+++ b/docs-app/app/router.js
@@ -1,10 +1,15 @@
import EmberRouter from '@ember/routing/router';
import config from 'docs-app/config/environment';
+import { properLinks } from 'ember-primitives/proper-links';
+import { addRoutes } from 'kolay';
+@properLinks
export default class Router extends EmberRouter {
location = config.locationType;
rootURL = config.rootURL;
}
-Router.map(function () {});
+Router.map(function () {
+ addRoutes(this);
+});
diff --git a/docs-app/app/routes/application.ts b/docs-app/app/routes/application.ts
index b5d831e6..2021ce16 100644
--- a/docs-app/app/routes/application.ts
+++ b/docs-app/app/routes/application.ts
@@ -1,8 +1,19 @@
import Route from '@ember/routing/route';
+import { service } from '@ember/service';
export default class ApplicationRoute extends Route {
+ @service('kolay/docs') docs;
+
async model() {
- const request = await fetch('/docs/manifest.json');
+ // TODO?: Should setup also fetch the manifest?
+ // then we just await setup here?
+ this.docs.setup({
+ // TODO: can be determined by createManifest plugin
+ // (if it emits a virtual module)
+ manifest: '/docs/manifest.json',
+ });
+
+ const request = await fetch(this.docs.manifestLocation);
const json = await request.json();
return { manifest: json };
diff --git a/docs-app/app/templates/application.gjs b/docs-app/app/templates/application.gjs
index 2cfc400d..eb2c9b7b 100644
--- a/docs-app/app/templates/application.gjs
+++ b/docs-app/app/templates/application.gjs
@@ -1,17 +1,38 @@
-// NOTE: this is a virtual module and doesn't actually exist
-// the build emits it
import ENV from 'docs-app/config/environment';
import { pageTitle } from 'ember-page-title';
import Route from 'ember-route-template';
-import { Demo } from './demo/logs';
+const Nav =
+
+ {{#each @item.pages as |page|}}
+ {{#if page.path}}
+
+;
export default Route(
{{pageTitle ENV.APP.shortVersion}}
- {{outlet}}
-
+ {{JSON.stringify @model.manifest null 3}}
adjective
+
+@{{child.name}}+ {{#if (isIntrinsic child.type)}} +
<:{{child.name}}>+ {{! Properties }} +