Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/longlho/ts-transform-json
Inline specific values from a JSON file or the whole JSON blob
https://github.com/longlho/ts-transform-json
ast compiler json transform typescript
Last synced: 16 days ago
JSON representation
Inline specific values from a JSON file or the whole JSON blob
- Host: GitHub
- URL: https://github.com/longlho/ts-transform-json
- Owner: longlho
- License: mit
- Created: 2019-02-10T18:31:37.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-03-06T10:57:47.000Z (over 1 year ago)
- Last Synced: 2024-10-03T12:23:46.818Z (about 1 month ago)
- Topics: ast, compiler, json, transform, typescript
- Language: TypeScript
- Size: 200 KB
- Stars: 15
- Watchers: 3
- Forks: 0
- Open Issues: 21
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-typescript-ecosystem - ts-transform-json - Inline specific values from a JSON file or the whole JSON blob (Transformers / General transformers)
README
# ts-transform-json
![build status](https://travis-ci.org/longlho/ts-transform-json.svg?branch=master)
Inline specific values from a JSON file or the whole JSON blob. For example:
```typescript
import {version} from 'package.json'
// becomes
var version = '1.0.5'// OR
import * as packageJson from 'package.json'
// becomes
var packageJson = {"version": "1.0.5", dependencies: {}}
```## Usage
First of all, you need some level of familiarity with the [TypeScript Compiler API](https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API).
`compile.ts` & tests should have examples of how this works. The available options are:
### isDeclaration?: boolean
Whether you're running this transformer in declaration files (typically specified in `afterDeclarations` instead of `after` in transformer list). This flag will inline types
instead of actual value.