@react-native-windows/telemetry 0.73.1 → 0.74.0-preview.1
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/lib-commonjs/e2etest/telemetry.test.d.ts +28 -28
- package/lib-commonjs/e2etest/telemetry.test.js +496 -496
- package/lib-commonjs/index.d.ts +11 -11
- package/lib-commonjs/index.js +26 -26
- package/lib-commonjs/telemetry.d.ts +84 -84
- package/lib-commonjs/telemetry.js +370 -370
- package/lib-commonjs/telemetry.js.map +1 -1
- package/lib-commonjs/test/basePropUtils.test.d.ts +7 -7
- package/lib-commonjs/test/basePropUtils.test.js +137 -137
- package/lib-commonjs/test/errorUtils.test.d.ts +7 -7
- package/lib-commonjs/test/errorUtils.test.js +159 -159
- package/lib-commonjs/test/projectUtils.test.d.ts +7 -7
- package/lib-commonjs/test/projectUtils.test.js +87 -87
- package/lib-commonjs/test/sanitizeUtils.test.d.ts +7 -7
- package/lib-commonjs/test/sanitizeUtils.test.js +97 -97
- package/lib-commonjs/test/versionUtils.test.d.ts +7 -7
- package/lib-commonjs/test/versionUtils.test.js +114 -114
- package/lib-commonjs/utils/basePropUtils.d.ts +81 -81
- package/lib-commonjs/utils/basePropUtils.js +173 -173
- package/lib-commonjs/utils/errorUtils.d.ts +87 -87
- package/lib-commonjs/utils/errorUtils.js +178 -178
- package/lib-commonjs/utils/optionUtils.d.ts +45 -45
- package/lib-commonjs/utils/optionUtils.js +95 -95
- package/lib-commonjs/utils/projectUtils.d.ts +50 -50
- package/lib-commonjs/utils/projectUtils.js +186 -186
- package/lib-commonjs/utils/sanitizeUtils.d.ts +12 -12
- package/lib-commonjs/utils/sanitizeUtils.js +81 -81
- package/lib-commonjs/utils/versionUtils.d.ts +38 -38
- package/lib-commonjs/utils/versionUtils.js +155 -155
- package/package.json +14 -16
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Microsoft Corporation.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
* @format
|
|
5
|
-
*/
|
|
6
|
-
interface ProjectInfo {
|
|
7
|
-
id: string | null;
|
|
8
|
-
platforms: Array<string>;
|
|
9
|
-
rnwLang: 'cpp' | 'cs' | 'cpp+cs' | null;
|
|
10
|
-
}
|
|
11
|
-
export interface DependencyProjectInfo extends ProjectInfo {
|
|
12
|
-
}
|
|
13
|
-
export interface AppProjectInfo extends ProjectInfo {
|
|
14
|
-
usesTS: boolean;
|
|
15
|
-
usesRNConfig: boolean;
|
|
16
|
-
jsEngine: string;
|
|
17
|
-
rnwSource: string;
|
|
18
|
-
dependencies: Array<DependencyProjectInfo>;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Gets a unique, telemetry-safe project ID based on the project name.
|
|
22
|
-
* @param projectName The project name.
|
|
23
|
-
* @returns The telemetry-safe project ID.
|
|
24
|
-
*/
|
|
25
|
-
export declare function getProjectId(projectName: string): string;
|
|
26
|
-
/**
|
|
27
|
-
* Gets whether the project at the given path has a react-native.config.js file.
|
|
28
|
-
* @param projectRoot The project root path to look in.
|
|
29
|
-
* @returns Whether the project at the given path has a react-native.config.js file.
|
|
30
|
-
*/
|
|
31
|
-
export declare function usesReactNativeConfig(projectRoot: string): Promise<boolean>;
|
|
32
|
-
/**
|
|
33
|
-
* Gets whether the project at the given path is using TypeScript.
|
|
34
|
-
* @param projectRoot The project root path to look in.
|
|
35
|
-
* @returns Whether the project at the given path is using TypeScript.
|
|
36
|
-
*/
|
|
37
|
-
export declare function usesTypeScript(projectRoot: string): Promise<boolean>;
|
|
38
|
-
/**
|
|
39
|
-
* Calculate the project telemetry info from a react-native CLI config.
|
|
40
|
-
* @param config Config passed from react-native CLI.
|
|
41
|
-
* @returns The calculated project info.
|
|
42
|
-
*/
|
|
43
|
-
export declare function configToProjectInfo(config: Record<string, any>): Promise<AppProjectInfo | DependencyProjectInfo | null>;
|
|
44
|
-
/**
|
|
45
|
-
* Gets the full path to the app's native project file from a react-native CLI config.
|
|
46
|
-
* @param config Config passed from react-native CLI.
|
|
47
|
-
* @returns The full path to the app's native project file
|
|
48
|
-
*/
|
|
49
|
-
export declare function getProjectFileFromConfig(config: Record<string, any>): string | null;
|
|
50
|
-
export {};
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
* @format
|
|
5
|
+
*/
|
|
6
|
+
interface ProjectInfo {
|
|
7
|
+
id: string | null;
|
|
8
|
+
platforms: Array<string>;
|
|
9
|
+
rnwLang: 'cpp' | 'cs' | 'cpp+cs' | null;
|
|
10
|
+
}
|
|
11
|
+
export interface DependencyProjectInfo extends ProjectInfo {
|
|
12
|
+
}
|
|
13
|
+
export interface AppProjectInfo extends ProjectInfo {
|
|
14
|
+
usesTS: boolean;
|
|
15
|
+
usesRNConfig: boolean;
|
|
16
|
+
jsEngine: string;
|
|
17
|
+
rnwSource: string;
|
|
18
|
+
dependencies: Array<DependencyProjectInfo>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Gets a unique, telemetry-safe project ID based on the project name.
|
|
22
|
+
* @param projectName The project name.
|
|
23
|
+
* @returns The telemetry-safe project ID.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getProjectId(projectName: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Gets whether the project at the given path has a react-native.config.js file.
|
|
28
|
+
* @param projectRoot The project root path to look in.
|
|
29
|
+
* @returns Whether the project at the given path has a react-native.config.js file.
|
|
30
|
+
*/
|
|
31
|
+
export declare function usesReactNativeConfig(projectRoot: string): Promise<boolean>;
|
|
32
|
+
/**
|
|
33
|
+
* Gets whether the project at the given path is using TypeScript.
|
|
34
|
+
* @param projectRoot The project root path to look in.
|
|
35
|
+
* @returns Whether the project at the given path is using TypeScript.
|
|
36
|
+
*/
|
|
37
|
+
export declare function usesTypeScript(projectRoot: string): Promise<boolean>;
|
|
38
|
+
/**
|
|
39
|
+
* Calculate the project telemetry info from a react-native CLI config.
|
|
40
|
+
* @param config Config passed from react-native CLI.
|
|
41
|
+
* @returns The calculated project info.
|
|
42
|
+
*/
|
|
43
|
+
export declare function configToProjectInfo(config: Record<string, any>): Promise<AppProjectInfo | DependencyProjectInfo | null>;
|
|
44
|
+
/**
|
|
45
|
+
* Gets the full path to the app's native project file from a react-native CLI config.
|
|
46
|
+
* @param config Config passed from react-native CLI.
|
|
47
|
+
* @returns The full path to the app's native project file
|
|
48
|
+
*/
|
|
49
|
+
export declare function getProjectFileFromConfig(config: Record<string, any>): string | null;
|
|
50
|
+
export {};
|
|
@@ -1,187 +1,187 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) Microsoft Corporation.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
* @format
|
|
6
|
-
*/
|
|
7
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
|
-
};
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.getProjectFileFromConfig = exports.configToProjectInfo = exports.usesTypeScript = exports.usesReactNativeConfig = exports.getProjectId = void 0;
|
|
12
|
-
const crypto_1 = require("crypto");
|
|
13
|
-
const fs_1 = __importDefault(require("@react-native-windows/fs"));
|
|
14
|
-
const path_1 = __importDefault(require("path"));
|
|
15
|
-
/**
|
|
16
|
-
* Gets a unique, telemetry-safe project ID based on the project name.
|
|
17
|
-
* @param projectName The project name.
|
|
18
|
-
* @returns The telemetry-safe project ID.
|
|
19
|
-
*/
|
|
20
|
-
function getProjectId(projectName) {
|
|
21
|
-
const hash = (0, crypto_1.createHash)('sha256');
|
|
22
|
-
hash.update(projectName);
|
|
23
|
-
return hash.digest('hex');
|
|
24
|
-
}
|
|
25
|
-
exports.getProjectId = getProjectId;
|
|
26
|
-
/**
|
|
27
|
-
* Checks that a given file exits in the path specified.
|
|
28
|
-
* @param fileName The file to check for.
|
|
29
|
-
* @param projectRoot The root path to look in.
|
|
30
|
-
* @returns Whether the file exists.
|
|
31
|
-
*/
|
|
32
|
-
async function fileExists(fileName, projectRoot) {
|
|
33
|
-
try {
|
|
34
|
-
const reactNativeConfigPath = path_1.default.resolve(projectRoot, fileName);
|
|
35
|
-
const stats = await fs_1.default.stat(reactNativeConfigPath);
|
|
36
|
-
return stats.isFile();
|
|
37
|
-
}
|
|
38
|
-
catch (_a) { }
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Gets whether the project at the given path has a react-native.config.js file.
|
|
43
|
-
* @param projectRoot The project root path to look in.
|
|
44
|
-
* @returns Whether the project at the given path has a react-native.config.js file.
|
|
45
|
-
*/
|
|
46
|
-
async function usesReactNativeConfig(projectRoot) {
|
|
47
|
-
return fileExists('./react-native.config.js', projectRoot);
|
|
48
|
-
}
|
|
49
|
-
exports.usesReactNativeConfig = usesReactNativeConfig;
|
|
50
|
-
/**
|
|
51
|
-
* Gets whether the project at the given path is using TypeScript.
|
|
52
|
-
* @param projectRoot The project root path to look in.
|
|
53
|
-
* @returns Whether the project at the given path is using TypeScript.
|
|
54
|
-
*/
|
|
55
|
-
async function usesTypeScript(projectRoot) {
|
|
56
|
-
return fileExists('./tsconfig.json', projectRoot);
|
|
57
|
-
}
|
|
58
|
-
exports.usesTypeScript = usesTypeScript;
|
|
59
|
-
/**
|
|
60
|
-
* Get the list of keys in the object for which the value is defined.
|
|
61
|
-
* @param obj The object to search.
|
|
62
|
-
* @returns The list of keys.
|
|
63
|
-
*/
|
|
64
|
-
function getDefinedKeys(obj) {
|
|
65
|
-
return Object.keys(obj).filter(value => obj[value] !== undefined && obj[value] !== null && value);
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Given a react-native CLI config, determine the language of the RNW dependency if possible.
|
|
69
|
-
* @param config Dependency config passed from react-native CLI.
|
|
70
|
-
* @returns The language of the RNW dependency.
|
|
71
|
-
*/
|
|
72
|
-
function getDependencyRnwLang(config) {
|
|
73
|
-
if (config) {
|
|
74
|
-
let cppCount = 0;
|
|
75
|
-
let csCount = 0;
|
|
76
|
-
for (const project of config.projects) {
|
|
77
|
-
switch (project.projectLang) {
|
|
78
|
-
case 'cpp':
|
|
79
|
-
cppCount++;
|
|
80
|
-
break;
|
|
81
|
-
case 'cs':
|
|
82
|
-
csCount++;
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
if (cppCount > 0 && csCount > 0) {
|
|
87
|
-
return 'cpp+cs';
|
|
88
|
-
}
|
|
89
|
-
else if (cppCount > 0) {
|
|
90
|
-
return 'cpp';
|
|
91
|
-
}
|
|
92
|
-
else if (csCount > 0) {
|
|
93
|
-
return 'cs';
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Returns true if the item is a boolean with a value of true or a string with a value of 'true'.
|
|
100
|
-
* @param item The item to parse.
|
|
101
|
-
* @returns The boolean value.
|
|
102
|
-
*/
|
|
103
|
-
function parseBoolean(item) {
|
|
104
|
-
if (typeof item === 'boolean') {
|
|
105
|
-
return item;
|
|
106
|
-
}
|
|
107
|
-
else if (typeof item === 'string') {
|
|
108
|
-
return item.toLowerCase() === 'true';
|
|
109
|
-
}
|
|
110
|
-
return false;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Calculate the project telemetry info from a react-native CLI config.
|
|
114
|
-
* @param config Config passed from react-native CLI.
|
|
115
|
-
* @returns The calculated project info.
|
|
116
|
-
*/
|
|
117
|
-
async function configToProjectInfo(config) {
|
|
118
|
-
var _a, _b, _c;
|
|
119
|
-
try {
|
|
120
|
-
const id = getProjectId(require(path_1.default.join(config.root, 'package.json')).name);
|
|
121
|
-
const platforms = getDefinedKeys(config.project);
|
|
122
|
-
if ('windows' in config.project && config.project.windows !== null) {
|
|
123
|
-
const rnwLang = (_a = config.project.windows.project) === null || _a === void 0 ? void 0 : _a.projectLang;
|
|
124
|
-
const usesTS = await usesTypeScript(config.project.windows.folder);
|
|
125
|
-
const usesRNConfig = await usesReactNativeConfig(config.project.windows.folder);
|
|
126
|
-
const jsEngine = parseBoolean((_b = config.project.windows.experimentalFeatures) === null || _b === void 0 ? void 0 : _b.UseHermes)
|
|
127
|
-
? 'Hermes'
|
|
128
|
-
: 'Chakra';
|
|
129
|
-
const rnwSource = parseBoolean((_c = config.project.windows.experimentalFeatures) === null || _c === void 0 ? void 0 : _c.UseExperimentalNuget)
|
|
130
|
-
? 'NuGet'
|
|
131
|
-
: 'Source';
|
|
132
|
-
const dependencies = [];
|
|
133
|
-
for (const dependencyName in config.dependencies) {
|
|
134
|
-
if (!Object.prototype.hasOwnProperty(dependencyName)) {
|
|
135
|
-
const dependencyId = getProjectId(dependencyName);
|
|
136
|
-
const dependencyPlatforms = getDefinedKeys(config.dependencies[dependencyName].platforms);
|
|
137
|
-
if (dependencyPlatforms.length > 0) {
|
|
138
|
-
const dependencyRnwLang = getDependencyRnwLang(config.dependencies[dependencyName].platforms.windows);
|
|
139
|
-
const dependencyInfo = {
|
|
140
|
-
id: dependencyId,
|
|
141
|
-
platforms: dependencyPlatforms,
|
|
142
|
-
rnwLang: dependencyRnwLang,
|
|
143
|
-
};
|
|
144
|
-
dependencies.push(dependencyInfo);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
const appInfo = {
|
|
149
|
-
id,
|
|
150
|
-
platforms,
|
|
151
|
-
rnwLang,
|
|
152
|
-
usesTS,
|
|
153
|
-
usesRNConfig,
|
|
154
|
-
jsEngine,
|
|
155
|
-
rnwSource,
|
|
156
|
-
dependencies,
|
|
157
|
-
};
|
|
158
|
-
return appInfo;
|
|
159
|
-
}
|
|
160
|
-
// Probably just a dependency project, return minimal info
|
|
161
|
-
const dependencyInfo = {
|
|
162
|
-
id,
|
|
163
|
-
platforms,
|
|
164
|
-
rnwLang: null,
|
|
165
|
-
};
|
|
166
|
-
return dependencyInfo;
|
|
167
|
-
}
|
|
168
|
-
catch (_d) { }
|
|
169
|
-
return null;
|
|
170
|
-
}
|
|
171
|
-
exports.configToProjectInfo = configToProjectInfo;
|
|
172
|
-
/**
|
|
173
|
-
* Gets the full path to the app's native project file from a react-native CLI config.
|
|
174
|
-
* @param config Config passed from react-native CLI.
|
|
175
|
-
* @returns The full path to the app's native project file
|
|
176
|
-
*/
|
|
177
|
-
function getProjectFileFromConfig(config) {
|
|
178
|
-
try {
|
|
179
|
-
if ('windows' in config.project && config.project.windows !== null) {
|
|
180
|
-
return path_1.default.join(config.project.windows.folder, config.project.windows.sourceDir, config.project.windows.project.projectFile);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
catch (_a) { }
|
|
184
|
-
return null;
|
|
185
|
-
}
|
|
186
|
-
exports.getProjectFileFromConfig = getProjectFileFromConfig;
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Microsoft Corporation.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
* @format
|
|
6
|
+
*/
|
|
7
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
|
+
};
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.getProjectFileFromConfig = exports.configToProjectInfo = exports.usesTypeScript = exports.usesReactNativeConfig = exports.getProjectId = void 0;
|
|
12
|
+
const crypto_1 = require("crypto");
|
|
13
|
+
const fs_1 = __importDefault(require("@react-native-windows/fs"));
|
|
14
|
+
const path_1 = __importDefault(require("path"));
|
|
15
|
+
/**
|
|
16
|
+
* Gets a unique, telemetry-safe project ID based on the project name.
|
|
17
|
+
* @param projectName The project name.
|
|
18
|
+
* @returns The telemetry-safe project ID.
|
|
19
|
+
*/
|
|
20
|
+
function getProjectId(projectName) {
|
|
21
|
+
const hash = (0, crypto_1.createHash)('sha256');
|
|
22
|
+
hash.update(projectName);
|
|
23
|
+
return hash.digest('hex');
|
|
24
|
+
}
|
|
25
|
+
exports.getProjectId = getProjectId;
|
|
26
|
+
/**
|
|
27
|
+
* Checks that a given file exits in the path specified.
|
|
28
|
+
* @param fileName The file to check for.
|
|
29
|
+
* @param projectRoot The root path to look in.
|
|
30
|
+
* @returns Whether the file exists.
|
|
31
|
+
*/
|
|
32
|
+
async function fileExists(fileName, projectRoot) {
|
|
33
|
+
try {
|
|
34
|
+
const reactNativeConfigPath = path_1.default.resolve(projectRoot, fileName);
|
|
35
|
+
const stats = await fs_1.default.stat(reactNativeConfigPath);
|
|
36
|
+
return stats.isFile();
|
|
37
|
+
}
|
|
38
|
+
catch (_a) { }
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Gets whether the project at the given path has a react-native.config.js file.
|
|
43
|
+
* @param projectRoot The project root path to look in.
|
|
44
|
+
* @returns Whether the project at the given path has a react-native.config.js file.
|
|
45
|
+
*/
|
|
46
|
+
async function usesReactNativeConfig(projectRoot) {
|
|
47
|
+
return fileExists('./react-native.config.js', projectRoot);
|
|
48
|
+
}
|
|
49
|
+
exports.usesReactNativeConfig = usesReactNativeConfig;
|
|
50
|
+
/**
|
|
51
|
+
* Gets whether the project at the given path is using TypeScript.
|
|
52
|
+
* @param projectRoot The project root path to look in.
|
|
53
|
+
* @returns Whether the project at the given path is using TypeScript.
|
|
54
|
+
*/
|
|
55
|
+
async function usesTypeScript(projectRoot) {
|
|
56
|
+
return fileExists('./tsconfig.json', projectRoot);
|
|
57
|
+
}
|
|
58
|
+
exports.usesTypeScript = usesTypeScript;
|
|
59
|
+
/**
|
|
60
|
+
* Get the list of keys in the object for which the value is defined.
|
|
61
|
+
* @param obj The object to search.
|
|
62
|
+
* @returns The list of keys.
|
|
63
|
+
*/
|
|
64
|
+
function getDefinedKeys(obj) {
|
|
65
|
+
return Object.keys(obj).filter(value => obj[value] !== undefined && obj[value] !== null && value);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Given a react-native CLI config, determine the language of the RNW dependency if possible.
|
|
69
|
+
* @param config Dependency config passed from react-native CLI.
|
|
70
|
+
* @returns The language of the RNW dependency.
|
|
71
|
+
*/
|
|
72
|
+
function getDependencyRnwLang(config) {
|
|
73
|
+
if (config) {
|
|
74
|
+
let cppCount = 0;
|
|
75
|
+
let csCount = 0;
|
|
76
|
+
for (const project of config.projects) {
|
|
77
|
+
switch (project.projectLang) {
|
|
78
|
+
case 'cpp':
|
|
79
|
+
cppCount++;
|
|
80
|
+
break;
|
|
81
|
+
case 'cs':
|
|
82
|
+
csCount++;
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (cppCount > 0 && csCount > 0) {
|
|
87
|
+
return 'cpp+cs';
|
|
88
|
+
}
|
|
89
|
+
else if (cppCount > 0) {
|
|
90
|
+
return 'cpp';
|
|
91
|
+
}
|
|
92
|
+
else if (csCount > 0) {
|
|
93
|
+
return 'cs';
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Returns true if the item is a boolean with a value of true or a string with a value of 'true'.
|
|
100
|
+
* @param item The item to parse.
|
|
101
|
+
* @returns The boolean value.
|
|
102
|
+
*/
|
|
103
|
+
function parseBoolean(item) {
|
|
104
|
+
if (typeof item === 'boolean') {
|
|
105
|
+
return item;
|
|
106
|
+
}
|
|
107
|
+
else if (typeof item === 'string') {
|
|
108
|
+
return item.toLowerCase() === 'true';
|
|
109
|
+
}
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Calculate the project telemetry info from a react-native CLI config.
|
|
114
|
+
* @param config Config passed from react-native CLI.
|
|
115
|
+
* @returns The calculated project info.
|
|
116
|
+
*/
|
|
117
|
+
async function configToProjectInfo(config) {
|
|
118
|
+
var _a, _b, _c;
|
|
119
|
+
try {
|
|
120
|
+
const id = getProjectId(require(path_1.default.join(config.root, 'package.json')).name);
|
|
121
|
+
const platforms = getDefinedKeys(config.project);
|
|
122
|
+
if ('windows' in config.project && config.project.windows !== null) {
|
|
123
|
+
const rnwLang = (_a = config.project.windows.project) === null || _a === void 0 ? void 0 : _a.projectLang;
|
|
124
|
+
const usesTS = await usesTypeScript(config.project.windows.folder);
|
|
125
|
+
const usesRNConfig = await usesReactNativeConfig(config.project.windows.folder);
|
|
126
|
+
const jsEngine = parseBoolean((_b = config.project.windows.experimentalFeatures) === null || _b === void 0 ? void 0 : _b.UseHermes)
|
|
127
|
+
? 'Hermes'
|
|
128
|
+
: 'Chakra';
|
|
129
|
+
const rnwSource = parseBoolean((_c = config.project.windows.experimentalFeatures) === null || _c === void 0 ? void 0 : _c.UseExperimentalNuget)
|
|
130
|
+
? 'NuGet'
|
|
131
|
+
: 'Source';
|
|
132
|
+
const dependencies = [];
|
|
133
|
+
for (const dependencyName in config.dependencies) {
|
|
134
|
+
if (!Object.prototype.hasOwnProperty(dependencyName)) {
|
|
135
|
+
const dependencyId = getProjectId(dependencyName);
|
|
136
|
+
const dependencyPlatforms = getDefinedKeys(config.dependencies[dependencyName].platforms);
|
|
137
|
+
if (dependencyPlatforms.length > 0) {
|
|
138
|
+
const dependencyRnwLang = getDependencyRnwLang(config.dependencies[dependencyName].platforms.windows);
|
|
139
|
+
const dependencyInfo = {
|
|
140
|
+
id: dependencyId,
|
|
141
|
+
platforms: dependencyPlatforms,
|
|
142
|
+
rnwLang: dependencyRnwLang,
|
|
143
|
+
};
|
|
144
|
+
dependencies.push(dependencyInfo);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
const appInfo = {
|
|
149
|
+
id,
|
|
150
|
+
platforms,
|
|
151
|
+
rnwLang,
|
|
152
|
+
usesTS,
|
|
153
|
+
usesRNConfig,
|
|
154
|
+
jsEngine,
|
|
155
|
+
rnwSource,
|
|
156
|
+
dependencies,
|
|
157
|
+
};
|
|
158
|
+
return appInfo;
|
|
159
|
+
}
|
|
160
|
+
// Probably just a dependency project, return minimal info
|
|
161
|
+
const dependencyInfo = {
|
|
162
|
+
id,
|
|
163
|
+
platforms,
|
|
164
|
+
rnwLang: null,
|
|
165
|
+
};
|
|
166
|
+
return dependencyInfo;
|
|
167
|
+
}
|
|
168
|
+
catch (_d) { }
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
exports.configToProjectInfo = configToProjectInfo;
|
|
172
|
+
/**
|
|
173
|
+
* Gets the full path to the app's native project file from a react-native CLI config.
|
|
174
|
+
* @param config Config passed from react-native CLI.
|
|
175
|
+
* @returns The full path to the app's native project file
|
|
176
|
+
*/
|
|
177
|
+
function getProjectFileFromConfig(config) {
|
|
178
|
+
try {
|
|
179
|
+
if ('windows' in config.project && config.project.windows !== null) {
|
|
180
|
+
return path_1.default.join(config.project.windows.folder, config.project.windows.sourceDir, config.project.windows.project.projectFile);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
catch (_a) { }
|
|
184
|
+
return null;
|
|
185
|
+
}
|
|
186
|
+
exports.getProjectFileFromConfig = getProjectFileFromConfig;
|
|
187
187
|
//# sourceMappingURL=projectUtils.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Microsoft Corporation.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
* @format
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Gets an anonymized version of the given path, suitable for Telemetry.
|
|
8
|
-
* @param filepath The path to anonymize.
|
|
9
|
-
* @param projectRoot Optional root path for the project. Defaults to process.cwd().
|
|
10
|
-
* @returns The anonymized path.
|
|
11
|
-
*/
|
|
12
|
-
export declare function getAnonymizedPath(filepath: string, projectRoot?: string): string;
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
* @format
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Gets an anonymized version of the given path, suitable for Telemetry.
|
|
8
|
+
* @param filepath The path to anonymize.
|
|
9
|
+
* @param projectRoot Optional root path for the project. Defaults to process.cwd().
|
|
10
|
+
* @returns The anonymized path.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getAnonymizedPath(filepath: string, projectRoot?: string): string;
|