Opal Frontend Common Node Library Guidelines
Overview
Use these rules to keep work aligned with the library structure, build tooling, and public API.
Project Structure
- •
src/contains TypeScript source organized by feature folders (app-insights/,csrf-token/,health/,helmet/,session/, etc.). - •
src/interfaces/holds shared types;src/index.tsre-exports public modules. - •
src/*.d.tsandsrc/global.d.tsprovide ambient typings and are copied todist/. - •
dist/is build output and should be generated viayarn build(do not hand-edit).
Build, Lint, and Audit Commands
- •
yarn buildrunsclean, compiles TypeScript, and copiespackage.json, root.d.tsfiles, andREADME.mdtodist/. - •
yarn cleanremovesdist/. - •
yarn lintruns ESLint oversrc/and Prettier checks. - •
yarn prettierchecks formatting;yarn prettier:fixformats in place. - •
yarn audit:saveupdatesyarn-known-issues;yarn audit:checkcompares against current advisories (requiresjq).
Export Map and Public API
- •This package is ESM (
"type": "module"). Keep imports/exports in ESM style. - •
package.jsonexportsis the source of truth for published entry points. - •When adding or removing a public module, update all of:
- •
package.jsonexports - •
src/index.ts(top-level re-exports) - •
tsconfig.jsonpaths(local TS resolution) - •
src/<module>/index.ts(module-local exports) - •any required ambient
.d.tsinsrc/so it is copied todist/
- •
Coding Style
- •Follow
.editorconfigand.prettierrc: 2-space indent, single quotes in TS, 120 print width, semicolons. - •Keep class members ordered per
@typescript-eslint/member-orderingineslint.config.js. - •Prefer small, focused modules; avoid unnecessary side effects at import time.
Tooling and Environment
- •Node.js v18+ and Yarn classic v1.22.22 (per
package.jsonandREADME.md). - •
tsconfig.jsonuses strict mode; avoidanyand keep types explicit.
Publishing
- •Bump the version in
package.json, create a GitHub release with that tag, and wait for the release workflow to publish (seeREADME.md). - •
dist/is generated duringyarn buildand is not committed.