Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Commit

Permalink
export declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
Dergash committed Jan 28, 2021
1 parent 87434b7 commit 572a650
Show file tree
Hide file tree
Showing 15 changed files with 44 additions and 5 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# Version 0.2.0 (January 28, 2021)

## Features

* Source types for JSON schemas are now exported and can be extended in your application to customize generated schemas.
0.3.0 is scheduled to export a function that will take customized types as arguments and will generate schemas based on provided customization.
```ts
import { ScreenMetaJson } from '@tesler-ui/schema'

export interface CustomScreenMetaJson extends ScreenMeta {
customField: number // add or modify fields if your *.screen.json file format is different
}
```

* Some types that previously were declared in [Tesler-UI](https://github.com/tesler-platform/tesler-ui) are moved here as they in fact affect both backend and frontend applications; Tesler UI will reexport those types so nothing should break if you referenced them from your application directly.

# Version 0.1.3 (January 26, 2021)

## Fixes
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ yarn add @tesler-ui/schema
},
```

### Disable `@tesler-ui/schema` in the `browser` section of your `package.json` file:
```json
"browser": {
"@tesler-ui/schema": false
}
```

### Launch command to generate schemas
```sh
yarn gen:schema
Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tesler-ui/schema",
"version": "0.1.3",
"version": "0.2.0",
"author": {
"name": "Constantine Dergachev",
"email": "dergachev@hotmail.com",
Expand All @@ -11,13 +11,14 @@
"url": "git://github.com/tesler-platform/tesler-schema.git"
},
"homepage": "https://github.com/tesler-platform/tesler-schema",
"main": "dist/generator.js",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"license": "Apache-2.0",
"bin": "./bin/build-schema",
"scripts": {
"lint": "prettier ./src --write",
"build": "tsc ./src/generator.ts --outDir dist --importsNotUsedAsValues remove",
"gen:schema": "yarn build && node ./dist/generator.js"
"build": "tsc",
"gen:schema": "yarn build && node ./dist/index.js"
},
"devDependencies": {
"@types/node": "^14.14.22",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function run() {
mkdirSync('schemas')
}
const program = TJS.getProgramFromFiles(
schemas.map(item => join(__dirname, '../', `src/files/${item}.d.ts`)),
schemas.map(item => join(__dirname, '../', `src/files/${item}.ts`)),
compilerOptions
)
const generator = TJS.buildGenerator(program, settings)
Expand Down
5 changes: 5 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@ export { ScreenMetaJson } from './files/ScreenMeta'
export { ViewMetaJson } from './files/ViewMeta'
export { WidgetMetaJson } from './files/WidgetMeta'
export { SqlBcJson } from './files/SqlBc'
export * from './interfaces/data'
export * from './interfaces/navigation'
export * from './interfaces/operations'
export * from './interfaces/router'
export * from './interfaces/widget'
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"outDir": "./dist/",
"baseUrl": "./src",
"declaration": true
},
"include": [
"src/index.ts"
]
}

0 comments on commit 572a650

Please sign in to comment.