@kubb/plugin-cypress 5.0.0-beta.42 → 5.0.0-beta.56
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/dist/index.cjs +93 -148
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +8 -12
- package/dist/index.js +94 -149
- package/dist/index.js.map +1 -1
- package/package.json +7 -15
- package/src/components/Request.tsx +3 -3
- package/src/generators/cypressGenerator.tsx +2 -2
- package/src/plugin.ts +2 -2
- package/src/resolvers/resolverCypress.ts +2 -2
- package/src/types.ts +8 -12
- package/extension.yaml +0 -908
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-cypress",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.56",
|
|
4
4
|
"description": "Generate Cypress request commands and e2e test fixtures from your OpenAPI specification, enabling automated API testing with zero manual setup.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"code-generation",
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
"files": [
|
|
25
25
|
"src",
|
|
26
26
|
"dist",
|
|
27
|
-
"extension.yaml",
|
|
28
27
|
"!/**/**.test.**",
|
|
29
28
|
"!/**/__tests__/**",
|
|
30
29
|
"!/**/__snapshots__/**"
|
|
@@ -47,30 +46,23 @@
|
|
|
47
46
|
"registry": "https://registry.npmjs.org/"
|
|
48
47
|
},
|
|
49
48
|
"dependencies": {
|
|
50
|
-
"@kubb/core": "5.0.0-beta.
|
|
51
|
-
"@kubb/renderer-jsx": "5.0.0-beta.
|
|
52
|
-
"@kubb/plugin-ts": "5.0.0-beta.
|
|
49
|
+
"@kubb/core": "5.0.0-beta.55",
|
|
50
|
+
"@kubb/renderer-jsx": "5.0.0-beta.55",
|
|
51
|
+
"@kubb/plugin-ts": "5.0.0-beta.56"
|
|
53
52
|
},
|
|
54
53
|
"devDependencies": {
|
|
55
54
|
"@internals/shared": "0.0.0",
|
|
56
55
|
"@internals/utils": "0.0.0"
|
|
57
56
|
},
|
|
58
57
|
"peerDependencies": {
|
|
59
|
-
"@kubb/renderer-jsx": "5.0.0-beta.
|
|
58
|
+
"@kubb/renderer-jsx": "5.0.0-beta.55"
|
|
60
59
|
},
|
|
61
|
-
"size-limit": [
|
|
62
|
-
{
|
|
63
|
-
"path": "./dist/*.js",
|
|
64
|
-
"limit": "510 KiB",
|
|
65
|
-
"gzip": true
|
|
66
|
-
}
|
|
67
|
-
],
|
|
68
60
|
"engines": {
|
|
69
61
|
"node": ">=22"
|
|
70
62
|
},
|
|
71
63
|
"scripts": {
|
|
72
|
-
"build": "tsdown
|
|
73
|
-
"clean": "
|
|
64
|
+
"build": "tsdown",
|
|
65
|
+
"clean": "node -e \"require('node:fs').rmSync('./dist', {recursive:true,force:true})\"",
|
|
74
66
|
"lint": "oxlint .",
|
|
75
67
|
"lint:fix": "oxlint --fix .",
|
|
76
68
|
"release": "pnpm publish --no-git-check",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getOperationParameters } from '@internals/shared'
|
|
2
|
-
import { camelCase,
|
|
2
|
+
import { camelCase, Url } from '@internals/utils'
|
|
3
3
|
import { ast } from '@kubb/core'
|
|
4
4
|
import type { ResolverTs } from '@kubb/plugin-ts'
|
|
5
5
|
import { functionPrinter } from '@kubb/plugin-ts'
|
|
@@ -55,10 +55,10 @@ export function Request({ baseURL = '', name, dataReturnType, resolver, node, pa
|
|
|
55
55
|
// even when the OpenAPI spec has inconsistent casing between the two.
|
|
56
56
|
const pathParamNameMap = new Map(casedPathParams.map((p) => [camelCase(p.name), p.name]))
|
|
57
57
|
|
|
58
|
-
const
|
|
59
|
-
const urlTemplate = urlPath.toTemplateString({
|
|
58
|
+
const urlTemplate = Url.toTemplateString(node.path, {
|
|
60
59
|
prefix: baseURL,
|
|
61
60
|
replacer: (param) => pathParamNameMap.get(camelCase(param)) ?? param,
|
|
61
|
+
casing: paramsCasing,
|
|
62
62
|
})
|
|
63
63
|
|
|
64
64
|
const requestOptions: Array<string> = [`method: '${node.method}'`, `url: ${urlTemplate}`]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { resolveOperationTypeNames } from '@internals/shared'
|
|
2
2
|
import { ast, defineGenerator } from '@kubb/core'
|
|
3
3
|
import { pluginTsName } from '@kubb/plugin-ts'
|
|
4
|
-
import { File,
|
|
4
|
+
import { File, jsxRenderer } from '@kubb/renderer-jsx'
|
|
5
5
|
import { Request } from '../components/Request.tsx'
|
|
6
6
|
import type { PluginCypress } from '../types.ts'
|
|
7
7
|
|
|
@@ -12,7 +12,7 @@ import type { PluginCypress } from '../types.ts'
|
|
|
12
12
|
*/
|
|
13
13
|
export const cypressGenerator = defineGenerator<PluginCypress>({
|
|
14
14
|
name: 'cypress',
|
|
15
|
-
renderer:
|
|
15
|
+
renderer: jsxRenderer,
|
|
16
16
|
operation(node, ctx) {
|
|
17
17
|
if (!ast.isHttpOperationNode(node)) return null
|
|
18
18
|
const { config, resolver, driver, root } = ctx
|
package/src/plugin.ts
CHANGED
|
@@ -36,7 +36,7 @@ export const pluginCypressName = 'plugin-cypress' satisfies PluginCypress['name'
|
|
|
36
36
|
*/
|
|
37
37
|
export const pluginCypress = definePlugin<PluginCypress>((options) => {
|
|
38
38
|
const {
|
|
39
|
-
output = { path: 'cypress',
|
|
39
|
+
output = { path: 'cypress', barrel: { type: 'named' } },
|
|
40
40
|
group,
|
|
41
41
|
exclude = [],
|
|
42
42
|
include,
|
|
@@ -51,7 +51,7 @@ export const pluginCypress = definePlugin<PluginCypress>((options) => {
|
|
|
51
51
|
generators: userGenerators = [],
|
|
52
52
|
} = options
|
|
53
53
|
|
|
54
|
-
const groupConfig = createGroupConfig(group
|
|
54
|
+
const groupConfig = createGroupConfig(group)
|
|
55
55
|
|
|
56
56
|
return {
|
|
57
57
|
name: pluginCypressName,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { camelCase } from '@internals/utils'
|
|
1
|
+
import { camelCase, toFilePath } from '@internals/utils'
|
|
2
2
|
import { defineResolver } from '@kubb/core'
|
|
3
3
|
import type { PluginCypress } from '../types.ts'
|
|
4
4
|
|
|
@@ -18,7 +18,7 @@ export const resolverCypress = defineResolver<PluginCypress>(() => ({
|
|
|
18
18
|
name: 'default',
|
|
19
19
|
pluginName: 'plugin-cypress',
|
|
20
20
|
default(name, type) {
|
|
21
|
-
return
|
|
21
|
+
return type === 'file' ? toFilePath(name) : camelCase(name)
|
|
22
22
|
},
|
|
23
23
|
resolveName(name) {
|
|
24
24
|
return this.default(name, 'function')
|
package/src/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ast, Exclude, Generator, Group, Include, Output, Override, PluginFactoryOptions, Resolver } from '@kubb/core'
|
|
1
|
+
import type { ast, Exclude, Generator, Group, Include, Output, OutputOptions, Override, PluginFactoryOptions, Resolver } from '@kubb/core'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Resolver for Cypress that provides naming methods for test functions.
|
|
@@ -46,13 +46,13 @@ type ParamsTypeOptions =
|
|
|
46
46
|
pathParamsType?: 'object' | 'inline'
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Where the generated Cypress helpers are written and how they are exported, plus the optional
|
|
51
|
+
* `group` strategy. The `group` option organizes `output.mode: 'directory'` output into per-tag or per-path subdirectories.
|
|
52
|
+
*
|
|
53
|
+
* @default { path: 'cypress', barrel: { type: 'named' } }
|
|
54
|
+
*/
|
|
55
|
+
export type Options = OutputOptions & {
|
|
56
56
|
/**
|
|
57
57
|
* Shape of the value returned from each helper.
|
|
58
58
|
* - `'data'` — only the response body.
|
|
@@ -72,10 +72,6 @@ export type Options = {
|
|
|
72
72
|
* adapter's server URL (typically `servers[0].url`).
|
|
73
73
|
*/
|
|
74
74
|
baseURL?: string
|
|
75
|
-
/**
|
|
76
|
-
* Split generated files into subfolders based on the operation's tag.
|
|
77
|
-
*/
|
|
78
|
-
group?: Group
|
|
79
75
|
/**
|
|
80
76
|
* Skip operations matching at least one entry in the list.
|
|
81
77
|
*/
|