Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

draft-windows-amd64.exe create does not detect the right language for the app #417

Open
eliassal opened this issue Oct 30, 2024 · 9 comments

Comments

@eliassal
Copy link

Describe the bug
I ran draft-windows-amd64.exe create against a node.js react app , draft detected it as a java and not javascript. The app can be found at https://github.com/rolfschutten/pokedex-aks

Mention the platform you are using
Win 10 64bit

To Reproduce
Steps to reproduce the behavior:

  1. on command line run draft-windows-amd64.exe create in node.ja app
  2. draft detected it as java projects

Expected behavior
it should detect javascript

Screenshots
Image

@davidgamero
Copy link
Collaborator

thank you for reporting this issue
i cloned this repo and attempted to reproduce the bug on both WSL and with the draft-windows-amd64.exe and both times got the following
Image

can you please retry with the -v flag appended so we can get some verbose logging to see where the language detection is failing?

@eliassal
Copy link
Author

Hi @davidgamero , it is really really verbse, it went through every and each single file. it took more than 6 minutes, huge scrlloing in the terminal, I recorded a video, enclosed here. Here is the last part and please note it stills detected it as java

[Draft] with file: node_modules\yocto-queue\license
[Draft] node_modules\yocto-queue\license is 1117 bytes
[Draft] node_modules\yocto-queue\license: filename to be ignored: false
[Draft] reading contents of node_modules\yocto-queue\license
[Draft] node_modules\yocto-queue\license got language hints: []string(nil)

[Draft] node_modules\yocto-queue\license got result by data: Propeller Spin
[Draft] with file: node_modules\yocto-queue\package.json
[Draft] node_modules\yocto-queue\package.json is 725 bytes
[Draft] node_modules\yocto-queue\package.json: filename to be ignored: false
[Draft] node_modules\yocto-queue\package.json got result by name: JSON
[Draft] with file: node_modules\yocto-queue\readme.md
[Draft] node_modules\yocto-queue\readme.md is 2096 bytes
[Draft] node_modules\yocto-queue\readme.md: filename to be ignored: false
[Draft] reading contents of node_modules\yocto-queue\readme.md
[Draft] node_modules\yocto-queue\readme.md got language hints: []string{"Markdown", "GCC Machine Description"}

[Draft] node_modules\yocto-queue\readme.md got result by data: Markdown
[Draft] with file: package-lock.json
[Draft] package-lock.json is 686750 bytes
[Draft] package-lock.json: filename to be ignored: false
[Draft] package-lock.json got result by name: JSON
[Draft] with file: package.json
[Draft] package.json is 815 bytes
[Draft] package.json: filename to be ignored: false
[Draft] package.json got result by name: JSON
[Draft] with file: public
[Draft] public is 0 bytes
[Draft] public is empty file, skipping
[Draft] with file: public\favicon.ico
[Draft] public\favicon.ico is 318 bytes
[Draft] public\favicon.ico: filename to be ignored: false
[Draft] reading contents of public\favicon.ico
[Draft] public\favicon.ico : contents should be ignored, skipping
[Draft] with file: public\index.html
[Draft] public\index.html is 1721 bytes
[Draft] public\index.html: filename to be ignored: false
[Draft] public\index.html got result by name: HTML
[Draft] with file: public\manifest.json
[Draft] public\manifest.json is 492 bytes
[Draft] public\manifest.json: filename to be ignored: false
[Draft] public\manifest.json got result by name: JSON
[Draft] with file: public\robots.txt
[Draft] public\robots.txt is 67 bytes
[Draft] public\robots.txt: filename to be ignored: false
[Draft] reading contents of public\robots.txt
[Draft] public\robots.txt got language hints: []string{"Text", "Vim Help File"}

