mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
1.1 KiB
1.1 KiB
Logto connectors directory
Template syncing
Since all connectors have a same pattern for package.json
, here we leverage several techniques to avoid annoying copy-pastes:
When pnpm i
- The
"pnpm:devPreinstall"
script in the project root executestemplates/sync-preset.js
that:- Check every connectors's
package.json
to see if there's any unexpected keys - Sync
templates/package.json
by REPLACING every template key (except dependency keys) in the currentpackage.json
with the value from the templatepackage.json
- Copies all config files to every connector directory
- Check every connectors's
- The hook in
.pnpmfile.cjs
of the project root merges dependency fields for every connector- Also we can update arbitrary fields in this hook, we still need to keep non-dependency fields in the connector's
package.json
since the hook only takes affect duringpnpm i
.
- Also we can update arbitrary fields in this hook, we still need to keep non-dependency fields in the connector's
Caution Workspace dependencies should be defined in connector's package.json (not template) in order to let PNPM correctly resolves the workspace dependency tree;
Add a new custom field
Head to templates/sync-preset.js
and update allowedCustomKeys
.