Giter Site home page Giter Site logo

Comments (6)

danieldunderfelt avatar danieldunderfelt commented on June 17, 2024

I got this to work with Yarn by installing it explicitly and then running the command with Yarn. I also needed to install the upgrade package as mentioned as well as a package called "transform-imports". Then I found out that the codemod does not work on files that use decorators.

from date-fns-upgrade-codemod.

dkozickis avatar dkozickis commented on June 17, 2024

Hi @danieldunderfelt! Thank you for reporting this one.

It's not clearly stated in README, but @date-fns/upgrade/v2 has to be installed as dependency for your project, the one that you're updating.

  1. Install @date-fns/upgrade/v2 as dependency for your project
  2. Run codemod

The codemod should not be a dependency in your project.

Regarding not working on files with decorators - that's something I have missed.

from date-fns-upgrade-codemod.

msolovyov avatar msolovyov commented on June 17, 2024

I use npm, installed @date-fns/upgrade --save and transform-imports --save but still get the same cannot find module when running the npx codemod

Error: Cannot find module '@date-fns/upgrade/v2' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15) at Function.Module._load (internal/modules/cjs/loader.js:507:25) at Module.require (internal/modules/cjs/loader.js:637:17) at require (internal/modules/cjs/helpers.js:22:18) at Object.<anonymous> (/home/michael/.npm/_npx/4223/lib/node_modules/@date-fns/upgrade-codemod/src/transform.ts:2:1) at Module._compile (internal/modules/cjs/loader.js:689:30) at Module._compile (/home/michael/.npm/_npx/4223/lib/node_modules/@date-fns/upgrade-codemod/node_modules/pirates/lib/index.js:99:24) at Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Object.newLoader [as .ts] (/home/michael/.npm/_npx/4223/lib/node_modules/@date-fns/upgrade-codemod/node_modules/pirates/lib/index.js:104:7) at Module.load (internal/modules/cjs/loader.js:599:32)

from date-fns-upgrade-codemod.

msolovyov avatar msolovyov commented on June 17, 2024

I got it to work by installing this repo locally and running the bin directly
cd node_modules/@date-fns/upgrade-codemod/bin
./date-fns-codemod.js projectdir

from date-fns-upgrade-codemod.

dkozickis avatar dkozickis commented on June 17, 2024

After further reconsideration @danieldunderfelt is actually correct :)
I'll merge his PR and publish new lib.

from date-fns-upgrade-codemod.

dkozickis avatar dkozickis commented on June 17, 2024

Closed via #6

from date-fns-upgrade-codemod.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.