[Draft] public\robots.txt got result by data: Text
[Draft] with file: src
[Draft] src is 4096 bytes
[Draft] with file: src.DS_Store
[Draft] src.DS_Store is 6148 bytes
[Draft] src.DS_Store: filename to be ignored: false
[Draft] reading contents of src.DS_Store
[Draft] src.DS_Store : contents should be ignored, skipping
[Draft] with file: src\Pokemon.js
[Draft] src\Pokemon.js is 245 bytes
[Draft] src\Pokemon.js: filename to be ignored: false
[Draft] src\Pokemon.js got result by name: JavaScript
[Draft] with file: src\assets
[Draft] src\assets is 0 bytes
[Draft] src\assets is empty file, skipping
[Draft] with file: src\assets\logo.png
[Draft] src\assets\logo.png is 147838 bytes
[Draft] src\assets\logo.png: filename to be ignored: false
[Draft] reading contents of src\assets\logo.png
[Draft] src\assets\logo.png : contents should be ignored, skipping
[Draft] with file: src\assets\sprites.png
[Draft] src\assets\sprites.png is 1050548 bytes
[Draft] src\assets\sprites.png: filename to be ignored: false
[Draft] reading contents of src\assets\sprites.png
[Draft] src\assets\sprites.png : contents should be ignored, skipping
[Draft] with file: src\components
[Draft] src\components is 4096 bytes
[Draft] with file: src\components\App.js
[Draft] src\components\App.js is 1057 bytes
[Draft] src\components\App.js: filename to be ignored: false
[Draft] src\components\App.js got result by name: JavaScript
[Draft] with file: src\components\DetailView.js
[Draft] src\components\DetailView.js is 487 bytes
[Draft] src\components\DetailView.js: filename to be ignored: false
[Draft] src\components\DetailView.js got result by name: JavaScript
[Draft] with file: src\components\PokeCell.js
[Draft] src\components\PokeCell.js is 409 bytes
[Draft] src\components\PokeCell.js: filename to be ignored: false
[Draft] src\components\PokeCell.js got result by name: JavaScript
[Draft] with file: src\components\PokeList.js
[Draft] src\components\PokeList.js is 487 bytes
[Draft] src\components\PokeList.js: filename to be ignored: false
[Draft] src\components\PokeList.js got result by name: JavaScript
[Draft] with file: src\components\styles
[Draft] src\components\styles is 0 bytes
[Draft] src\components\styles is empty file, skipping
[Draft] with file: src\components\styles\App.css
[Draft] src\components\styles\App.css is 543 bytes
[Draft] src\components\styles\App.css: filename to be ignored: false
[Draft] src\components\styles\App.css got result by name: CSS
[Draft] with file: src\components\styles\DetailView.css
[Draft] src\components\styles\DetailView.css is 750 bytes
[Draft] src\components\styles\DetailView.css: filename to be ignored: false
[Draft] src\components\styles\DetailView.css got result by name: CSS
[Draft] with file: src\components\styles\PokeCell.css
[Draft] src\components\styles\PokeCell.css is 224 bytes
[Draft] src\components\styles\PokeCell.css: filename to be ignored: false
[Draft] src\components\styles\PokeCell.css got result by name: CSS
[Draft] with file: src\components\styles\PokeList.css
[Draft] src\components\styles\PokeList.css is 296 bytes
[Draft] src\components\styles\PokeList.css: filename to be ignored: false
[Draft] src\components\styles\PokeList.css got result by name: CSS
[Draft] with file: src\index.css
[Draft] src\index.css is 146 bytes
[Draft] src\index.css: filename to be ignored: false
[Draft] src\index.css got result by name: CSS
[Draft] with file: src\index.js
[Draft] src\index.js is 178 bytes
[Draft] src\index.js: filename to be ignored: false
[Draft] src\index.js got result by name: JavaScript
[Draft] with file: src\pokeClasses.js
[Draft] src\pokeClasses.js is 10400 bytes
[Draft] src\pokeClasses.js: filename to be ignored: false
[Draft] src\pokeClasses.js got result by name: JavaScript
[Draft] with file: src\reportWebVitals.js
[Draft] src\reportWebVitals.js is 362 bytes
[Draft] src\reportWebVitals.js: filename to be ignored: false
[Draft] src\reportWebVitals.js got result by name: JavaScript
[Draft] with file: src\setupTests.js
[Draft] src\setupTests.js is 241 bytes
[Draft] src\setupTests.js: filename to be ignored: false
[Draft] src\setupTests.js got result by name: JavaScript
[Draft] with file: src\test
[Draft] src\test is 0 bytes
[Draft] src\test is empty file, skipping
[Draft] with file: src\test\App.test.js
[Draft] src\test\App.test.js is 246 bytes
[Draft] src\test\App.test.js: filename to be ignored: false
[Draft] src\test\App.test.js got result by name: JavaScript
[Draft] language: Wikitext percent: 0.000655 color: #fc5757
[Draft] language: M percent: 0.000928 color:
[Draft] language: PLpgSQL percent: 0.000076 color: #336790
[Draft] language: HTML percent: 0.009628 color: #e34c26
[Draft] language: OCaml percent: 0.204848 color: #3be133
[Draft] language: MUF percent: 0.002133 color:
[Draft] language: Perl percent: 0.009343 color: #0298c3
[Draft] language: Java percent: 0.002471 color: #b07219
[Draft] language: JavaScript percent: 62.759147 color: #f1e05a
[Draft] language: Lex percent: 0.000268 color: #DBCA00
[Draft] language: Standard ML percent: 0.032169 color: #dc566d
[Draft] language: Rascal percent: 0.009417 color: #fffaa0
[Draft] language: PLSQL percent: 0.002733 color: #dad8d8
[Draft] language: Pod percent: 0.007451 color:
[Draft] language: ShellSession percent: 0.000076 color:
[Draft] language: CodeQL percent: 0.001759 color: #140f46
[Draft] language: HCL percent: 0.084121 color:
[Draft] language: TypeScript percent: 0.834279 color: #2b7489
[Draft] language: ActionScript percent: 0.001766 color: #882B0F
[Draft] language: RDoc percent: 0.000324 color: #701516
[Draft] language: CSS percent: 0.072382 color: #563d7c
[Draft] language: Modula-3 percent: 0.000037 color: #223388
[Draft] language: Inform 7 percent: 0.000076 color:
[Draft] language: GN percent: 0.013671 color:
[Draft] language: Coq percent: 15.958208 color: #d0b68c
[Draft] language: C percent: 0.002573 color: #555555
[Draft] language: D percent: 0.002637 color: #ba595e
[Draft] language: GCC Machine Description percent: 0.366311 color: #FFCFAB
[Draft] language: Fluent percent: 0.007290 color: #ffcc33
[Draft] language: eC percent: 0.001059 color: #913960
[Draft] language: JSON with Comments percent: 0.004080 color: #292929
[Draft] language: Propeller Spin percent: 0.600101 color: #7fa2a7
[Draft] language: Jison percent: 0.003252 color: #56b3cb
[Draft] language: Shell percent: 0.033714 color: #89e051
[Draft] language: JSON percent: 11.048482 color: #292929
[Draft] language: Rich Text Format percent: 0.143998 color:
[Draft] language: UnrealScript percent: 0.001030 color: #a54c4d
[Draft] language: Muse percent: 0.060652 color:
[Draft] language: C++ percent: 0.016678 color: #f34b7d
[Draft] language: Common Lisp percent: 0.000015 color: #3fb68b
[Draft] language: Text percent: 0.093077 color:
[Draft] language: AppleScript percent: 0.001457 color: #101F1F
[Draft] language: RPC percent: 0.019197 color:
[Draft] language: Crystal percent: 0.000003 color: #100
[Draft] language: Roff Manpage percent: 0.087931 color: #ecdebe
[Draft] language: Verilog percent: 0.091732 color: #b2b7f8
[Draft] language: Object Data Instance Notation percent: 0.003257 color:
[Draft] language: Euphoria percent: 0.004441 color: #FF790B
[Draft] language: F# percent: 0.001769 color: #b845fc
[Draft] language: PHP percent: 0.041770 color: #4F5D95
[Draft] language: Nit percent: 0.001393 color: #009917
[Draft] language: Rebol percent: 0.000878 color: #358a5b
[Draft] language: EQ percent: 0.008420 color: #a78649
[Draft] language: Reason percent: 0.003970 color: #ff5847
[Draft] language: PowerShell percent: 0.042706 color: #012456
[Draft] language: WebIDL percent: 0.000413 color:
[Draft] language: LoomScript percent: 0.000488 color:
[Draft] language: OpenEdge ABL percent: 0.001621 color: #5ce600
[Draft] language: Fennel percent: 0.002208 color: #fff3d7
[Draft] language: EJS percent: 0.031677 color: #a91e50
[Draft] language: Kaitai Struct percent: 0.000083 color: #773b37
[Draft] language: Mathematica percent: 0.004064 color: #dd1100
[Draft] language: PEG.js percent: 0.000739 color: #234d6b
[Draft] language: XML percent: 0.202101 color: #0060ac
[Draft] language: q percent: 0.002241 color: #0040cd
[Draft] language: Pan percent: 0.001719 color: #cc0000
[Draft] language: Nextflow percent: 0.001672 color: #3ac486
[Draft] language: mIRC Script percent: 0.001073 color: #3d57c3
[Draft] language: NCL percent: 0.005516 color: #28431f
[Draft] language: Max percent: 0.001208 color: #c4a79c
[Draft] language: Raku percent: 0.005819 color: #0000fb
[Draft] language: AGS Script percent: 0.000761 color: #B9D9FF
[Draft] language: Hack percent: 0.000972 color: #878787
[Draft] language: LFE percent: 0.000622 color: #4C3023
[Draft] language: GLSL percent: 0.000854 color: #5686a5
[Draft] language: Markdown percent: 6.433186 color: #083fa1
[Draft] language: Python percent: 0.052588 color: #3572A5
[Draft] language: Gosu percent: 0.003501 color: #82937f
[Draft] language: Tcsh percent: 0.000302 color:
[Draft] language: hoon percent: 0.056029 color: #00b171
[Draft] language: Latte percent: 0.008170 color: #f2a542
[Draft] language: TeX percent: 0.001542 color: #3D6117
[Draft] language: Pod 6 percent: 0.000543 color:
[Draft] language: Vyper percent: 0.002007 color: #2980b9
[Draft] language: GraphQL percent: 0.001760 color: #e10098
[Draft] language: 2-Dimensional Array percent: 0.000353 color: #38761D
[Draft] language: Shen percent: 0.014867 color: #120F14
[Draft] language: Web Ontology Language percent: 0.156906 color: #5b70bd
[Draft] language: SVG percent: 0.021676 color: #ff9900
[Draft] language: RUNOFF percent: 0.045360 color: #665a4e
[Draft] language: Roff percent: 0.067759 color: #ecdebe
[Draft] language: TSX percent: 0.123094 color: #2b7489
[Draft] language: Clean percent: 0.006278 color: #3F85AF
[Draft] language: CoffeeScript percent: 0.020555 color: #244776
[Draft] language: RPM Spec percent: 0.000289 color:
[Draft] language: Git Config percent: 0.001522 color: #F44D27
[Draft] language: Nix percent: 0.000252 color: #7e7eff
[Draft] language: Batchfile percent: 0.013769 color: #C1F12E
[Draft] linguist.ProcessDir(.) result:

Error:
[Draft] JavaScript: 62.759147 (#f1e05a)
[Draft] Coq: 15.958208 (#d0b68c)
[Draft] JSON: 11.048482 (#292929)
[Draft] Markdown: 6.433186 (#083fa1)
[Draft] TypeScript: 0.834279 (#2b7489)
[Draft] Propeller Spin: 0.600101 (#7fa2a7)
[Draft] GCC Machine Description: 0.366311 (#FFCFAB)
[Draft] OCaml: 0.204848 (#3be133)
[Draft] XML: 0.202101 (#0060ac)
[Draft] Web Ontology Language: 0.156906 (#5b70bd)
[Draft] Rich Text Format: 0.143998 ()
[Draft] TSX: 0.123094 (#2b7489)
[Draft] Text: 0.093077 ()
[Draft] Verilog: 0.091732 (#b2b7f8)
[Draft] Roff Manpage: 0.087931 (#ecdebe)
[Draft] HCL: 0.084121 ()
[Draft] CSS: 0.072382 (#563d7c)
[Draft] Roff: 0.067759 (#ecdebe)
[Draft] Muse: 0.060652 ()
[Draft] hoon: 0.056029 (#00b171)
[Draft] Python: 0.052588 (#3572A5)
[Draft] RUNOFF: 0.045360 (#665a4e)
[Draft] PowerShell: 0.042706 (#012456)
[Draft] PHP: 0.041770 (#4F5D95)
[Draft] Shell: 0.033714 (#89e051)
[Draft] Standard ML: 0.032169 (#dc566d)
[Draft] EJS: 0.031677 (#a91e50)
[Draft] SVG: 0.021676 (#ff9900)
[Draft] CoffeeScript: 0.020555 (#244776)
[Draft] RPC: 0.019197 ()
[Draft] C++: 0.016678 (#f34b7d)
[Draft] Shen: 0.014867 (#120F14)
[Draft] Batchfile: 0.013769 (#C1F12E)
[Draft] GN: 0.013671 ()
[Draft] HTML: 0.009628 (#e34c26)
[Draft] Rascal: 0.009417 (#fffaa0)
[Draft] Perl: 0.009343 (#0298c3)
[Draft] EQ: 0.008420 (#a78649)
[Draft] Latte: 0.008170 (#f2a542)
[Draft] Pod: 0.007451 ()
[Draft] Fluent: 0.007290 (#ffcc33)
[Draft] Clean: 0.006278 (#3F85AF)
[Draft] Raku: 0.005819 (#0000fb)
[Draft] NCL: 0.005516 (#28431f)
[Draft] Euphoria: 0.004441 (#FF790B)
[Draft] JSON with Comments: 0.004080 (#292929)
[Draft] Mathematica: 0.004064 (#dd1100)
[Draft] Reason: 0.003970 (#ff5847)
[Draft] Gosu: 0.003501 (#82937f)
[Draft] Object Data Instance Notation: 0.003257 ()
[Draft] Jison: 0.003252 (#56b3cb)
[Draft] PLSQL: 0.002733 (#dad8d8)
[Draft] D: 0.002637 (#ba595e)
[Draft] C: 0.002573 (#555555)
[Draft] Java: 0.002471 (#b07219)
Use the arrow keys to navigate: ↓ ↑ → ←
? Linguist detected Java, are you using maven or gradle?:

gradle
maven
gradlew

@eliassal
Copy link
Author

Oh please ignore my response, it was my bad, when Iran draft-windows-amd64.exe create I was in the root folder and not in the src

Image
I
did
cd src, ran again draft and it recognized it as javascript. Thanks for your help

@davidgamero
Copy link
Collaborator

im glad you were able to get it working!

it looks like we are reading all the files in the node_modules directory, which is not optimal for performance and led to the excessive verbose logging. i'll file an issue referencing this to see if we can exclude package manager directories

another approach would be to use the .gitignore to avoid this.

either way, thank you for reporting your issue!

@eliassal
Copy link
Author

Sorry @davidgamero to reopen thisthread, can you pelase tell me di you run create in the root folder or did you cd into src? The instructions I am following are in a video at https://www.youtube.com/live/btY8qGMHxWQ minute 29 where we see the guy runs create in the root not in the src folder.

@davidgamero davidgamero reopened this Nov 12, 2024
@davidgamero
Copy link
Collaborator

hi @eliassal, i randraft create at the root of this repo

i retried with a fresh npm i , and i got the following output:

➜  pokedex-aks git:(main) ✗ ../draft/draft create
[Draft] --- Detecting Language ---
[Draft] --> Draft detected JSON (97.595408%)

[Draft] --> Could not find a pack for JSON. Trying to find the next likely language match...
[Draft] --> Draft detected JavaScript (1.900084%)

can you paste the similar section from your command output for the percent of each langauge?
you can run draft craft without the -v flag to get just this part

@eliassal
Copy link
Author

Here is the ouptut when I rin at the root

Image

@eliassal
Copy link
Author

eliassal commented Nov 12, 2024

@davidgamero , I have cloned the repo in another folder reran draft at root leve it recognized JS and not as before. So it might be somehting wrong happened when I cloned it for the 1st time.
So many thanks for your help

@eliassal
Copy link
Author

eliassal commented Nov 12, 2024

One last question, I ran

draft-windows-amd64.exe setup-gh -v

it worked fine until I got an error indicating
finished listing Azure tenants
Error: multiple tenants found

whereas I have on single tenant in my subscription
Image

Image

When I issue
Get-AzTenant
I see only one in the subsccription I chose

Get-AzTenant
Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants