Skip to content

Commit 80d56c9

Browse files
authored
feat: apply cumulative update to address various issues (#10324)
1 parent 621a7f0 commit 80d56c9

File tree

298 files changed

+11697
-12311
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

298 files changed

+11697
-12311
lines changed

.browserslistrc

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
maintained node versions
33

44
[node-development]
5-
node 20.3.0
5+
node 22
66

77
[browser-production]
88
> 1%
@@ -26,4 +26,4 @@ maintained node versions
2626
last 1 chrome version
2727
last 1 firefox version
2828
last 1 safari version
29-
node 20.3.0
29+
node 22

.eslintrc

-38
This file was deleted.

.eslintrc.js

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/**
2+
* @prettier
3+
*/
4+
const path = require("node:path")
5+
6+
module.exports = {
7+
parser: "@babel/eslint-parser",
8+
env: {
9+
browser: true,
10+
node: true,
11+
es6: true,
12+
jest: true,
13+
"jest/globals": true,
14+
},
15+
parserOptions: {
16+
ecmaFeatures: { jsx: true },
17+
babelOptions: { configFile: path.join(__dirname, "babel.config.js") },
18+
},
19+
extends: [
20+
"eslint:recommended",
21+
"plugin:react/recommended",
22+
"plugin:prettier/recommended",
23+
],
24+
plugins: ["react", "import", "jest", "prettier"],
25+
settings: {
26+
react: {
27+
pragma: "React",
28+
version: "15.0",
29+
},
30+
},
31+
rules: {
32+
semi: [2, "never"],
33+
strict: 0,
34+
quotes: [
35+
2,
36+
"double",
37+
{
38+
avoidEscape: true,
39+
allowTemplateLiterals: true,
40+
},
41+
],
42+
"no-unused-vars": 2,
43+
"no-multi-spaces": 1,
44+
camelcase: [
45+
"error",
46+
{
47+
allow: [
48+
"^UNSAFE_",
49+
"^requestSnippetGenerator_",
50+
"^JsonSchema_",
51+
"^curl_",
52+
"^dom_",
53+
"^api_",
54+
"^client_",
55+
"^grant_",
56+
"^code_",
57+
"^redirect_",
58+
"^spec",
59+
],
60+
},
61+
],
62+
"no-use-before-define": [2, "nofunc"],
63+
"no-underscore-dangle": 0,
64+
"no-unused-expressions": 1,
65+
"comma-dangle": 0,
66+
"no-console": [
67+
2,
68+
{
69+
allow: ["warn", "error"],
70+
},
71+
],
72+
"react/jsx-no-bind": 1,
73+
"react/jsx-no-target-blank": 2,
74+
"react/display-name": 0,
75+
"import/no-extraneous-dependencies": 2,
76+
"react/jsx-filename-extension": 2,
77+
},
78+
}

.lintstagedrc

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"*.js": "eslint"
2+
"*.{js,jsx}": ["eslint --max-warnings 0"],
3+
"*.scss": ["stylelint '**/*.scss'"]
34
}

.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20.3.0
1+
22.11.0

.releaserc

+9-19
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
{
22
"branches": [
3-
{
4-
"name": "master"
5-
},
6-
{
7-
"name": "next",
8-
"channel": "alpha",
9-
"prerelease": "alpha"
10-
}
3+
{"name": "master"}
114
],
125
"tagFormat": "v${version}",
136
"plugins": [
@@ -21,15 +14,12 @@
2114
"@semantic-release/release-notes-generator",
2215
"@semantic-release/npm",
2316
"@semantic-release/github",
24-
[
25-
"@semantic-release/git",
26-
{
27-
"assets": [
28-
"package.json",
29-
"package-lock.json"
30-
],
31-
"message": "chore(release): cut the ${nextRelease.version} release\n\n${nextRelease.notes}"
32-
}
33-
]
17+
["@semantic-release/git", {
18+
"assets": [
19+
"package.json",
20+
"package-lock.json"
21+
],
22+
"message": "chore(release): cut the ${nextRelease.version} release\n\n${nextRelease.notes}"
23+
}]
3424
]
35-
}
25+
}

Dockerfile

+7
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44

55
FROM nginx:1.27.4-alpine
66

7+
LABEL maintainer="[email protected]" \
8+
org.opencontainers.image.authors="[email protected]" \
9+
org.opencontainers.image.url="docker.swagger.io/swaggerapi/swagger-ui" \
10+
org.opencontainers.image.source="https://github.com/swagger-api/swagger-ui" \
11+
org.opencontainers.image.description="SwaggerUI Docker image" \
12+
org.opencontainers.image.licenses="Apache-2.0"
13+
714
RUN apk add --update-cache --no-cache "nodejs"
815

916
LABEL maintainer="char0n"

config/jest/jest.unit.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ module.exports = {
1818
moduleNameMapper: {
1919
'^.+\\.svg$': 'jest-transform-stub'
2020
},
21-
transformIgnorePatterns: ['/node_modules/(?!(sinon|react-syntax-highlighter)/)'],
21+
transformIgnorePatterns: ['/node_modules/(?!(sinon|react-syntax-highlighter|@asamuzakjp/css-color)/)'],
2222
silent: true, // set to `false` to allow console.* calls to be printed
2323
};

