Skip to content

Commit 237f422

Browse files
Update all dependencies
1 parent 8775bb6 commit 237f422

15 files changed

+2834
-1782
lines changed

package-lock.json

Lines changed: 2702 additions & 1660 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,48 +25,53 @@
2525
"prepublish": "npm run build",
2626
"build": "npm run clean && tsc",
2727
"clean": "rimraf dist",
28-
"test": "jest"
28+
"test": "jest",
29+
"format": "prettier --write package.json src/**/*.ts"
2930
},
3031
"dependencies": {
31-
"@types/dockerode": "^2.5.24",
32+
"@types/dockerode": "^2.5.33",
3233
"byline": "^5.0.0",
3334
"debug": "^4.1.1",
34-
"default-gateway": "^5.0.2",
35+
"default-gateway": "^6.0.1",
3536
"docker-compose": "^0.23.4",
36-
"dockerode": "^2.5.8",
37-
"get-port": "^4.2.0",
37+
"dockerode": "^3.2.0",
38+
"get-port": "^5.1.1",
3839
"glob": "^7.1.6",
3940
"node-duration": "^1.0.4",
4041
"stream-to-array": "^2.3.0",
41-
"tar-fs": "^2.0.0"
42+
"tar-fs": "^2.1.0"
4243
},
4344
"devDependencies": {
44-
"@types/byline": "^4.2.31",
45-
"@types/debug": "0.0.31",
46-
"@types/default-gateway": "^3.0.0",
47-
"@types/glob": "^7.1.2",
48-
"@types/jest": "^23.3.14",
49-
"@types/node-fetch": "^2.3.4",
45+
"@types/byline": "^4.2.32",
46+
"@types/debug": "4.1.5",
47+
"@types/default-gateway": "^3.0.1",
48+
"@types/glob": "^7.1.3",
49+
"@types/jest": "^26.0.4",
50+
"@types/node": "^14.0.18",
51+
"@types/node-fetch": "^2.5.7",
5052
"@types/stream-to-array": "^2.3.0",
51-
"@types/tar-fs": "^1.16.1",
53+
"@types/tar-fs": "^2.0.0",
5254
"husky": "^4.2.5",
53-
"jest": "^24.8.0",
55+
"jest": "^26.1.0",
5456
"lint-staged": "^10.2.11",
5557
"node-fetch": "^2.6.0",
56-
"prettier": "^1.17.1",
58+
"prettier": "^2.0.5",
5759
"rimraf": "^3.0.2",
58-
"ts-jest": "^24.0.2",
59-
"ts-node": "^7.0.1",
60-
"tslint": "^5.17.0",
60+
"ts-jest": "^26.1.1",
61+
"ts-node": "^8.10.2",
62+
"tslint": "^6.1.2",
6163
"tslint-config-prettier": "^1.18.0",
62-
"typescript": "^3.5.1"
64+
"typescript": "^3.9.6"
6365
},
6466
"husky": {
6567
"hooks": {
6668
"pre-commit": "lint-staged"
6769
}
6870
},
6971
"lint-staged": {
72+
"package.json": [
73+
"prettier --write"
74+
],
7075
"src/**/*.ts": [
7176
"prettier --write",
7277
"tslint --fix"

src/container.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ export class DockerodeContainer implements Container {
6161

6262
public stop(options: StopOptions): Promise<void> {
6363
return this.container.stop({
64-
t: options.timeout.get(TemporalUnit.SECONDS)
64+
t: options.timeout.get(TemporalUnit.SECONDS),
6565
});
6666
}
6767

6868
public remove(options: RemoveOptions): Promise<void> {
6969
return this.container.remove({
70-
v: options.removeVolumes
70+
v: options.removeVolumes,
7171
});
7272
}
7373

@@ -76,7 +76,7 @@ export class DockerodeContainer implements Container {
7676
await this.container.exec({
7777
Cmd: options.cmd,
7878
AttachStdout: options.attachStdout,
79-
AttachStderr: options.attachStderr
79+
AttachStderr: options.attachStderr,
8080
})
8181
);
8282
}
@@ -86,7 +86,7 @@ export class DockerodeContainer implements Container {
8686
const options = {
8787
follow: true,
8888
stdout: true,
89-
stderr: true
89+
stderr: true,
9090
};
9191

9292
this.container.logs(options, (err, stream) => {
@@ -110,7 +110,7 @@ export class DockerodeContainer implements Container {
110110
hostPorts: this.getHostPorts(inspectResult),
111111
internalPorts: this.getInternalPorts(inspectResult),
112112
name: this.getName(inspectResult),
113-
healthCheckStatus: this.getHealthCheckStatus(inspectResult)
113+
healthCheckStatus: this.getHealthCheckStatus(inspectResult),
114114
};
115115
}
116116

@@ -119,13 +119,13 @@ export class DockerodeContainer implements Container {
119119
}
120120

121121
private getInternalPorts(inspectInfo: ContainerInspectInfo): Port[] {
122-
return Object.keys(inspectInfo.NetworkSettings.Ports).map(port => Number(port.split("/")[0]));
122+
return Object.keys(inspectInfo.NetworkSettings.Ports).map((port) => Number(port.split("/")[0]));
123123
}
124124

125125
private getHostPorts(inspectInfo: ContainerInspectInfo): Port[] {
126126
return Object.values(inspectInfo.NetworkSettings.Ports)
127-
.filter(portsArray => portsArray !== null)
128-
.map(portsArray => Number(portsArray[0].HostPort));
127+
.filter((portsArray) => portsArray !== null)
128+
.map((portsArray) => Number(portsArray[0].HostPort));
129129
}
130130

131131
private getHealthCheckStatus(inspectResult: ContainerInspectInfo): HealthCheckStatus {

src/docker-client.ts

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export class DockerodeClient implements DockerClient {
118118
public async pull(repoTag: RepoTag, authConfig?: AuthConfig): Promise<void> {
119119
log.info(`Pulling image: ${repoTag}`);
120120
const stream = await this.dockerode.pull(repoTag.toString(), {
121-
authconfig: authConfig
121+
authconfig: authConfig,
122122
});
123123
await streamToArray(stream);
124124
}
@@ -140,16 +140,26 @@ export class DockerodeClient implements DockerClient {
140140
Binds: this.getBindMounts(options.bindMounts),
141141
Tmpfs: options.tmpFs,
142142
LogConfig: this.getLogConfig(options.useDefaultLogDriver),
143-
Privileged: options.privilegedMode
144-
}
143+
Privileged: options.privilegedMode,
144+
},
145145
});
146146

147147
return new DockerodeContainer(dockerodeContainer);
148148
}
149149

150150
public async createNetwork(options: CreateNetworkOptions): Promise<string> {
151151
log.info(`Creating network ${options.name}`);
152-
const network: Network = await this.dockerode.createNetwork(options);
152+
const network: Network = await this.dockerode.createNetwork({
153+
Name: options.name,
154+
CheckDuplicate: options.checkDuplicate,
155+
Driver: options.driver,
156+
Internal: options.internal,
157+
Attachable: options.attachable,
158+
Ingress: options.ingress,
159+
EnableIPv6: options.enableIPv6,
160+
Options: options.options,
161+
Labels: options.labels,
162+
});
153163
return network.id;
154164
}
155165

@@ -171,7 +181,7 @@ export class DockerodeClient implements DockerClient {
171181
const exec = await container.exec({
172182
cmd: command,
173183
attachStdout: true,
174-
attachStderr: true
184+
attachStderr: true,
175185
});
176186

177187
const stream = await exec.start();
@@ -189,11 +199,11 @@ export class DockerodeClient implements DockerClient {
189199
): Promise<void> {
190200
log.info(`Building image '${repoTag.toString()}' with context '${context}'`);
191201
const dockerIgnoreFiles = await findDockerIgnoreFiles(context);
192-
const tarStream = tar.pack(context, { ignore: name => dockerIgnoreFiles.has(name) });
202+
const tarStream = tar.pack(context, { ignore: (name) => dockerIgnoreFiles.has(name) });
193203
const stream = await this.dockerode.buildImage(tarStream, {
194204
dockerfile: dockerfileName,
195205
buildargs: buildArgs,
196-
t: repoTag.toString()
206+
t: repoTag.toString(),
197207
});
198208
await streamToArray(stream);
199209
}
@@ -205,7 +215,7 @@ export class DockerodeClient implements DockerClient {
205215
if (this.isDanglingImage(image)) {
206216
return repoTags;
207217
}
208-
const imageRepoTags = image.RepoTags.map(imageRepoTag => {
218+
const imageRepoTags = image.RepoTags.map((imageRepoTag) => {
209219
const [imageName, tag] = imageRepoTag.split(":");
210220
return new RepoTag(imageName, tag);
211221
});
@@ -230,12 +240,9 @@ export class DockerodeClient implements DockerClient {
230240
}
231241

232242
private getEnv(env: Env): DockerodeEnvironment {
233-
return Object.entries(env).reduce(
234-
(dockerodeEnvironment, [key, value]) => {
235-
return [...dockerodeEnvironment, `${key}=${value}`];
236-
},
237-
[] as DockerodeEnvironment
238-
);
243+
return Object.entries(env).reduce((dockerodeEnvironment, [key, value]) => {
244+
return [...dockerodeEnvironment, `${key}=${value}`];
245+
}, [] as DockerodeEnvironment);
239246
}
240247

241248
private getHealthCheck(healthCheck?: HealthCheck): DockerodeHealthCheck | undefined {
@@ -247,7 +254,7 @@ export class DockerodeClient implements DockerClient {
247254
Interval: healthCheck.interval ? this.toNanos(healthCheck.interval) : 0,
248255
Timeout: healthCheck.timeout ? this.toNanos(healthCheck.timeout) : 0,
249256
Retries: healthCheck.retries || 0,
250-
StartPeriod: healthCheck.startPeriod ? this.toNanos(healthCheck.startPeriod) : 0
257+
StartPeriod: healthCheck.startPeriod ? this.toNanos(healthCheck.startPeriod) : 0,
251258
};
252259
}
253260

@@ -282,7 +289,7 @@ export class DockerodeClient implements DockerClient {
282289

283290
return {
284291
Type: "json-file",
285-
Config: {}
292+
Config: {},
286293
};
287294
}
288295
}

src/docker-compose-environment.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe("DockerComposeEnvironment", () => {
1515
};
1616

1717
afterEach(async () => {
18-
await Promise.all(managedEnvironments.map(async environment => await environment.down()));
18+
await Promise.all(managedEnvironments.map(async (environment) => await environment.down()));
1919
managedEnvironments = [];
2020
});
2121

@@ -37,7 +37,7 @@ describe("DockerComposeEnvironment", () => {
3737
);
3838

3939
await Promise.all(
40-
["container_1", "another_container_1"].map(async containerName => {
40+
["container_1", "another_container_1"].map(async (containerName) => {
4141
const container = startedEnvironment.getContainer(containerName);
4242
const url = `http://${container.getContainerIpAddress()}:${container.getMappedPort(8080)}`;
4343
const response = await fetch(`${url}/hello-world`);
@@ -55,7 +55,7 @@ describe("DockerComposeEnvironment", () => {
5555
);
5656

5757
await Promise.all(
58-
["container_1", "another_container_1"].map(async containerName => {
58+
["container_1", "another_container_1"].map(async (containerName) => {
5959
const container = startedEnvironment.getContainer(containerName);
6060
const url = `http://${container.getContainerIpAddress()}:${container.getMappedPort(8080)}`;
6161
const response = await fetch(`${url}/hello-world`);

src/docker-compose-environment.ts

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { HostPortWaitStrategy, WaitStrategy } from "./wait-strategy";
1515
const createDockerComposeOptions = (filePath: string, fileName: string): dockerCompose.IDockerComposeOptions => ({
1616
cwd: filePath,
1717
config: fileName,
18-
log: false
18+
log: false,
1919
});
2020

2121
export class DockerComposeEnvironment {
@@ -44,30 +44,32 @@ export class DockerComposeEnvironment {
4444
await this.dockerComposeUp();
4545
const startedContainers = await this.findStartedContainers();
4646

47-
const startedGenericContainers = (await Promise.all(
48-
startedContainers.map(async startedContainer => {
49-
const container = await this.dockerClient.getContainer(startedContainer.Id);
50-
const containerName = resolveDockerComposeContainerName(startedContainer.Names[0]);
51-
52-
(await container.logs())
53-
.on("data", data => log.trace(`${containerName}: ${data}`))
54-
.on("err", data => log.error(`${containerName}: ${data}`));
55-
56-
const inspectResult = await container.inspect();
57-
const boundPorts = this.getBoundPorts(startedContainer);
58-
const containerState = new ContainerState(inspectResult);
59-
60-
await this.waitForContainer(container, containerName, containerState, boundPorts);
61-
62-
return new StartedGenericContainer(
63-
container,
64-
this.dockerClient.getHost(),
65-
boundPorts,
66-
containerName,
67-
this.dockerClient
68-
);
69-
})
70-
)).reduce((map, startedGenericContainer) => {
47+
const startedGenericContainers = (
48+
await Promise.all(
49+
startedContainers.map(async (startedContainer) => {
50+
const container = await this.dockerClient.getContainer(startedContainer.Id);
51+
const containerName = resolveDockerComposeContainerName(startedContainer.Names[0]);
52+
53+
(await container.logs())
54+
.on("data", (data) => log.trace(`${containerName}: ${data}`))
55+
.on("err", (data) => log.error(`${containerName}: ${data}`));
56+
57+
const inspectResult = await container.inspect();
58+
const boundPorts = this.getBoundPorts(startedContainer);
59+
const containerState = new ContainerState(inspectResult);
60+
61+
await this.waitForContainer(container, containerName, containerState, boundPorts);
62+
63+
return new StartedGenericContainer(
64+
container,
65+
this.dockerClient.getHost(),
66+
boundPorts,
67+
containerName,
68+
this.dockerClient
69+
);
70+
})
71+
)
72+
).reduce((map, startedGenericContainer) => {
7173
const containerName = startedGenericContainer.getName();
7274
return { ...map, [containerName]: startedGenericContainer };
7375
}, {});
@@ -91,12 +93,12 @@ export class DockerComposeEnvironment {
9193

9294
private async findStartedContainers(): Promise<Dockerode.ContainerInfo[]> {
9395
const containers = await this.dockerClient.listContainers();
94-
return containers.filter(container => container.Labels["com.docker.compose.version"] !== undefined);
96+
return containers.filter((container) => container.Labels["com.docker.compose.version"] !== undefined);
9597
}
9698

9799
private getBoundPorts(containerInfo: Dockerode.ContainerInfo): BoundPorts {
98100
const boundPorts = new BoundPorts();
99-
containerInfo.Ports.forEach(port => boundPorts.setBinding(port.PrivatePort, port.PublicPort));
101+
containerInfo.Ports.forEach((port) => boundPorts.setBinding(port.PrivatePort, port.PublicPort));
100102
return boundPorts;
101103
}
102104

src/docker-ignore.ts

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,24 @@ export const findDockerIgnoreFiles = async (context: string): Promise<Set<string
1313
const dockerIgnorePatterns = (await fs.readFile(dockerIgnoreFilePath, { encoding: "utf-8" }))
1414
.toString()
1515
.split("\n")
16-
.map(dockerIgnorePattern => path.resolve(context, dockerIgnorePattern));
16+
.map((dockerIgnorePattern) => path.resolve(context, dockerIgnorePattern));
1717

1818
const dockerIgnoreMatches: string[][] = await Promise.all(
19-
dockerIgnorePatterns.map(
20-
dockerIgnorePattern =>
21-
new Promise((resolve, reject) =>
22-
glob(dockerIgnorePattern, (err, matches) => {
23-
if (err) {
24-
return reject(err);
25-
} else {
26-
resolve(matches);
27-
}
28-
})
29-
)
30-
)
19+
dockerIgnorePatterns.map((dockerIgnorePattern) => {
20+
return new Promise((resolve, reject) =>
21+
glob(dockerIgnorePattern, (err, matches) => {
22+
if (err) {
23+
return reject(err);
24+
} else {
25+
resolve(matches);
26+
}
27+
})
28+
) as Promise<string[]>;
29+
})
3130
);
3231

33-
dockerIgnoreMatches.forEach(dockerIgnoreFileBatch => {
34-
dockerIgnoreFileBatch.forEach(dockerIgnoreFile => dockerIgnoreFiles.add(dockerIgnoreFile));
32+
dockerIgnoreMatches.forEach((dockerIgnoreFileBatch) => {
33+
dockerIgnoreFileBatch.forEach((dockerIgnoreFile) => dockerIgnoreFiles.add(dockerIgnoreFile));
3534
});
3635

3736
return dockerIgnoreFiles;

0 commit comments

Comments
 (0)