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
|| Containers | ECS, EKS | Google Kubernetes Engine | AKS, Azure Service Fabric\*| DO Kubernetes\*| Container Service*, Container Service for Kubernetes*|
206
+
|| Containers | ECS, EKS | Google Kubernetes Engine | AKS, Azure Service Fabric\*| DO Kubernetes | Container Service*, Container Service for Kubernetes*|
Copy file name to clipboardExpand all lines: generator/README.md
+37Lines changed: 37 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -82,6 +82,19 @@ GCP:
82
82
83
83
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.
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 +112,27 @@ This is the most important part of the code generator tool. Currently, there are
99
112
*`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.
100
113
101
114
*`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`.
115
+
116
+
## Understanding the directory structure of generator
117
+
118
+
The code generation component of nodecloud is present in generator folder. It is a separate workspace/module managed using lerna.
The entry point of nodecloud is the main.ts file which you provide to typescript to generate the js file and then run the same. Inside the main file we fetch services from YML file and one by one pass the SDK file path and service name to generator function.
133
+
134
+
Inside generator we first call the parser to get the needed class and extract functions, parameters,etc needed for building Nodecloud classes. All this data is then passed onto the
135
+
transformer which transforms the dummy class into an working Nodecloud class for that specific service. All these classes are then written into the Js file.
136
+
137
+
## Running the code generation tool
138
+
- 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