Repository navigation
refactor(effect-app): remove helpers Effect already provides - #914
Merged
Merged
Conversation
Drop aliases and wrappers that match Effect 4, including the date-fns calendar module, and add migrateEffectAppSource to rewrite call sites. Co-authored-by: Patrick Roza <42661+patroza@users.noreply.github.com>
@effect-app/cli
effect-app
@effect-app/eslint-codegen-model
@effect-app/eslint-shared-config
@effect-app/infra
@effect-app/vue
@effect-app/vue-components
commit: |
Co-authored-by: Patrick Roza <42661+patroza@users.noreply.github.com>
These helpers are not the same call as Record.filter and Option.liftPredicate. typedValuesOf still becomes Record.values, with Object.values where the value type depends on the key. Co-authored-by: Patrick Roza <42661+patroza@users.noreply.github.com>
Co-authored-by: Patrick Roza <42661+patroza@users.noreply.github.com>
DateAdd* and DateSub* rewrite through DateTime.fromDateUnsafe(date).pipe(DateTime.add({ unit }), DateTime.toDate).
Co-authored-by: Patrick Roza <42661+patroza@users.noreply.github.com>
Add makeZonedLocal and pipeZonedLocal. DateAdd* and DateSub* migrate through pipeZonedLocal, which keeps the local calendar and returns the instant with toDateUtc. Co-authored-by: Patrick Roza <42661+patroza@users.noreply.github.com>
Co-authored-by: Patrick Roza <42661+patroza@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
effect-app/_ext/dateandeffect-app/_ext/misc, and drop thedate-fnsdependency.migrateEffectAppSourceineffect-app/migration/nativeEffectso an app can rewrite one file at a time.Migration
The table
nativeEffectReplacementslists each old name, the Effect expression, and the imports to add.Three replacements are not identical on every input:
Chunk.containsWithcalls the equivalence as(needle, element). The oldelemcalled it as(element, needle). A symmetric equivalence is unchanged.DateAdd*andDateSub*becomepipeZonedLocal(date, DateTime.add({ days }))fromeffect-app/DateTime. That attaches the process timezone and returns the instant withtoDateUtc, so the local calendar stays.makeZonedLocalis the same zoning without the pipe.Record.valuesexpects one value type. A mapped type whose value depends on its key should useObject.values.dropUndefinedandfromBoolstay. So dogroupByT(any key, entry list),randomElement,findFirstMap, schema constructors that add construction defaults, anddropUndefinedT/dropUndefinedT2/dropUndefinedRec.The changeset is a patch for the fixed group, so the next release is 4.0.1.
Test plan
vitestpackages/effect-app/test/nativeEffectMigration.test.tsanddateTimeLocal.test.tstsgoon effect-app, infra, vue, and e2epnpm check,pnpm lint,pnpm test)opened by patroza in chat thread Discord · Discord · T3
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.