fix(web): break web-pkg/design-system/web-test-helpers dependency cycle
web-pkg, design-system and web-test-helpers formed a cycle: the mount
helpers have to install the design system (its components are registered
globally) and web-pkg's mocked pinia stores, so web-test-helpers was
imported by both packages that imported it back.
Resolved by layering the helpers onto the packages that already need
them, instead of adding another one:
design-system/testing mount/shallowMount, prop types, design system +
gettext + router-link stub plugins
web-pkg/src/testing the above, extended with casl abilities, mocked
pinia stores and component mocks
web-test-helpers re-export of web-pkg/src/testing
design-system sits at the bottom of the workspace graph, so it cannot
depend on a package that installs it - hence the generic half lives
there. web-pkg composes those plugins rather than duplicating them, so
every helper is still defined exactly once, and no package depends on
one above it.
The public API of `@ownclouders/web-test-helpers` is unchanged, so
external extensions are unaffected.
Also:
- pin `typescript` via `pnpm.overrides` - without it, a second peer-
resolved typescript version forks `vue`, which forks `vue3-gettext`
into two module instances, breaking `inject(GetTextSymbol)` for any
component mounted through these helpers.
- keep `@ownclouders/design-system/testing` external in web-pkg's lib
build. rollup matches `external` strings exactly, so the subpath was
inlined, shipping a second copy of the design system and of
@vue/test-utils into the published bundle - components and wrappers
were then not identity-equal to the consumer's own, and gettext
injection broke.
- name the web-test-helpers umd output `.cjs`. The package is ESM, so the
`.js` file that publishConfig.exports pointed `require` at could not be
required.
Verified: `pnpm install --frozen-lockfile` clean, zero cyclic-workspace
warnings; `pnpm test:unit` 380 files / 3129 tests pass; `pnpm check:types`
0 errors; `pnpm lint`/`check:format` 0 errors; `pnpm build` succeeds;
published artifacts checked by mounting through the built `dist/` bundles
the way an external extension resolves them via publishConfig.exports.
100 lines
2.8 KiB
JSON
100 lines
2.8 KiB
JSON
{
|
|
"name": "@ownclouders/web-pkg",
|
|
"version": "12.5.0",
|
|
"description": "ownCloud web pkg",
|
|
"license": "Apache-2.0",
|
|
"main": "src/index.ts",
|
|
"types": "types.d.ts",
|
|
"private": false,
|
|
"author": "ownCloud GmbH <devops@owncloud.com>",
|
|
"type": "module",
|
|
"homepage": "https://github.com/owncloud/web/tree/master/packages/web-pkg",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "https://github.com/owncloud/web",
|
|
"directory": "packages/web-pkg"
|
|
},
|
|
"files": [
|
|
"dist/"
|
|
],
|
|
"publishConfig": {
|
|
"directory": "package",
|
|
"linkDirectory": false,
|
|
"exports": {
|
|
".": {
|
|
"import": "./dist/web-pkg.js",
|
|
"require": "./dist/web-pkg.umd.cjs",
|
|
"types": "./dist/types/index.d.ts"
|
|
},
|
|
"./src/testing": {
|
|
"import": "./dist/web-pkg-testing.js",
|
|
"require": "./dist/web-pkg-testing.umd.cjs",
|
|
"types": "./dist/types/testing/index.d.ts"
|
|
}
|
|
}
|
|
},
|
|
"scripts": {
|
|
"vite": "vite",
|
|
"prepublishOnly": "rm -rf ./package && clean-publish && rm -rf package/dist/tests package/dist/*.css && find package && cat package/package.json",
|
|
"postpublish": "rm -rf ./package",
|
|
"test:unit": "NODE_OPTIONS=--unhandled-rejections=throw vitest"
|
|
},
|
|
"dependencies": {
|
|
"@casl/ability": "^6.8.1",
|
|
"@casl/vue": "^2.2.6",
|
|
"@chevrotain/regexp-to-ast": "^11.2.0",
|
|
"@microsoft/fetch-event-source": "^2.0.1",
|
|
"@ownclouders/design-system": "workspace:^",
|
|
"@ownclouders/web-client": "workspace:^",
|
|
"@pdf-lib/fontkit": "^1.1.1",
|
|
"@pinia/testing": "^1.0.3",
|
|
"@sentry/vue": "10.51.0",
|
|
"@uppy/core": "5.2.0",
|
|
"@uppy/drop-target": "4.1.0",
|
|
"@uppy/tus": "5.1.1",
|
|
"@uppy/utils": "7.2.0",
|
|
"@uppy/xhr-upload": "5.2.0",
|
|
"@vavt/cm-extension": "^1.11.2",
|
|
"@vue/shared": "^3.5.29",
|
|
"@vueuse/core": "^14.3.0",
|
|
"deepmerge": "^4.3.1",
|
|
"dompurify": "^3.4.13",
|
|
"emoji-regex": "^10.6.0",
|
|
"filesize": "^11.0.17",
|
|
"fuse.js": "^7.3.0",
|
|
"highlight.js": "^11.11.1",
|
|
"html2canvas": "^1.4.1",
|
|
"katex": "^0.16.45",
|
|
"lodash-es": "^4.18.1",
|
|
"luxon": "^3.7.2",
|
|
"mark.js": "^8.11.1",
|
|
"marked": "^17.0.6",
|
|
"md-editor-v3": "^6.5.0",
|
|
"mermaid": "^11.16.1",
|
|
"oidc-client-ts": "^3.5.0",
|
|
"p-queue": "^9.2.0",
|
|
"password-sheriff": "^2.0.0",
|
|
"pdf-lib": "^1.17.1",
|
|
"pinia": "^3.0.4",
|
|
"portal-vue": "^3.0.0",
|
|
"prettier": "^3.8.1",
|
|
"prismjs": "^1.30.0",
|
|
"qs": "^6.15.2",
|
|
"screenfull": "^6.0.2",
|
|
"uuid": "^14.0.0",
|
|
"vitest-mock-extended": "3.1.1",
|
|
"vue-concurrency": "^5.0.3",
|
|
"vue-router": "^5.0.6",
|
|
"vue3-gettext": "^4.0.1",
|
|
"zod": "^4.3.6"
|
|
},
|
|
"devDependencies": {
|
|
"@types/lodash-es": "4.17.12",
|
|
"@vitest/web-worker": "4.1.5",
|
|
"clean-publish": "6.0.1",
|
|
"vite": "7.3.5",
|
|
"vite-plugin-dts": "4.5.4",
|
|
"vite-plugin-node-polyfills": "0.24.0"
|
|
}
|
|
}
|