Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
27902a7
feat(ts): add TypeScript typings and type-check tests
UmbraCi Aug 8, 2025
6902d75
refactor(ts): move type definitions to separate types/ directory
UmbraCi Aug 9, 2025
7a93628
fix: 修复 jsmind.screenshot.d.ts 中的模块扩展语法错误
UmbraCi Aug 9, 2025
f1a789c
fix: run prettier lint
UmbraCi Aug 9, 2025
3570508
refactor(typings): use package-name module augmentation and English c…
UmbraCi Aug 9, 2025
dd37dbb
chore(types): move TS type-check fixture to tests/fixtures and drop u…
UmbraCi Aug 9, 2025
f56b662
test(typings): update test title to fixtures path after file move
UmbraCi Aug 9, 2025
5768f9d
build(types): add JSDoc-based .d.ts generation via tsc allowJs\n\n- a…
UmbraCi Aug 10, 2025
70f1085
docs(typings): convert comments to English and exclude js-legacy from…
UmbraCi Aug 10, 2025
0854a0d
chore: 安装自动生成.d.ts依赖
UmbraCi Aug 10, 2025
9a9372c
chore: replace remaining Chinese comment in typings fixture and ensur…
UmbraCi Aug 10, 2025
fd1777d
docs(jsdoc): annotate jsMind.find_node_before param and return types\…
UmbraCi Aug 10, 2025
91e9749
feat(types): add JSDoc annotations and prepublish type generation
UmbraCi Aug 10, 2025
d63514c
feat(types): migrate and regenerate TypeScript declarations; align co…
UmbraCi Aug 10, 2025
a52076a
docs(changelog): document PR changes (typings migration, CI, scripts,…
UmbraCi Aug 10, 2025
ff6d27f
chore(typings): regenerate declarations; sync JSDoc/comments across c…
UmbraCi Aug 10, 2025
ad21b4a
chore: format code
UmbraCi Aug 10, 2025
b867eaf
chore(types): ignore generated d.ts; auto-generate on test/prepare/pu…
UmbraCi Aug 10, 2025
121c28c
chore(build): fix UMD plugin bundles by adding output.name and using …
UmbraCi Aug 10, 2025
f1dbc0c
chore: format package.json
UmbraCi Aug 10, 2025
fc4c4a7
chore(ci): exclude generated declaration files from Prettier check (t…
UmbraCi Aug 10, 2025
6e57fb6
chore(ci): fix Prettier ignore paths for CI by using paths relative t…
UmbraCi Aug 10, 2025
33c3962
chore(types): generate top-level types entry from src and ignore hand…
UmbraCi Aug 10, 2025
d082861
chore: format types-index.ts
UmbraCi Aug 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions .config/prettierignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
.config
.github
.vscode
docs
es6
js-legacy
node_modules
screenshots
LICENSE
package-lock.json
../.github
../.vscode
../docs
../es6
../js-legacy
../node_modules
../screenshots
../LICENSE
../package-lock.json
../types/generated
4 changes: 4 additions & 0 deletions .config/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ export default [
{
input: 'src/plugins/jsmind.draggable-node.js',
output: {
name: 'jsMindDraggableNode',
file: 'es6/jsmind.draggable-node.js',
format: 'umd',
banner: '/**\n* @license BSD-3-Clause\n* @copyright 2014-2025 hizzgdev@163.com\n*\n* Project Home:\n* https://github.com/hizzgdev/jsmind/\n*/',
sourcemap: true,
globals: {
jsmind: 'jsMind',
},
exports: 'named',
},
external: ['jsmind'],
plugins: [
Expand All @@ -48,6 +50,7 @@ export default [
{
input: 'src/plugins/jsmind.screenshot.js',
output: {
name: 'jsMindScreenshot',
file: 'es6/jsmind.screenshot.js',
format: 'umd',
banner: '/**\n* @license BSD-3-Clause\n* @copyright 2014-2025 hizzgdev@163.com\n*\n* Project Home:\n* https://github.com/hizzgdev/jsmind/\n*/',
Expand All @@ -56,6 +59,7 @@ export default [
'jsmind': 'jsMind',
'dom-to-image': 'domtoimage',
},
exports: 'named',
},
external: ['jsmind', 'dom-to-image'],
plugins: [
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 18.x
- run: npm ci
- run: npm ci && npm run gen:dts:check
- run: npm test

publish-npm:
Expand All @@ -28,7 +28,7 @@ jobs:
node-version: 18.x
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run build
- run: npm run gen:dts && npm run build
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
node_modules/
es6/*.js
es6/*.js.map
types/generated/
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
## Changelog / 变更日志

### 2025-08-10

- Added

- Central typings entry `types/index.d.ts` and regenerated declaration files under `types/generated/` for core and plugins (dom, format, graph, layout_provider, mind, node, option, plugin, shortcut_provider, util, view_provider, draggable-node, screenshot).
- Declaration build config `tsconfig.decls.json` and npm scripts: `gen:dts`, `gen:dts:check`.
- TypeScript typings validation: `tests/unit/typescript.types.test.js` with fixture `tests/fixtures/typescript-test.ts` using TypeScript Compiler API.

- Changed

- Updated `package.json` to expose `types` via `types/index.d.ts` and added scripts for generating/checking declarations.
- Enriched JSDoc and in-source documentation across core modules and plugins to improve generated typings (data_provider, dom, format, graph, layout_provider, mind, node, option, plugin, util, view_provider, draggable-node, screenshot).
- Updated `tsconfig.json` strictness and paths; CI updated to run `npm run gen:dts` before build and include `gen:dts:check` in install pipeline.
- Dev dependencies refreshed, adding `typescript`, `tsd-jsdoc`, and updating various `@types/*`, jest, jsdoc toolchain packages.

- Removed

- Legacy type files under `types/` (`jsmind.d.ts`, `jsmind.draggable-node.d.ts`, `jsmind.screenshot.d.ts`) in favor of `types/generated/`.

- Notes

- Running `npm test` now validates both runtime tests and TypeScript definitions. Consumers can rely on the aggregated public typings from the package root; plugin typings are exposed under `plugins/` paths.

### 2025-08-09

- Added

- TypeScript support: publish `.d.ts` for core and plugins (`es6/jsmind.d.ts`, `es6/jsmind.draggable-node.d.ts`, `es6/jsmind.screenshot.d.ts`).
- Type checking in CI: added Jest test `tests/unit/typescript.types.test.js` using TypeScript Compiler API to verify typings with `tsconfig.json` (noEmit).

- Changed

- Updated root `package.json` to expose `types` and proper `exports` fields for typings.

- Notes

- The TS example `example/typescript-test.ts` is included in `tsconfig.json#includes` for compile-time verification.
- Running `npm test` will now validate TypeScript definitions.
Loading