[Feature Request] Shared defaults for every schema in a repository
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 38/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- json, node.js, typescript
- Domain
- tooling
Research direction
Start by reading the monorepo guide and the schema-loading code that handles imports, root decorators, and generator options; the issue does not name specific files or tests. Decide how repository defaults are discovered, combined with each schema's header, and overridden, then add coverage for multiple package depths and explicit opt-in behavior. Done means repository-wide defaults can be configured once and individual schemas can override them.
Written by the indexing model from the issue text.
Description
Description
A way to apply shared defaults to every schema in a repository (common imports, root decorators, generator options), without repeating them in each .env.schema.
Motivation
Following the monorepo guide (one schema per package, imports for what each needs), every package schema tends to start with the same header, for example:
# @import(../../.env.shared)
# @import(../../.env.secrets, enabled=forEnv(development))
# @generateTsTypes(path=./env.d.ts, auto=forEnv(development, test))
# ---
The relative paths differ by depth, and a change to the shared setup (a new generator option, a different auth import) means editing every schema. Varlock deliberately does not walk up to parent directories, which is reasonable as a default, so this would need an explicit opt-in.
Proposed Solution
For example, a varlock.defaults entry in the root package.json (or a root .env.defaults file that schemas opt into) listing imports and root decorators applied to every schema varlock loads within the repository, before the schema's own header, so a schema can still override any of them.
{
"varlock": {
"defaults": {
"imports": [".env.shared", { "path": ".env.secrets", "enabled": "forEnv(development)" }],
"generateTsTypes": { "path": "./env.d.ts", "auto": "forEnv(development, test)" }
}
}
}
The exact shape matters less than having one place for it.
Alternatives
- Keep the repeated header in each schema (works, drifts).
- A single root schema with tags and
varlock.loadPath/filterper package, which loses per-package ownership of vars.
Additional Information
Pairs with importing workspace packages by name (#1140), which would remove the depth-dependent relative paths as well.
- Dominant language
- TypeScript
- Stars
- 4.9k
- Forks
- 140
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 35
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dmno-dev/varlock
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
dmno-dev/varlock#1279 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
dmno-dev/varlock#1100 · 3 comments ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 78/100
dmno-dev/varlock#1278 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
dmno-dev/varlock#1275 · 1 comment ·
Maintainers usually reply within 1 day
-
core:varlock RFC
Difficulty 5/5 Over a week Newbie friendliness 28/100
dmno-dev/varlock#1258 · 1 comment ·
Maintainers usually reply within 1 day
All issues in dmno-dev/varlock
Similar issues
-
documentation good first issue roadmap
Difficulty 1/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
resend/react-email#3876 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
siyuan-note/siyuan#21324 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
himynameisdave/bsky-profanity-counter#59 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100