- we do not intend to publish most components as library, we do not bundle and transpile to cjs
- At components/agents receipes we prefer to compile components just-in-time, so as to benefit performance by avoiding intermediate build step
- We allow end-application to use bundler of choice, while for now esm is a must. We could create receipes for compiling commonjs with tsbuild.
- shadn use alias at
components.json(reference) - tsconfig paths alias is not sufficient and we use nodejs subpath imports i.e. imports at package.json for the # alias to support IDE, we need array with explicit extension. Note order matters so IDE can process accordingly
"imports": {
"#*": ["./src/*", "./src/*.tsx"]
},
This is expected for auto import to work.
-
includePackageJsonAutoImportsis to trade off performance for full search on paths for all internal packages, so as to support wildcard import -
importModuleSpecifierEndingis to avoid automatically adding.jsextension, , although in practice we find it a bit fuzzy
"typescript.preferences.includePackageJsonAutoImports": "on",
"typescript.preferences.importModuleSpecifierEnding": "minimal",
-
Environment variables are namespaced and configured via the canonical util config file
packages/domain/src/config.ts -
Refers to
env.sampleto create.envfile.- To align common convention and be agnostic across various build environment, currently prefix like
VITEorSTORYBOOKis not required.
- To align common convention and be agnostic across various build environment, currently prefix like
-
Avoid loading environment directly at components / libs (e.g. process.env) and always prefer injecting config
-
process.envis defined explicitly at Vite config. At storybook / vitest it is injected at config and picked up via vite loaderloadEnv. -
we could consider use of defu to merge config
- We could consider to share a base project root config
- to be customized for dom based testing at storybook / ui-react packages
- for now we install related dependencies at root
This project uses changesets for package versioning and publishing. When making changes:
- Run
pnpm changesetto create a new changeset - Follow the prompts to describe your changes
- Commit the generated changeset file
For more details on using changesets, refer to the official documentation.