create-nx-workspace 19.0.2 → 19.0.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/package.json
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.recordStat = exports.messages = exports.PromptMessages = exports.NxCloudChoices = void 0;
|
|
4
|
+
const node_child_process_1 = require("node:child_process");
|
|
4
5
|
const is_ci_1 = require("../ci/is-ci");
|
|
6
|
+
const package_manager_1 = require("../package-manager");
|
|
5
7
|
exports.NxCloudChoices = ['yes', 'github', 'circleci', 'skip'];
|
|
6
8
|
const messageOptions = {
|
|
7
9
|
setupCI: [
|
|
@@ -81,12 +83,9 @@ exports.messages = new PromptMessages();
|
|
|
81
83
|
*/
|
|
82
84
|
async function recordStat(opts) {
|
|
83
85
|
try {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
console.log(`Record stat. Major: ${major}`);
|
|
86
|
+
if (!shouldRecordStats()) {
|
|
87
|
+
return;
|
|
87
88
|
}
|
|
88
|
-
if (major < 10 || major > 19)
|
|
89
|
-
return; // test version, skip it
|
|
90
89
|
const axios = require('axios');
|
|
91
90
|
await (axios['default'] ?? axios)
|
|
92
91
|
.create({
|
|
@@ -107,3 +106,16 @@ async function recordStat(opts) {
|
|
|
107
106
|
}
|
|
108
107
|
}
|
|
109
108
|
exports.recordStat = recordStat;
|
|
109
|
+
function shouldRecordStats() {
|
|
110
|
+
const pmc = (0, package_manager_1.getPackageManagerCommand)();
|
|
111
|
+
try {
|
|
112
|
+
const stdout = (0, node_child_process_1.execSync)(pmc.getRegistryUrl, { encoding: 'utf-8' });
|
|
113
|
+
const url = new URL(stdout.trim());
|
|
114
|
+
// don't record stats when testing locally
|
|
115
|
+
return url.hostname !== 'localhost';
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
// fallback to true if we can't detect the registry
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -18,6 +18,7 @@ export declare function getPackageManagerCommand(packageManager?: PackageManager
|
|
|
18
18
|
exec: string;
|
|
19
19
|
preInstall?: string;
|
|
20
20
|
globalAdd: string;
|
|
21
|
+
getRegistryUrl: string;
|
|
21
22
|
};
|
|
22
23
|
export declare function generatePackageManagerFiles(root: string, packageManager?: PackageManager): void;
|
|
23
24
|
export declare function getPackageManagerVersion(packageManager: PackageManager, cwd?: string): string;
|
|
@@ -44,6 +44,9 @@ function getPackageManagerCommand(packageManager = detectPackageManager()) {
|
|
|
44
44
|
// using npx is necessary to avoid yarn classic manipulating the version detection when using berry
|
|
45
45
|
exec: useBerry ? 'npx' : 'yarn',
|
|
46
46
|
globalAdd: 'yarn global add',
|
|
47
|
+
getRegistryUrl: useBerry
|
|
48
|
+
? 'yarn config get npmRegistryServer'
|
|
49
|
+
: 'yarn config get registry',
|
|
47
50
|
};
|
|
48
51
|
case 'pnpm':
|
|
49
52
|
let useExec = false;
|
|
@@ -54,12 +57,14 @@ function getPackageManagerCommand(packageManager = detectPackageManager()) {
|
|
|
54
57
|
install: 'pnpm install --no-frozen-lockfile --silent --ignore-scripts',
|
|
55
58
|
exec: useExec ? 'pnpm exec' : 'pnpx',
|
|
56
59
|
globalAdd: 'pnpm add -g',
|
|
60
|
+
getRegistryUrl: 'pnpm config get registry',
|
|
57
61
|
};
|
|
58
62
|
case 'npm':
|
|
59
63
|
return {
|
|
60
64
|
install: 'npm install --silent --ignore-scripts',
|
|
61
65
|
exec: 'npx',
|
|
62
66
|
globalAdd: 'npm i -g',
|
|
67
|
+
getRegistryUrl: 'npm config get registry',
|
|
63
68
|
};
|
|
64
69
|
}
|
|
65
70
|
}
|