create-nx-workspace 19.1.0-beta.0 → 19.1.0-beta.2

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": "create-nx-workspace",
3
- "version": "19.1.0-beta.0",
3
+ "version": "19.1.0-beta.2",
4
4
  "private": false,
5
5
  "description": "Smart Monorepos · Fast CI",
6
6
  "repository": {
@@ -95,6 +95,7 @@ async function determinePackageManager(parsedArgs) {
95
95
  { name: 'npm', message: 'NPM' },
96
96
  { name: 'yarn', message: 'Yarn' },
97
97
  { name: 'pnpm', message: 'PNPM' },
98
+ { name: 'bun', message: 'Bun' },
98
99
  ],
99
100
  },
100
101
  ])
@@ -108,6 +108,11 @@ async function recordStat(opts) {
108
108
  exports.recordStat = recordStat;
109
109
  function shouldRecordStats() {
110
110
  const pmc = (0, package_manager_1.getPackageManagerCommand)();
111
+ if (!pmc.getRegistryUrl) {
112
+ // Fallback on true as Package management doesn't support reading config for registry.
113
+ // currently Bun doesn't support fetching config settings https://github.com/oven-sh/bun/issues/7140
114
+ return true;
115
+ }
111
116
  try {
112
117
  const stdout = (0, node_child_process_1.execSync)(pmc.getRegistryUrl, { encoding: 'utf-8' });
113
118
  const url = new URL(stdout.trim());
@@ -1,4 +1,4 @@
1
- export declare const packageManagerList: readonly ["pnpm", "yarn", "npm"];
1
+ export declare const packageManagerList: readonly ["pnpm", "yarn", "npm", "bun"];
2
2
  export type PackageManager = typeof packageManagerList[number];
3
3
  export declare function detectPackageManager(dir?: string): PackageManager;
4
4
  /**
@@ -18,7 +18,7 @@ export declare function getPackageManagerCommand(packageManager?: PackageManager
18
18
  exec: string;
19
19
  preInstall?: string;
20
20
  globalAdd: string;
21
- getRegistryUrl: string;
21
+ getRegistryUrl?: string;
22
22
  };
23
23
  export declare function generatePackageManagerFiles(root: string, packageManager?: PackageManager): void;
24
24
  export declare function getPackageManagerVersion(packageManager: PackageManager, cwd?: string): string;
@@ -8,13 +8,15 @@ const path_1 = require("path");
8
8
  * Because we don't want to depend on @nx/workspace (to speed up the workspace creation)
9
9
  * we duplicate the helper functions from @nx/workspace in this file.
10
10
  */
11
- exports.packageManagerList = ['pnpm', 'yarn', 'npm'];
11
+ exports.packageManagerList = ['pnpm', 'yarn', 'npm', 'bun'];
12
12
  function detectPackageManager(dir = '') {
13
- return (0, fs_1.existsSync)((0, path_1.join)(dir, 'yarn.lock'))
14
- ? 'yarn'
15
- : (0, fs_1.existsSync)((0, path_1.join)(dir, 'pnpm-lock.yaml'))
16
- ? 'pnpm'
17
- : 'npm';
13
+ return (0, fs_1.existsSync)((0, path_1.join)(dir, 'bun.lockb'))
14
+ ? 'bun'
15
+ : (0, fs_1.existsSync)((0, path_1.join)(dir, 'yarn.lock'))
16
+ ? 'yarn'
17
+ : (0, fs_1.existsSync)((0, path_1.join)(dir, 'pnpm-lock.yaml'))
18
+ ? 'pnpm'
19
+ : 'npm';
18
20
  }
19
21
  exports.detectPackageManager = detectPackageManager;
20
22
  /**
@@ -66,6 +68,13 @@ function getPackageManagerCommand(packageManager = detectPackageManager()) {
66
68
  globalAdd: 'npm i -g',
67
69
  getRegistryUrl: 'npm config get registry',
68
70
  };
71
+ case 'bun':
72
+ // bun doesn't current support programatically reading config https://github.com/oven-sh/bun/issues/7140
73
+ return {
74
+ install: 'bun install --silent --ignore-scripts',
75
+ exec: 'bunx',
76
+ globalAdd: 'bun install -g',
77
+ };
69
78
  }
70
79
  }
71
80
  exports.getPackageManagerCommand = getPackageManagerCommand;