Skip to content

Commit 8eff9dd

Browse files
authored
fix(rspeedy/core): should run typia transform on CLI (#478)
<!-- Thank you for submitting a pull request! We appreciate the time and effort you have invested in making these changes. Please ensure that you provide enough information to allow others to review your pull request. Upon submission, your pull request will be automatically assigned with reviewers. If you want to learn more about contributing to this project, please visit: https://github.com/lynx-family/lynx-stack/blob/main/CONTRIBUTING.md. --> ## Summary <!-- Can you explain the reasoning behind implementing this change? What problem or issue does this pull request resolve? --> Fix a regression of #475: "Error on typia.createValidateEquals(): no transform has been configured." <!-- It would be helpful if you could provide any relevant context, such as GitHub issues or related discussions. --> ## Checklist <!--- Check and mark with an "x" --> - [ ] Tests updated (or not required). - [ ] Documentation updated (or not required).
1 parent d9b705b commit 8eff9dd

File tree

2 files changed

+26
-13
lines changed

2 files changed

+26
-13
lines changed

packages/rspeedy/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@
4141
"bin/rspeedy.js",
4242
"client",
4343
"dist",
44-
"register",
4544
"client.d.ts",
4645
"CHANGELOG.md",
4746
"README.md"
4847
],
4948
"scripts": {
5049
"api-extractor": "api-extractor run --verbose",
5150
"build": "rslib build",
51+
"prepublishOnly": "rslib build",
5252
"test": "pnpm -w run test --project rspeedy",
5353
"test:type": "vitest --typecheck.only"
5454
},

packages/rspeedy/core/rslib.config.ts

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineConfig } from '@rslib/core'
1+
import { defineConfig, type rsbuild } from '@rslib/core'
22
import { pluginPublint } from 'rsbuild-plugin-publint'
33
import { TypiaRspackPlugin } from 'typia-rspack-plugin'
44

@@ -8,17 +8,7 @@ export default defineConfig({
88
format: 'esm',
99
syntax: 'es2022',
1010
dts: { bundle: true },
11-
tools: {
12-
rspack: {
13-
plugins: [
14-
new TypiaRspackPlugin({
15-
cache: false,
16-
include: './src/config/validate.ts',
17-
tsconfig: './tsconfig.build.json',
18-
}),
19-
],
20-
},
21-
},
11+
plugins: [pluginTypia()],
2212
},
2313
{
2414
format: 'esm',
@@ -30,6 +20,7 @@ export default defineConfig({
3020
},
3121
},
3222
dts: false,
23+
plugins: [pluginTypia()],
3324
},
3425
{
3526
format: 'esm',
@@ -73,3 +64,25 @@ export default defineConfig({
7364
},
7465
},
7566
})
67+
68+
function pluginTypia(): rsbuild.RsbuildPlugin {
69+
return {
70+
name: 'rspeedy-plugin-typia',
71+
setup(api) {
72+
api.modifyBundlerChain(chain => {
73+
const { source } = api.getRsbuildConfig()
74+
75+
chain
76+
.plugin('typia')
77+
.use(TypiaRspackPlugin, [
78+
{
79+
cache: false,
80+
include: './src/config/validate.ts',
81+
tsconfig: source?.tsconfigPath,
82+
log: false,
83+
},
84+
])
85+
})
86+
},
87+
}
88+
}

0 commit comments

Comments
 (0)