Comments (6)
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.
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.
- Install
@date-fns/upgrade/v2
as dependency for your project - 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.
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.
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.
After further reconsideration @danieldunderfelt is actually correct :)
I'll merge his PR and publish new lib.
from date-fns-upgrade-codemod.
Closed via #6
from date-fns-upgrade-codemod.
Related Issues (2)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from date-fns-upgrade-codemod.