-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add type renderer * render type declarations * sort exported entity types * fix build * implement client-cli * 2.14.0
- Loading branch information
1 parent
658491f
commit 0f5c7db
Showing
17 changed files
with
1,701 additions
and
772 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const minimist = require('minimist'); | ||
const { TypeRenderer } = require('../dist'); | ||
const { writeFileSync } = require('fs'); | ||
|
||
async function main() { | ||
const args = minimist(process.argv.slice(2), { | ||
alias: { | ||
outFile: 'out-file' | ||
}, | ||
}); | ||
if (args.help) { | ||
console.log('Usage: client-cli [options]'); | ||
console.log('Options:'); | ||
console.log(' --host <host> The HTTP address of the host api server to connect to'); | ||
console.log(' --out-file <file> The output file to write the rendered types to'); | ||
return; | ||
} | ||
if (!args.host) { | ||
console.error('Error: Missing required argument --host'); | ||
return process.exit(-1); | ||
} | ||
const typeRenderer = new TypeRenderer(args.host); | ||
const result = await typeRenderer.renderAny(); | ||
if (args.outFile) { | ||
writeFileSync(args.outFile, result); | ||
} else { | ||
process.stdout.write(result); | ||
process.stdout.write('\n'); | ||
} | ||
} | ||
|
||
main().then(() => { | ||
return process.exit(0); | ||
}).catch((err) => { | ||
console.error(err.message); | ||
console.error(err.stack); | ||
return process.exit(-1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"private": true, | ||
"module": "dist/index.esm.js", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"scripts": { | ||
"test": "jasmine" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import {TypeRenderer} from '@themost/client/util'; | ||
import { serveApplication, getApplication } from '@themost/test'; | ||
|
||
describe("BasicClientDataContext", () => { | ||
|
||
beforeAll(async () => { | ||
const app = await getApplication(); | ||
await serveApplication(app, 8080) | ||
}); | ||
|
||
it("should render type", async () => { | ||
const renderer = new TypeRenderer('http://localhost:8080/api/'); | ||
let typeDeclaration = await renderer.render('Thing'); | ||
expect(typeDeclaration).toBeInstanceOf(String); | ||
typeDeclaration = await renderer.render('Workspace'); | ||
expect(typeDeclaration).toBeInstanceOf(String); | ||
}); | ||
|
||
it("should render any type", async () => { | ||
const renderer = new TypeRenderer('http://localhost:8080/api/'); | ||
const typeDeclarations = await renderer.renderAny(); | ||
expect(typeDeclarations).toBeInstanceOf(String); | ||
}); | ||
|
||
|
||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const SpecReporter = require('jasmine-spec-reporter').SpecReporter; | ||
jasmine.getEnv().addReporter(new SpecReporter({ | ||
spec: { | ||
displayPending: true, | ||
displayStacktrace: 'raw' | ||
} | ||
})); | ||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const path = require('path'); | ||
require('ts-node').register({ | ||
project: path.resolve(__dirname, '../../tsconfig.spec.json'), | ||
transpileOnly: true | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const tsConfig = require("../../tsconfig.spec.json"); | ||
const tsConfigPaths = require("tsconfig-paths"); | ||
|
||
const baseUrl = "./"; | ||
tsConfigPaths.register({ | ||
baseUrl, | ||
paths: tsConfig.compilerOptions.paths, | ||
}); |
Oops, something went wrong.