Comments (27)
cc/ @keithamus
from cosmiconfig.
It looks to do what I want from it π.
However, I would suggest that it does not parse process.argv
, and instead I have to manually pass you the option which I have parsed from the command line. I wouldn't want it to change behaviour through external options - only the options I feed into the function. But it's your code so you do what you want π
from cosmiconfig.
@keithamus Maybe make it optional? @davidtheclark Is it optional?
from cosmiconfig.
@keithamus : Thanks for the feedback. I was on the fence about --config
and kind of did it just because rc was doing it so I assumed people liked it .... I do admit, though, that I can't think of a reason not to push the process.argv
parsing into the user's court.
@TrySound : It's not optional currently but would be very easy to make optional.
from cosmiconfig.
@davidtheclark I think every feature should be optional
from cosmiconfig.
@TrySound : So you'd suggest lots more options --- for turning off YAML, JSON, or JS parsing, not looking in package.json, not looking for module.config.js
, etc?
from cosmiconfig.
@davidtheclark I'm about searching rc, config, global and argv. Parsing don't need to complicate.
from cosmiconfig.
@davidtheclark Also I don't understand, why need parse-json
if yaml can parse json out of the box. And first symbol checking do not make guarantee correct detecting.
from cosmiconfig.
@TrySound : parse-json throws extra nice JSON errors, so I thought it might be handy. More importantly, though, I was finding that YAML was weirdly lenient in its JSON parsing? Maybe I misunderstood --- could test it out more. I agree that the first symbol checking is not great: open to a better way.
from cosmiconfig.
@davidtheclark I think it's a good feature for rc file. It's multiformat file. So, why we shoundn't let it be free?
from cosmiconfig.
@davidtheclark And need to add appveyor support. On windows tests fails
from cosmiconfig.
from cosmiconfig.
@davidtheclark I'd like to suggest you to use this publishing way https://github.com/sindresorhus/np/blob/master/np.sh
Also if you use npm3 you can add some good hooks
https://github.com/TrySound/postcss-inline-svg/blob/master/package.json#L37-L42
from cosmiconfig.
FYI those scripts also work for npm2. In fact they also work for npm1 π. http://blog.keithcirkel.co.uk/how-to-use-npm-as-a-build-tool/
from cosmiconfig.
@keithamus Oh, cool. I just heard from somebody that they are not reliable, but in npm3 works fine. Maybe just a noise in my head :))
from cosmiconfig.
They're pretty darn reliable. I've been using them for about 2 years now, so long before npm3 came out. Never had a problem with them.
@davidtheclark you could also look at https://github.com/semantic-release/semantic-release - which takes a while to set up, but could manage all of your releases automatically for you π
from cosmiconfig.
I've never been too annoyed by typing the git and npm commands manually, but will look into the scripts. Thanks for the suggestions!
And thanks for all the feedback above. Based on what's been said so far, here are some changes I think could be made:
- Add
noJs
,noRc
,noPackageProp
, andnoArgv
options, each of which turns off one of the places this module might look. - Add appveyor CI.
@TrySound I prefer keeping JSON strict instead of the leniency allowed by yaml parsing. If I have a .json
file, I want it to be valid JSON. I will double-check my reasoning for including parse-json, though, because I don't exactly remember the details :)
from cosmiconfig.
@davidtheclark Maybe better {js:true, rc:true, packageProp:true, argv:true, strictJSON:false}
?
from cosmiconfig.
I find positive options to be less confusing than negative ones.
from cosmiconfig.
Good suggestion.
from cosmiconfig.
@davidtheclark I didn't mean json files parsing with yaml. Only .[moduleName]rc file. It should have free format.
from cosmiconfig.
@davidtheclark Can argv extends file config? Like here
from cosmiconfig.
@davidtheclark However let's do not extend. Just rewrite. If somebody want to extend it he can disable default argv.
from cosmiconfig.
That sounds like a good feature, yep.
from cosmiconfig.
@TrySound : Actually, I'm second-guessing -- are you saying that if the configuration might have a format
property, the module user could set or override that with --format something
? I think that might be too app-specific: we don't want to check all the CLI arguments by default and plug them into the config. Considering how simple it should be for the cosmiconfig user to handle CLI arguments themselves and determine exactly what should get included in the config, vs what should do something else, I'm not sure cosmiconfig should try to address that.
from cosmiconfig.
By closing #11 and #12 I think all the feedback above is addressed. If anybody feels like taking a second look at the docs to reassess, feedback would be much appreciated -- just open an issue!
from cosmiconfig.
Also current version is published as 0.5.0, if you want to try it out and see if it does the job.
from cosmiconfig.
Related Issues (20)
- metaConfig.config ?? {}; HOT 4
- `explorer.search(...)` crashes with `{stopDir: undefined}` option HOT 2
- Node.js version breaking change HOT 2
- Why does cosmiconfig require Node version greater than 18.0.0? HOT 2
- Could not resolve module "node:os" from
- Regression in v8.3.x - missing json config file doesn't always return null HOT 9
- SyntaxError: Unexpected token '.' HOT 2
- Lerna-Lite project having an empty `.config.json` file gets picked up by cosmiconfig and is unexpected - behavior changed after 8.0 HOT 8
- Add link to Python port of Cosmiconfig HOT 2
- README doesn't mention .mjs files inside of a config directory HOT 2
- Error: EACCES: permission denied, open '/.config/puppeteerrcβ HOT 9
- Offer a "minimal" version with less dependencies
- Also find [`pnpm`] package.yaml/json5 properties HOT 1
- Module "typescript" possibly misplaced as a dev dependency HOT 1
- cosmiconfig requires at least version 4 of Node, please upgrade HOT 1
- Please release source code to npm if you release source map files HOT 1
- Question: latest v9 not mentioned in changelog and no github release exists HOT 2
- Meta config files are not looked in cwd anymore? (in v9 changelog but not in README HOT 6
- It says `.ts` configs are supported automatically, and also `.cjs` and `.mjs`, but why `.cts` and `.mts` are not supported?
- CJS configuration files in ESM projects do not freshly import
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 cosmiconfig.