nx 23.0.0-beta.16 → 23.0.0-beta.17

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.
@@ -34,10 +34,15 @@ async function format(command, args) {
34
34
  process.exit(1);
35
35
  }
36
36
  const { nxArgs } = (0, command_line_utils_1.splitArgsIntoNxArgsAndOverrides)(args, 'affected', { printWarnings: false }, (0, configuration_1.readNxJson)());
37
- const patterns = (await getPatterns(prettier, { ...args, ...nxArgs })).map(
38
- // prettier removes one of the \
39
- // prettier-ignore
40
- (p) => `"${p.replace(/\$/g, '\\\$')}"`);
37
+ const patterns = (await getPatterns(prettier, { ...args, ...nxArgs })).map((p) => {
38
+ // On non-Windows, escape $ to prevent shell variable interpolation
39
+ // (the shell consumes one \, so \\$ becomes \$ which the shell treats as literal $)
40
+ // On Windows (cmd.exe), $ is not a special character, so escaping it would
41
+ // cause prettier to look for a file with a literal \$ in the name
42
+ // prettier-ignore
43
+ const escaped = process.platform !== 'win32' ? p.replace(/\$/g, '\\\$') : p;
44
+ return `"${escaped}"`;
45
+ });
41
46
  // Chunkify the patterns array to prevent crashing the windows terminal
42
47
  const chunkList = (0, chunkify_1.chunkify)(patterns);
43
48
  switch (command) {
@@ -204,7 +209,12 @@ function getPrettierPath() {
204
209
  return prettierPath;
205
210
  }
206
211
  const { packageJson, path: packageJsonPath } = (0, package_json_1.readModulePackageJson)('prettier');
207
- prettierPath = path.resolve(path.dirname(packageJsonPath), packageJson.bin);
212
+ const bin = packageJson.bin;
213
+ const binPath = typeof bin === 'string' ? bin : bin?.['prettier'];
214
+ if (!binPath) {
215
+ throw new Error(`Could not find prettier binary in ${packageJsonPath}`);
216
+ }
217
+ prettierPath = path.resolve(path.dirname(packageJsonPath), binPath);
208
218
  return prettierPath;
209
219
  }
210
220
  let useListDifferent;
@@ -383,7 +383,6 @@ function findRegisteredPluginsBeingUsed(nxJson) {
383
383
  }
384
384
  function findInstalledPackagesWeCareAbout() {
385
385
  const packagesWeMayCareAbout = {};
386
- // TODO (v20): Remove workaround for hiding @nrwl packages when matching @nx package is found.
387
386
  for (const pkg of exports.packagesWeCareAbout) {
388
387
  const v = readPackageVersion(pkg);
389
388
  if (v) {
@@ -8,6 +8,7 @@ const path_1 = require("path");
8
8
  const resolve_exports_1 = require("resolve.exports");
9
9
  const register_1 = require("../plugins/js/utils/register");
10
10
  const packages_1 = require("../plugins/js/utils/packages");
11
+ const typescript_1 = require("../plugins/js/utils/typescript");
11
12
  const path_2 = require("../utils/path");
12
13
  /**
13
14
  * This function is used to get the implementation factory of an executor or generator.
@@ -96,7 +97,7 @@ function tryResolveFromSource(path, directory, packageName, projects) {
96
97
  const fromExports = (0, resolve_exports_1.resolve)({
97
98
  name: localProject.metadata.js.packageName,
98
99
  exports: localProject.metadata.js.packageExports,
99
- }, path, { conditions: ['development'] });
100
+ }, path, { conditions: (0, typescript_1.getRootTsConfigResolveExportsConditions)() });
100
101
  if (fromExports && fromExports.length) {
101
102
  for (const exportPath of fromExports) {
102
103
  if ((0, fs_1.existsSync)((0, path_1.join)(directory, exportPath))) {