Skip to content

Commit e4f96fc

Browse files
galesky-ajeandersonbc
authored andcommitted
add agents md file
1 parent 6a01170 commit e4f96fc

1 file changed

Lines changed: 92 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
## Overview
2+
3+
This is the Adyen Node.js API Library, providing Node.js developers with an easy way to interact with the Adyen API. The library is a wrapper around the Adyen API, generated from OpenAPI specifications.
4+
5+
## Code Generation
6+
7+
A significant portion of this library, particularly the API services and data models, is automatically generated.
8+
9+
- **Engine**: We use [OpenAPI Generator](https://openapi-generator.tech/) with custom [Mustache](https://mustache.github.io/) templates to convert Adyen's OpenAPI specifications into TypeScript code.
10+
- **Templates**: The custom templates are located in the `/templates-v7/typescript` directory. These templates are tailored to fit our custom HTTP client and model structure.
11+
- **Automation**:
12+
- **Centralized**: The primary generation process is managed in a separate repository, [`adyen-sdk-automation`](https://github.com/Adyen/adyen-sdk-automation). Changes to the OpenAPI specs trigger a GitHub workflow in that repository, which generates the code and opens Pull Requests in this library.
13+
- **Local**: For development and testing, you must use the [`adyen-sdk-automation`](https://github.com/Adyen/adyen-sdk-automation) repository.
14+
15+
### Local Code Generation
16+
17+
To test new features or changes to the templates, you must run the generation process from a local clone of the `adyen-sdk-automation` repository.
18+
19+
1. **Clone the automation repository**:
20+
```bash
21+
git clone https://github.com/Adyen/adyen-sdk-automation.git
22+
```
23+
24+
2. **Link this library**: The automation project needs to target your local clone of `adyen-node-api-library`. From inside the `adyen-sdk-automation` directory, run the following commands. This will replace the `node/repo` directory with a symlink to your local project.
25+
```bash
26+
rm -rf node/repo
27+
ln -s /path/to/your/adyen-node-api-library node/repo
28+
```
29+
30+
3. **Run the generator**: You can now run the Gradle commands to generate code.
31+
- **To generate all services for the Node.js library**:
32+
```bash
33+
./gradlew :node:services
34+
```
35+
- **To generate a single service (e.g., Checkout)**:
36+
```bash
37+
./gradlew :node:checkout
38+
```
39+
- **To clean the repository before generating**:
40+
```bash
41+
./gradlew :node:cleanRepo :node:checkout
42+
```
43+
44+
## Core Components
45+
46+
- **`src/client.ts`**: The central class for configuring the library (API key, environment, etc.) and accessing API services.
47+
- **`src/service.ts`**: The base class for all API services, containing the generic HTTP client logic.
48+
- **`src/services/`**: This package contains the generated service classes (e.g., `CheckoutAPI`, `Management`) that expose methods for specific API endpoints.
49+
- **`src/typings/`**: This package contains the generated TypeScript types (models) used for API requests and responses.
50+
51+
## Development Workflow
52+
53+
This is a standard Node.js/TypeScript project.
54+
55+
### Building
56+
57+
To compile the TypeScript source code into JavaScript, run:
58+
59+
```bash
60+
npm run build
61+
```
62+
63+
### Running Tests
64+
65+
To execute the unit tests using Jest:
66+
67+
```bash
68+
npm test
69+
```
70+
71+
### Code Style & Formatting
72+
73+
We use ESLint for linting.
74+
75+
- **Check for style violations**:
76+
```bash
77+
npm run lint
78+
```
79+
- **Apply automatic fixes**:
80+
```bash
81+
npm run lint:fix
82+
```
83+
84+
The build will fail if there are any linting errors. Run `npm run lint:fix` and fix any remaining issues before committing.
85+
86+
## Release Process
87+
88+
The release process is automated via GitHub Actions. When a release is triggered:
89+
1. A script determines the next version number (major, minor, or patch).
90+
2. The `package.json` and other version files are updated.
91+
3. A pull request is created with the version bump.
92+
4. Once merged, a GitHub release is created, and the new version is published to npm.

0 commit comments

Comments
 (0)