Skip to content
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

Env: Migrate to Compose V2 #51339

Merged
merged 1 commit into from
Dec 5, 2023
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
54 changes: 37 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions packages/env/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Breaking Change

- Update Docker usage to `docker compose` V2 following [deprecation](https://docs.docker.com/compose/migrate/) of `docker-compose` V1.

## 8.13.0 (2023-11-29)

## 8.12.0 (2023-11-16)
Expand Down
4 changes: 2 additions & 2 deletions packages/env/lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ const withSpinner =
'err' in error &&
'out' in error
) {
// Error is a docker-compose error. That means something docker-related failed.
// Error is a docker compose error. That means something docker-related failed.
// https://github.com/PDMLab/docker-compose/blob/HEAD/src/index.ts
spinner.fail(
'Error while running docker-compose command.'
'Error while running docker compose command.'
);
if ( error.out ) {
process.stdout.write( error.out );
Expand Down
2 changes: 1 addition & 1 deletion packages/env/lib/commands/clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* External dependencies
*/
const dockerCompose = require( 'docker-compose' );
const { v2: dockerCompose } = require( 'docker-compose' );

/**
* Internal dependencies
Expand Down
2 changes: 1 addition & 1 deletion packages/env/lib/commands/destroy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* External dependencies
*/
const dockerCompose = require( 'docker-compose' );
const { v2: dockerCompose } = require( 'docker-compose' );
const util = require( 'util' );
const fs = require( 'fs' ).promises;
const path = require( 'path' );
Expand Down
2 changes: 1 addition & 1 deletion packages/env/lib/commands/logs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* External dependencies
*/
const dockerCompose = require( 'docker-compose' );
const { v2: dockerCompose } = require( 'docker-compose' );

/**
* Internal dependencies
Expand Down
3 changes: 2 additions & 1 deletion packages/env/lib/commands/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ function spawnCommandDirectly( config, container, command, envCwd, spinner ) {
);

const composeCommand = [
'compose',
'-f',
config.dockerComposeConfigPath,
'exec',
Expand All @@ -98,7 +99,7 @@ function spawnCommandDirectly( config, container, command, envCwd, spinner ) {
// cannot use it to spawn an interactive command. Thus, we run docker-
// compose on the CLI directly.
const childProc = spawn(
'docker-compose',
'docker',
composeCommand,
{ stdio: 'inherit' },
spinner
Expand Down
2 changes: 1 addition & 1 deletion packages/env/lib/commands/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* External dependencies
*/
const dockerCompose = require( 'docker-compose' );
const { v2: dockerCompose } = require( 'docker-compose' );
const util = require( 'util' );
const path = require( 'path' );
const fs = require( 'fs' ).promises;
Expand Down
2 changes: 1 addition & 1 deletion packages/env/lib/commands/stop.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* External dependencies
*/
const dockerCompose = require( 'docker-compose' );
const { v2: dockerCompose } = require( 'docker-compose' );

/**
* Internal dependencies
Expand Down
2 changes: 1 addition & 1 deletion packages/env/lib/test/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ describe( 'env cli', () => {
await env.start.mock.results[ 0 ].value.catch( () => {} );

expect( spinner.fail ).toHaveBeenCalledWith(
'Error while running docker-compose command.'
'Error while running docker compose command.'
);
expect( process.stderr.write ).toHaveBeenCalledWith( 'failure error' );
expect( process.exit ).toHaveBeenCalledWith( 1 );
Expand Down
2 changes: 1 addition & 1 deletion packages/env/lib/wordpress.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* External dependencies
*/
const dockerCompose = require( 'docker-compose' );
const { v2: dockerCompose } = require( 'docker-compose' );
const util = require( 'util' );
const fs = require( 'fs' ).promises;
const path = require( 'path' );
Expand Down
2 changes: 1 addition & 1 deletion packages/env/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"dependencies": {
"chalk": "^4.0.0",
"copy-dir": "^1.3.0",
"docker-compose": "^0.22.2",
"docker-compose": "^0.24.3",
"extract-zip": "^1.6.7",
"got": "^11.8.5",
"inquirer": "^7.1.0",
Expand Down
4 changes: 4 additions & 0 deletions test/unit/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ module.exports = {
transform: {
'^.+\\.[jt]sx?$': '<rootDir>/test/unit/scripts/babel-transformer.js',
},
transformIgnorePatterns: [
'/node_modules/(?!(docker-compose|yaml)/)',
'\\.pnp\\.[^\\/]+$',
],
snapshotSerializers: [
'@emotion/jest/serializer',
'snapshot-diff/serializer',
Expand Down
Loading