- This is an npm workspaces monorepo managed by Lerna (
lerna.jsonuses independent versioning andnpmClient: npm). packages/stencil-libraryis the source of truth for the web component and all identifier renderers.packages/react-library,packages/vue-library, andpackages/angular-libraryare thin wrapper packages generated from Stencil output targets; do not hand-edit generateddist/orlib/stencil-generated/files.packages/nextjs-appis a private demo/Storybook host, not a published package.
- The main public component is
packages/stencil-library/src/components/pid-component/pid-component.tsx. - Identifier-specific logic lives in
packages/stencil-library/src/rendererModules/*and extendsGenericIdentifierType. - The renderer registry and priority order are centralized in
packages/stencil-library/src/utils/utils.ts. - Auto-detection is implemented in
packages/stencil-library/src/auto-detect/initPidDetection.ts: it scans DOM text nodes, chooses a renderer withdetectBestFit, and replaces matches while preserving original text for recovery. - The public entrypoint is
packages/stencil-library/src/index.ts; export additions should start there.
- Renderer class names follow the
*Typepattern: e.g.HandleType,ORCIDType,DataCiteDOIType,CrossRefDOIType. - New renderer behavior usually needs three edits: implement the renderer, register it in
src/utils/utils.ts, and export it fromsrc/index.ts. - Many props are designed for both HTML and TSX usage; remember hyphenated attributes in plain HTML and camelCase in Stencil/JSX code.
settingsand some options are passed as stringified JSON, not typed objects, so preserve that contract when editing props or docs.- Example/demo data lives in
examples/and is re-exported fromexamples/index.ts; keep stories and demos aligned when adding new sample identifiers.
- Use npm only; the README explicitly says not to use yarn or pnpm.
- Common commands:
npm run build,npm run lint,npm test,npm run storybook,npm run storybook:all, andnpm run build-storybook. - Package-level Stencil workflows live in
packages/stencil-library:npm run buildWatch,npm run test:spec,npm run test:e2e,npm run test:watch. - Browser-based tests and Storybook tests require Chromium:
npx playwright install --with-deps chromium. - CI also checks formatting via
npx lerna run format:check. - Before giving any result to the user, please run
lerna run build && npm run build-storybookas well asnpm run lintandnpm testto ensure the code is in good shape.
- The Stencil library drives wrapper generation and public API shape; changes here can affect every framework package.
packages/stencil-library/src/utils/utils.tscontrols auto-detection defaults viaautoDiscoverableByDefault;LocaleTypeandFallbackTypeare intentionally not auto-discovered by default.pid-componentrecursively renders subcomponents and uses props likelevelOfSubcomponents,currentLevelOfSubcomponents,showTopLevelCopy, andfallbackToAllto control nested behavior.- Prefer changing source files over generated outputs; Storybook static assets and compiled bundle directories are build artifacts.