Repository navigation
feat: add @deprecated item decorator - #644
Conversation
|
The changes in this PR will be included in the next version bump.
|
| const msgPart = decVal.isStatic && _.isString(decVal.staticValue) | ||
| ? `: ${decVal.staticValue}` | ||
| : ''; | ||
| throw new SchemaError(`This config item is deprecated${msgPart}`, { isWarning: true }); |
There was a problem hiding this comment.
Im not sure about having a warning here. I thought it would just add it to the generated ts types?
The user knows it's likely still set, or else they would remove it from the schema altogether.
We could potentially still mark it somehow in the varlock load output, but the warning may be a bit too agressive?
There was a problem hiding this comment.
Yeah I'm on the fence there too. I could see a case for warning, especially in CI, but maybe we put it behind a flag?
| expect(g.configSchema.ALSO_NOT_DEPRECATED.isDeprecated).toBe(false); | ||
| }); | ||
|
|
||
| it('@deprecated is included in type gen info', async () => { |
There was a problem hiding this comment.
prob want one too checking the type output with just the @deprecated and no custom message
commit: |
Agent-Logs-Url: https://github.com/dmno-dev/varlock/sessions/86c3a61d-4c29-49b1-b072-fecf43de4aef Co-authored-by: philmillman <3722211+philmillman@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dmno-dev/varlock/sessions/86c3a61d-4c29-49b1-b072-fecf43de4aef Co-authored-by: philmillman <3722211+philmillman@users.noreply.github.com>
Co-authored-by: Theo Ephraim <theo@dmno.dev>
…el in pretty output Instead of emitting a SchemaError warning, deprecated items now show a strikethrough key name and a 😵deprecated label in the pretty output.
744aa2b to
507773e
Compare


Adds a
@deprecateddecorator for env-spec config items that shows visual deprecation in CLI output and annotates generated TypeScript types with@deprecatedJSDoc so IDEs show strikethrough on access.Decorator behavior
strikethroughon the key name + 😵deprecated label@deprecated=falseallows opt-out (useful for override scenarios)Changes
decorators.ts— registersdeprecatedinbuiltInItemDecorators(no-op processor, purely declarative)config-item.ts— addsisDeprecatedanddeprecationMessagegetterstype-generation.ts— emits@deprecated [message]JSDoc tag wheninfo.isDeprecatedis trueformatting.ts— shows strikethrough key name + 😵deprecated label in pretty CLI outputdeprecated-decorator.test.ts— tests for resolution, opt-out, getter values, and type gen info