-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8881ba6
commit 17ed421
Showing
5 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"root": true, | ||
"parser": "@typescript-eslint/parser", | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
node_modules | ||
lib | ||
cache | ||
testReal/*js | ||
src/**/*.js | ||
.env | ||
.idea | ||
cov | ||
docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Ignore artifacts: | ||
lib | ||
coverage | ||
node_modules | ||
*.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"printWidth": 120, | ||
"tabWidth": 4, | ||
"useTabs": false, | ||
"semi": true, | ||
"singleQuote": false, | ||
"bracketSpacing": true, | ||
"arrowParens": "always" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,86 @@ | ||
# compose-craft-lib | ||
|
||
A TypeScript library for working with Docker Compose configurations, providing strong typing and easy manipulation of Docker Compose data structures. | ||
|
||
## Overview | ||
|
||
`compose-craft-lib` is a powerful TypeScript library designed to simplify working with Docker Compose configurations. It offers: | ||
- Strong TypeScript typing for Docker Compose structures | ||
- Easy creation and manipulation of compose configurations | ||
- Translation between different representation formats | ||
- Intuitive, object-oriented approach to defining services and configurations | ||
|
||
## Features | ||
|
||
- Type-safe Docker Compose configuration management | ||
- Support for creating and modifying services, images, and port mappings | ||
- Translator design pattern for flexible configuration handling | ||
- Comprehensive type definitions | ||
|
||
## Installation | ||
|
||
Install the library using npm: | ||
|
||
```bash | ||
npm install @composecraft/docker-compose-lib | ||
``` | ||
|
||
Or using yarn: | ||
|
||
```bash | ||
yarn add @composecraft/docker-compose-lib | ||
``` | ||
|
||
Or using pnpm: | ||
|
||
```bash | ||
pnpm add @composecraft/docker-compose-lib | ||
``` | ||
|
||
## Usage Examples | ||
|
||
### Basic Composition Creation | ||
|
||
```typescript | ||
import { Compose, Service, Image, PortMapping, Translator } from "@composecraft/docker-compose-lib" | ||
import { stringify } from "yaml"; | ||
|
||
// Create a new Compose configuration | ||
const compose = new Compose({name: "demo"}); | ||
|
||
// Define a web service | ||
const webService = new Service({ | ||
name: "web", | ||
image: new Image({ name: "nginx" }), | ||
ports: [new PortMapping({ hostPort: 80, containerPort: 80 })], | ||
}); | ||
|
||
// Add the service to the composition | ||
compose.addService(webService); | ||
|
||
// Translate to a dictionary and convert to YAML | ||
const translator = new Translator(compose); | ||
const yamlConfig = stringify(translator.toDict()); | ||
``` | ||
|
||
## API Documentation | ||
|
||
For detailed API documentation, please visit the [official documentation](https://composecraft.github.io/docker-compose-lib). | ||
|
||
## Contributing | ||
|
||
Contributions are welcome! Please feel free to submit a Pull Request. | ||
|
||
1. Fork the repository | ||
2. Create your feature branch (`git checkout -b feature/AmazingFeature`) | ||
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`) | ||
4. Push to the branch (`git push origin feature/AmazingFeature`) | ||
5. Open a Pull Request | ||
|
||
## License | ||
|
||
Distributed under the MIT License. See `LICENSE` for more information. | ||
|
||
## Contact | ||
|
||
Project Link: [https://github.com/composecraft/docker-compose-lib](https://github.com/composecraft/docker-compose-lib) |