-
-
Notifications
You must be signed in to change notification settings - Fork 985
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
Support package.yaml #1100
Comments
I like the yaml format. I'd be OK with this feature. However, we currently don't implement the publish command and publish would have to convert |
I see. In that case will it be fine if I generate (or idempotently overwrite) the equivalent package.json (if package.yaml exists) whenever cli is run ? Perhaps this can be made more safe by inclusion of an additional entry like |
Cool! We recently investigated JSON5 vs YAML, based on a couple requirements:
It seemed to me that JSON5 has a number of advantages compared to YAML:
From a functional perspective, YAML doesn't seem to have any killer features that JSON5 lacks. Thus, it seemed difficult to justify "yet another" file format if there is no clear advantage. One major disadvantage of JSON5 is that it's less widely used. The problem it solves is somewhat specific to NodeJS. |
From an implementation point of view, the complex part is adding support to any alternative. So once we support anything else than .json, supporting X formats is easy. We have js-yaml as a dependency already, so I think it makes sense to support Personally, I think it will be cool to use multiline string in YAML. For instance, I could rewrite the scripts in pnpm/package.yaml like this: scripts:
pnpm-registry-mock: pnpm-registry-mock
test-tap: ts-node test --type-check
test: >-
pnpm run lint &&
pnpm run tsc &&
rimraf ../../../.tmp/ &&
rimraf node_modules/.bin/pnpm &&
pnpm-registry-mock prepare &&
npm-run-all -p -r pnpm-registry-mock test-tap
tsc: rimraf lib && tsc
release: sh .scripts/release.sh
}, |
Created #1803 to track what commands support the new manifest formats |
🚢 3.3.0-0 |
Will it be feasible to support a yaml alternative to package.json ?
JSON is really not a good configuration format and yaml would be beneficial in many ways:
Supports comments
This is the single biggest advantage. I find myself wondering so many times why a specific rc/alpha/outdated version was included in the package (instead of the latest stable), Some details about a script etc.
Supports anchors
Remove duplication between peer deps and dev deps etc.
Multiline strings
Useful for npm scripts involving commands
etc.
The text was updated successfully, but these errors were encountered: