@zuplo/cli 7.10.0 → 7.11.1
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/common/worker-output.d.ts +7 -0
- package/dist/common/worker-output.d.ts.map +1 -1
- package/dist/common/worker-output.js +39 -0
- package/dist/common/worker-output.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@hono/node-server/README.md +2 -0
- package/node_modules/@hono/node-server/dist/index.cjs +1 -1
- package/node_modules/@hono/node-server/dist/index.mjs +1 -1
- package/node_modules/@hono/node-server/dist/serve-static.cjs +2 -1
- package/node_modules/@hono/node-server/dist/serve-static.mjs +2 -1
- package/node_modules/@hono/node-server/package.json +1 -1
- package/node_modules/@posthog/core/dist/metrics/index.d.ts +9 -0
- package/node_modules/@posthog/core/dist/metrics/index.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/metrics/index.js +38 -3
- package/node_modules/@posthog/core/dist/metrics/index.mjs +38 -3
- package/node_modules/@posthog/core/dist/metrics/types.d.ts +7 -2
- package/node_modules/@posthog/core/dist/metrics/types.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/traces/ids.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/traces/ids.js +2 -2
- package/node_modules/@posthog/core/dist/traces/ids.mjs +2 -2
- package/node_modules/@posthog/core/dist/types.d.ts +1 -1
- package/node_modules/@posthog/core/dist/types.d.ts.map +1 -1
- package/node_modules/@posthog/core/package.json +4 -3
- package/node_modules/@posthog/core/src/metrics/index.spec.ts +75 -0
- package/node_modules/@posthog/core/src/metrics/index.ts +60 -0
- package/node_modules/@posthog/core/src/metrics/types.ts +7 -1
- package/node_modules/@posthog/core/src/traces/ids.ts +4 -2
- package/node_modules/@posthog/core/src/types.ts +1 -1
- package/node_modules/@posthog/types/dist/capture-metric.d.ts +10 -0
- package/node_modules/@posthog/types/dist/capture-metric.d.ts.map +1 -1
- package/node_modules/@posthog/types/dist/capture.d.ts +1 -1
- package/node_modules/@posthog/types/dist/capture.d.ts.map +1 -1
- package/node_modules/@posthog/types/dist/index.d.ts +1 -1
- package/node_modules/@posthog/types/dist/index.d.ts.map +1 -1
- package/node_modules/@posthog/types/package.json +1 -1
- package/node_modules/@posthog/types/src/capture-metric.ts +11 -0
- package/node_modules/@posthog/types/src/capture.ts +1 -1
- package/node_modules/@posthog/types/src/index.ts +1 -0
- package/node_modules/@zuplo/core/customer.cli.minified.js +272 -261
- package/node_modules/@zuplo/core/index.minified.js +276 -265
- package/node_modules/@zuplo/core/package.json +1 -1
- package/node_modules/@zuplo/graphql/package.json +1 -1
- package/node_modules/@zuplo/openapi-tools/package.json +5 -2
- package/node_modules/@zuplo/otel/package.json +1 -1
- package/node_modules/@zuplo/runtime/out/esm/{chunk-YJ2BHVUH.js → chunk-CDEAY3VY.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/chunk-LVSZ3WTO.js +37 -0
- package/node_modules/@zuplo/runtime/out/esm/chunk-LVSZ3WTO.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/{chunk-VTO3F6DK.js → chunk-NUVXDVLJ.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/{chunk-6YPRGG62.js → chunk-RHU3Z7DA.js} +108 -108
- package/node_modules/@zuplo/runtime/out/esm/chunk-RHU3Z7DA.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/internal/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/sdks/aws/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/types/index.d.ts +15 -24
- package/node_modules/@zuplo/runtime/out/types/internal/index.d.ts +14 -0
- package/node_modules/@zuplo/runtime/package.json +1 -1
- package/package.json +15 -12
- package/dist/__tests__/archive-utils.test.d.ts +0 -2
- package/dist/__tests__/archive-utils.test.d.ts.map +0 -1
- package/dist/__tests__/archive-utils.test.js +0 -50
- package/dist/__tests__/archive-utils.test.js.map +0 -1
- package/dist/__tests__/import-openapi.test.d.ts +0 -2
- package/dist/__tests__/import-openapi.test.d.ts.map +0 -1
- package/dist/__tests__/import-openapi.test.js +0 -251
- package/dist/__tests__/import-openapi.test.js.map +0 -1
- package/dist/__tests__/integration/confirm-linked-config.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/confirm-linked-config.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/confirm-linked-config.integration.test.js +0 -202
- package/dist/__tests__/integration/confirm-linked-config.integration.test.js.map +0 -1
- package/dist/__tests__/integration/confirm-production-deploy.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/confirm-production-deploy.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/confirm-production-deploy.integration.test.js +0 -184
- package/dist/__tests__/integration/confirm-production-deploy.integration.test.js.map +0 -1
- package/dist/__tests__/integration/custom-domain.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/custom-domain.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/custom-domain.integration.test.js +0 -563
- package/dist/__tests__/integration/custom-domain.integration.test.js.map +0 -1
- package/dist/__tests__/integration/delete.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/delete.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/delete.integration.test.js +0 -262
- package/dist/__tests__/integration/delete.integration.test.js.map +0 -1
- package/dist/__tests__/integration/deploy.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/deploy.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/deploy.integration.test.js +0 -519
- package/dist/__tests__/integration/deploy.integration.test.js.map +0 -1
- package/dist/__tests__/integration/get-project-param.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/get-project-param.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/get-project-param.integration.test.js +0 -305
- package/dist/__tests__/integration/get-project-param.integration.test.js.map +0 -1
- package/dist/__tests__/integration/info.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/info.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/info.integration.test.js +0 -293
- package/dist/__tests__/integration/info.integration.test.js.map +0 -1
- package/dist/__tests__/integration/jest-mocks-setup.d.ts +0 -2
- package/dist/__tests__/integration/jest-mocks-setup.d.ts.map +0 -1
- package/dist/__tests__/integration/jest-mocks-setup.js +0 -104
- package/dist/__tests__/integration/jest-mocks-setup.js.map +0 -1
- package/dist/__tests__/integration/jest-setup.d.ts +0 -2
- package/dist/__tests__/integration/jest-setup.d.ts.map +0 -1
- package/dist/__tests__/integration/jest-setup.js +0 -12
- package/dist/__tests__/integration/jest-setup.js.map +0 -1
- package/dist/__tests__/integration/link.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/link.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/link.integration.test.js +0 -395
- package/dist/__tests__/integration/link.integration.test.js.map +0 -1
- package/dist/__tests__/integration/linked-config-cascade.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/linked-config-cascade.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/linked-config-cascade.integration.test.js +0 -179
- package/dist/__tests__/integration/linked-config-cascade.integration.test.js.map +0 -1
- package/dist/__tests__/integration/list.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/list.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/list.integration.test.js +0 -300
- package/dist/__tests__/integration/list.integration.test.js.map +0 -1
- package/dist/__tests__/integration/source-upgrade.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/source-upgrade.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/source-upgrade.integration.test.js +0 -100
- package/dist/__tests__/integration/source-upgrade.integration.test.js.map +0 -1
- package/dist/__tests__/integration/test-utils.d.ts +0 -30
- package/dist/__tests__/integration/test-utils.d.ts.map +0 -1
- package/dist/__tests__/integration/test-utils.js +0 -82
- package/dist/__tests__/integration/test-utils.js.map +0 -1
- package/dist/__tests__/integration/tunnel.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/tunnel.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/tunnel.integration.test.js +0 -486
- package/dist/__tests__/integration/tunnel.integration.test.js.map +0 -1
- package/dist/__tests__/integration/variable.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/variable.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/variable.integration.test.js +0 -258
- package/dist/__tests__/integration/variable.integration.test.js.map +0 -1
- package/dist/__tests__/integration/whoami.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/whoami.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/whoami.integration.test.js +0 -116
- package/dist/__tests__/integration/whoami.integration.test.js.map +0 -1
- package/dist/__tests__/outdated.test.d.ts +0 -2
- package/dist/__tests__/outdated.test.d.ts.map +0 -1
- package/dist/__tests__/outdated.test.js +0 -67
- package/dist/__tests__/outdated.test.js.map +0 -1
- package/dist/__tests__/populate.test.d.ts +0 -2
- package/dist/__tests__/populate.test.d.ts.map +0 -1
- package/dist/__tests__/populate.test.js +0 -445
- package/dist/__tests__/populate.test.js.map +0 -1
- package/dist/__tests__/tsconfig-upgrader.test.d.ts +0 -2
- package/dist/__tests__/tsconfig-upgrader.test.d.ts.map +0 -1
- package/dist/__tests__/tsconfig-upgrader.test.js +0 -31
- package/dist/__tests__/tsconfig-upgrader.test.js.map +0 -1
- package/dist/ca-certificate/validation.test.d.ts +0 -2
- package/dist/ca-certificate/validation.test.d.ts.map +0 -1
- package/dist/ca-certificate/validation.test.js +0 -131
- package/dist/ca-certificate/validation.test.js.map +0 -1
- package/dist/common/analytics/cli-invocation.test.d.ts +0 -2
- package/dist/common/analytics/cli-invocation.test.d.ts.map +0 -1
- package/dist/common/analytics/cli-invocation.test.js +0 -51
- package/dist/common/analytics/cli-invocation.test.js.map +0 -1
- package/dist/common/analytics/package-manager.test.d.ts +0 -2
- package/dist/common/analytics/package-manager.test.d.ts.map +0 -1
- package/dist/common/analytics/package-manager.test.js +0 -163
- package/dist/common/analytics/package-manager.test.js.map +0 -1
- package/dist/common/cli-dispatcher.test.d.ts +0 -2
- package/dist/common/cli-dispatcher.test.d.ts.map +0 -1
- package/dist/common/cli-dispatcher.test.js +0 -80
- package/dist/common/cli-dispatcher.test.js.map +0 -1
- package/dist/common/middleware/check-pnpm-lifecycle.test.d.ts +0 -2
- package/dist/common/middleware/check-pnpm-lifecycle.test.d.ts.map +0 -1
- package/dist/common/middleware/check-pnpm-lifecycle.test.js +0 -125
- package/dist/common/middleware/check-pnpm-lifecycle.test.js.map +0 -1
- package/dist/common/middleware/get-environment-param.test.d.ts +0 -2
- package/dist/common/middleware/get-environment-param.test.d.ts.map +0 -1
- package/dist/common/middleware/get-environment-param.test.js +0 -57
- package/dist/common/middleware/get-environment-param.test.js.map +0 -1
- package/dist/common/read-linked-config.test.d.ts +0 -2
- package/dist/common/read-linked-config.test.d.ts.map +0 -1
- package/dist/common/read-linked-config.test.js +0 -363
- package/dist/common/read-linked-config.test.js.map +0 -1
- package/dist/common/terminal.test.d.ts +0 -2
- package/dist/common/terminal.test.d.ts.map +0 -1
- package/dist/common/terminal.test.js +0 -101
- package/dist/common/terminal.test.js.map +0 -1
- package/dist/common/utils/build-environment-prompt-choices.test.d.ts +0 -2
- package/dist/common/utils/build-environment-prompt-choices.test.d.ts.map +0 -1
- package/dist/common/utils/build-environment-prompt-choices.test.js +0 -97
- package/dist/common/utils/build-environment-prompt-choices.test.js.map +0 -1
- package/dist/common/utils/format-environment-type.test.d.ts +0 -2
- package/dist/common/utils/format-environment-type.test.d.ts.map +0 -1
- package/dist/common/utils/format-environment-type.test.js +0 -32
- package/dist/common/utils/format-environment-type.test.js.map +0 -1
- package/dist/common/utils/pnpm-lifecycle.test.d.ts +0 -2
- package/dist/common/utils/pnpm-lifecycle.test.d.ts.map +0 -1
- package/dist/common/utils/pnpm-lifecycle.test.js +0 -196
- package/dist/common/utils/pnpm-lifecycle.test.js.map +0 -1
- package/dist/common/utils/pretty-print-environment-prompt.test.d.ts +0 -2
- package/dist/common/utils/pretty-print-environment-prompt.test.d.ts.map +0 -1
- package/dist/common/utils/pretty-print-environment-prompt.test.js +0 -42
- package/dist/common/utils/pretty-print-environment-prompt.test.js.map +0 -1
- package/dist/common/utils/sort-environments-for-prompt.test.d.ts +0 -2
- package/dist/common/utils/sort-environments-for-prompt.test.d.ts.map +0 -1
- package/dist/common/utils/sort-environments-for-prompt.test.js +0 -82
- package/dist/common/utils/sort-environments-for-prompt.test.js.map +0 -1
- package/dist/common/utils/stringify-config.test.d.ts +0 -2
- package/dist/common/utils/stringify-config.test.d.ts.map +0 -1
- package/dist/common/utils/stringify-config.test.js +0 -80
- package/dist/common/utils/stringify-config.test.js.map +0 -1
- package/dist/common/validators/argument-validators.spec.d.ts +0 -2
- package/dist/common/validators/argument-validators.spec.d.ts.map +0 -1
- package/dist/common/validators/argument-validators.spec.js +0 -181
- package/dist/common/validators/argument-validators.spec.js.map +0 -1
- package/dist/deploy/archive.local-registry.test.d.ts +0 -2
- package/dist/deploy/archive.local-registry.test.d.ts.map +0 -1
- package/dist/deploy/archive.local-registry.test.js +0 -100
- package/dist/deploy/archive.local-registry.test.js.map +0 -1
- package/dist/deploy/archive.test.d.ts +0 -2
- package/dist/deploy/archive.test.d.ts.map +0 -1
- package/dist/deploy/archive.test.js +0 -248
- package/dist/deploy/archive.test.js.map +0 -1
- package/dist/deploy/classify-build-probe.test.d.ts +0 -2
- package/dist/deploy/classify-build-probe.test.d.ts.map +0 -1
- package/dist/deploy/classify-build-probe.test.js +0 -51
- package/dist/deploy/classify-build-probe.test.js.map +0 -1
- package/dist/deploy/poll-deployment.test.d.ts +0 -2
- package/dist/deploy/poll-deployment.test.d.ts.map +0 -1
- package/dist/deploy/poll-deployment.test.js +0 -158
- package/dist/deploy/poll-deployment.test.js.map +0 -1
- package/dist/dev/zuplo-local-gitignore.test.d.ts +0 -2
- package/dist/dev/zuplo-local-gitignore.test.d.ts.map +0 -1
- package/dist/dev/zuplo-local-gitignore.test.js +0 -58
- package/dist/dev/zuplo-local-gitignore.test.js.map +0 -1
- package/dist/editor/e2e/editor.spec.d.ts +0 -2
- package/dist/editor/e2e/editor.spec.d.ts.map +0 -1
- package/dist/editor/e2e/editor.spec.js +0 -44
- package/dist/editor/e2e/editor.spec.js.map +0 -1
- package/dist/link/project-type.test.d.ts +0 -2
- package/dist/link/project-type.test.d.ts.map +0 -1
- package/dist/link/project-type.test.js +0 -225
- package/dist/link/project-type.test.js.map +0 -1
- package/dist/lint/resolve-binary.test.d.ts +0 -2
- package/dist/lint/resolve-binary.test.d.ts.map +0 -1
- package/dist/lint/resolve-binary.test.js +0 -155
- package/dist/lint/resolve-binary.test.js.map +0 -1
- package/dist/open-api/convert/handler.spec.d.ts +0 -2
- package/dist/open-api/convert/handler.spec.d.ts.map +0 -1
- package/dist/open-api/convert/handler.spec.js +0 -301
- package/dist/open-api/convert/handler.spec.js.map +0 -1
- package/dist/open-api/merge/handler.spec.d.ts +0 -2
- package/dist/open-api/merge/handler.spec.d.ts.map +0 -1
- package/dist/open-api/merge/handler.spec.js +0 -673
- package/dist/open-api/merge/handler.spec.js.map +0 -1
- package/dist/open-api/overlay/handler.spec.d.ts +0 -2
- package/dist/open-api/overlay/handler.spec.d.ts.map +0 -1
- package/dist/open-api/overlay/handler.spec.js +0 -346
- package/dist/open-api/overlay/handler.spec.js.map +0 -1
- package/dist/source/ai-gateway/files.test.d.ts +0 -2
- package/dist/source/ai-gateway/files.test.d.ts.map +0 -1
- package/dist/source/ai-gateway/files.test.js +0 -135
- package/dist/source/ai-gateway/files.test.js.map +0 -1
- package/dist/source/ai-gateway/handler.test.d.ts +0 -2
- package/dist/source/ai-gateway/handler.test.d.ts.map +0 -1
- package/dist/source/ai-gateway/handler.test.js +0 -113
- package/dist/source/ai-gateway/handler.test.js.map +0 -1
- package/dist/source/ai-gateway/package.test.d.ts +0 -2
- package/dist/source/ai-gateway/package.test.d.ts.map +0 -1
- package/dist/source/ai-gateway/package.test.js +0 -30
- package/dist/source/ai-gateway/package.test.js.map +0 -1
- package/dist/source/ai-gateway/planner.test.d.ts +0 -2
- package/dist/source/ai-gateway/planner.test.d.ts.map +0 -1
- package/dist/source/ai-gateway/planner.test.js +0 -330
- package/dist/source/ai-gateway/planner.test.js.map +0 -1
- package/dist/source/ai-gateway/release.test.d.ts +0 -2
- package/dist/source/ai-gateway/release.test.d.ts.map +0 -1
- package/dist/source/ai-gateway/release.test.js +0 -62
- package/dist/source/ai-gateway/release.test.js.map +0 -1
- package/dist/test/invoke-test.test.d.ts +0 -2
- package/dist/test/invoke-test.test.d.ts.map +0 -1
- package/dist/test/invoke-test.test.js +0 -150
- package/dist/test/invoke-test.test.js.map +0 -1
- package/dist/test/test-files.test.d.ts +0 -2
- package/dist/test/test-files.test.d.ts.map +0 -1
- package/dist/test/test-files.test.js +0 -57
- package/dist/test/test-files.test.js.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/file-format.spec.d.ts +0 -2
- package/node_modules/@zuplo/openapi-tools/dist/file-format.spec.d.ts.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/file-format.spec.js +0 -289
- package/node_modules/@zuplo/openapi-tools/dist/file-format.spec.js.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/merge-fixtures.spec.d.ts +0 -2
- package/node_modules/@zuplo/openapi-tools/dist/merge-fixtures.spec.d.ts.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/merge-fixtures.spec.js +0 -181
- package/node_modules/@zuplo/openapi-tools/dist/merge-fixtures.spec.js.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/merge.spec.d.ts +0 -2
- package/node_modules/@zuplo/openapi-tools/dist/merge.spec.d.ts.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/merge.spec.js +0 -399
- package/node_modules/@zuplo/openapi-tools/dist/merge.spec.js.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/overlay.spec.d.ts +0 -2
- package/node_modules/@zuplo/openapi-tools/dist/overlay.spec.d.ts.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/overlay.spec.js +0 -779
- package/node_modules/@zuplo/openapi-tools/dist/overlay.spec.js.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/path-transform.spec.d.ts +0 -2
- package/node_modules/@zuplo/openapi-tools/dist/path-transform.spec.d.ts.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/path-transform.spec.js +0 -269
- package/node_modules/@zuplo/openapi-tools/dist/path-transform.spec.js.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/url-utils.spec.d.ts +0 -2
- package/node_modules/@zuplo/openapi-tools/dist/url-utils.spec.d.ts.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/url-utils.spec.js +0 -93
- package/node_modules/@zuplo/openapi-tools/dist/url-utils.spec.js.map +0 -1
- package/node_modules/@zuplo/runtime/out/esm/chunk-6YPRGG62.js.map +0 -1
- package/node_modules/@zuplo/runtime/out/esm/chunk-PBDT4FDO.js +0 -37
- package/node_modules/@zuplo/runtime/out/esm/chunk-PBDT4FDO.js.map +0 -1
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-YJ2BHVUH.js.map → chunk-CDEAY3VY.js.map} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-PBDT4FDO.js.LEGAL.txt → chunk-LVSZ3WTO.js.LEGAL.txt} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-VTO3F6DK.js.map → chunk-NUVXDVLJ.js.map} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-6YPRGG62.js.LEGAL.txt → chunk-RHU3Z7DA.js.LEGAL.txt} +0 -0
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import assert from "node:assert";
|
|
2
|
-
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
3
|
-
import { tmpdir } from "node:os";
|
|
4
|
-
import { join } from "node:path";
|
|
5
|
-
import { afterEach, beforeEach, describe, it } from "node:test";
|
|
6
|
-
import { shouldWarnAboutZuploLocalGitignore } from "./zuplo-local-gitignore.js";
|
|
7
|
-
describe("shouldWarnAboutZuploLocalGitignore", () => {
|
|
8
|
-
let sourceDirectory;
|
|
9
|
-
beforeEach(() => {
|
|
10
|
-
sourceDirectory = mkdtempSync(join(tmpdir(), "zuplo-local-gitignore-"));
|
|
11
|
-
});
|
|
12
|
-
afterEach(() => {
|
|
13
|
-
rmSync(sourceDirectory, { recursive: true, force: true });
|
|
14
|
-
});
|
|
15
|
-
it("returns false when .zuplo-local does not exist", () => {
|
|
16
|
-
assert.strictEqual(shouldWarnAboutZuploLocalGitignore(sourceDirectory), false);
|
|
17
|
-
});
|
|
18
|
-
it("returns true when .zuplo-local exists and there is no .gitignore", () => {
|
|
19
|
-
mkdirSync(join(sourceDirectory, ".zuplo-local"));
|
|
20
|
-
assert.strictEqual(shouldWarnAboutZuploLocalGitignore(sourceDirectory), true);
|
|
21
|
-
});
|
|
22
|
-
it("returns true when .gitignore does not cover .zuplo-local", () => {
|
|
23
|
-
mkdirSync(join(sourceDirectory, ".zuplo-local"));
|
|
24
|
-
writeFileSync(join(sourceDirectory, ".gitignore"), "node_modules\ndist\n.env\n");
|
|
25
|
-
assert.strictEqual(shouldWarnAboutZuploLocalGitignore(sourceDirectory), true);
|
|
26
|
-
});
|
|
27
|
-
it("returns false when .gitignore contains '.zuplo-local'", () => {
|
|
28
|
-
mkdirSync(join(sourceDirectory, ".zuplo-local"));
|
|
29
|
-
writeFileSync(join(sourceDirectory, ".gitignore"), "node_modules\n.zuplo-local\n");
|
|
30
|
-
assert.strictEqual(shouldWarnAboutZuploLocalGitignore(sourceDirectory), false);
|
|
31
|
-
});
|
|
32
|
-
it("returns false when .gitignore contains '.zuplo-local/'", () => {
|
|
33
|
-
mkdirSync(join(sourceDirectory, ".zuplo-local"));
|
|
34
|
-
writeFileSync(join(sourceDirectory, ".gitignore"), "node_modules\n.zuplo-local/\n");
|
|
35
|
-
assert.strictEqual(shouldWarnAboutZuploLocalGitignore(sourceDirectory), false);
|
|
36
|
-
});
|
|
37
|
-
it("returns false when .gitignore contains root-anchored '/.zuplo-local/'", () => {
|
|
38
|
-
mkdirSync(join(sourceDirectory, ".zuplo-local"));
|
|
39
|
-
writeFileSync(join(sourceDirectory, ".gitignore"), "node_modules\n/.zuplo-local/\n");
|
|
40
|
-
assert.strictEqual(shouldWarnAboutZuploLocalGitignore(sourceDirectory), false);
|
|
41
|
-
});
|
|
42
|
-
it("returns false when .gitignore contains root-anchored '/.zuplo-local'", () => {
|
|
43
|
-
mkdirSync(join(sourceDirectory, ".zuplo-local"));
|
|
44
|
-
writeFileSync(join(sourceDirectory, ".gitignore"), "node_modules\n/.zuplo-local\n");
|
|
45
|
-
assert.strictEqual(shouldWarnAboutZuploLocalGitignore(sourceDirectory), false);
|
|
46
|
-
});
|
|
47
|
-
it("trims whitespace around .gitignore lines", () => {
|
|
48
|
-
mkdirSync(join(sourceDirectory, ".zuplo-local"));
|
|
49
|
-
writeFileSync(join(sourceDirectory, ".gitignore"), " .zuplo-local/ \n");
|
|
50
|
-
assert.strictEqual(shouldWarnAboutZuploLocalGitignore(sourceDirectory), false);
|
|
51
|
-
});
|
|
52
|
-
it("does not match unrelated lines that merely contain the name", () => {
|
|
53
|
-
mkdirSync(join(sourceDirectory, ".zuplo-local"));
|
|
54
|
-
writeFileSync(join(sourceDirectory, ".gitignore"), "# .zuplo-local is great\nfoo/.zuplo-local\n");
|
|
55
|
-
assert.strictEqual(shouldWarnAboutZuploLocalGitignore(sourceDirectory), true);
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
//# sourceMappingURL=zuplo-local-gitignore.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"zuplo-local-gitignore.test.js","sourceRoot":"","sources":["../../src/dev/zuplo-local-gitignore.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAA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KAAK,CACN,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;QAClD,SAAS,CAAC,IAAI,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC,CAAC;QACjD,aAAa,CAAC,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC,EAAE,qBAAqB,CAAC,CAAC;QAC1E,MAAM,CAAC,WAAW,CAChB,kCAAkC,CAAC,eAAe,CAAC,EACnD,KAAK,CACN,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6DAA6D,EAAE,GAAG,EAAE;QACrE,SAAS,CAAC,IAAI,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC,CAAC;QACjD,aAAa,CACX,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC,EACnC,6CAA6C,CAC9C,CAAC;QACF,MAAM,CAAC,WAAW,CAChB,kCAAkC,CAAC,eAAe,CAAC,EACnD,IAAI,CACL,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import assert from \"node:assert\";\nimport { mkdirSync, mkdtempSync, rmSync, writeFileSync } from \"node:fs\";\nimport { tmpdir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { afterEach, beforeEach, describe, it } from \"node:test\";\nimport { shouldWarnAboutZuploLocalGitignore } from \"./zuplo-local-gitignore.js\";\n\ndescribe(\"shouldWarnAboutZuploLocalGitignore\", () => {\n let sourceDirectory: string;\n\n beforeEach(() => {\n sourceDirectory = mkdtempSync(join(tmpdir(), \"zuplo-local-gitignore-\"));\n });\n\n afterEach(() => {\n rmSync(sourceDirectory, { recursive: true, force: true });\n });\n\n it(\"returns false when .zuplo-local does not exist\", () => {\n assert.strictEqual(\n shouldWarnAboutZuploLocalGitignore(sourceDirectory),\n false\n );\n });\n\n it(\"returns true when .zuplo-local exists and there is no .gitignore\", () => {\n mkdirSync(join(sourceDirectory, \".zuplo-local\"));\n assert.strictEqual(\n shouldWarnAboutZuploLocalGitignore(sourceDirectory),\n true\n );\n });\n\n it(\"returns true when .gitignore does not cover .zuplo-local\", () => {\n mkdirSync(join(sourceDirectory, \".zuplo-local\"));\n writeFileSync(\n join(sourceDirectory, \".gitignore\"),\n \"node_modules\\ndist\\n.env\\n\"\n );\n assert.strictEqual(\n shouldWarnAboutZuploLocalGitignore(sourceDirectory),\n true\n );\n });\n\n it(\"returns false when .gitignore contains '.zuplo-local'\", () => {\n mkdirSync(join(sourceDirectory, \".zuplo-local\"));\n writeFileSync(\n join(sourceDirectory, \".gitignore\"),\n \"node_modules\\n.zuplo-local\\n\"\n );\n assert.strictEqual(\n shouldWarnAboutZuploLocalGitignore(sourceDirectory),\n false\n );\n });\n\n it(\"returns false when .gitignore contains '.zuplo-local/'\", () => {\n mkdirSync(join(sourceDirectory, \".zuplo-local\"));\n writeFileSync(\n join(sourceDirectory, \".gitignore\"),\n \"node_modules\\n.zuplo-local/\\n\"\n );\n assert.strictEqual(\n shouldWarnAboutZuploLocalGitignore(sourceDirectory),\n false\n );\n });\n\n it(\"returns false when .gitignore contains root-anchored '/.zuplo-local/'\", () => {\n mkdirSync(join(sourceDirectory, \".zuplo-local\"));\n writeFileSync(\n join(sourceDirectory, \".gitignore\"),\n \"node_modules\\n/.zuplo-local/\\n\"\n );\n assert.strictEqual(\n shouldWarnAboutZuploLocalGitignore(sourceDirectory),\n false\n );\n });\n\n it(\"returns false when .gitignore contains root-anchored '/.zuplo-local'\", () => {\n mkdirSync(join(sourceDirectory, \".zuplo-local\"));\n writeFileSync(\n join(sourceDirectory, \".gitignore\"),\n \"node_modules\\n/.zuplo-local\\n\"\n );\n assert.strictEqual(\n shouldWarnAboutZuploLocalGitignore(sourceDirectory),\n false\n );\n });\n\n it(\"trims whitespace around .gitignore lines\", () => {\n mkdirSync(join(sourceDirectory, \".zuplo-local\"));\n writeFileSync(join(sourceDirectory, \".gitignore\"), \" .zuplo-local/ \\n\");\n assert.strictEqual(\n shouldWarnAboutZuploLocalGitignore(sourceDirectory),\n false\n );\n });\n\n it(\"does not match unrelated lines that merely contain the name\", () => {\n mkdirSync(join(sourceDirectory, \".zuplo-local\"));\n writeFileSync(\n join(sourceDirectory, \".gitignore\"),\n \"# .zuplo-local is great\\nfoo/.zuplo-local\\n\"\n );\n assert.strictEqual(\n shouldWarnAboutZuploLocalGitignore(sourceDirectory),\n true\n );\n });\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"editor.spec.d.ts","sourceRoot":"","sources":["../../../src/editor/e2e/editor.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { expect, test } from "@playwright/test";
|
|
2
|
-
const EDITOR_URL = `http://localhost:${process.env.EDITOR_PORT}`;
|
|
3
|
-
const GATEWAY_URL = `http://localhost:${process.env.GATEWAY_PORT}`;
|
|
4
|
-
test.describe("Editor UI Tests", () => {
|
|
5
|
-
test.beforeEach(async ({ page }) => {
|
|
6
|
-
await page.goto(EDITOR_URL);
|
|
7
|
-
});
|
|
8
|
-
test("Project view displays gateway and splash content", async ({ page }) => {
|
|
9
|
-
const projectHeader = page.getByRole("link", { name: "Project" });
|
|
10
|
-
await expect(projectHeader).toBeVisible();
|
|
11
|
-
await projectHeader.click();
|
|
12
|
-
await expect(page).toHaveURL(/\/dev\/project\/local$/);
|
|
13
|
-
await expect(page.getByRole("heading", { name: "Welcome to your Gateway" })).toBeVisible();
|
|
14
|
-
await expect(page.getByText("Gateway").first()).toBeVisible();
|
|
15
|
-
await expect(page.getByRole("link", { name: GATEWAY_URL })).toBeVisible();
|
|
16
|
-
await expect(page.getByText("Developer Portal")).toBeVisible();
|
|
17
|
-
await expect(page.getByRole("button", { name: "Open Portal" })).toBeVisible();
|
|
18
|
-
await expect(page.getByRole("link", { name: "Start Building" })).toBeVisible();
|
|
19
|
-
await expect(page.getByRole("link", { name: "Quickstart" })).toBeVisible();
|
|
20
|
-
await expect(page.getByRole("heading", { name: "Support" })).toBeVisible();
|
|
21
|
-
});
|
|
22
|
-
test("Code view displays routes and route designer", async ({ page }) => {
|
|
23
|
-
test.setTimeout(60_000);
|
|
24
|
-
const codeHeader = page.getByRole("link", { name: "Code" });
|
|
25
|
-
await expect(codeHeader).toBeVisible();
|
|
26
|
-
await codeHeader.click();
|
|
27
|
-
await expect(page).toHaveURL(/\/dev\/project\/local\/edit/);
|
|
28
|
-
await expect(page.getByTestId("add-route-btn").first()).toBeVisible({
|
|
29
|
-
timeout: 30_000,
|
|
30
|
-
});
|
|
31
|
-
const expandFileTree = page.getByTestId("expand-file-tree");
|
|
32
|
-
if (await expandFileTree.isVisible()) {
|
|
33
|
-
await expandFileTree.click();
|
|
34
|
-
}
|
|
35
|
-
const routesFile = page.getByTestId("repros.oas.json");
|
|
36
|
-
await expect(routesFile).toBeVisible();
|
|
37
|
-
await routesFile.click();
|
|
38
|
-
await expect(page).toHaveURL(/path=%2Fconfig%2Frepros\.oas\.json/);
|
|
39
|
-
await expect(page.getByRole("tab", { name: "Route Designer" })).toBeVisible();
|
|
40
|
-
await expect(page.getByRole("tab", { name: "repros.oas.json" })).toBeVisible();
|
|
41
|
-
await expect(page.getByText("Create an Unsigned Transaction")).toBeVisible();
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
//# sourceMappingURL=editor.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"editor.spec.js","sourceRoot":"","sources":["../../../src/editor/e2e/editor.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAEhD,MAAM,UAAU,GAAG,oBAAoB,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;AACjE,MAAM,WAAW,GAAG,oBAAoB,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC;AAEnE,IAAI,CAAC,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IACpC,IAAI,CAAC,UAAU,CAAC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,MAAM,CACV,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC,CAClD,CAAC,WAAW,EAAE,CAAC;QAChB,MAAM,MAAM,CACV,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC,CACnD,CAAC,WAAW,EAAE,CAAC;QAEhB,MAAM,MAAM,CACV,IAAI,CAAC,SAAS,CAAC,gCAAgC,CAAC,CACjD,CAAC,WAAW,EAAE,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect, test } from \"@playwright/test\";\n\nconst EDITOR_URL = `http://localhost:${process.env.EDITOR_PORT}`;\nconst GATEWAY_URL = `http://localhost:${process.env.GATEWAY_PORT}`;\n\ntest.describe(\"Editor UI Tests\", () => {\n test.beforeEach(async ({ page }) => {\n await page.goto(EDITOR_URL);\n });\n\n test(\"Project view displays gateway and splash content\", async ({ page }) => {\n const projectHeader = page.getByRole(\"link\", { name: \"Project\" });\n await expect(projectHeader).toBeVisible();\n\n await projectHeader.click();\n\n await expect(page).toHaveURL(/\\/dev\\/project\\/local$/);\n\n await expect(\n page.getByRole(\"heading\", { name: \"Welcome to your Gateway\" })\n ).toBeVisible();\n\n await expect(page.getByText(\"Gateway\").first()).toBeVisible();\n await expect(page.getByRole(\"link\", { name: GATEWAY_URL })).toBeVisible();\n\n await expect(page.getByText(\"Developer Portal\")).toBeVisible();\n await expect(\n page.getByRole(\"button\", { name: \"Open Portal\" })\n ).toBeVisible();\n\n await expect(\n page.getByRole(\"link\", { name: \"Start Building\" })\n ).toBeVisible();\n await expect(page.getByRole(\"link\", { name: \"Quickstart\" })).toBeVisible();\n\n await expect(page.getByRole(\"heading\", { name: \"Support\" })).toBeVisible();\n });\n\n test(\"Code view displays routes and route designer\", async ({ page }) => {\n test.setTimeout(60_000);\n\n const codeHeader = page.getByRole(\"link\", { name: \"Code\" });\n await expect(codeHeader).toBeVisible();\n\n await codeHeader.click();\n\n await expect(page).toHaveURL(/\\/dev\\/project\\/local\\/edit/);\n\n // Code view auto-opens the first *.oas.json; wait for the designer.\n await expect(page.getByTestId(\"add-route-btn\").first()).toBeVisible({\n timeout: 30_000,\n });\n\n // File tree defaults to collapsed. Expand only if needed — prefs can\n // persist across runs when the local editor server is reused.\n const expandFileTree = page.getByTestId(\"expand-file-tree\");\n if (await expandFileTree.isVisible()) {\n await expandFileTree.click();\n }\n\n const routesFile = page.getByTestId(\"repros.oas.json\");\n await expect(routesFile).toBeVisible();\n await routesFile.click();\n\n await expect(page).toHaveURL(/path=%2Fconfig%2Frepros\\.oas\\.json/);\n\n await expect(\n page.getByRole(\"tab\", { name: \"Route Designer\" })\n ).toBeVisible();\n await expect(\n page.getByRole(\"tab\", { name: \"repros.oas.json\" })\n ).toBeVisible();\n\n await expect(\n page.getByText(\"Create an Unsigned Transaction\")\n ).toBeVisible();\n });\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"project-type.test.d.ts","sourceRoot":"","sources":["../../src/link/project-type.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
import assert from "node:assert";
|
|
2
|
-
import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
|
3
|
-
import { tmpdir } from "node:os";
|
|
4
|
-
import { join } from "node:path";
|
|
5
|
-
import { afterEach, beforeEach, describe, it, mock } from "node:test";
|
|
6
|
-
import { detectProjectType, syncProjectTypeForLink, updateProjectType, } from "./project-type.js";
|
|
7
|
-
describe("link project type detection", () => {
|
|
8
|
-
let testDir;
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
testDir = await mkdtemp(join(tmpdir(), "zuplo-dev-project-type-test-"));
|
|
11
|
-
});
|
|
12
|
-
afterEach(async () => {
|
|
13
|
-
mock.restoreAll();
|
|
14
|
-
await rm(testDir, { recursive: true, force: true });
|
|
15
|
-
});
|
|
16
|
-
it("detects a managed-dedicated project", async () => {
|
|
17
|
-
mock.method(globalThis, "fetch", async () => {
|
|
18
|
-
return Response.json({
|
|
19
|
-
data: [
|
|
20
|
-
{ name: "other-project", type: "managed-edge" },
|
|
21
|
-
{ name: "my-project", type: "managed-dedicated" },
|
|
22
|
-
],
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
const result = await detectProjectType({
|
|
26
|
-
accountName: "my-account",
|
|
27
|
-
authToken: "token",
|
|
28
|
-
projectName: "my-project",
|
|
29
|
-
});
|
|
30
|
-
assert.strictEqual(result, "managed-dedicated");
|
|
31
|
-
});
|
|
32
|
-
it("uses the explicitly designated project when multiple projects exist", async () => {
|
|
33
|
-
mock.method(globalThis, "fetch", async () => {
|
|
34
|
-
return Response.json({
|
|
35
|
-
data: [
|
|
36
|
-
{ name: "linked-project", type: "managed-dedicated" },
|
|
37
|
-
{ name: "explicit-project", type: "managed-edge" },
|
|
38
|
-
],
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
const result = await detectProjectType({
|
|
42
|
-
accountName: "my-account",
|
|
43
|
-
authToken: "token",
|
|
44
|
-
projectName: "explicit-project",
|
|
45
|
-
});
|
|
46
|
-
assert.strictEqual(result, "managed-edge");
|
|
47
|
-
});
|
|
48
|
-
it("defaults self-hosted and unknown project types to managed-edge", async () => {
|
|
49
|
-
mock.method(globalThis, "fetch", async () => {
|
|
50
|
-
return Response.json({
|
|
51
|
-
data: [{ name: "my-project", type: "self-hosted" }],
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
const result = await detectProjectType({
|
|
55
|
-
accountName: "my-account",
|
|
56
|
-
authToken: "token",
|
|
57
|
-
projectName: "my-project",
|
|
58
|
-
});
|
|
59
|
-
assert.strictEqual(result, "managed-edge");
|
|
60
|
-
});
|
|
61
|
-
it("defaults to managed-edge when running offline", async () => {
|
|
62
|
-
mock.method(globalThis, "fetch", async () => {
|
|
63
|
-
throw new Error("offline");
|
|
64
|
-
});
|
|
65
|
-
const result = await detectProjectType({
|
|
66
|
-
accountName: "my-account",
|
|
67
|
-
authToken: "token",
|
|
68
|
-
projectName: "my-project",
|
|
69
|
-
});
|
|
70
|
-
assert.strictEqual(result, "managed-edge");
|
|
71
|
-
});
|
|
72
|
-
it("resolves the account from who-am-i when it is not supplied", async () => {
|
|
73
|
-
const requests = [];
|
|
74
|
-
mock.method(globalThis, "fetch", async (input) => {
|
|
75
|
-
requests.push(String(input));
|
|
76
|
-
if (String(input).endsWith("/v1/who-am-i")) {
|
|
77
|
-
return Response.json({ account: "resolved-account" });
|
|
78
|
-
}
|
|
79
|
-
return Response.json({
|
|
80
|
-
data: [{ name: "my-project", type: "managed-dedicated" }],
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
const result = await detectProjectType({
|
|
84
|
-
authToken: "token",
|
|
85
|
-
projectName: "my-project",
|
|
86
|
-
});
|
|
87
|
-
assert.strictEqual(result, "managed-dedicated");
|
|
88
|
-
assert.strictEqual(requests.length, 2);
|
|
89
|
-
assert.match(requests[1], /accountName=resolved-account/);
|
|
90
|
-
});
|
|
91
|
-
it("does not overwrite an existing projectType", async () => {
|
|
92
|
-
const configPath = join(testDir, "zuplo.jsonc");
|
|
93
|
-
await writeFile(configPath, `{
|
|
94
|
-
// Keep this comment.
|
|
95
|
-
"version": 1,
|
|
96
|
-
"projectType": "managed-edge"
|
|
97
|
-
}
|
|
98
|
-
`, "utf-8");
|
|
99
|
-
await updateProjectType(testDir, "managed-dedicated");
|
|
100
|
-
const contents = await readFile(configPath, "utf-8");
|
|
101
|
-
assert.match(contents, /Keep this comment/);
|
|
102
|
-
assert.match(contents, /"projectType": "managed-edge"/);
|
|
103
|
-
});
|
|
104
|
-
it("adds projectType when it is missing", async () => {
|
|
105
|
-
const configPath = join(testDir, "zuplo.jsonc");
|
|
106
|
-
await writeFile(configPath, `{
|
|
107
|
-
// Keep this comment.
|
|
108
|
-
"version": 1
|
|
109
|
-
}
|
|
110
|
-
`, "utf-8");
|
|
111
|
-
await updateProjectType(testDir, "managed-dedicated");
|
|
112
|
-
const contents = await readFile(configPath, "utf-8");
|
|
113
|
-
assert.match(contents, /Keep this comment/);
|
|
114
|
-
assert.match(contents, /"version": 1,/);
|
|
115
|
-
assert.match(contents, /"projectType": "managed-dedicated"/);
|
|
116
|
-
});
|
|
117
|
-
it("skips detection when projectType is already configured", async () => {
|
|
118
|
-
const configPath = join(testDir, "zuplo.jsonc");
|
|
119
|
-
await writeFile(configPath, `{
|
|
120
|
-
"version": 1,
|
|
121
|
-
"projectType": "managed-dedicated"
|
|
122
|
-
}
|
|
123
|
-
`, "utf-8");
|
|
124
|
-
const fetchMock = mock.method(globalThis, "fetch", async () => {
|
|
125
|
-
throw new Error("Project type detection should not run");
|
|
126
|
-
});
|
|
127
|
-
await syncProjectTypeForLink({
|
|
128
|
-
sourceDirectory: testDir,
|
|
129
|
-
accountName: "my-account",
|
|
130
|
-
authToken: "token",
|
|
131
|
-
projectName: "my-project",
|
|
132
|
-
});
|
|
133
|
-
const contents = await readFile(configPath, "utf-8");
|
|
134
|
-
assert.match(contents, /"projectType": "managed-dedicated"/);
|
|
135
|
-
assert.strictEqual(fetchMock.mock.callCount(), 0);
|
|
136
|
-
});
|
|
137
|
-
it("recognizes projectType in JSONC with a trailing comma", async () => {
|
|
138
|
-
const configPath = join(testDir, "zuplo.jsonc");
|
|
139
|
-
const originalContents = `{
|
|
140
|
-
"version": 1,
|
|
141
|
-
"projectType": "managed-dedicated",
|
|
142
|
-
}
|
|
143
|
-
`;
|
|
144
|
-
await writeFile(configPath, originalContents, "utf-8");
|
|
145
|
-
const fetchMock = mock.method(globalThis, "fetch", async () => {
|
|
146
|
-
throw new Error("Project type detection should not run");
|
|
147
|
-
});
|
|
148
|
-
await syncProjectTypeForLink({
|
|
149
|
-
sourceDirectory: testDir,
|
|
150
|
-
accountName: "my-account",
|
|
151
|
-
authToken: "token",
|
|
152
|
-
projectName: "my-project",
|
|
153
|
-
});
|
|
154
|
-
assert.strictEqual(await readFile(configPath, "utf-8"), originalContents);
|
|
155
|
-
assert.strictEqual(fetchMock.mock.callCount(), 0);
|
|
156
|
-
});
|
|
157
|
-
it("persists a project type confirmed by the API", async () => {
|
|
158
|
-
const configPath = join(testDir, "zuplo.jsonc");
|
|
159
|
-
await writeFile(configPath, '{\n "version": 1\n}\n', "utf-8");
|
|
160
|
-
mock.method(globalThis, "fetch", async () => {
|
|
161
|
-
return Response.json({
|
|
162
|
-
data: [{ name: "my-project", type: "managed-edge" }],
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
await syncProjectTypeForLink({
|
|
166
|
-
sourceDirectory: testDir,
|
|
167
|
-
accountName: "my-account",
|
|
168
|
-
authToken: "token",
|
|
169
|
-
projectName: "my-project",
|
|
170
|
-
});
|
|
171
|
-
const contents = await readFile(configPath, "utf-8");
|
|
172
|
-
assert.match(contents, /"projectType": "managed-edge"/);
|
|
173
|
-
});
|
|
174
|
-
it("does not persist the managed-edge fallback when detection fails", async () => {
|
|
175
|
-
const configPath = join(testDir, "zuplo.jsonc");
|
|
176
|
-
const originalContents = '{\n "version": 1\n}\n';
|
|
177
|
-
await writeFile(configPath, originalContents, "utf-8");
|
|
178
|
-
mock.method(globalThis, "fetch", async () => {
|
|
179
|
-
throw new Error("offline");
|
|
180
|
-
});
|
|
181
|
-
await syncProjectTypeForLink({
|
|
182
|
-
sourceDirectory: testDir,
|
|
183
|
-
accountName: "my-account",
|
|
184
|
-
authToken: "token",
|
|
185
|
-
projectName: "my-project",
|
|
186
|
-
});
|
|
187
|
-
assert.strictEqual(await readFile(configPath, "utf-8"), originalContents);
|
|
188
|
-
});
|
|
189
|
-
it("does not persist a fallback for an unrecognized API project type", async () => {
|
|
190
|
-
const configPath = join(testDir, "zuplo.jsonc");
|
|
191
|
-
const originalContents = '{\n "version": 1\n}\n';
|
|
192
|
-
await writeFile(configPath, originalContents, "utf-8");
|
|
193
|
-
mock.method(globalThis, "fetch", async () => {
|
|
194
|
-
return Response.json({
|
|
195
|
-
data: [{ name: "my-project", type: "self-hosted" }],
|
|
196
|
-
});
|
|
197
|
-
});
|
|
198
|
-
await syncProjectTypeForLink({
|
|
199
|
-
sourceDirectory: testDir,
|
|
200
|
-
accountName: "my-account",
|
|
201
|
-
authToken: "token",
|
|
202
|
-
projectName: "my-project",
|
|
203
|
-
});
|
|
204
|
-
assert.strictEqual(await readFile(configPath, "utf-8"), originalContents);
|
|
205
|
-
});
|
|
206
|
-
it("does not modify malformed JSONC", async () => {
|
|
207
|
-
const configPath = join(testDir, "zuplo.jsonc");
|
|
208
|
-
const originalContents = `{
|
|
209
|
-
"version": 1,
|
|
210
|
-
`;
|
|
211
|
-
await writeFile(configPath, originalContents, "utf-8");
|
|
212
|
-
const fetchMock = mock.method(globalThis, "fetch", async () => {
|
|
213
|
-
throw new Error("Project type detection should not run");
|
|
214
|
-
});
|
|
215
|
-
await syncProjectTypeForLink({
|
|
216
|
-
sourceDirectory: testDir,
|
|
217
|
-
accountName: "my-account",
|
|
218
|
-
authToken: "token",
|
|
219
|
-
projectName: "my-project",
|
|
220
|
-
});
|
|
221
|
-
assert.strictEqual(await readFile(configPath, "utf-8"), originalContents);
|
|
222
|
-
assert.strictEqual(fetchMock.mock.callCount(), 0);
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
//# sourceMappingURL=project-type.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"project-type.test.js","sourceRoot":"","sources":["../../src/link/project-type.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,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AAE,YAAY;YACzB,SAAS,EAAE,OAAO;YAClB,WAAW,EAAE,YAAY;SAC1B,CAAC,CAAC;QAEH,MAAM,CAAC,WAAW,CAAC,MAAM,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,EAAE,gBAAgB,CAAC,CAAC;QAC1E,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import assert from \"node:assert\";\nimport { mkdtemp, readFile, rm, writeFile } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { afterEach, beforeEach, describe, it, mock } from \"node:test\";\nimport {\n detectProjectType,\n syncProjectTypeForLink,\n updateProjectType,\n} from \"./project-type.js\";\n\ndescribe(\"link project type detection\", () => {\n let testDir: string;\n\n beforeEach(async () => {\n testDir = await mkdtemp(join(tmpdir(), \"zuplo-dev-project-type-test-\"));\n });\n\n afterEach(async () => {\n mock.restoreAll();\n await rm(testDir, { recursive: true, force: true });\n });\n\n it(\"detects a managed-dedicated project\", async () => {\n mock.method(globalThis, \"fetch\", async () => {\n return Response.json({\n data: [\n { name: \"other-project\", type: \"managed-edge\" },\n { name: \"my-project\", type: \"managed-dedicated\" },\n ],\n });\n });\n\n const result = await detectProjectType({\n accountName: \"my-account\",\n authToken: \"token\",\n projectName: \"my-project\",\n });\n\n assert.strictEqual(result, \"managed-dedicated\");\n });\n\n it(\"uses the explicitly designated project when multiple projects exist\", async () => {\n mock.method(globalThis, \"fetch\", async () => {\n return Response.json({\n data: [\n { name: \"linked-project\", type: \"managed-dedicated\" },\n { name: \"explicit-project\", type: \"managed-edge\" },\n ],\n });\n });\n\n const result = await detectProjectType({\n accountName: \"my-account\",\n authToken: \"token\",\n projectName: \"explicit-project\",\n });\n\n assert.strictEqual(result, \"managed-edge\");\n });\n\n it(\"defaults self-hosted and unknown project types to managed-edge\", async () => {\n mock.method(globalThis, \"fetch\", async () => {\n return Response.json({\n data: [{ name: \"my-project\", type: \"self-hosted\" }],\n });\n });\n\n const result = await detectProjectType({\n accountName: \"my-account\",\n authToken: \"token\",\n projectName: \"my-project\",\n });\n\n assert.strictEqual(result, \"managed-edge\");\n });\n\n it(\"defaults to managed-edge when running offline\", async () => {\n mock.method(globalThis, \"fetch\", async () => {\n throw new Error(\"offline\");\n });\n\n const result = await detectProjectType({\n accountName: \"my-account\",\n authToken: \"token\",\n projectName: \"my-project\",\n });\n\n assert.strictEqual(result, \"managed-edge\");\n });\n\n it(\"resolves the account from who-am-i when it is not supplied\", async () => {\n const requests: string[] = [];\n mock.method(globalThis, \"fetch\", async (input: string | URL | Request) => {\n requests.push(String(input));\n if (String(input).endsWith(\"/v1/who-am-i\")) {\n return Response.json({ account: \"resolved-account\" });\n }\n return Response.json({\n data: [{ name: \"my-project\", type: \"managed-dedicated\" }],\n });\n });\n\n const result = await detectProjectType({\n authToken: \"token\",\n projectName: \"my-project\",\n });\n\n assert.strictEqual(result, \"managed-dedicated\");\n assert.strictEqual(requests.length, 2);\n assert.match(requests[1], /accountName=resolved-account/);\n });\n\n it(\"does not overwrite an existing projectType\", async () => {\n const configPath = join(testDir, \"zuplo.jsonc\");\n await writeFile(\n configPath,\n `{\n // Keep this comment.\n \"version\": 1,\n \"projectType\": \"managed-edge\"\n}\n`,\n \"utf-8\"\n );\n\n await updateProjectType(testDir, \"managed-dedicated\");\n\n const contents = await readFile(configPath, \"utf-8\");\n assert.match(contents, /Keep this comment/);\n assert.match(contents, /\"projectType\": \"managed-edge\"/);\n });\n\n it(\"adds projectType when it is missing\", async () => {\n const configPath = join(testDir, \"zuplo.jsonc\");\n await writeFile(\n configPath,\n `{\n // Keep this comment.\n \"version\": 1\n}\n`,\n \"utf-8\"\n );\n\n await updateProjectType(testDir, \"managed-dedicated\");\n\n const contents = await readFile(configPath, \"utf-8\");\n assert.match(contents, /Keep this comment/);\n assert.match(contents, /\"version\": 1,/);\n assert.match(contents, /\"projectType\": \"managed-dedicated\"/);\n });\n\n it(\"skips detection when projectType is already configured\", async () => {\n const configPath = join(testDir, \"zuplo.jsonc\");\n await writeFile(\n configPath,\n `{\n \"version\": 1,\n \"projectType\": \"managed-dedicated\"\n}\n`,\n \"utf-8\"\n );\n const fetchMock = mock.method(globalThis, \"fetch\", async () => {\n throw new Error(\"Project type detection should not run\");\n });\n\n await syncProjectTypeForLink({\n sourceDirectory: testDir,\n accountName: \"my-account\",\n authToken: \"token\",\n projectName: \"my-project\",\n });\n\n const contents = await readFile(configPath, \"utf-8\");\n assert.match(contents, /\"projectType\": \"managed-dedicated\"/);\n assert.strictEqual(fetchMock.mock.callCount(), 0);\n });\n\n it(\"recognizes projectType in JSONC with a trailing comma\", async () => {\n const configPath = join(testDir, \"zuplo.jsonc\");\n const originalContents = `{\n \"version\": 1,\n \"projectType\": \"managed-dedicated\",\n}\n`;\n await writeFile(configPath, originalContents, \"utf-8\");\n const fetchMock = mock.method(globalThis, \"fetch\", async () => {\n throw new Error(\"Project type detection should not run\");\n });\n\n await syncProjectTypeForLink({\n sourceDirectory: testDir,\n accountName: \"my-account\",\n authToken: \"token\",\n projectName: \"my-project\",\n });\n\n assert.strictEqual(await readFile(configPath, \"utf-8\"), originalContents);\n assert.strictEqual(fetchMock.mock.callCount(), 0);\n });\n\n it(\"persists a project type confirmed by the API\", async () => {\n const configPath = join(testDir, \"zuplo.jsonc\");\n await writeFile(configPath, '{\\n \"version\": 1\\n}\\n', \"utf-8\");\n mock.method(globalThis, \"fetch\", async () => {\n return Response.json({\n data: [{ name: \"my-project\", type: \"managed-edge\" }],\n });\n });\n\n await syncProjectTypeForLink({\n sourceDirectory: testDir,\n accountName: \"my-account\",\n authToken: \"token\",\n projectName: \"my-project\",\n });\n\n const contents = await readFile(configPath, \"utf-8\");\n assert.match(contents, /\"projectType\": \"managed-edge\"/);\n });\n\n it(\"does not persist the managed-edge fallback when detection fails\", async () => {\n const configPath = join(testDir, \"zuplo.jsonc\");\n const originalContents = '{\\n \"version\": 1\\n}\\n';\n await writeFile(configPath, originalContents, \"utf-8\");\n mock.method(globalThis, \"fetch\", async () => {\n throw new Error(\"offline\");\n });\n\n await syncProjectTypeForLink({\n sourceDirectory: testDir,\n accountName: \"my-account\",\n authToken: \"token\",\n projectName: \"my-project\",\n });\n\n assert.strictEqual(await readFile(configPath, \"utf-8\"), originalContents);\n });\n\n it(\"does not persist a fallback for an unrecognized API project type\", async () => {\n const configPath = join(testDir, \"zuplo.jsonc\");\n const originalContents = '{\\n \"version\": 1\\n}\\n';\n await writeFile(configPath, originalContents, \"utf-8\");\n mock.method(globalThis, \"fetch\", async () => {\n return Response.json({\n data: [{ name: \"my-project\", type: \"self-hosted\" }],\n });\n });\n\n await syncProjectTypeForLink({\n sourceDirectory: testDir,\n accountName: \"my-account\",\n authToken: \"token\",\n projectName: \"my-project\",\n });\n\n assert.strictEqual(await readFile(configPath, \"utf-8\"), originalContents);\n });\n\n it(\"does not modify malformed JSONC\", async () => {\n const configPath = join(testDir, \"zuplo.jsonc\");\n const originalContents = `{\n \"version\": 1,\n`;\n await writeFile(configPath, originalContents, \"utf-8\");\n const fetchMock = mock.method(globalThis, \"fetch\", async () => {\n throw new Error(\"Project type detection should not run\");\n });\n\n await syncProjectTypeForLink({\n sourceDirectory: testDir,\n accountName: \"my-account\",\n authToken: \"token\",\n projectName: \"my-project\",\n });\n\n assert.strictEqual(await readFile(configPath, \"utf-8\"), originalContents);\n assert.strictEqual(fetchMock.mock.callCount(), 0);\n });\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-binary.test.d.ts","sourceRoot":"","sources":["../../src/lint/resolve-binary.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
import assert from "node:assert";
|
|
2
|
-
import { mkdirSync, mkdtempSync, realpathSync, rmSync, writeFileSync, } from "node:fs";
|
|
3
|
-
import { tmpdir } from "node:os";
|
|
4
|
-
import path from "node:path";
|
|
5
|
-
import { after, before, describe, it } from "node:test";
|
|
6
|
-
import { LintBinaryNotFoundError, lintPackageName, resolveLintBinary, } from "./resolve-binary.js";
|
|
7
|
-
describe("lintPackageName", () => {
|
|
8
|
-
it("derives the package name from platform and arch", () => {
|
|
9
|
-
assert.strictEqual(lintPackageName("darwin", "arm64"), "@zuplo/lint-darwin-arm64");
|
|
10
|
-
assert.strictEqual(lintPackageName("linux", "x64"), "@zuplo/lint-linux-x64");
|
|
11
|
-
assert.strictEqual(lintPackageName("win32", "x64"), "@zuplo/lint-win32-x64");
|
|
12
|
-
});
|
|
13
|
-
});
|
|
14
|
-
describe("resolveLintBinary", () => {
|
|
15
|
-
let tmpRoot;
|
|
16
|
-
let overridePath;
|
|
17
|
-
before(() => {
|
|
18
|
-
tmpRoot = realpathSync(mkdtempSync(path.join(tmpdir(), "lint-binary-")));
|
|
19
|
-
overridePath = path.join(tmpRoot, "custom-zuplo-lint");
|
|
20
|
-
writeFileSync(overridePath, "#!/bin/sh\n");
|
|
21
|
-
});
|
|
22
|
-
after(() => {
|
|
23
|
-
rmSync(tmpRoot, { recursive: true, force: true });
|
|
24
|
-
});
|
|
25
|
-
it("uses an explicit override ahead of everything else", () => {
|
|
26
|
-
const devBinaryPath = path.join(tmpRoot, "dev", "zuplo-lint");
|
|
27
|
-
mkdirSync(path.dirname(devBinaryPath), { recursive: true });
|
|
28
|
-
writeFileSync(devBinaryPath, "");
|
|
29
|
-
assert.strictEqual(resolveLintBinary({ override: overridePath, devBinaryPath }), overridePath);
|
|
30
|
-
});
|
|
31
|
-
it("resolves a relative override against the working directory", () => {
|
|
32
|
-
const relative = path.relative(process.cwd(), overridePath);
|
|
33
|
-
assert.strictEqual(resolveLintBinary({ override: relative }), path.resolve(relative));
|
|
34
|
-
});
|
|
35
|
-
it("reports the bad path when the override does not exist", () => {
|
|
36
|
-
const missing = path.join(tmpRoot, "nope");
|
|
37
|
-
assert.throws(() => resolveLintBinary({ override: missing }), (err) => {
|
|
38
|
-
assert.ok(err instanceof LintBinaryNotFoundError);
|
|
39
|
-
assert.match(err.message, /No zuplo-lint binary at/);
|
|
40
|
-
assert.ok(err.message.includes(missing), "expected the resolved path in the message");
|
|
41
|
-
assert.match(err.message, /--lint-binary/);
|
|
42
|
-
return true;
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
it("falls back to the repo build output when the platform package is absent", () => {
|
|
46
|
-
const devBinaryPath = path.join(tmpRoot, "dist", "zuplo-lint");
|
|
47
|
-
mkdirSync(path.dirname(devBinaryPath), { recursive: true });
|
|
48
|
-
writeFileSync(devBinaryPath, "");
|
|
49
|
-
assert.strictEqual(resolveLintBinary({
|
|
50
|
-
platform: "linux",
|
|
51
|
-
arch: "mips",
|
|
52
|
-
devBinaryPath,
|
|
53
|
-
}), devBinaryPath);
|
|
54
|
-
});
|
|
55
|
-
it("throws an actionable error when nothing is installed", () => {
|
|
56
|
-
assert.throws(() => resolveLintBinary({
|
|
57
|
-
platform: "linux",
|
|
58
|
-
arch: "mips",
|
|
59
|
-
devBinaryPath: path.join(tmpRoot, "does-not-exist"),
|
|
60
|
-
}), (err) => {
|
|
61
|
-
assert.ok(err instanceof LintBinaryNotFoundError);
|
|
62
|
-
assert.strictEqual(err.packageName, "@zuplo/lint-linux-mips");
|
|
63
|
-
assert.match(err.message, /@zuplo\/lint-linux-mips/);
|
|
64
|
-
assert.match(err.message, /linux-mips/);
|
|
65
|
-
assert.match(err.message, /--lint-binary/);
|
|
66
|
-
return true;
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
it("finds the binary inside an installed platform package", () => {
|
|
70
|
-
const projectDir = path.join(tmpRoot, "consumer");
|
|
71
|
-
const pkgDir = path.join(projectDir, "node_modules", "@zuplo", "lint-linux-x64");
|
|
72
|
-
mkdirSync(path.join(pkgDir, "bin"), { recursive: true });
|
|
73
|
-
writeFileSync(path.join(pkgDir, "package.json"), JSON.stringify({ name: "@zuplo/lint-linux-x64", version: "1.0.0" }));
|
|
74
|
-
const binPath = path.join(pkgDir, "bin", "zuplo-lint");
|
|
75
|
-
writeFileSync(binPath, "");
|
|
76
|
-
const resolved = resolveLintBinary({
|
|
77
|
-
platform: "linux",
|
|
78
|
-
arch: "x64",
|
|
79
|
-
resolveFrom: path.join(projectDir, "index.js"),
|
|
80
|
-
devBinaryPath: path.join(tmpRoot, "does-not-exist"),
|
|
81
|
-
});
|
|
82
|
-
assert.strictEqual(resolved, binPath);
|
|
83
|
-
});
|
|
84
|
-
it("looks for the .exe on Windows", () => {
|
|
85
|
-
const projectDir = path.join(tmpRoot, "consumer-win");
|
|
86
|
-
const pkgDir = path.join(projectDir, "node_modules", "@zuplo", "lint-win32-x64");
|
|
87
|
-
mkdirSync(path.join(pkgDir, "bin"), { recursive: true });
|
|
88
|
-
writeFileSync(path.join(pkgDir, "package.json"), JSON.stringify({ name: "@zuplo/lint-win32-x64", version: "1.0.0" }));
|
|
89
|
-
const binPath = path.join(pkgDir, "bin", "zuplo-lint.exe");
|
|
90
|
-
writeFileSync(binPath, "");
|
|
91
|
-
const resolved = resolveLintBinary({
|
|
92
|
-
platform: "win32",
|
|
93
|
-
arch: "x64",
|
|
94
|
-
resolveFrom: path.join(projectDir, "index.js"),
|
|
95
|
-
devBinaryPath: path.join(tmpRoot, "does-not-exist"),
|
|
96
|
-
});
|
|
97
|
-
assert.strictEqual(resolved, binPath);
|
|
98
|
-
});
|
|
99
|
-
it("reports a package that is present but unreadable, instead of calling it missing", () => {
|
|
100
|
-
const projectDir = path.join(tmpRoot, "consumer-corrupt");
|
|
101
|
-
const pkgDir = path.join(projectDir, "node_modules", "@zuplo", "lint-linux-x64");
|
|
102
|
-
mkdirSync(path.join(pkgDir, "bin"), { recursive: true });
|
|
103
|
-
writeFileSync(path.join(pkgDir, "package.json"), JSON.stringify({
|
|
104
|
-
name: "@zuplo/lint-linux-x64",
|
|
105
|
-
version: "1.0.0",
|
|
106
|
-
exports: { "./bin/*": "./bin/*" },
|
|
107
|
-
}));
|
|
108
|
-
writeFileSync(path.join(pkgDir, "bin", "zuplo-lint"), "");
|
|
109
|
-
const devBinaryPath = path.join(tmpRoot, "dist", "zuplo-lint");
|
|
110
|
-
mkdirSync(path.dirname(devBinaryPath), { recursive: true });
|
|
111
|
-
writeFileSync(devBinaryPath, "");
|
|
112
|
-
assert.throws(() => resolveLintBinary({
|
|
113
|
-
platform: "linux",
|
|
114
|
-
arch: "x64",
|
|
115
|
-
resolveFrom: path.join(projectDir, "index.js"),
|
|
116
|
-
devBinaryPath,
|
|
117
|
-
}), (err) => {
|
|
118
|
-
assert.ok(err instanceof LintBinaryNotFoundError);
|
|
119
|
-
assert.match(err.message, /installed but could not be read/);
|
|
120
|
-
assert.strictEqual(err.packageName, "@zuplo/lint-linux-x64");
|
|
121
|
-
return true;
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
it("treats a genuinely absent package as not installed, not an error to rethrow", () => {
|
|
125
|
-
const projectDir = path.join(tmpRoot, "consumer-absent");
|
|
126
|
-
mkdirSync(projectDir, { recursive: true });
|
|
127
|
-
const devBinaryPath = path.join(tmpRoot, "dist", "zuplo-lint");
|
|
128
|
-
mkdirSync(path.dirname(devBinaryPath), { recursive: true });
|
|
129
|
-
writeFileSync(devBinaryPath, "");
|
|
130
|
-
assert.strictEqual(resolveLintBinary({
|
|
131
|
-
platform: "linux",
|
|
132
|
-
arch: "x64",
|
|
133
|
-
resolveFrom: path.join(projectDir, "index.js"),
|
|
134
|
-
devBinaryPath,
|
|
135
|
-
}), devBinaryPath);
|
|
136
|
-
});
|
|
137
|
-
it("prefers the installed platform package over the repo build output", () => {
|
|
138
|
-
const projectDir = path.join(tmpRoot, "consumer-precedence");
|
|
139
|
-
const pkgDir = path.join(projectDir, "node_modules", "@zuplo", "lint-linux-x64");
|
|
140
|
-
mkdirSync(path.join(pkgDir, "bin"), { recursive: true });
|
|
141
|
-
writeFileSync(path.join(pkgDir, "package.json"), JSON.stringify({ name: "@zuplo/lint-linux-x64", version: "1.0.0" }));
|
|
142
|
-
const binPath = path.join(pkgDir, "bin", "zuplo-lint");
|
|
143
|
-
writeFileSync(binPath, "");
|
|
144
|
-
const devBinaryPath = path.join(tmpRoot, "dist", "zuplo-lint");
|
|
145
|
-
mkdirSync(path.dirname(devBinaryPath), { recursive: true });
|
|
146
|
-
writeFileSync(devBinaryPath, "");
|
|
147
|
-
assert.strictEqual(resolveLintBinary({
|
|
148
|
-
platform: "linux",
|
|
149
|
-
arch: "x64",
|
|
150
|
-
resolveFrom: path.join(projectDir, "index.js"),
|
|
151
|
-
devBinaryPath,
|
|
152
|
-
}), binPath);
|
|
153
|
-
});
|
|
154
|
-
});
|
|
155
|
-
//# sourceMappingURL=resolve-binary.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-binary.test.js","sourceRoot":"","sources":["../../src/lint/resolve-binary.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EACL,SAAS,EACT,WAAW,EACX,YAAY,EACZ,MAAM,EACN,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EACL,uBAAuB,EACvB,eAAe,EACf,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAE7B,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;QACzD,MAAM,CAAC,WAAW,CAChB,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,EAClC,0BAA0B,CAC3B,CAAC;QACF,MAAM,CAAC,WAAW,CAChB,eAAe,CAAC,OAAO,EAAE,KAAK,CAAC,EAC/B,uBAAuB,CACxB,CAAC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AG,IAAI,CAAC,IAAI,CACtB,UAAU,EACV,cAAc,EACd,QAAQ,EACR,gBAAgB,CACjB,CAAC;QACF,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACzD,aAAa,CACX,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,cAAc,CAAC,EACjC,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,uBAAuB,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CACpE,CAAC;QACF,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;QACvD,aAAa,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAE3B,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;QAC/D,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5D,aAAa,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;QAEjC,MAAM,CAAC,WAAW,CAChB,iBAAiB,CAAC;YAChB,QAAQ,EAAE,OAAO;YACjB,IAAI,EAAE,KAAK;YACX,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC;YAC9C,aAAa;SACd,CAAC,EACF,OAAO,CACR,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import assert from \"node:assert\";\nimport {\n mkdirSync,\n mkdtempSync,\n realpathSync,\n rmSync,\n writeFileSync,\n} from \"node:fs\";\nimport { tmpdir } from \"node:os\";\nimport path from \"node:path\";\nimport { after, before, describe, it } from \"node:test\";\nimport {\n LintBinaryNotFoundError,\n lintPackageName,\n resolveLintBinary,\n} from \"./resolve-binary.js\";\n\ndescribe(\"lintPackageName\", () => {\n it(\"derives the package name from platform and arch\", () => {\n assert.strictEqual(\n lintPackageName(\"darwin\", \"arm64\"),\n \"@zuplo/lint-darwin-arm64\"\n );\n assert.strictEqual(\n lintPackageName(\"linux\", \"x64\"),\n \"@zuplo/lint-linux-x64\"\n );\n assert.strictEqual(\n lintPackageName(\"win32\", \"x64\"),\n \"@zuplo/lint-win32-x64\"\n );\n });\n});\n\ndescribe(\"resolveLintBinary\", () => {\n let tmpRoot: string;\n let overridePath: string;\n\n before(() => {\n // realpath because require.resolve returns real paths, and on macOS\n // os.tmpdir() is /tmp, a symlink to /private/tmp.\n tmpRoot = realpathSync(mkdtempSync(path.join(tmpdir(), \"lint-binary-\")));\n overridePath = path.join(tmpRoot, \"custom-zuplo-lint\");\n writeFileSync(overridePath, \"#!/bin/sh\\n\");\n });\n\n after(() => {\n rmSync(tmpRoot, { recursive: true, force: true });\n });\n\n it(\"uses an explicit override ahead of everything else\", () => {\n const devBinaryPath = path.join(tmpRoot, \"dev\", \"zuplo-lint\");\n mkdirSync(path.dirname(devBinaryPath), { recursive: true });\n writeFileSync(devBinaryPath, \"\");\n\n assert.strictEqual(\n resolveLintBinary({ override: overridePath, devBinaryPath }),\n overridePath\n );\n });\n\n it(\"resolves a relative override against the working directory\", () => {\n const relative = path.relative(process.cwd(), overridePath);\n\n assert.strictEqual(\n resolveLintBinary({ override: relative }),\n path.resolve(relative)\n );\n });\n\n it(\"reports the bad path when the override does not exist\", () => {\n const missing = path.join(tmpRoot, \"nope\");\n\n assert.throws(\n () => resolveLintBinary({ override: missing }),\n (err: unknown) => {\n assert.ok(err instanceof LintBinaryNotFoundError);\n assert.match(err.message, /No zuplo-lint binary at/);\n assert.ok(\n err.message.includes(missing),\n \"expected the resolved path in the message\"\n );\n // The message has to name the flag, or the user cannot tell where the\n // path came from.\n assert.match(err.message, /--lint-binary/);\n return true;\n }\n );\n });\n\n it(\"falls back to the repo build output when the platform package is absent\", () => {\n const devBinaryPath = path.join(tmpRoot, \"dist\", \"zuplo-lint\");\n mkdirSync(path.dirname(devBinaryPath), { recursive: true });\n writeFileSync(devBinaryPath, \"\");\n\n assert.strictEqual(\n resolveLintBinary({\n platform: \"linux\",\n arch: \"mips\",\n devBinaryPath,\n }),\n devBinaryPath\n );\n });\n\n it(\"throws an actionable error when nothing is installed\", () => {\n assert.throws(\n () =>\n resolveLintBinary({\n platform: \"linux\",\n arch: \"mips\",\n devBinaryPath: path.join(tmpRoot, \"does-not-exist\"),\n }),\n (err: unknown) => {\n assert.ok(err instanceof LintBinaryNotFoundError);\n assert.strictEqual(err.packageName, \"@zuplo/lint-linux-mips\");\n // An unsupported platform must say which package is missing and how to\n // recover, not just that something went wrong.\n assert.match(err.message, /@zuplo\\/lint-linux-mips/);\n assert.match(err.message, /linux-mips/);\n assert.match(err.message, /--lint-binary/);\n return true;\n }\n );\n });\n\n it(\"finds the binary inside an installed platform package\", () => {\n // Lay out a node_modules tree the way npm would, and resolve from a module\n // inside it.\n const projectDir = path.join(tmpRoot, \"consumer\");\n const pkgDir = path.join(\n projectDir,\n \"node_modules\",\n \"@zuplo\",\n \"lint-linux-x64\"\n );\n mkdirSync(path.join(pkgDir, \"bin\"), { recursive: true });\n writeFileSync(\n path.join(pkgDir, \"package.json\"),\n JSON.stringify({ name: \"@zuplo/lint-linux-x64\", version: \"1.0.0\" })\n );\n const binPath = path.join(pkgDir, \"bin\", \"zuplo-lint\");\n writeFileSync(binPath, \"\");\n\n const resolved = resolveLintBinary({\n platform: \"linux\",\n arch: \"x64\",\n resolveFrom: path.join(projectDir, \"index.js\"),\n devBinaryPath: path.join(tmpRoot, \"does-not-exist\"),\n });\n\n assert.strictEqual(resolved, binPath);\n });\n\n it(\"looks for the .exe on Windows\", () => {\n const projectDir = path.join(tmpRoot, \"consumer-win\");\n const pkgDir = path.join(\n projectDir,\n \"node_modules\",\n \"@zuplo\",\n \"lint-win32-x64\"\n );\n mkdirSync(path.join(pkgDir, \"bin\"), { recursive: true });\n writeFileSync(\n path.join(pkgDir, \"package.json\"),\n JSON.stringify({ name: \"@zuplo/lint-win32-x64\", version: \"1.0.0\" })\n );\n const binPath = path.join(pkgDir, \"bin\", \"zuplo-lint.exe\");\n writeFileSync(binPath, \"\");\n\n const resolved = resolveLintBinary({\n platform: \"win32\",\n arch: \"x64\",\n resolveFrom: path.join(projectDir, \"index.js\"),\n devBinaryPath: path.join(tmpRoot, \"does-not-exist\"),\n });\n\n assert.strictEqual(resolved, binPath);\n });\n\n it(\"reports a package that is present but unreadable, instead of calling it missing\", () => {\n // An `exports` map that does not expose ./package.json makes require.resolve\n // fail with ERR_PACKAGE_PATH_NOT_EXPORTED rather than MODULE_NOT_FOUND. The\n // package is right there, so saying \"not installed\" would send the user\n // hunting for something they already have.\n const projectDir = path.join(tmpRoot, \"consumer-corrupt\");\n const pkgDir = path.join(\n projectDir,\n \"node_modules\",\n \"@zuplo\",\n \"lint-linux-x64\"\n );\n mkdirSync(path.join(pkgDir, \"bin\"), { recursive: true });\n writeFileSync(\n path.join(pkgDir, \"package.json\"),\n JSON.stringify({\n name: \"@zuplo/lint-linux-x64\",\n version: \"1.0.0\",\n exports: { \"./bin/*\": \"./bin/*\" },\n })\n );\n writeFileSync(path.join(pkgDir, \"bin\", \"zuplo-lint\"), \"\");\n\n // A dev binary is available, but must NOT be used to paper over this: the\n // consumer's own platform package is broken and they need to know.\n const devBinaryPath = path.join(tmpRoot, \"dist\", \"zuplo-lint\");\n mkdirSync(path.dirname(devBinaryPath), { recursive: true });\n writeFileSync(devBinaryPath, \"\");\n\n assert.throws(\n () =>\n resolveLintBinary({\n platform: \"linux\",\n arch: \"x64\",\n resolveFrom: path.join(projectDir, \"index.js\"),\n devBinaryPath,\n }),\n (err: unknown) => {\n assert.ok(err instanceof LintBinaryNotFoundError);\n assert.match(err.message, /installed but could not be read/);\n assert.strictEqual(err.packageName, \"@zuplo/lint-linux-x64\");\n return true;\n }\n );\n });\n\n it(\"treats a genuinely absent package as not installed, not an error to rethrow\", () => {\n // The counterpart to the test above: MODULE_NOT_FOUND must stay on the\n // ordinary path so the dev fallback still applies.\n const projectDir = path.join(tmpRoot, \"consumer-absent\");\n mkdirSync(projectDir, { recursive: true });\n\n const devBinaryPath = path.join(tmpRoot, \"dist\", \"zuplo-lint\");\n mkdirSync(path.dirname(devBinaryPath), { recursive: true });\n writeFileSync(devBinaryPath, \"\");\n\n assert.strictEqual(\n resolveLintBinary({\n platform: \"linux\",\n arch: \"x64\",\n resolveFrom: path.join(projectDir, \"index.js\"),\n devBinaryPath,\n }),\n devBinaryPath\n );\n });\n\n it(\"prefers the installed platform package over the repo build output\", () => {\n const projectDir = path.join(tmpRoot, \"consumer-precedence\");\n const pkgDir = path.join(\n projectDir,\n \"node_modules\",\n \"@zuplo\",\n \"lint-linux-x64\"\n );\n mkdirSync(path.join(pkgDir, \"bin\"), { recursive: true });\n writeFileSync(\n path.join(pkgDir, \"package.json\"),\n JSON.stringify({ name: \"@zuplo/lint-linux-x64\", version: \"1.0.0\" })\n );\n const binPath = path.join(pkgDir, \"bin\", \"zuplo-lint\");\n writeFileSync(binPath, \"\");\n\n const devBinaryPath = path.join(tmpRoot, \"dist\", \"zuplo-lint\");\n mkdirSync(path.dirname(devBinaryPath), { recursive: true });\n writeFileSync(devBinaryPath, \"\");\n\n assert.strictEqual(\n resolveLintBinary({\n platform: \"linux\",\n arch: \"x64\",\n resolveFrom: path.join(projectDir, \"index.js\"),\n devBinaryPath,\n }),\n binPath\n );\n });\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handler.spec.d.ts","sourceRoot":"","sources":["../../../src/open-api/convert/handler.spec.ts"],"names":[],"mappings":""}
|