You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Darabonba Code Generator was designed to work in Node.js. The preferred way to install the Generator is to use the NPM package manager. Simply type the following into a terminal window:
npm install @darabonba/typescript-generator
Usage
"use strict";constpath=require("path");constfs=require("fs");constparser=require("@darabonba/parser");constgenerator=require("@darabonba/typescript-generator");constsourceDir="<Darabonda package directory>";constoutputDir="<Generate output directory>";// generate AST data by parserletpackageMetaFilePath=path.join(sourceDir,"Darafile");letpackageMeta=JSON.parse(fs.readFileSync(packageMetaFilePath,"utf8"));letmainFile=path.join(sourceDir,packageMeta.main);letast=parser.parse(fs.readFileSync(mainFile,"utf8"),mainFile);// initialize generatorletgeneratorConfig={
...packageMeta,pkgDir: sourceDir,
outputDir,};letgenerator=newgenerator(generatorConfig);// generate typescript code by generatorgenerator.visit(ast);// The execution result will be output in the 'outputDir'
Issues
Opening an Issue, Issues not conforming to the guidelines may be closed immediately.
Changelog
Detailed changes for each release are documented in the release notes.
License
Apache-2.0
Copyright (c) 2009-present, Alibaba Cloud All rights reserved.