@nx/docker 0.0.0-pr-31634-cb74636 → 0.0.0-pr-31634-ece4eca

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/README.md CHANGED
@@ -26,6 +26,8 @@ An AI-first build platform that connects everything from your editor to CI. Help
26
26
 
27
27
  This package is a [Docker plugin for Nx](https://nx.dev/nx-api/docker).
28
28
 
29
+ **Experimental**: Support for Docker is currently experimental. Breaking changes may occur and not adhere to semver versioning.
30
+
29
31
  ## Getting Started
30
32
 
31
33
  ### Creating an Nx Workspace
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "Nx Docker",
3
+ "version": "0.1",
4
+ "generators": {
5
+ "init": {
6
+ "factory": "./src/generators/init/init#initGeneratorInternal",
7
+ "schema": "./src/generators/init/schema.json",
8
+ "description": "Initialize the `@nx/docker` plugin. **Experimental**: Docker support is experimental. Breaking changes may occur and not adhere to semver versioning.",
9
+ "aliases": ["ng-add"],
10
+ "hidden": true
11
+ }
12
+ }
13
+ }
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-31634-cb74636",
4
+ "version": "0.0.0-pr-31634-ece4eca",
5
5
  "type": "commonjs",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -37,8 +37,10 @@
37
37
  }
38
38
  },
39
39
  "executors": "./executors.json",
40
+ "generators": "./generators.json",
40
41
  "dependencies": {
41
- "@nx/devkit": "0.0.0-pr-31634-cb74636",
42
+ "@nx/devkit": "0.0.0-pr-31634-ece4eca",
43
+ "enquirer": "~2.3.6",
42
44
  "tslib": "^2.3.0"
43
45
  },
44
46
  "types": "./index.d.ts"
@@ -6,6 +6,7 @@ const child_process_1 = require("child_process");
6
6
  const path_1 = require("path");
7
7
  const fs_1 = require("fs");
8
8
  async function dockerReleasePublish(schema, context) {
9
+ devkit_1.logger.warn(`Docker support is experimental. Breaking changes may occur and not adhere to semver versioning.`);
9
10
  const projectConfig = context.projectGraph.nodes[context.projectName];
10
11
  const options = normalizeOptions(projectConfig, schema);
11
12
  if (!options.dryRun) {
@@ -0,0 +1,6 @@
1
+ import { type Tree, type GeneratorCallback } from '@nx/devkit';
2
+ import { InitGeneratorSchema } from './schema';
3
+ export declare function updateDependencies(tree: Tree, schema: InitGeneratorSchema): GeneratorCallback;
4
+ export declare function initGenerator(tree: Tree, schema: InitGeneratorSchema): Promise<GeneratorCallback>;
5
+ export declare function initGeneratorInternal(tree: Tree, schema: InitGeneratorSchema): Promise<GeneratorCallback>;
6
+ export default initGenerator;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateDependencies = updateDependencies;
4
+ exports.initGenerator = initGenerator;
5
+ exports.initGeneratorInternal = initGeneratorInternal;
6
+ const devkit_1 = require("@nx/devkit");
7
+ const add_plugin_1 = require("@nx/devkit/src/utils/add-plugin");
8
+ const plugin_1 = require("../../plugins/plugin");
9
+ const versions_1 = require("../../utils/versions");
10
+ function updateDependencies(tree, schema) {
11
+ return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
12
+ '@nx/docker': versions_1.nxVersion,
13
+ }, undefined, schema.keepExistingVersions);
14
+ }
15
+ function initGenerator(tree, schema) {
16
+ return initGeneratorInternal(tree, { addPlugin: false, ...schema });
17
+ }
18
+ async function initGeneratorInternal(tree, schema) {
19
+ devkit_1.logger.warn(`Docker support is experimental. Breaking changes may occur and not adhere to semver versioning.`);
20
+ const nxJson = (0, devkit_1.readNxJson)(tree);
21
+ const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
22
+ nxJson.useInferencePlugins !== false;
23
+ schema.addPlugin ??= addPluginDefault;
24
+ if (schema.addPlugin) {
25
+ await (0, add_plugin_1.addPlugin)(tree, await (0, devkit_1.createProjectGraphAsync)(), '@nx/docker', plugin_1.createNodesV2, {
26
+ buildTarget: ['docker:build', 'docker-build', 'build-docker'],
27
+ runTarget: ['docker:run', 'docker-run', 'run-docker'],
28
+ }, schema.updatePackageScripts);
29
+ }
30
+ const tasks = [];
31
+ if (!schema.skipPackageJson) {
32
+ tasks.push(updateDependencies(tree, schema));
33
+ }
34
+ if (!schema.skipFormat) {
35
+ await (0, devkit_1.formatFiles)(tree);
36
+ }
37
+ return (0, devkit_1.runTasksInSerial)(...tasks);
38
+ }
39
+ exports.default = initGenerator;
@@ -0,0 +1,8 @@
1
+ export interface InitGeneratorSchema {
2
+ rootProject?: boolean;
3
+ keepExistingVersions?: boolean;
4
+ updatePackageScripts?: boolean;
5
+ skipFormat?: boolean;
6
+ skipPackageJson?: boolean;
7
+ addPlugin?: boolean;
8
+ }
@@ -0,0 +1,41 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "Init",
4
+ "title": "Nx Docker Init Generator",
5
+ "type": "object",
6
+ "description": "Docker init generator.",
7
+ "properties": {
8
+ "rootProject": {
9
+ "type": "boolean",
10
+ "x-priority": "internal"
11
+ },
12
+ "keepExistingVersions": {
13
+ "type": "boolean",
14
+ "x-priority": "internal",
15
+ "description": "Keep existing dependencies versions",
16
+ "default": false
17
+ },
18
+ "updatePackageScripts": {
19
+ "type": "boolean",
20
+ "x-priority": "internal",
21
+ "description": "Update package scripts",
22
+ "default": false
23
+ },
24
+ "skipFormat": {
25
+ "description": "Skip formatting files.",
26
+ "type": "boolean",
27
+ "default": false
28
+ },
29
+ "skipPackageJson": {
30
+ "description": "Do not add dependencies to `package.json`.",
31
+ "type": "boolean",
32
+ "default": false
33
+ },
34
+ "addPlugin": {
35
+ "type": "boolean",
36
+ "description": "Add the plugin to the nx.json file.",
37
+ "default": true
38
+ }
39
+ },
40
+ "required": []
41
+ }
@@ -51,7 +51,7 @@ function updateProjectVersion(newVersion, projectRoot, repositoryName, registry)
51
51
  if (!isDryRun) {
52
52
  (0, child_process_1.execSync)(`docker tag ${imageRef} ${fullImageRef}`);
53
53
  }
54
- const logs = [`Image ${imageRef} tagged with ${fullImageRef}.`];
54
+ const logs = [`Image tagged with ${fullImageRef}.`];
55
55
  if (isDryRun) {
56
56
  logs.push(`No changes were applied as --dry-run is enabled.`);
57
57
  }
@@ -0,0 +1 @@
1
+ export declare const nxVersion: any;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.nxVersion = void 0;
4
+ exports.nxVersion = require('../../../package.json').version;