Skip to content

feat: support docker compose v2 plugin version #228

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Apr 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
81e72e9
feat: support docker compose v2 plugin version
AlexZeitler Feb 4, 2023
fa511b8
test: run v2 tests only
AlexZeitler Feb 4, 2023
12f956a
Merge branch 'master' into compose-v2-plugin-support
AlexZeitler Feb 6, 2023
2528dc9
Merge branch 'master' into compose-v2-plugin-support
AlexZeitler Feb 6, 2023
ba7a700
chore: replace jest with vitest
AlexZeitler Apr 25, 2023
8633345
test: run vitest command instead of jest
AlexZeitler Apr 25, 2023
886c4fc
refactor: create v2 tests in test folder, move old tests to old folder
AlexZeitler Apr 25, 2023
892e6db
fix(lint): remove jest plugin reference
AlexZeitler Apr 25, 2023
fcabbc2
fix(lint): no-useless-escape for \" characters
AlexZeitler Apr 25, 2023
36d543d
fix(build): exclude old tests temporarily
AlexZeitler Apr 25, 2023
0722abd
test: support versions with extensions like 2.17.2+azure-1 (gh ci)
AlexZeitler Apr 25, 2023
db2e8b9
chore(ci): use v3 checkout
AlexZeitler Apr 25, 2023
abaa504
test: (re-)add tests for v2 port mapping
AlexZeitler Apr 26, 2023
14ad15c
chore: increase test timeout to 30s (as was in the past)
AlexZeitler Apr 26, 2023
8897ba5
refactor: move v2 test files to v2 subfolder
AlexZeitler Apr 27, 2023
85c4c15
fix: expect volume name to match changed folder name
AlexZeitler Apr 27, 2023
d5a56ca
refactor: move v1 tests back to v1 test subfolder
AlexZeitler Apr 27, 2023
add6912
refactor: use jest style vitest for v1 tests
AlexZeitler Apr 27, 2023
0e14e95
refactor: run v1 and v2 tests consecutively
AlexZeitler Apr 27, 2023
0539dd8
chore(release): 0.23.20-preview.0
AlexZeitler Apr 27, 2023
4516df9
build: export v2 via index
AlexZeitler Apr 28, 2023
cfd7100
docs: describe v2 imports and issues
AlexZeitler Apr 28, 2023
bafacda
Merge branch 'master' into compose-v2-plugin-support
AlexZeitler Apr 28, 2023
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
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module.exports = {
extends: [
'eslint:recommended',
'plugin:jest/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended'
],
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-22.04
name: info
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
Expand All @@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-22.04
name: Lint
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
Expand All @@ -32,10 +32,11 @@ jobs:
runs-on: ubuntu-22.04
name: Build + Test
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
- run: yarn
- run: yarn build
- run: yarn test
- run: yarn test-v1
- run: yarn test-v2
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [0.23.20-preview.0](https://github.com/PDMLab/docker-compose/compare/v0.23.19...v0.23.20-preview.0) (2023-04-27)


### Features

* support docker compose v2 plugin version ([81e72e9](https://github.com/PDMLab/docker-compose/commit/81e72e9985aba05474463306852501287ad32680))


### Bug Fixes

* expect volume name to match changed folder name ([85c4c15](https://github.com/PDMLab/docker-compose/commit/85c4c150ce5191c95116e98145e2d3c75604a4a4))
* **build:** exclude old tests temporarily ([36d543d](https://github.com/PDMLab/docker-compose/commit/36d543db56822be95c9cd31eaa890a4c46e789a4))
* **lint:** no-useless-escape for \" characters ([fcabbc2](https://github.com/PDMLab/docker-compose/commit/fcabbc2ea7c7d42f15f45a26badab9fe73030a6c))
* **lint:** remove jest plugin reference ([892e6db](https://github.com/PDMLab/docker-compose/commit/892e6db60302ef734e5b42b74da6f583c1fb9e52))

### [0.23.19](https://github.com/PDMLab/docker-compose/compare/v0.23.18...v0.23.19) (2023-02-05)

### [0.23.18](https://github.com/PDMLab/docker-compose/compare/v0.23.17...v0.23.18) (2023-01-24)
Expand Down
34 changes: 27 additions & 7 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,40 @@ home: false
npm install --save-dev docker-compose
```

## Usage
## Import for docker-compose (v1)

You can either import particular functions like `upAll`:
To import commands for the v1 version, please use this import statement:

```typescript
import { upAll, down, exec, stopOne, logs } from "docker-compose";
```ts
import * as compose from 'docker-compose'
```

or you can just import the complete library:
You can also import only the required commands:

```typescript
import * as compose from "docker-compose";
```ts
import { run, upAll } from 'docker-compose'
```

### Import for docker-compose (v2)

To import commands for the v2 version, please use this import statement:

```ts
import { v2 as compose } from 'docker-compose'
```

You can also import only the required commands:

```ts
import { run, upAll } from 'docker-compose/dist/v2'
```

## Known issues with v2 support

* During testing we noticed that `docker compose` seems to send it's exit code also commands don't seem to have finished. This doesn't occur for all commands, but for example with `stop` or `down`. We had the option to wait for stopped / removed containers using third party libraries but this would make bootstrapping `docker-compose` much more complicated for the users. So we decided to use a `setTimeout(500)` workaround. We're aware this is not perfect but it seems to be the most appropriate solution for now. Details can be found in the [v2 PR discussion](https://github.com/PDMLab/docker-compose/pull/228#issuecomment-1422895821) (we're happy to get help here).

## Usage

`docker-compose` current supports these commands:

* `buildAll(options)` - Build or rebuild services
Expand Down
187 changes: 0 additions & 187 deletions jest.config.js

This file was deleted.

11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "docker-compose",
"version": "0.23.19",
"version": "0.23.20-preview.0",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"types": "dist/index.d.ts",
"scripts": {
"test": "jest test --verbose",
"test-v1": "npx vitest --dir test/v1 --test-timeout=30000",
"test-v2": "npx vitest --dir test/v2 --test-timeout=30000",
"lint": "eslint src/**/*.ts test/**/*.ts",
"build": "tsc",
"prepublishOnly": "tsc",
Expand Down Expand Up @@ -83,23 +84,21 @@
"@commitlint/cli": "^13.1.0",
"@commitlint/config-conventional": "13.1.0",
"@types/dockerode": "^2.5.27",
"@types/jest": "^29.4.0",
"@types/node": "^12.12.6",
"@typescript-eslint/eslint-plugin": "^4.21.0",
"@typescript-eslint/parser": "^4.21.0",
"@vitest/ui": "^0.30.1",
"dockerode": "^3.2.1",
"eslint": "^7.24.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^24.3.4",
"eslint-plugin-prettier": "^3.3.1",
"eslint-watch": "^7.0.0",
"husky": "^6.0.0",
"jest": "^29.4.1",
"prettier": "^2.2.1",
"standard-version": "9.3.1",
"ts-jest": "^29.0.5",
"typescript": "^4.9.5",
"vitest": "^0.30.1",
"vuepress": "^2.0.0-beta.7"
},
"engines": {
Expand Down
Loading