Skip to content

7frank/ts-json

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published