@nk11/ts-json-yaml

2.0.0 • Public • Published

overview

Goal:

  • Define your json files in typescript instead.
  • Have full type inference support & some tooling to build json files when you need them
  • support json, yaml output

scripts

  • run npm run dev to generate typescript interfaces for schemas listed at ts.config.json

    • you will find the schemas at .schema delete the folder or a single file to trigger rebuild
  • configure npm run dev -- -h

  • run tsx ./test/example.ts > ./test/example.json to create json from ts on the fly (Note: this will be done automatically via the configuration)

  • or tsx ./test/traefik.yaml.ts > ./test/traefik.yaml

Example - Azure DevOps Pipelines

Get a personal access token from your user and for your orga

make sure it has proper permissions otherwise you will get a 401 T_T

curl -u :$ADO_PAT "https://dev.azure.com/$ORGA/_apis/distributedtask/yamlschema" > schema/azure-pipelines.schema.json

OR

curl -u :$ADO_PAT "https://dev.azure.com/$ORGA/_apis/distributedtask/yamlschema?api-version=5.1" > schema/azure-pipelines.schema.json

TODO

  • "Convert" is not working,
  • bundle size with compile is huge > 100MB

Readme

Keywords

none

Package Sidebar

Install

npm i @nk11/ts-json-yaml

Weekly Downloads

0

Version

2.0.0

License

MIT

Unpacked Size

10.2 MB

Total Files

6

Last publish

Collaborators

  • nk11