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

Bug: 1.4.1 still does not support global configuration #71

Open
1 task
shaobeichen opened this issue Aug 22, 2022 · 14 comments
Open
1 task

Bug: 1.4.1 still does not support global configuration #71

shaobeichen opened this issue Aug 22, 2022 · 14 comments
Labels
bug Something isn't working

Comments

@shaobeichen
Copy link

What did you do?

image

git cz works, but doesn't use global config.

What did you expect to happen?

czvinyl supports global configuration

What actually happened?

image

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

No response

@shaobeichen shaobeichen added the bug Something isn't working label Aug 22, 2022
@tal-rofe
Copy link
Owner

tal-rofe commented Aug 22, 2022

@shaobeichen
Could you please share what's the directory on which you store the files?
Also, does it work if you set .czrc file in the project directory level?
I tested it on MacOS and it worked.
I will check on Windows, depends on your answer

@shaobeichen
Copy link
Author

C:\Users\xxxxxxx

@tal-rofe
Copy link
Owner

C:\Users\xxxxxxx

Will check.

@tal-rofe
Copy link
Owner

tal-rofe commented Aug 26, 2022

@shaobeichen

It may take a while as I only own a macOS machine. If you'd like to make a PR it will be great

@shaobeichen
Copy link
Author

shaobeichen commented Aug 31, 2022

I modified the configuration file, from the log results, I think it is the problem of cosmiconfig, but I don't know how to solve it for the time being.

image

output

# console.log(SEARCH_PLACES)
[
  'package.json',   
  '.czvinylrc',     
  '.czvinylrc.json',
  '.czvinylrc.yaml',
  '.czvinylrc.yml', 
  '.czvinylrc.js',  
  '.czvinylrc.ts',  
  '.czvinylrc.cjs', 
  'czvinyl.config.js',
  'czvinyl.config.ts',
  'czvinyl.config.cjs',
  'C:\\Users\\D1M\\package.json',
  'C:\\Users\\D1M\\.czvinylrc',
  'C:\\Users\\D1M\\.czvinylrc.json',
  'C:\\Users\\D1M\\.czvinylrc.yaml',
  'C:\\Users\\D1M\\czvinyl.config.cjs'
]
# console.log(result, result1 && result1.filepath)
null, C:\Users\D1M\.czvinylrc

System Info
Output of npx envinfo --system --npmPackages vue --binaries --browsers

  System:
    OS: Windows 10 10.0.19043
    CPU: (8) x64 Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz
    Memory: 6.88 GB / 15.88 GB
  Binaries:
    Node: 16.13.1 - D:\nodejs\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD       
    npm: 8.1.2 - D:\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (104.0.1293.70)
    Internet Explorer: 11.0.19041.1566

@tal-rofe
Copy link
Owner

@shaobeichen

Regarding the 2nd log, What if you were to log the result itself (result1)? You'd get the configured file as you expect?

@shaobeichen
Copy link
Author

@shaobeichen

Regarding the 2nd log, What if you were to log the result itself (result1)? You'd get the configured file as you expect?

Yes, result1 can get the file path and content I want, but search cannot; I tried to use mjs file to remove loaders, but the result of search is still null

@tal-rofe
Copy link
Owner

tal-rofe commented Sep 6, 2022

@shaobeichen
Did you try to replace SEARCH_PLACES with an hardcoded value? for example C:\Users\D1M\.czvinylrc. Would it work? Need to understand whether issue with cz-vinyl or with cosmiconfig

@shaobeichen
Copy link
Author

yes, i tried the hardcoded way and it still doesn't work, I set it as below so it doesn't work

[
  'C:/Users/D1M/.czvinylrc',
]
[
  'C:\Users\D1M\.czvinylrc',
]
[
  'C:\\Users\\D1M\\.czvinylrc',
]
[
  'package.json',   
  '.czvinylrc',     
  '.czvinylrc.json',
  '.czvinylrc.yaml',
  '.czvinylrc.yml', 
  '.czvinylrc.js',  
  '.czvinylrc.ts',  
  '.czvinylrc.cjs', 
  'czvinyl.config.js',
  'czvinyl.config.ts',
  'czvinyl.config.cjs',
  'C:/Users/D1M/package.json',
  'C:/Users/D1M/.czvinylrc',
  'C:/Users/D1M/.czvinylrc.json',
  'C:/Users/D1M/.czvinylrc.yaml',
  'C:/Users/D1M/czvinyl.config.cjs'
]
[
  'package.json',   
  '.czvinylrc',     
  '.czvinylrc.json',
  '.czvinylrc.yaml',
  '.czvinylrc.yml', 
  '.czvinylrc.js',  
  '.czvinylrc.ts',  
  '.czvinylrc.cjs', 
  'czvinyl.config.js',
  'czvinyl.config.ts',
  'czvinyl.config.cjs',
  'C:\Users\D1M\package.json',
  'C:\Users\D1M\.czvinylrc',
  'C:\Users\D1M\.czvinylrc.json',
  'C:\Users\D1M\.czvinylrc.yaml',
  'C:\Users\D1M\czvinyl.config.cjs'
]
[
  'package.json',   
  '.czvinylrc',     
  '.czvinylrc.json',
  '.czvinylrc.yaml',
  '.czvinylrc.yml', 
  '.czvinylrc.js',  
  '.czvinylrc.ts',  
  '.czvinylrc.cjs', 
  'czvinyl.config.js',
  'czvinyl.config.ts',
  'czvinyl.config.cjs',
  'C:\\Users\\D1M\\package.json',
  'C:\\Users\\D1M\\.czvinylrc',
  'C:\\Users\\D1M\\.czvinylrc.json',
  'C:\\Users\\D1M\\.czvinylrc.yaml',
  'C:\\Users\\D1M\\czvinyl.config.cjs'
]

@tal-rofe
Copy link
Owner

tal-rofe commented Sep 7, 2022

@shaobeichen

Seems like the 3rd party library has an issue.

@tal-rofe tal-rofe closed this as completed Sep 7, 2022
@tal-rofe tal-rofe reopened this Sep 7, 2022
@13OnTheCode
Copy link

@tal-rofe

You are correct. I have conducted preliminary tests and it seems that the reason is because macOS has a unified directory structure with a single home directory serving as the user's personal file space. On the other hand, Windows uses a partition-based concept and follows a layered directory structure, organizing files and directories using logical disks such as C, D, E, etc., each having its own root directory. After briefly examining the source code of cosmiconfig, it appears that no additional handling for Windows systems has been implemented. It is unclear whether this was intentionally done by the developers or if it was overlooked

Testing process:

I executed cosmiconfig(...).search(...) inside D:\Developer\13OnTheCode\test\index.js As a result, cosmiconfig recursively reached the "home directory" on the D drive, rather than the C drive. Therefore, when the configuration file is created in the root directory of the D drive, it can be found successfully

I just discussed (Zhengqbbb/cz-git#132) this issue in cz-git and submitted a PR (Zhengqbbb/cz-git#133) because it also has the same problem that prevents Windows users from loading the global configuration correctly.

I hope this will be helpful for cz-vinyl

@shaobeichen
Copy link
Author

It seems that v9 has been resolved,cosmiconfig/cosmiconfig#278

@tal-rofe
Copy link
Owner

It seems that v9 has been resolved,cosmiconfig/cosmiconfig#278

Once cosmiconfig will upgrade by Renovate to V9

@tal-rofe
Copy link
Owner

@shaobeichen
I just created a new release on both GitHub & NPM for version 2.5.0 which uses cosmiconfig@9 new major. Please test it with the new version and update, so we could finally close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants