Skip to content

Commit 8e585f9

Browse files
committed
feat!: migrate to tsdown, vitest, and oxc tooling
1 parent c821cce commit 8e585f9

33 files changed

+4125
-6077
lines changed

.lintstagedrc.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"*.{js,json,md,mjs,ts,yaml,yml}": "prettier --write"
2+
"*.{js,mjs,ts}": ["oxlint -c ./.oxlintrc.json", "oxfmt --config ./.oxfmtrc.json --write"],
3+
"vitest.config.mjs": "oxfmt --config ./.oxfmtrc.json --write",
4+
"tsdown.config.mjs": "oxfmt --config ./.oxfmtrc.json --write"
35
}

.oxfmtrc.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"endOfLine": "lf",
3+
"printWidth": 120,
4+
"singleQuote": true,
5+
"trailingComma": "all",
6+
"ignorePatterns": [
7+
"node_modules",
8+
"dist",
9+
"coverage",
10+
"*.tgz"
11+
]
12+
}

.oxlintrc.json

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"$schema": "./node_modules/oxlint/configuration_schema.json",
3+
"env": {
4+
"browser": true,
5+
"node": true
6+
},
7+
"plugins": ["typescript"],
8+
"ignorePatterns": ["dist/**", "coverage/**"],
9+
"rules": {
10+
"no-unused-vars": ["error", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }]
11+
},
12+
"overrides": [
13+
{
14+
"files": ["**/*.ts"],
15+
"rules": {
16+
"no-unused-vars": "off",
17+
"typescript/ban-ts-comment": "error",
18+
"typescript/no-inferrable-types": "off",
19+
"typescript/no-unused-vars": ["error", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }],
20+
"typescript/no-explicit-any": "error"
21+
}
22+
},
23+
{
24+
"files": ["src/lib/lifecycle-hooks.ts"],
25+
"rules": {
26+
"typescript/no-explicit-any": "off"
27+
}
28+
},
29+
{
30+
"files": ["tests/**/*.ts"],
31+
"globals": {
32+
"afterAll": "readonly",
33+
"afterEach": "readonly",
34+
"beforeAll": "readonly",
35+
"beforeEach": "readonly",
36+
"describe": "readonly",
37+
"expect": "readonly",
38+
"it": "readonly",
39+
"test": "readonly"
40+
},
41+
"rules": {
42+
"typescript/no-explicit-any": "off"
43+
}
44+
},
45+
{
46+
"files": ["tools/**/*.ts"],
47+
"rules": {
48+
"typescript/no-explicit-any": "off"
49+
}
50+
},
51+
{
52+
"files": ["src/lib/generated/**/*.ts"],
53+
"rules": {
54+
"typescript/no-explicit-any": "off",
55+
"typescript/no-unused-vars": "off"
56+
}
57+
}
58+
]
59+
}

.prettierignore

Lines changed: 0 additions & 6 deletions
This file was deleted.

.prettierrc.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ npm run build
1919
npm run validate:package
2020
```
2121

22-
- `npm run lint` checks the ESLint and Prettier baselines.
23-
- `npm run test` runs the manual-code typecheck, the test TypeScript compile, and Jest.
22+
- `npm run lint` checks the Oxlint and Oxfmt baselines.
23+
- `npm run test` runs the manual-code typecheck and Vitest.
2424
- `npm run build` creates the distributable package under `dist/`.
25-
- `npm run validate:package` builds the package, validates the packaged manifest, and smoke-tests the packed tarball.
25+
- `npm run validate:package` builds the package, runs package-shape validation, and smoke-tests the packed tarball.
2626

2727
### Generated code workflow
2828

@@ -44,7 +44,7 @@ The tooling architecture and generator rationale are documented in [tools/README
4444

4545
### Browser examples
4646

47-
The package still ships a standalone browser bundle for direct script usage. To build the bundle and open the browser examples locally:
47+
The package ships browser examples for both the native ESM build and the standalone UMD bundle. To build the package and open the browser examples locally:
4848

4949
```sh
5050
npm run serve

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ With this SDK, you can:
3030
- Parse workflow definitions in JSON and YAML formats
3131
- Programmatically build workflow definitions
3232
- Validate workflow definitions
33-
- Consume the SDK from Node.js runtimes and modern browsers, including a standalone browser bundle
33+
- Consume the SDK from Node.js runtimes and modern browsers through CommonJS, native ESM, and a standalone UMD bundle
3434

3535
## Status
3636

@@ -369,7 +369,7 @@ flowchart TD
369369
classDef hidden width: 1px, height: 0px, opacity: 0;
370370
```
371371

372-
You can refer to the Mermaid browser example for a live demo. The top-level [`examples/browser`](./examples/browser) samples use native ESM imports, while the legacy standalone bundle samples are preserved under [`examples/browser/umd`](./examples/browser/umd).
372+
You can refer to the Mermaid browser examples for a live demo. The browser samples under [`examples/browser`](./examples/browser) include native ESM examples and legacy UMD-global examples under [`examples/browser/umd`](./examples/browser/umd).
373373

374374
### Building Locally
375375

@@ -384,13 +384,13 @@ npm run test
384384
npm run validate:package
385385
```
386386

387-
You can also build the standalone browser bundle and run the browser examples by executing:
387+
You can also build the package and run the browser examples by executing:
388388

389389
```sh
390390
npm run serve
391391
```
392392

393-
This serves the ESM-first examples in [`examples/browser`](./examples/browser). If you want to compare them with the legacy standalone bundle usage, open the matching files under [`examples/browser/umd`](./examples/browser/umd).
393+
This serves the browser examples in [`examples/browser`](./examples/browser), including both native ESM samples and UMD-global samples in [`examples/browser/umd`](./examples/browser/umd).
394394

395395
Generated files live under `src/lib/generated/` and should be refreshed with:
396396

RELEASING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
4. Run `npm run test`.
77
5. Run `npm run validate:package`.
88
6. Run `npm run codegen:check` if generator or schema inputs changed.
9-
7. Review the packed `dist/package.json` and confirm the public API shape is unchanged for `1.x`.
10-
8. Update release notes with any consumer-facing packaging, runtime, or migration details.
9+
7. Review the packed `dist/package.json` and confirm the documented `import`, `require`, `browser`, and `types` entrypoints are correct.
10+
8. Update release notes with any consumer-facing packaging, runtime, or migration details, especially browser ESM and UMD guidance.
1111
9. Create the GitHub release tag and let the publish workflow release from CI.

eslint.config.js

Lines changed: 0 additions & 57 deletions
This file was deleted.

examples/browser/mermaid.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<div id="diagram-container"></div>
1414
<pre id="output"></pre>
1515
<script type="module">
16-
import { Classes, convertToMermaidCode } from '../../dist/esm/index.js';
16+
import { Classes, convertToMermaidCode } from '../../dist/index.mjs';
1717
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs';
1818

1919
(async () => {

0 commit comments

Comments
 (0)