KnodesCommunity / typedoc-plugins

A monorepo containing all knodes-published TypeDoc plugins
https://knodescommunity.github.io/typedoc-plugins/
MIT License
20 stars 4 forks source link

Not sure how to build #84

Closed StoneCypher closed 2 years ago

StoneCypher commented 2 years ago

Want to add a feature for hidden pages, so that I can add a huge list of subpages and not spam the index

First step is to fork, build, and install locally

npm install && npm run build

Oh, there's ... no build. Okay. Let's look at the package. There's a projects:build.

$ npm run projects:build

> @knodes/typedoc-plugins@0.22.5 projects:build
> npm run projects:patch -- apply && node ./tools/s-projects 'npm run build -- --pretty'

> @knodes/typedoc-plugins@0.22.5 projects:patch
> node ./tools/typedoc-patcher --no-stash "apply"

Applying patches from packages/plugin-pages/src/theme-plugins/search/default-pages-javascript-index-plugin.GENERATED.ts.patch
node:internal/process/promises:246
          triggerUncaughtException(err, true /* fromPromise */);
          ^

AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:

  assert( match && match[1] )

    at E:\projects\typedoc-plugins\tools\typedoc-patcher.js:28:2
    at async E:\projects\typedoc-plugins\tools\typedoc-patcher.js:118:100
    at async Promise.all (index 0)
    at async E:\projects\typedoc-plugins\tools\typedoc-patcher.js:118:31 {
  generatedMessage: true,
  code: 'ERR_ASSERTION',
  actual: null,
  expected: true,
  operator: '=='
}

Node.js v17.2.0

Er.

There's no gh action to mimic

Not really sure how to get this to build.

GerkinDev commented 2 years ago

Hi, yeah, I should complete the readme with a proper how-to.

You need to clone the typedoc submodule. In fact, a couple of files are auto-generated by patching files from the submodule (typically, the javascript index plugin).

So, it should be something like the following

git submodule init --recursive
npm i --workspaces
npm run projects:build

I'll complete the readme with those instructions next time I do an iteration on that repo.

StoneCypher commented 2 years ago

git submodule init --recursive

Not a thing. Ended up doing git submodule update --init --recursive because StackUnderthink.

 

npm i --workspaces

Works

 

npm run projects:build

No change.

