2.0.0 • Published 8 months ago
@nk11/ts-json-yaml v2.0.0
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
- you will find the schemas at
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