lblod / frontend-embeddable-notule-editor

Frontend for an embeddable variant of the editor.
MIT License
1 stars 1 forks source link

bundle editor type declarations with builds #263

Closed piemonkey closed 3 weeks ago

piemonkey commented 4 weeks ago

Overview

Copy the say-controller type declarations from the editor in node_modules as we rely on those types for the public API but do not want to require consuming apps to install them themselves. This avoids type errors when using embeddable in a TS app with "skipLibChecks": false.

node_modules/@lblod/embeddable-say-editor/types/main.d.ts:68:24 - error TS2307: Cannot find module '@lblod/ember-rdfa-editor/core/say-controller' or its corresponding type declarations.
controller: import("@lblod/ember-rdfa-editor/core/say-controller").default;

Adds an angular test-app to make testing the types easier. There's also a docker-based automated test, as the only way to get an effective test is to have a repo that is not part of the pnpm workspace.

I did not yet add a woodpecker step to run these tests, which is something we should definitely do. I intend to add a small script to allow for the angular app to be run in the workspace as well as in docker, but that will not be in this PR.

connected issues and PRs:

Jira ticket: https://binnenland.atlassian.net/browse/GN-5071

Setup

N/A

How to test/reproduce

To test locally, the easiest is to copy the test-angular repo outside of the workspace, run pnpm i and pnpm start in that dir. You should see the Angular build with a type error for missing types. If you then pnpm pack this PR (in the embeddable-say-editor dir), then pnpm i the resulting file in the angular app, you should then see no errors on pnpm start.

Challenges/uncertainties

Difficulties with how pnpm workspaces work and how we're doing something that the ecosystem doesn't seem to like (publishing packaged code rather than depending on other packages).

Checks PR readiness

abeforgit commented 3 weeks ago

works beautifully, also confirmed the docker test fails when you mess up one of the typeImports files, I'll add it to CI