docs/development/scripts.md

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Script name | Description
1010
`lint` | Report ESLint style errors and warnings.
1111
`lint-errors` | Report ESLint style errors, without warnings.
1212
`lint-fix` | Attempt to fix style errors automatically.
13+
`lint-styles` | Report Stylelint style errors and warnings.
14+
`lint-styles-fix` | Attempt to fix Stylelint errors and warnings automatically.
1315
`watch` | Rebuild the core files in `/dist` when the source code changes. Useful for `npm link` with Swagger Editor.
1416

1517
### Building

docs/development/setting-up.md

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
# Setting up a dev environment
22

3-
Swagger UI includes a development server that provides hot module reloading and unminified stack traces, for easier development.
3+
SwaggerUI includes a development server that provides hot module reloading and unminified stack traces, for easier development.
44

55
### Prerequisites
66

77
- git, any version
8-
- **Node.js >=20.3.0** and **npm >=9.6.7** are the minimum required versions that this repo runs on, but we always recommend using the latest version of Node.js.
8+
- **Node.js >=22.11.0** and **npm >=10.9.0** are the minimum required versions that this repo runs on, but we always recommend using the latest version of Node.js.
9+
10+
911

1012
### Steps
1113

1214
1. `git clone https://github.com/swagger-api/swagger-ui.git`
1315
2. `cd swagger-ui`
1416
3. `npm install`
15-
4. `npm run dev`
16-
5. Wait a bit
17-
6. Open http://localhost:3200/
17+
4. `npx husky init` (optional)
18+
5. `npm run dev`
19+
6. Wait a bit
20+
7. Open http://localhost:3200/
1821

1922
### Using your own local api definition with local dev build
2023

docs/samples/webpack-getting-started/src/swagger-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
openapi: "3.0.0"
1+
openapi: "3.0.4"
22
info:
33
version: "0.0.1"
44
title: "Swagger UI Webpack Setup"

docs/usage/configuration.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ Set the value to the literal object value you'd like, taking care to escape char
371371
Example:
372372

373373
```sh
374-
SPEC="{ \"openapi\": \"3.0.0\" }"
374+
SPEC="{ \"openapi\": \"3.0.4\" }"
375375
```
376376

377377
### Docker-Compose

docs/usage/installation.md

+17
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,23 @@ We publish three modules to npm: **`swagger-ui`**, **`swagger-ui-dist`** and **`
1010
such as Webpack, Browserify, and Rollup. Its main file exports Swagger UI's main function,
1111
and the module also includes a namespaced stylesheet at `swagger-ui/dist/swagger-ui.css`. Here's an example:
1212

13+
### Installation
14+
15+
You can now install SwaggerUI packages using `npm`:
16+
17+
```sh
18+
$ npm install swagger-ui
19+
````
20+
21+
```sh
22+
$ npm install swagger-ui-react
23+
````
24+
25+
```sh
26+
$ npm install swagger-ui-dist
27+
````
28+
29+
1330
```javascript
1431
import SwaggerUI from 'swagger-ui'
1532
// or use require if you prefer

flavors/swagger-ui-react/README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Alternatively, you can set the environment variable `SCARF_ANALYTICS` to `false`
3333
Install `swagger-ui-react`:
3434

3535
```
36-
$ npm i --save swagger-ui-react
36+
$ npm install swagger-ui-react
3737
```
3838

3939
Use it in your React application:
@@ -194,6 +194,11 @@ Redirect url given as parameter to the oauth2 provider. Default the url refers t
194194

195195
⚠️ This prop is currently only applied once, on mount. Changes to this prop's value will not be propagated to the underlying Swagger UI instance. A future version of this module will remove this limitation, and the change will not be considered a breaking change.
196196

197+
#### `initialState`: PropTypes.object
198+
199+
Passes initial values to the Swagger UI state.
200+
201+
⚠️ This prop is currently only applied once, on mount. Changes to this prop's value will not be propagated to the underlying Swagger UI instance. A future version of this module will remove this limitation, and the change will not be considered a breaking change.
197202

198203
## Limitations
199204

flavors/swagger-ui-react/index.jsx

+3
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const SwaggerUI = ({
4545
persistAuthorization = config.defaults.persistAuthorization,
4646
oauth2RedirectUrl = config.defaults.oauth2RedirectUrl,
4747
onComplete = null,
48+
initialState = config.defaults.initialState,
4849
}) => {
4950
const [system, setSystem] = useState(null)
5051
const SwaggerUIComponent = system?.getComponent("App", "root")
@@ -83,6 +84,7 @@ const SwaggerUI = ({
8384
filter,
8485
persistAuthorization,
8586
withCredentials,
87+
initialState,
8688
...(typeof oauth2RedirectUrl === "string"
8789
? { oauth2RedirectUrl: oauth2RedirectUrl }
8890
: {}),
@@ -165,6 +167,7 @@ SwaggerUI.propTypes = {
165167
persistAuthorization: PropTypes.bool,
166168
withCredentials: PropTypes.bool,
167169
oauth2RedirectUrl: PropTypes.string,
170+
initialState: PropTypes.object,
168171
}
169172
SwaggerUI.System = SwaggerUIConstructor.System
170173
SwaggerUI.presets = SwaggerUIConstructor.presets

0 commit comments

Comments
 (0)