Skip to content

Commit 4cb137a

Browse files
committed
Added directory structure details and tool flow diagram
1 parent 58ab96b commit 4cb137a

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed
212 KB
Loading
72.8 KB
Loading

generator/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,15 @@ GCP:
8282

8383
For the class-based SDKs there is a minor change in the `node-cloud.yml` to record the main class of an SDK. For the above scenario, it’s the DNS class.
8484

85+
* Digital Ocean
86+
87+
```
88+
DO:
89+
create: droplets.d.ts create
90+
```
91+
92+
93+
8594
## Code parsers
8695

8796
This is the simplest part of the code generation tool. The SDK files are read from the relevant SDKs as specified in the `node-cloud.yml` file. Afterwards, it is converted to an **Abstract Syntax Tree**. Finally, the class declaration Node of that **Abstract Syntax Tree** is returned. This retured Node is another **Abstract Syntax Tree** since a class declaration itself is another **Abstract Syntax Tree**.
@@ -99,3 +108,22 @@ This is the most important part of the code generator tool. Currently, there are
99108
* `addIdentifiers`: In this transformation all the Identifier nodes are updated. After this transformation the code is logically compelete. All the neccessary code parts are added and finalized such as parameter names, parameter types, client names, class name, package names, SDK function names etc.
100109

101110
* `addComments`: This transformation aims to auto-generate the API documentation. All the comments are added to the structure required by `JSDoc`. The `@category` is used to categorize the generated classes depending on the cloud provider. This tag is from the `better-docs` template used with `JSDoc`.
111+
112+
## Understanding the directory structure of generator
113+
114+
The code generation component of nodecloud is present in generator folder. It is a separate workspace/module managed using lerna.
115+
116+
<p align="center">
117+
<img src="../assets/generator/high_level_diagrams/directory_structure_diagram.png" />
118+
</p>
119+
120+
## Understanding the code generator tool
121+
122+
The code generation tool is using typescript compiler api to extract and analyse cloud SDK's and then making the classes for nodelcloud out of it.
123+
The tool works in this flow:
124+
<p align="center">
125+
<img src="../assets/generator/high_level_diagrams/toolflow_diagram.png" />
126+
</p>
127+
128+
## Running the code generation tool
129+
- To build classes run `tsc main && node main` or 'yarn run tool' if inside generator directory and `yarn run generator` if inside nodecloud directory.

0 commit comments

Comments
 (0)