Search in sources :

Example 1 with TSGenerator

use of io.crnk.gen.typescript.internal.TSGenerator in project crnk-framework by crnk-project.

the class GeneratorExecutor method run.

public void run(File outputDir) {
    TSGeneratorConfig config = new TSGeneratorConfig();
    config.setGenerateExpressions(true);
    config.getNpm().setPackagingEnabled(false);
    config.getNpm().setPackageName("@crnk/angular-ngrx");
    config.getNpm().getPackageMapping().put(MetaElement.class.getPackage().getName(), "@crnk/angular-ngrx/meta");
    MetaModule metaModule = MetaModule.create();
    metaModule.addMetaProvider(new ResourceMetaProvider());
    CrnkBoot boot = new CrnkBoot();
    boot.setServiceDiscovery(new EmptyServiceDiscovery());
    boot.addModule(metaModule);
    boot.boot();
    TSGenerator generator = new TSGenerator(outputDir, metaModule.getLookup(), config);
    try {
        generator.run();
    } catch (IOException e) {
        throw new IllegalStateException(e);
    }
}
Also used : CrnkBoot(io.crnk.core.boot.CrnkBoot) TSGenerator(io.crnk.gen.typescript.internal.TSGenerator) TSGeneratorConfig(io.crnk.gen.typescript.TSGeneratorConfig) ResourceMetaProvider(io.crnk.meta.provider.resource.ResourceMetaProvider) IOException(java.io.IOException) MetaModule(io.crnk.meta.MetaModule) EmptyServiceDiscovery(io.crnk.core.module.discovery.EmptyServiceDiscovery)

Aggregations

CrnkBoot (io.crnk.core.boot.CrnkBoot)1 EmptyServiceDiscovery (io.crnk.core.module.discovery.EmptyServiceDiscovery)1 TSGeneratorConfig (io.crnk.gen.typescript.TSGeneratorConfig)1 TSGenerator (io.crnk.gen.typescript.internal.TSGenerator)1 MetaModule (io.crnk.meta.MetaModule)1 ResourceMetaProvider (io.crnk.meta.provider.resource.ResourceMetaProvider)1 IOException (java.io.IOException)1