john@DESKTOP-26H4050 MINGW64 /e/projects/typedoc-plugins (main)
$ git submodule update --init --recursive
Submodule 'typedoc' (https://github.com/TypeStrong/typedoc.git) registered for path 'typedoc'
Cloning into 'E:/projects/typedoc-plugins/typedoc'...
Submodule path 'typedoc': checked out 'abed9a64d674c6c3b20284847c024abd5334547b'

john@DESKTOP-26H4050 MINGW64 /e/projects/typedoc-plugins (main)
$ npm i --workspaces

> @knodes/typedoc-plugins@0.22.5 prepare
> npm run prepare:husky

> @knodes/typedoc-plugins@0.22.5 prepare:husky
> [ -d ./node_modules/husky ] && husky install || true

husky - Git hooks installed

up to date, audited 782 packages in 3s

found 0 vulnerabilities

john@DESKTOP-26H4050 MINGW64 /e/projects/typedoc-plugins (main)
$ npm run projects:build

> @knodes/typedoc-plugins@0.22.5 projects:build
> npm run projects:patch -- apply && node ./tools/s-projects 'npm run build -- --pretty'

> @knodes/typedoc-plugins@0.22.5 projects:patch
> node ./tools/typedoc-patcher --no-stash "apply"

Applying patches from packages/plugin-pages/src/theme-plugins/search/default-pages-javascript-index-plugin.GENERATED.ts.patch
node:internal/process/promises:246
          triggerUncaughtException(err, true /* fromPromise */);
          ^

AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:

  assert( match && match[1] )

    at E:\projects\typedoc-plugins\tools\typedoc-patcher.js:28:2
    at async E:\projects\typedoc-plugins\tools\typedoc-patcher.js:118:100
    at async Promise.all (index 0)
    at async E:\projects\typedoc-plugins\tools\typedoc-patcher.js:118:31 {
  generatedMessage: true,
  code: 'ERR_ASSERTION',
  actual: null,
  expected: true,
  operator: '=='
}

Node.js v17.2.0
GerkinDev commented 2 years ago

Yeah you're right about the command to update submodule, I told you the command as I remembered, but you're absolutely right. Thank you.

That probably means that the file recently changed @ the typedoc level, preventing the patch from being applied correctly. I might be able to take care of this this w-e, and maybe before that. Sry about that

StoneCypher commented 2 years ago

I'll fix the rest for you if you get that one step 😄

I have an implementation of my feature. It's probably wrong; I haven't been able to try it yet.

I can't push it to Github because this stack has put its own code into the git process with husky hooks, meaning I'm not able to use git until the bug is fixed. (In general, I feel that husky is an extreme mistake on grounds like this, and that github actions is the correct place to do things like that.)

StoneCypher commented 2 years ago
$ git status
On branch HiddenPages
Your branch is up to date with 'FixScripts'.

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        modified:   package.json
        modified:   packages/plugin-pages/src/plugin.ts
        modified:   packages/plugin-pages/src/theme-plugins/page-tree/a-page-tree-builder.spec.ts
        modified:   packages/plugin-pages/src/theme-plugins/page-tree/a-page-tree-builder.ts

john@DESKTOP-26H4050 MINGW64 /e/projects/typedoc-plugins (HiddenPages)
$ git add . && git commit -m "There is no way to commit"

> @knodes/typedoc-plugins@0.22.7 precommit
> npm run projects:patch -- diff && npm run lint -- --cache && npm run projects:build && npm run projects:test -- --onlyChanged && npm run docs

> @knodes/typedoc-plugins@0.22.7 projects:patch
> node ./tools/typedoc-patcher --no-stash "diff"

Generating patches on

> @knodes/typedoc-plugins@0.22.7 lint
> eslint --ignore-path ./.eslintignore '**/?(.)*.?([cm])[tj]s?(x)' "--cache"

Oops! Something went wrong! :(

ESLint: 8.14.0

No files matching the pattern "'**/?(.)*.?([cm])[tj]s?(x)'" were found.
Please check for typing mistakes in the pattern.

husky - pre-commit hook exited with code 2 (error)

john@DESKTOP-26H4050 MINGW64 /e/projects/typedoc-plugins (HiddenPages)
$ git status
On branch HiddenPages
Your branch is up to date with 'FixScripts'.

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        modified:   package.json
        modified:   packages/plugin-pages/src/plugin.ts
        modified:   packages/plugin-pages/src/theme-plugins/page-tree/a-page-tree-builder.spec.ts
        modified:   packages/plugin-pages/src/theme-plugins/page-tree/a-page-tree-builder.ts
GerkinDev commented 2 years ago

Go with git commit --no-verify.

StoneCypher commented 2 years ago

PR https://github.com/KnodesCommunity/typedoc-plugins/pull/88 will make it so that you do not have to document or explain git submodules or npm workspaces. Once the patch is working again, this should be ready for merge.

PR https://github.com/KnodesCommunity/typedoc-plugins/pull/89 is the feature I would like to develop. It is currently known to be incorrect and is not ready for merge, but what it does should be generally clear, so if you'd like to see what my goal is, and tell me whether you think it fits, it's at least ready to be looked at. Nice and short.

GerkinDev commented 2 years ago

Hi, So, I've started the update & check of the package. The issue you encountered was expected & by design: the javascript index being a replacement of the typedoc built-in plugin, I forced the workflow to follow strictly updates from the typedoc upstream, to avoid releases of new versions not implementing typedoc new features from this plugin.

I had to do this because typedoc does not expose customization of how reflection were mapped in the search index.

I am checking if this override can be dropped, since they recently added the ability to customize search weights from reflection properties.

Please note that this customization originates from another unmaintained project that used this strategy, and the plugin-pages is a fork of it.

More infos tomorrow.

StoneCypher commented 2 years ago

Great, thanks.

GerkinDev commented 2 years ago

Well, DUH, I made my scripts for unix-like newlines only. Fix is ready and I'm pushing it

StoneCypher commented 2 years ago

not sure if i'm looking in the wrong place, but it seems like neither this repo nor the -pages plugin repo, on main or develop, got updated

GerkinDev commented 2 years ago

Yeah I have a life and my wife was kinda upset I was still working yesterday at 10pm, which I already did up to midnight for 2 weeks in a row. I do as much as I can, sorry. But I have :

I know you're of good will and want to bring a nice feature, and I'm glad you want to. But I'm already at full pressure right now.

The build system fix commit is done on my machine. There is just another behavioral commit left to unify behavior across posix & windows. All tests are green, I just have to commit this and push.

I should have the time to do it tonight, after taking care of my family life just a bit.

StoneCypher commented 2 years ago

ok sorry i was just reacting to "Fix is ready and I'm pushing it," thought maybe it got forgotten

GerkinDev commented 2 years ago

Well I realized after that comment that there was also inconsistencies between shells in windows VS posix, and quite serious problems in the patching system for windows. I usually avoid that OS as much as I can, so I usually don't have to take those problems into consideration. I do it only for you.

StoneCypher commented 2 years ago

Well I realized after that comment that there was also inconsistencies between shells in windows VS posix, and quite serious problems in the patching system for windows. I usually avoid that OS as much as I can, so I usually don't have to take those problems into consideration.

If you can show me where your patch is, I'll finish it

 

there was also inconsistencies between shells in windows VS posix

The shell shouldn't be involved on any platform

 

I do it only for you.

I feel like I should remind you that most people are on Windows

GerkinDev commented 2 years ago

Patch is pushed. Npm run spawns a subshell. Unix is majoritary https://insights.stackoverflow.com/survey/2021#section-most-popular-technologies-operating-system

StoneCypher commented 2 years ago

ty for the patch

GerkinDev commented 2 years ago

Can I close this issue now ?

StoneCypher commented 2 years ago

Oh, sorry, thought I did already. Yes, please feel free. My mistake