question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[V3] Migration should be done with a codemod?

See original GitHub issue

Is your feature request related to a problem? Please describe. I found after writing the documentation there are several steps to migrate a large application:

  • NumberFormat and DateFormat components were removed. Use date and number formats from @lingui/core package instead.
  • Change import of components to macro from react package
  • plural parameters changed:
- plural({ value, one: "# book", other: "# books" })
+ plural(value, { one: "# book", other: "# books" })
  • i18n.t(), i18n.plural(), i18n.select() and i18n.selectOrdinal() methods are removed and replaced with macros.
  • Rename I18nProvider.defaultRender prop to I18nProvider.defaultComponent
  • Macros don’t need to be wrapped inside i18n._: i18n._(t'Message') => t'Message'

To not implement:

  • setupI18n can be safely removed and i18n can be imported from @lingui/core (if setupI18n has some parameters, I would leave it for user to handle it), this is a easily migration for the end user so probably it’s not the worth time to implement a codemod to this

Describe proposed solution I propose to write a codemod for do all this migration with a just

npx codemod lingui-v2-to-v3

the user only should migrate his i18n setup from a declarative API to the new i18n.load, and i18n.activate

What do you think @tricoder42? Probably I could get it working tomorrow or the next, with this and the documentation finished we’ll have a good adoption.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
tricoder42commented, Oct 22, 2020

@semoal I’ve invited you as a collaborator. Let me know if it enables write access for you

1reaction
semoalcommented, Oct 21, 2020
Screenshot 2020-10-22 at 00 36 54 I've already got 2/7 (in 1 hour or less), it's my first time with codemods and AST, i'll try to give it some time tomorrow!
Read more comments on GitHub >

github_iconTop Results From Across the Web

Migrating Code Using Codemods - Medium
To do this, we're going to be using the following tools: JSCodeShift to apply our codemod to our codebase; AST Explorer to test...
Read more >
Strapi v3 to v4 Migration Using Codemods [ Strapi ... - YouTube
strapiStrapi v3 to v4 Migration Using Codemods [ Strapi Migration Guide Part 2 ]This tutorial video will cover how to use codemods when ......
Read more >
How To Migrate From Strapi v3 to v4 Walkthrough
This article will cover the "bird's view" of the Strapi v3 to v4 migration process. ... We need to do this before using...
Read more >
Migrating your code to SDK for JavaScript V3
The experimental collection of codemod scripts in aws-sdk-js-codemod helps migrate your existing AWS SDK for JavaScript (v2) application to use v3 APIs.
Read more >
Migrate From V6 to V7 - Simple React forms validation
This will info hook form that errors object is been subscribed. You can use this codemod library to speed up the process: https://github.com/react-hook-form/ ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found