可以通过在项目根目录中输入 npm run <script name>
来运行以下任何脚本。
开发
脚本名称 | 描述 |
---|
dev | 在端口 3200 上生成一个热重载开发服务器。 |
deps-check | 生成 Swagger UI 依赖项的大小和许可报告。 |
lint | 报告 ESLint 样式错误和警告。 |
lint-errors | 报告 ESLint 样式错误,不包括警告。 |
lint-fix | 尝试自动修复样式错误。 |
watch | 当源代码更改时,在 /dist 中重建核心文件。对于使用 Swagger 编辑器的 npm link 很有用。 |
构建
脚本名称 | 描述 |
---|
build | 构建一组新的 JS 和 CSS 资产,并将它们输出到 /dist 。 |
build-bundle | 仅构建 swagger-ui-bundle.js (commonJS)。 |
build-core | 仅构建 swagger-ui.(js|css) (commonJS)。 |
build-standalone | 仅构建 swagger-ui-standalone-preset.js (commonJS)。 |
build-stylesheets | 仅构建 swagger-ui.css 。 |
build:es:bundle | 仅构建 swagger-ui-es-bundle.js (es2015)。 |
build:es:bundle:core | 仅构建 swagger-ui-es-bundle-core.js (es2015)。 |
测试
脚本名称 | 描述 |
---|
test | 在 Node 中运行单元测试,运行 Cypress 端到端测试,并在仅限错误的模式下运行 ESLint。 |
test:unit | 在 Node 中运行 Jest 单元测试。 |
e2e | 运行端到端测试(需要 JDK 和 Selenium)。 |
e2e-cypress | 使用 Cypress 运行端到端浏览器测试。 |
dev-e2e-cypress | 开发模式,打开 Cypress 运行器并手动选择要运行的测试。 |
lint | 运行 ESLint 测试 |
test:artifact | 在 Jest 中运行捆绑包工件测试列表 |
test:artifact:umd:bundle | 运行单元测试,确认 swagger-ui-bundle 导出为函数 |
test:artifact:es:bundle | 运行单元测试,确认 swagger-ui-es-bundle 导出为函数 |
test:artifact:es:bundle:core | 运行单元测试,确认 swagger-ui-es-bundle-core 导出为函数 |