@nx/devkit 18.1.2 → 18.1.3

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/devkit",
3
- "version": "18.1.2",
3
+ "version": "18.1.3",
4
4
  "private": false,
5
5
  "description": "The Nx Devkit is used to customize Nx for different technologies and use cases. It contains many utility functions for reading and writing files, updating configuration, working with Abstract Syntax Trees(ASTs), and more. Learn more about [extending Nx by leveraging the Nx Devkit](https://nx.dev/extending-nx/intro/getting-started) on our docs.",
6
6
  "repository": {
@@ -35,7 +35,7 @@
35
35
  "tslib": "^2.3.0",
36
36
  "semver": "^7.5.3",
37
37
  "yargs-parser": "21.1.1",
38
- "@nrwl/devkit": "18.1.2"
38
+ "@nrwl/devkit": "18.1.3"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "nx": ">= 16 <= 18"
@@ -116,9 +116,20 @@ function getNameAndDirectoryOptionFormats(tree, options) {
116
116
  }
117
117
  function getAsProvidedOptions(tree, options) {
118
118
  const relativeCwd = getRelativeCwd();
119
- const asProvidedDirectory = options.directory
120
- ? joinPathFragments(relativeCwd, options.directory)
121
- : relativeCwd;
119
+ let asProvidedDirectory;
120
+ if (options.directory) {
121
+ // append the directory to the current working directory if it doesn't start with it
122
+ if (options.directory === relativeCwd ||
123
+ options.directory.startsWith(`${relativeCwd}/`)) {
124
+ asProvidedDirectory = options.directory;
125
+ }
126
+ else {
127
+ asProvidedDirectory = joinPathFragments(relativeCwd, options.directory);
128
+ }
129
+ }
130
+ else {
131
+ asProvidedDirectory = relativeCwd;
132
+ }
122
133
  const asProvidedProject = findProjectFromPath(tree, asProvidedDirectory);
123
134
  const asProvidedFileName = options.fileName ??
124
135
  (options.suffix ? `${options.name}.${options.suffix}` : options.name);