Comments (10)
One option would be to use prettier, which by default always uses unix-style line endings https://prettier.io/docs/en/options.html#end-of-line
Would you accept a PR adding prettier to the codebase?
from typescript-call-graph.
opened a PR 🤞
#10
from typescript-call-graph.
@whyboris just wondering whether you had time to take a look at this - let me know if you have any questions about it or don't think it's the right solution.
from typescript-call-graph.
Sorry for the delay - busy weeks for me - I'm packing and getting ready to move to a new house 😅
I'll try to find time this week 🤝
cool, just checking
no rush 🙂
from typescript-call-graph.
Hi here 👋 First of all, thanks a lot for this nice tool! Liking the project a lot :)
However, I've been running into the same issue as @ensconced lately and I am curious if there's any chance for #10 to be reviewed? For now, I managed to solve the issue by replacing the line endings locally, but a more stable solution would be great 😊
For anyone interested, this worked for me to bypass the issue. I've edited the line endings on the installed tcg
like this using vim
:
# Make sure `tcg` is installed globally.
# $ npm i -g typescript-call-graph
$ vim $(which tcg)
#!/usr/bin/env node
"use strict";
exports.__esModule = true;
var open = require("open");
...
# now in VIM command mode
# first set all line endings to the DOS format to avoid mixed endings
:e ++ff=dos
# change the line endings to a UNIX format
:set ++ff=unix
# save the file and quit
:wq
If tcg
is installed in project-specific node_modules, it is also possible to apply the same fix to the node_modules/typescript-call-graph/bin/index.js
file. Of course, besides VIM other editors can do the same trick, and many people have been suggesting using a separate tool dos2unix
.
(Approach credits to this unix.stackexchange post 🙂 )
Hope this helps anyone. Cheers ✌️
from typescript-call-graph.
I've been away from personal coding projects for most of the last year 😓 -- moving to a new state and fixing up the house has been time consuming 😅
I'll try to get back to coding in August (in a few weeks) - I really should have merged #10 earlier 🙇
from typescript-call-graph.
@whyboris thanks for the response! :) No worries at all, I can imagine the feeling! ✌️ Of course take your time! :)
from typescript-call-graph.
Sounds good! Thank you - I will accept a PR that adds prettier (and any fixes to the CRLF
line-endings).
I wonder if it's because I used Windows to do my coding 😅 … I found this claim:
in Windows both a CR and LF are required to note the end of a line
It's pretty bizarre that yarn can't handle something that's rather ubiquitous 🤔
I guess another approach is to re-save whatever files necessary replacing CRLF
with whatever yarn wants 🤷 -- whatever is easiest for you - thanks! 😁
Would also be great if you happen to be able to check if it still works on Windows before you create the PR 👍 but I could check too - just let me know.
from typescript-call-graph.
I've had a closer look and the line-endings are actually fine (i.e. unix-style) in the source code so prettier won't help us here.
I think what's happening is that you have core.autocrlf = true
in your git config (this is common for Windows) meaning when you check out the project, git will turn all the line endings into CRLFs in your working tree even if they are LFs in the repo in .git
.
npm publish
will publish whatever is in your working directory so when I yarn add
your project I end up with the CRLFs (whereas npm install
automatically changes them to LFs).
I think the best solution is to add a .gitattributes
file to prevent git from using CRLFs in the working directory. I think that will override your local configuration.
from typescript-call-graph.
Sorry for the delay - busy weeks for me - I'm packing and getting ready to move to a new house 😅
I'll try to find time this week 🤝
from typescript-call-graph.
Related Issues (10)
- argument list too long: tcg HOT 5
- VSCode has call hierarchy which is similar to what this project does HOT 2
- Seems not to be detecting any functions at all? HOT 3
- Browser just showing TypeScript-Call-Graph's own internal functions only - not the functions from my project HOT 2
- Detect fat arrow functions HOT 7
- Arrow function are not taken into account in the Call graph HOT 4
- Class methods HOT 1
- Consider D2 for diagrams HOT 1
- Screenshots HOT 4
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 typescript-call-graph.