bimplus-renderer 1.8.38 → 1.8.40-webifc1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/JSDOC_MIGRATION_PLAN.md +244 -0
- package/README.md +72 -4
- package/dist/bimplus-renderer.js +1 -1
- package/jsdoc.json +23 -0
- package/package.json +39 -31
- package/playwright.config.mjs +71 -0
- package/scripts/generate-api-markdown.js +371 -0
- package/scripts/jsdoc-class-ownership-plugin.js +107 -0
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
# JSDoc Migration Plan
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
|
|
5
|
+
Replace the `documentation` package with JSDoc tooling while preserving the existing documentation workflows:
|
|
6
|
+
|
|
7
|
+
- HTML documentation in `./documentation`
|
|
8
|
+
- Markdown API documentation in `./documentation/Bimplus_Renderer_doc.md`
|
|
9
|
+
- Confluence-compatible Markdown in `./documentation/Bimplus_Renderer_doc_confluence.md`
|
|
10
|
+
- The existing `build-doc*` npm script interface
|
|
11
|
+
|
|
12
|
+
The migration should also remove the vulnerable transitive `vue-template-compiler` dependency.
|
|
13
|
+
|
|
14
|
+
## Scope
|
|
15
|
+
|
|
16
|
+
Files expected to change:
|
|
17
|
+
|
|
18
|
+
- `package.json`
|
|
19
|
+
- `package-lock.json`
|
|
20
|
+
- New root-level `jsdoc.json` configuration
|
|
21
|
+
- Existing `scripts/generate-api-markdown.js` renderer
|
|
22
|
+
- `eslint.config.mjs` for scoped Node.js globals when linting the renderer
|
|
23
|
+
- `README.md`
|
|
24
|
+
- `documentation/Bimplus Renderer basics.md` as the HTML landing-page source
|
|
25
|
+
- `documentation/convert_to_confluence_md.py`
|
|
26
|
+
- Remove obsolete `doc_config.yml`
|
|
27
|
+
- Generated files under `documentation/`
|
|
28
|
+
|
|
29
|
+
The following should remain functionally unchanged:
|
|
30
|
+
|
|
31
|
+
- JSDoc comments in `src/*.js`
|
|
32
|
+
- Application source, build, and test configuration
|
|
33
|
+
|
|
34
|
+
## Porting This Plan to Other Projects
|
|
35
|
+
|
|
36
|
+
Use this file as a migration template for each repository, not as a blind file-copy checklist. Before implementation, record the current source glob, generated output paths, existing `build-doc*` script names, Markdown heading/anchor conventions, and any downstream Confluence or publishing workflow. Preserve established output names and script interfaces when consumers depend on them; adapt paths and symbol grouping to that repository's JSDoc conventions.
|
|
37
|
+
|
|
38
|
+
The reference custom renderer in [scripts/generate-api-markdown.js](scripts/generate-api-markdown.js) is the implementation model. Copy it only after checking that the other repository's doclets use compatible `kind`, `memberof`, `scope`, and `longname` values. Add project-specific filters or display rules only when required by its documented public API.
|
|
39
|
+
|
|
40
|
+
## Implementation Steps
|
|
41
|
+
|
|
42
|
+
### 1. Replace development dependencies
|
|
43
|
+
|
|
44
|
+
Remove `documentation` from `devDependencies` and add:
|
|
45
|
+
|
|
46
|
+
- `jsdoc` for parsing source comments and generating HTML
|
|
47
|
+
- A repository-owned Markdown renderer using JSDoc's structured doclets
|
|
48
|
+
|
|
49
|
+
Remove any old generator dependencies and install JSDoc:
|
|
50
|
+
|
|
51
|
+
```powershell
|
|
52
|
+
npm uninstall documentation jsdoc-to-markdown
|
|
53
|
+
npm install --save-dev jsdoc
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Do not add a third-party Markdown generator. `scripts/generate-api-markdown.js` renders JSDoc doclets directly and validates symbol anchors.
|
|
57
|
+
|
|
58
|
+
Do not run `npm audit fix --force`; it may apply a breaking downgrade and does not provide a patched version of the vulnerable Vue 2 package.
|
|
59
|
+
|
|
60
|
+
### 2. Add `jsdoc.json`
|
|
61
|
+
|
|
62
|
+
Create a root-level JSDoc configuration with these requirements:
|
|
63
|
+
|
|
64
|
+
- Include JavaScript files under `src/`
|
|
65
|
+
- Recurse through the source directory
|
|
66
|
+
- Parse ES module syntax
|
|
67
|
+
- Write HTML output to `./documentation`
|
|
68
|
+
- Use `documentation/Bimplus Renderer basics.md` as the documentation landing-page content when supported
|
|
69
|
+
- Enable JSDoc's Markdown plugin and recursive source discovery
|
|
70
|
+
|
|
71
|
+
Proposed configuration:
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"source": {
|
|
76
|
+
"include": ["src"],
|
|
77
|
+
"includePattern": ".*\\.js$",
|
|
78
|
+
"excludePattern": "(^|[\\\\/])node_modules[\\\\/]"
|
|
79
|
+
},
|
|
80
|
+
"opts": {
|
|
81
|
+
"destination": "./documentation",
|
|
82
|
+
"recurse": true,
|
|
83
|
+
"readme": "./documentation/Bimplus Renderer basics.md"
|
|
84
|
+
},
|
|
85
|
+
"templates": {
|
|
86
|
+
"cleverLinks": false,
|
|
87
|
+
"monospaceLinks": true
|
|
88
|
+
},
|
|
89
|
+
"plugins": [
|
|
90
|
+
"plugins/markdown"
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
`opts.recurse: true` includes deeper source directories than the previous shallow globs. Review the additional doclets and exclude non-public implementation modules as needed. Do not add `plugins/recurse`: it is not shipped by JSDoc 4 and makes the command fail with "Unable to find the plugin". Validate the configuration against the installed JSDoc version.
|
|
96
|
+
|
|
97
|
+
### 3. Update npm scripts
|
|
98
|
+
|
|
99
|
+
Replace the current `documentation` commands with JSDoc equivalents while retaining the existing script names:
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"lint-doc": "jsdoc --configure jsdoc.json --explain",
|
|
104
|
+
"build-doc": "npm run lint-doc && jsdoc --configure jsdoc.json",
|
|
105
|
+
"build-docMd": "npm run lint-doc && node scripts/generate-api-markdown.js",
|
|
106
|
+
"build-docConf": "npm run build-docMd && cd ./documentation && python convert_to_confluence_md.py",
|
|
107
|
+
"build-docAll": "npm run build-doc && npm run build-docConf"
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
`scripts/generate-api-markdown.js` replaces `jsdoc2md`; do not add a third-party Markdown renderer. The renderer should:
|
|
112
|
+
|
|
113
|
+
1. Invoke the installed JSDoc CLI with `process.execPath`, the local `node_modules/jsdoc/jsdoc.js` entrypoint, `--configure jsdoc.json`, and `--explain`. Run with the repository root as `cwd`, capture stdout/stderr, and fail clearly on a non-zero exit or invalid JSON.
|
|
114
|
+
2. Parse the JSON doclets and include documented public classes, modules, namespaces, and supported API doclets only. Exclude undocumented, private, anonymous, and implementation-only symbols. Deduplicate repeated doclets by `longname`; group members by `memberof`; retain documented global functions.
|
|
115
|
+
3. Render the information present on doclets: container parameters, method signatures, descriptions, parameter tables, return values, callbacks/properties, types/defaults, deprecation/since/throws/see tags, and examples where present. Preserve the Markdown/HTML descriptions produced by JSDoc.
|
|
116
|
+
4. Emit both a useful API index and a section for each documented symbol. Escape values placed in code or Markdown tables without altering trusted JSDoc description markup.
|
|
117
|
+
5. Emit explicit `<a id="…" name="…"></a>` targets. Keep each fragment used in a Markdown link identical to an emitted ID. Normalize instance-method `#` separators to the existing `+` anchor form; preserve dots for static members/callbacks. For example, `BimExplorer#getUrl` maps to `BimExplorer+getUrl`, while `BimExplorer.this.onObjectSelected` keeps its dotted name. Handle nested names such as `BimExplorer.BimObjectProperties#load` explicitly.
|
|
118
|
+
6. Before writing the file, fail if a rendered API symbol has no anchor or if any generated `](#target)` link has no matching anchor ID. Create the destination directory if needed and write UTF-8.
|
|
119
|
+
|
|
120
|
+
The checks in the renderer protect the source Markdown structure. They do not replace rendering the Markdown and testing real click navigation in the target preview/browser.
|
|
121
|
+
|
|
122
|
+
The `lint-doc` command should be tested with the installed JSDoc CLI. Existing `@private` tags with values warn under JSDoc; do not use `--pedantic` unless those source comments are corrected. `--explain` emits a large doclet JSON report; suppress or capture that output in automated logs if it becomes unwieldy, while preserving the command's exit status.
|
|
123
|
+
|
|
124
|
+
### 4. Regenerate documentation
|
|
125
|
+
|
|
126
|
+
Run the formats individually first:
|
|
127
|
+
|
|
128
|
+
```powershell
|
|
129
|
+
npm run lint-doc
|
|
130
|
+
npm run build-doc
|
|
131
|
+
npm run build-docMd
|
|
132
|
+
npm run build-docConf
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Then run the complete workflow:
|
|
136
|
+
|
|
137
|
+
```powershell
|
|
138
|
+
npm run build-docAll
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
The Confluence converter should continue reading `Bimplus_Renderer_doc.md` from `documentation/` and writing `Bimplus_Renderer_doc_confluence.md`. It must:
|
|
142
|
+
|
|
143
|
+
- Read and write UTF-8 explicitly so Unicode output works on Windows.
|
|
144
|
+
- Rewrite links case-insensitively when JSDoc preserves case in fragments.
|
|
145
|
+
- When rewriting a target to `RendererApidescription-{fragment}`, emit a matching `<a id="RendererApidescription-{fragment}" name="RendererApidescription-{fragment}"></a>` alias. Rewriting links without creating matching targets leaves the converted document's links dead.
|
|
146
|
+
- Validate every converted internal Markdown link against an emitted ID before writing the final Confluence file.
|
|
147
|
+
|
|
148
|
+
Keep the raw Markdown IDs and Confluence aliases separate: the raw file uses the API fragments; only the Confluence variant uses the required `RendererApidescription-` prefix.
|
|
149
|
+
|
|
150
|
+
### 5. Review generated output
|
|
151
|
+
|
|
152
|
+
Check the following:
|
|
153
|
+
|
|
154
|
+
- `documentation/index.html` opens successfully
|
|
155
|
+
- HTML assets load without missing-file errors
|
|
156
|
+
- All documented public classes, modules, namespaces, methods, callbacks, parameters, and return values are represented
|
|
157
|
+
- Every rendered API symbol has a generated Markdown anchor, and internal Markdown links resolve
|
|
158
|
+
- Markdown headings and links are readable
|
|
159
|
+
- Confluence anchors contain the expected `RendererApidescription-` prefix
|
|
160
|
+
- Confluence-prefixed links have matching prefixed target IDs
|
|
161
|
+
- No stale files from the previous generator remain in the generated output
|
|
162
|
+
|
|
163
|
+
Do not treat matching fragment strings in source files as proof of working links. Render both Markdown files with the parser/preview used by their consumers, inspect the resulting `href` and `id` values, and click representative links: a class/module, an instance method containing `+`, a dotted member, and a nested method. If the consumer is VS Code Markdown Preview, test there; if the Confluence Markdown is pasted into Confluence, verify links in Confluence's preview/page because its anchor generation rules differ from local Markdown renderers.
|
|
164
|
+
|
|
165
|
+
JSDoc will produce a different HTML structure and may use different anchor names than documentation.js. This is expected, but no public API should disappear.
|
|
166
|
+
|
|
167
|
+
### 6. Update repository guidance
|
|
168
|
+
|
|
169
|
+
Update `README.md` to describe:
|
|
170
|
+
|
|
171
|
+
- `jsdoc.json`
|
|
172
|
+
- `jsdoc` and the repository-owned Markdown renderer
|
|
173
|
+
- The revised npm scripts
|
|
174
|
+
- The new HTML output structure
|
|
175
|
+
- The continued Markdown-to-Confluence conversion
|
|
176
|
+
- The fact that generated output must be regenerated after source JSDoc changes
|
|
177
|
+
- The repository-owned Markdown renderer and its symbol/link validation
|
|
178
|
+
- The distinction between raw Markdown IDs and Confluence-prefixed alias IDs
|
|
179
|
+
|
|
180
|
+
### 7. Remove obsolete dependency output
|
|
181
|
+
|
|
182
|
+
After a successful install, verify that the old packages are gone:
|
|
183
|
+
|
|
184
|
+
```powershell
|
|
185
|
+
npm ls documentation jsdoc-to-markdown vue-template-compiler
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
The command should report that none of these packages is installed, or that they are not found in the dependency tree. Search scripts, READMEs, and the lockfile for stale `jsdoc2md`/`jsdoc-to-markdown` references; the removal-check command in this plan may name the package intentionally.
|
|
189
|
+
|
|
190
|
+
Review `package-lock.json` for removal of the obsolete dependency chain. Do not remove unrelated lockfile changes produced by the package manager.
|
|
191
|
+
|
|
192
|
+
## Verification Checklist
|
|
193
|
+
|
|
194
|
+
Run the documentation workflow and existing project checks:
|
|
195
|
+
|
|
196
|
+
```powershell
|
|
197
|
+
npm install
|
|
198
|
+
npm run lint-doc
|
|
199
|
+
npm run build-docAll
|
|
200
|
+
npm run build
|
|
201
|
+
npm test
|
|
202
|
+
npm audit
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Also lint the renderer directly if the repository ESLint script does not include it:
|
|
206
|
+
|
|
207
|
+
```powershell
|
|
208
|
+
npx eslint scripts/generate-api-markdown.js
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Expected results:
|
|
212
|
+
|
|
213
|
+
- Documentation commands complete successfully
|
|
214
|
+
- Generated HTML, Markdown, and Confluence files exist
|
|
215
|
+
- The application build remains successful
|
|
216
|
+
- Existing tests remain successful
|
|
217
|
+
- The `vue-template-compiler` audit finding is no longer introduced by this documentation toolchain
|
|
218
|
+
- `jsdoc-to-markdown` is absent from the manifest, lockfile dependency tree, and generation scripts
|
|
219
|
+
- Rendered raw Markdown and Confluence Markdown links navigate to their intended targets in their actual consumers
|
|
220
|
+
|
|
221
|
+
`npm audit` may still report unrelated vulnerabilities. Record those separately instead of applying a forced dependency downgrade.
|
|
222
|
+
|
|
223
|
+
## Rollback
|
|
224
|
+
|
|
225
|
+
If the generated output loses API content or the Confluence conversion cannot be adapted safely:
|
|
226
|
+
|
|
227
|
+
1. Restore the previous `package.json` and `package-lock.json` documentation dependencies.
|
|
228
|
+
2. Remove `jsdoc.json` and restore `scripts/generate-api-markdown.js` to its pre-migration contents if rollback is required.
|
|
229
|
+
3. Restore the previous generated `documentation/` output.
|
|
230
|
+
4. Reassess the JSDoc configuration and renderer before retrying.
|
|
231
|
+
|
|
232
|
+
Do not modify application source code as part of rollback.
|
|
233
|
+
|
|
234
|
+
## Acceptance Criteria
|
|
235
|
+
|
|
236
|
+
The migration is complete when:
|
|
237
|
+
|
|
238
|
+
- `documentation` is no longer a development dependency
|
|
239
|
+
- JSDoc generates readable HTML from the reviewed JavaScript files under `src/`
|
|
240
|
+
- The repository-owned renderer generates the API Markdown file
|
|
241
|
+
- The existing Confluence conversion succeeds
|
|
242
|
+
- `build-doc`, `build-docMd`, `build-docConf`, and `build-docAll` all work
|
|
243
|
+
- Generated documentation is reviewed and committed
|
|
244
|
+
- Application build and tests remain unaffected
|
package/README.md
CHANGED
|
@@ -79,7 +79,7 @@ goto your application folder which uses the renderer
|
|
|
79
79
|
npm install
|
|
80
80
|
|
|
81
81
|
### Unit testing
|
|
82
|
-
Run tests from the renderer root. Vitest
|
|
82
|
+
Run tests from the renderer root. Vitest runs the unit and geometry DDT suites; the
|
|
83
83
|
test files import Vitest APIs directly. Browser globals, fixtures, and
|
|
84
84
|
test-only dependencies are initialized in `test/setup/vitestBrowser.setup.js`.
|
|
85
85
|
|
|
@@ -144,6 +144,75 @@ npm run test-vitest-modelviewer-chrome
|
|
|
144
144
|
npm run test-vitest-modelviewer-chrome-long
|
|
145
145
|
```
|
|
146
146
|
|
|
147
|
+
### Modelviewer image comparison (Playwright Test)
|
|
148
|
+
|
|
149
|
+
The standalone Playwright suite loads each IFC into the real renderer, checks
|
|
150
|
+
viewport diagnostics, fits a fixed perspective view without camera animation,
|
|
151
|
+
and compares the 1000 x 700 viewport against a PNG baseline. It uses the same
|
|
152
|
+
Vite shader/asset configuration and viewer helpers as the geometry DDT, without
|
|
153
|
+
reading or changing `Results.db` or requiring the DDT server.
|
|
154
|
+
|
|
155
|
+
```sh
|
|
156
|
+
npx playwright install firefox chromium
|
|
157
|
+
npm run test-modelviewer-ddt-visual
|
|
158
|
+
npm run test-modelviewer-ddt-visual-long
|
|
159
|
+
npx playwright test --project=chromium
|
|
160
|
+
npx playwright test --project=chromium-long
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
The IFC datasets must be present locally (use `sync-modelviewer-ddt` or
|
|
164
|
+
`sync-modelviewer-ddt-long` if needed). Only the selected dataset is required.
|
|
165
|
+
To run only one model, use Playwright's title filter:
|
|
166
|
+
|
|
167
|
+
```sh
|
|
168
|
+
npm run test-modelviewer-ddt-visual -- --grep "BasicProject.ifc"
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Missing baselines fail normal runs. To create only missing baselines without
|
|
172
|
+
replacing existing images:
|
|
173
|
+
|
|
174
|
+
```sh
|
|
175
|
+
npm run test-modelviewer-ddt-visual-init
|
|
176
|
+
npm run test-modelviewer-ddt-visual-long-init
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
To explicitly replace baselines after reviewing an intentional rendering change:
|
|
180
|
+
|
|
181
|
+
```sh
|
|
182
|
+
npm run test-modelviewer-ddt-visual -- --update-snapshots
|
|
183
|
+
npm run test-modelviewer-ddt-visual-long -- --update-snapshots
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Review the images before committing them under
|
|
187
|
+
`modelviewer-data-driven-tests/playwright/snapshots/`. Baselines are separated
|
|
188
|
+
by browser, dataset, and OS; generate and compare using the same OS and GPU
|
|
189
|
+
environment. The included Windows Firefox baselines cover both datasets;
|
|
190
|
+
other browser/OS combinations need their own initial baseline generation.
|
|
191
|
+
The per-test timeout is 100 minutes and includes IFC loading; the separate
|
|
192
|
+
15-second screenshot timeout starts only after loading and camera setup finish.
|
|
193
|
+
An `A snapshot doesn't exist` error means a baseline is missing, not that
|
|
194
|
+
loading timed out. Use the initialization command above in that case.
|
|
195
|
+
Comparisons allow a per-pixel color
|
|
196
|
+
threshold of 0.2 but no differing pixels above that threshold. Playwright waits for consecutive stable
|
|
197
|
+
screenshots rather than using a fixed sleep. Failures produce expected, actual,
|
|
198
|
+
and diff images under `test-results/modelviewer-visual/`; the HTML report is
|
|
199
|
+
in `playwright-report/`, with JUnit output in
|
|
200
|
+
`test-results/playwright-modelviewer-visual.xml`.
|
|
201
|
+
|
|
202
|
+
The HTML reporter uses hashed filenames internally. Actual comparison images
|
|
203
|
+
from failed comparisons are also copied directly to
|
|
204
|
+
`playwright-report/data/named/`, using the baseline filename without the
|
|
205
|
+
`-actual` suffix, for example `BasicProject-ifc.png`.
|
|
206
|
+
The filename comes from the matching baseline, preserving the full name even
|
|
207
|
+
when Playwright shortens the failure artifact's filename with a hash.
|
|
208
|
+
There are no subfolders, expected images, diff images, or full-page failure
|
|
209
|
+
screenshots in this folder.
|
|
210
|
+
If multiple browsers, repeats, or retries produce the same filename, the last
|
|
211
|
+
result in report order replaces the earlier copy; run one browser at a time
|
|
212
|
+
to keep its images separate. The internal hashed files are retained so the
|
|
213
|
+
HTML report's image viewer continues to work, including expected and diff
|
|
214
|
+
images. Both sets of report images are regenerated on each run.
|
|
215
|
+
|
|
147
216
|
Vitest writes JUnit output under `test-results/`. Firefox Istanbul coverage is
|
|
148
217
|
written under `coverage/`, including `coverage/lcov.info` for CI artifact
|
|
149
218
|
collection. Coverage instruments renderer source under `src/`, excluding
|
|
@@ -154,10 +223,9 @@ update reference data automatically. See
|
|
|
154
223
|
[the migration plan](KARMA_TO_VITEST_MIGRATION_PLAN.md) for remaining gates.
|
|
155
224
|
|
|
156
225
|
### Documentation
|
|
157
|
-
Bimplus
|
|
158
|
-
To generate a documentation please install documentation plugin via npm :
|
|
226
|
+
Bimplus Renderer documentation is generated with the local JSDoc dependency and the repository-owned API Markdown renderer. Install the project dependencies with `npm install` before running the documentation scripts.
|
|
159
227
|
|
|
160
|
-
|
|
228
|
+
JSDoc source discovery and HTML output are configured in `jsdoc.json`; `scripts/generate-api-markdown.js` renders the API doclets and checks Markdown anchors. Regenerate the documentation after changing source JSDoc comments. Raw Markdown uses API anchors, while the Confluence output adds matching `RendererApidescription-` aliases.
|
|
161
229
|
|
|
162
230
|
To create documentation in html format go to your renderer folder and run :
|
|
163
231
|
|