Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for custom output directory structure #2111

Open
NullVoxPopuli opened this issue Dec 8, 2022 · 5 comments
Open

Support for custom output directory structure #2111

NullVoxPopuli opened this issue Dec 8, 2022 · 5 comments
Labels
enhancement Improved functionality help wanted Contributions are especially encouraged
Milestone

Comments

@NullVoxPopuli
Copy link

NullVoxPopuli commented Dec 8, 2022

Search terms

Cloudflare pages

Expected Behavior

Visiting a link for a function works

Actual Behavior

Cloudflare pages reverts to the /index.html
because /functions is used for Cloudflare-specific stuff.

Steps to reproduce the bug

  1. Deploy any typedoc output to Cloudflare pages.
  2. Click any function on any of the docs pages.

Example:

I have this output:

Permissions Size User          Date Modified Name
.rw-rw-r--   143 nullvoxpopuli  8 Dec 13:23  .nojekyll
drwxrwxr-x     - nullvoxpopuli  8 Dec 13:23  assets
drwxrwxr-x     - nullvoxpopuli  8 Dec 13:23  classes
drwxrwxr-x     - nullvoxpopuli  8 Dec 13:23  functions
.rw-rw-r--   23k nullvoxpopuli  8 Dec 13:23  index.html
drwxrwxr-x     - nullvoxpopuli  8 Dec 13:23  interfaces
drwxrwxr-x     - nullvoxpopuli  8 Dec 13:23  modules
.rw-rw-r--  9.1k nullvoxpopuli  8 Dec 13:23  modules.html
drwxrwxr-x     - nullvoxpopuli  8 Dec 13:23  types
drwxrwxr-x     - nullvoxpopuli  8 Dec 13:23  variables

Which is deployed to: ember-resources.pages.dev/
On any page, such as: https://ember-resources.pages.dev/modules/util_cell
I click the available functions, such as: https://ember-resources.pages.dev/functions/util_cell.cell.html, but I am redirected to a poorly rendered version of https://ember-resources.pages.dev

My config:

{
  "tsconfig": "../ember-resources/tsconfig.json",
  "entryPoints": [
    "../ember-resources/src/index.ts",
    "../ember-resources/src/util/"
  ],
  "entryPointStrategy": "expand",
  "readme": "../README.md",
  "exclude": [],
  "json": "./docs.json",
  "out": "dist",
  "pretty": true,
  "excludePrivate": true,
  "excludeProtected": false,
  "excludeExternals": true,
  "disableSources": true,
  "searchInComments": true,
  "categorizeByGroup": false,
  "plugin": [
  ]
}

Environment

typedoc 0.23.14
typescript 4.8.3

❯ node -v
v16.15.1

❯ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.1 LTS
Release:	22.04
Codename:	jammy

I guess, what I'd like to see is a way to have customization over the file/folder structure.
Maybe functions can be nested under their modules?

@NullVoxPopuli NullVoxPopuli added the bug Functionality does not match expectation label Dec 8, 2022
@Cherry
Copy link

Cherry commented Dec 8, 2022

Looks like the same issue as in cloudflare/workers-sdk#2240

@amochkin
Copy link

amochkin commented Dec 8, 2022

Temporary solution:
cloudflare/workers-sdk#2240 (comment)

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Dec 8, 2022

Wow, cloudflare, talk about a terrible design decision...

@Gerrit0 Gerrit0 added enhancement Improved functionality and removed bug Functionality does not match expectation labels Dec 8, 2022
@Gerrit0 Gerrit0 changed the title Cloudflare pages breaks because of the /functions folder. Support for custom output directory structure Dec 8, 2022
@Gerrit0 Gerrit0 added the help wanted Contributions are especially encouraged label Dec 8, 2022
Gerrit0 added a commit that referenced this issue Sep 24, 2023
@mogelbrod
Copy link
Contributor

I encountered this today, and unfortunately it seems like the workaround is not working 😞

Temporary solution: cloudflare/workers-sdk#2240 (comment)

I adapted it to work specifically for typedoc:

typedoc && mv docs/functions docs/funcs && find docs -name '*.html' -exec sed -i '' -E 's:(href="[^"]*)functions:\1funcs:g' {} +

With the above in place it works fine when JS is disabled, but typedoc generates links via JS when enabled using the gzip encoded data in window.navigationData. This data isn't easily modified via sed, so I'm currently stuck without any viable workaround other than perhaps manually patching the typedoc codebase 😬

const res = await fetch(window.navigationData);
const data = await res.arrayBuffer();
const json = new Blob([data])
.stream()
.pipeThrough(new DecompressionStream("gzip"));

@NikolaRHristov
Copy link

NikolaRHristov commented Sep 30, 2023

I made a custom theme that overrides the default mappings and outputs to different directories, you can see an example in:

https://github.com/NikolaRHristov/TypeScriptESBuild/blob/main/Source/Variable/Load.ts
https://github.com/NikolaRHristov/TypeScriptESBuild/blob/main/Source/Class/Theme.ts

And here is how it works: https://typescript-esbuild.nikolahristov.tech/Function/Build.Build

This is hosted on Cloudflare Pages, so no issues there. That's the output of the file structure:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improved functionality help wanted Contributions are especially encouraged
Projects
None yet
Development

No branches or pull requests

6 participants