@nx/docker 22.1.0-rc.2 → 22.1.0-rc.4
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 +70 -0
- package/package.json +3 -3
- package/src/plugins/plugin.d.ts +11 -0
- package/src/plugins/plugin.d.ts.map +1 -1
- package/src/plugins/plugin.js +13 -3
package/README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<p style="text-align: center;">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-dark.svg">
|
|
4
|
+
<img alt="Nx - Smart Repos · Fast Builds" src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-light.svg" width="100%">
|
|
5
|
+
</picture>
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
<div style="text-align: center;">
|
|
9
|
+
|
|
10
|
+
[](https://circleci.com/gh/nrwl/nx)
|
|
11
|
+
[]()
|
|
12
|
+
[](https://www.npmjs.com/package/nx)
|
|
13
|
+
[]()
|
|
14
|
+
[](http://commitizen.github.io/cz-cli/)
|
|
15
|
+
[](https://gitter.im/nrwl-nx/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
|
16
|
+
[](https://go.nx.dev/community)
|
|
17
|
+
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
<hr>
|
|
22
|
+
|
|
23
|
+
# Nx: Smart Repos · Fast Builds
|
|
24
|
+
|
|
25
|
+
Get to green PRs in half the time. Nx optimizes your builds, scales your CI, and fixes failed PRs. Built for developers and AI agents.
|
|
26
|
+
|
|
27
|
+
This package is a [Docker plugin for Nx](https://nx.dev/technologies/build-tools/docker/introduction).
|
|
28
|
+
|
|
29
|
+
**Experimental**: Support for Docker is currently experimental. Breaking changes may occur and not adhere to semver versioning.
|
|
30
|
+
|
|
31
|
+
## Getting Started
|
|
32
|
+
|
|
33
|
+
### Creating an Nx Workspace
|
|
34
|
+
|
|
35
|
+
**Using `npx`**
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npx create-nx-workspace
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Using `npm init`**
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm init nx-workspace
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Using `yarn create`**
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
yarn create nx-workspace
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Adding Nx to an Existing Repository
|
|
54
|
+
|
|
55
|
+
Run:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npx nx@latest init
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Documentation & Resources
|
|
62
|
+
|
|
63
|
+
- [Nx.Dev: Documentation, Guides, Tutorials](https://nx.dev)
|
|
64
|
+
- [Intro to Nx](https://nx.dev/getting-started/intro)
|
|
65
|
+
- [Official Nx YouTube Channel](https://www.youtube.com/@NxDevtools)
|
|
66
|
+
- [Blog Posts About Nx](https://nx.dev/blog)
|
|
67
|
+
|
|
68
|
+
<p style="text-align: center;"><a href="https://nx.dev/#learning-materials" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-courses-and-videos.svg"
|
|
69
|
+
width="100%" alt="Nx - Smart Repos · Fast Builds"></a></p>
|
|
70
|
+
|
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": "22.1.0-rc.
|
|
4
|
+
"version": "22.1.0-rc.4",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -51,12 +51,12 @@
|
|
|
51
51
|
"executors": "./executors.json",
|
|
52
52
|
"generators": "./generators.json",
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@nx/devkit": "22.1.0-rc.
|
|
54
|
+
"@nx/devkit": "22.1.0-rc.4",
|
|
55
55
|
"enquirer": "~2.3.6",
|
|
56
56
|
"tslib": "^2.3.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"nx": "22.1.0-rc.
|
|
59
|
+
"nx": "22.1.0-rc.4"
|
|
60
60
|
},
|
|
61
61
|
"types": "./src/index.d.ts"
|
|
62
62
|
}
|
package/src/plugins/plugin.d.ts
CHANGED
|
@@ -5,6 +5,17 @@ export interface DockerTargetOptions {
|
|
|
5
5
|
env?: Record<string, string>;
|
|
6
6
|
envFile?: string;
|
|
7
7
|
cwd?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Skip adding the default `--tag` argument to the Docker build command.
|
|
10
|
+
* When set to `true`, you must provide your own tag via the `args` property.
|
|
11
|
+
*
|
|
12
|
+
* **Important:** Setting this to `true` opts out of Nx Release support for this project.
|
|
13
|
+
* The automatic versioning and publishing features of `nx release` will not work
|
|
14
|
+
* with Docker projects that have `skipDefaultTag` enabled.
|
|
15
|
+
*
|
|
16
|
+
* @default false
|
|
17
|
+
*/
|
|
18
|
+
skipDefaultTag?: boolean;
|
|
8
19
|
configurations?: Record<string, Omit<DockerTargetOptions, 'configurations' | 'name'>>;
|
|
9
20
|
}
|
|
10
21
|
export interface DockerPluginOptions {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/docker/src/plugins/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAQnB,MAAM,YAAY,CAAC;AAUpB,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,OAAO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DF,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,GACpB,MAAM,CAOR"}
|
package/src/plugins/plugin.js
CHANGED
|
@@ -99,8 +99,13 @@ function buildTargetOptions(interpolatedTarget, projectRoot, imageRef, isRunTarg
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
else {
|
|
102
|
-
// Build target
|
|
103
|
-
|
|
102
|
+
// Build target includes --tag default unless skipDefaultTag is true
|
|
103
|
+
if (interpolatedTarget.skipDefaultTag) {
|
|
104
|
+
options.args = interpolatedTarget.args ?? [];
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
options.args = [`--tag ${imageRef}`, ...(interpolatedTarget.args ?? [])];
|
|
108
|
+
}
|
|
104
109
|
}
|
|
105
110
|
if (interpolatedTarget.env) {
|
|
106
111
|
options.env = interpolatedTarget.env;
|
|
@@ -117,7 +122,12 @@ function buildTargetConfigurations(interpolatedTarget, projectRoot, imageRef, is
|
|
|
117
122
|
const configurations = {};
|
|
118
123
|
for (const [configName, configOptions] of Object.entries(interpolatedTarget.configurations)) {
|
|
119
124
|
// Each configuration gets the full treatment with defaults
|
|
120
|
-
|
|
125
|
+
// Inherit skipDefaultTag from parent if not explicitly set in config
|
|
126
|
+
configurations[configName] = buildTargetOptions({
|
|
127
|
+
...configOptions,
|
|
128
|
+
name: interpolatedTarget.name,
|
|
129
|
+
skipDefaultTag: configOptions.skipDefaultTag ?? interpolatedTarget.skipDefaultTag,
|
|
130
|
+
}, projectRoot, imageRef, isRunTarget);
|
|
121
131
|
}
|
|
122
132
|
return configurations;
|
|
123
133
|
}
|