Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,26 @@ This is a component of the [Amplication](https://github.com/amplication/amplicat
- Common interfaces and types across language implementations
- Extensible architecture for adding new language support

## Scope and Purpose

The AST libraries are not intended to cover all language functionality. Instead, they focus on the elements needed to create the foundation and boilerplate code with Amplication plugins. These libraries provide the essential building blocks for generating well-structured code across different languages.

When more specialized or custom code is needed, the `CodeBlock` can be used as a generic node that can include any code as a string. This flexibility allows you to generate both structured AST-based code and custom code blocks when necessary.

```typescript
import { CodeBlock } from '@amplication/java-ast'; // or '@amplication/csharp-ast'

// Create a custom code block when needed
const customLogic = new CodeBlock(`
// Custom implementation that may not be supported by the AST library directly
if (condition) {
specialFunction();
return customResult;
}
`);

```

### Libraries

#### ast-types
Expand Down
23 changes: 23 additions & 0 deletions libs/csharp-ast/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
# csharp-ast


## Scope and Purpose

The C# AST library is not intended to cover all C# language functionality. Instead, it focuses on the elements needed to create foundation and boilerplate code with Amplication plugins. The library provides building blocks for generating well-structured C# code for common patterns and use cases.

When more specialized or custom code is needed, the `CodeBlock` class can be used as a generic node that can include any code as a string:

```typescript
import { CodeBlock } from '@amplication/csharp-ast';

// Create a custom code block for specialized logic
const customLogic = new CodeBlock(`
// Custom C# implementation
using (var client = new HttpClient())
{
var response = await client.GetAsync(endpoint);
return await response.Content.ReadAsStringAsync();
}
`);

// Add to your class or method
```

This library was generated with [Nx](https://nx.dev).

## Building
Expand Down
26 changes: 26 additions & 0 deletions libs/java-ast/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,32 @@

A library for generating Java code through an abstract syntax tree (AST) approach. This library allows you to programmatically generate Java code in a type-safe manner.


## Scope and Purpose

The Java AST library is not intended to cover all Java language functionality. Instead, it focuses on the elements needed to create foundation and boilerplate code with Amplication plugins. The library provides building blocks for generating well-structured Java code for common patterns and use cases.

When more specialized or custom code is needed, the `CodeBlock` class can be used as a generic node that can include any code as a string:

```typescript
import { CodeBlock } from '@amplication/java-ast';

// Create a custom code block for specialized logic
const customLogic = new CodeBlock(`
// Custom Java implementation
try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
String line;
while ((line = reader.readLine()) != null) {
processLine(line);
}
} catch (IOException e) {
logger.error("Error reading file", e);
}
`);

// Add to your class or method
```

## Installation

```sh
Expand Down
5 changes: 5 additions & 0 deletions typedoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
"cleanOutputDir": true,
"disableGit": true,
"includeVersion": true,
"navigationLinks": {
"GitHub": "https://github.com/amplication/ast-types",
"Amplication Docs": "https://docs.amplication.com/plugin-development/ast-libraries",
"Amplication": "https://amplication.com"
},
"exclude": [
"**/*.test.ts",
"**/*.spec.ts",
Expand Down
Loading