@nx/docker 0.0.0-pr-32149-2d2cbf3 → 0.0.0-pr-32117-d66fe0d

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nx/docker",
3
3
  "description": "The Nx Plugin for Docker to aid in containerizing projects.",
4
- "version": "0.0.0-pr-32149-2d2cbf3",
4
+ "version": "0.0.0-pr-32117-d66fe0d",
5
5
  "type": "commonjs",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -43,12 +43,12 @@
43
43
  "executors": "./executors.json",
44
44
  "generators": "./generators.json",
45
45
  "dependencies": {
46
- "@nx/devkit": "0.0.0-pr-32149-2d2cbf3",
46
+ "@nx/devkit": "0.0.0-pr-32117-d66fe0d",
47
47
  "enquirer": "~2.3.6",
48
48
  "tslib": "^2.3.0"
49
49
  },
50
50
  "devDependencies": {
51
- "nx": "0.0.0-pr-32149-2d2cbf3"
51
+ "nx": "0.0.0-pr-32117-d66fe0d"
52
52
  },
53
53
  "types": "./src/index.d.ts"
54
54
  }
@@ -1 +1 @@
1
- {"version":3,"file":"release-publish.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/docker/src/executors/release-publish/release-publish.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,eAAe,EAIrB,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AAI3D,MAAM,WAAW,oCAAoC;IACnD,KAAK,EAAE,OAAO,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,eAAO,MAAM,YAAY,QAAiB,CAAC;AAE3C,wBAA8B,oBAAoB,CAChD,MAAM,EAAE,0BAA0B,EAClC,OAAO,EAAE,eAAe;;GAmBzB"}
1
+ {"version":3,"file":"release-publish.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/docker/src/executors/release-publish/release-publish.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,eAAe,EAIrB,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AAI3D,MAAM,WAAW,oCAAoC;IACnD,KAAK,EAAE,OAAO,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,eAAO,MAAM,YAAY,QAAiB,CAAC;AAE3C,wBAA8B,oBAAoB,CAChD,MAAM,EAAE,0BAA0B,EAClC,OAAO,EAAE,eAAe;;GAiBzB"}
@@ -9,10 +9,10 @@ const version_utils_1 = require("../../release/version-utils");
9
9
  exports.LARGE_BUFFER = 1024 * 1000000;
10
10
  async function dockerReleasePublish(schema, context) {
11
11
  const projectConfig = context.projectGraph.nodes[context.projectName];
12
- const options = await normalizeOptions(projectConfig, schema);
12
+ const options = normalizeOptions(projectConfig, schema);
13
13
  if (!options.dryRun) {
14
- const digest = await dockerPush(options.imageReference, options.quiet);
15
- devkit_1.logger.log(`Successfully pushed ${options.imageReference}. ${options.quiet && `Digest: ${digest}`}`);
14
+ const digest = dockerPush(options.imageReference, options.quiet);
15
+ devkit_1.logger.log(`Successfully pushed ${options.imageReference}. Digest: ${digest}`);
16
16
  }
17
17
  else {
18
18
  devkit_1.logger.log(`Docker Image ${options.imageReference} was not pushed as --dry-run is enabled.`);
@@ -21,17 +21,17 @@ async function dockerReleasePublish(schema, context) {
21
21
  success: true,
22
22
  };
23
23
  }
24
- async function normalizeOptions(projectConfig, schema) {
24
+ function normalizeOptions(projectConfig, schema) {
25
25
  return {
26
26
  quiet: schema.quiet ?? false,
27
- imageReference: await findImageReference(projectConfig, schema),
27
+ imageReference: findImageReference(projectConfig, schema),
28
28
  dryRun: process.env.NX_DRY_RUN === 'true' || schema.dryRun || false,
29
29
  };
30
30
  }
31
- async function findImageReference(projectConfig, schema) {
31
+ function findImageReference(projectConfig, schema) {
32
32
  let imageRef = readVersionFromFile(projectConfig.data.root);
33
33
  if (imageRef) {
34
- if (await checkDockerImageExistsLocally(imageRef)) {
34
+ if (checkDockerImageExistsLocally(imageRef)) {
35
35
  return imageRef;
36
36
  }
37
37
  throw new Error(`Could not find Docker Image ${imageRef}. Did you run 'nx release version'?`);
@@ -45,47 +45,21 @@ function readVersionFromFile(projectRoot) {
45
45
  const version = (0, fs_1.readFileSync)(versionFilePath, { encoding: 'utf8' });
46
46
  return version.trim();
47
47
  }
48
- async function checkDockerImageExistsLocally(imageRef) {
48
+ function checkDockerImageExistsLocally(imageRef) {
49
49
  try {
50
- return await new Promise((res) => {
51
- const childProcess = (0, child_process_1.exec)(`docker images --filter "reference=${imageRef}" --quiet`, { encoding: 'utf8' });
52
- let result = '';
53
- childProcess.stdout?.on('data', (data) => {
54
- result += data;
55
- });
56
- childProcess.stderr?.on('data', (data) => {
57
- console.error(data);
58
- });
59
- childProcess.on('exit', () => {
60
- res(result.trim().length > 0);
61
- });
62
- });
50
+ const result = (0, child_process_1.execSync)(`docker images --filter "reference=${imageRef}" --quiet`, { encoding: 'utf8', stdio: 'inherit', maxBuffer: exports.LARGE_BUFFER });
51
+ return result.trim().length > 0;
63
52
  }
64
53
  catch {
65
54
  return false;
66
55
  }
67
56
  }
68
- async function dockerPush(imageReference, quiet) {
57
+ function dockerPush(imageReference, quiet) {
69
58
  try {
70
- return await new Promise((res) => {
71
- const childProcess = (0, child_process_1.exec)(`docker push ${imageReference}${quiet ? ' --quiet' : ''}`, {
72
- encoding: 'utf8',
73
- maxBuffer: exports.LARGE_BUFFER,
74
- });
75
- let result = '';
76
- childProcess.stdout?.on('data', (data) => {
77
- result += data;
78
- if (!quiet) {
79
- console.log(data);
80
- }
81
- });
82
- childProcess.stderr?.on('data', (data) => {
83
- console.error(data);
84
- });
85
- childProcess.on('exit', () => {
86
- res(result.trim());
87
- });
59
+ const result = (0, child_process_1.execSync)(`docker push ${imageReference}${quiet ? ' --quiet' : ''}`, {
60
+ encoding: 'utf8',
88
61
  });
62
+ return result.trim();
89
63
  }
90
64
  catch (e) {
91
65
  devkit_1.logger.error(`Failed to push ${imageReference}`);