@react-native-windows/cli 0.0.0-canary.21 → 0.0.0-canary.211
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/README.md +47 -0
- package/lib-commonjs/commands/autolinkWindows/autolinkWindows.d.ts +87 -0
- package/lib-commonjs/commands/autolinkWindows/autolinkWindows.js +661 -0
- package/lib-commonjs/commands/autolinkWindows/autolinkWindows.js.map +1 -0
- package/lib-commonjs/commands/autolinkWindows/autolinkWindowsOptions.d.ts +14 -0
- package/lib-commonjs/commands/autolinkWindows/autolinkWindowsOptions.js +33 -0
- package/lib-commonjs/commands/autolinkWindows/autolinkWindowsOptions.js.map +1 -0
- package/lib-commonjs/commands/codegenWindows/codegenWindows.d.ts +27 -0
- package/lib-commonjs/commands/codegenWindows/codegenWindows.js +206 -0
- package/lib-commonjs/commands/codegenWindows/codegenWindows.js.map +1 -0
- package/lib-commonjs/commands/codegenWindows/codegenWindowsOptions.d.ts +12 -0
- package/lib-commonjs/commands/codegenWindows/codegenWindowsOptions.js +23 -0
- package/lib-commonjs/commands/codegenWindows/codegenWindowsOptions.js.map +1 -0
- package/lib-commonjs/{config → commands/config}/configUtils.d.ts +123 -93
- package/lib-commonjs/commands/config/configUtils.js +381 -0
- package/lib-commonjs/commands/config/configUtils.js.map +1 -0
- package/lib-commonjs/{config → commands/config}/dependencyConfig.d.ts +37 -37
- package/lib-commonjs/commands/config/dependencyConfig.js +228 -0
- package/lib-commonjs/commands/config/dependencyConfig.js.map +1 -0
- package/lib-commonjs/{config → commands/config}/projectConfig.d.ts +27 -24
- package/lib-commonjs/{config → commands/config}/projectConfig.js +180 -120
- package/lib-commonjs/commands/config/projectConfig.js.map +1 -0
- package/lib-commonjs/commands/healthCheck/healthCheckList.d.ts +6 -0
- package/lib-commonjs/commands/healthCheck/healthCheckList.js +21 -0
- package/lib-commonjs/commands/healthCheck/healthCheckList.js.map +1 -0
- package/lib-commonjs/commands/healthCheck/healthChecks.d.ts +7 -0
- package/lib-commonjs/commands/healthCheck/healthChecks.js +124 -0
- package/lib-commonjs/commands/healthCheck/healthChecks.js.map +1 -0
- package/lib-commonjs/commands/initWindows/initWindows.d.ts +46 -0
- package/lib-commonjs/commands/initWindows/initWindows.js +244 -0
- package/lib-commonjs/commands/initWindows/initWindows.js.map +1 -0
- package/lib-commonjs/commands/initWindows/initWindowsOptions.d.ts +15 -0
- package/lib-commonjs/commands/initWindows/initWindowsOptions.js +38 -0
- package/lib-commonjs/commands/initWindows/initWindowsOptions.js.map +1 -0
- package/lib-commonjs/{runWindows → commands/runWindows}/runWindows.d.ts +10 -10
- package/lib-commonjs/commands/runWindows/runWindows.js +322 -0
- package/lib-commonjs/commands/runWindows/runWindows.js.map +1 -0
- package/lib-commonjs/{runWindows → commands/runWindows}/runWindowsOptions.d.ts +56 -52
- package/lib-commonjs/{runWindows → commands/runWindows}/runWindowsOptions.js +132 -131
- package/lib-commonjs/commands/runWindows/runWindowsOptions.js.map +1 -0
- package/lib-commonjs/e2etest/autolink.test.d.ts +6 -0
- package/lib-commonjs/e2etest/autolink.test.js +367 -0
- package/lib-commonjs/e2etest/autolink.test.js.map +1 -0
- package/lib-commonjs/e2etest/dependencyConfig.test.d.ts +6 -0
- package/lib-commonjs/e2etest/dependencyConfig.test.js +130 -0
- package/lib-commonjs/e2etest/dependencyConfig.test.js.map +1 -0
- package/lib-commonjs/e2etest/healthChecks.test.d.ts +6 -0
- package/lib-commonjs/e2etest/healthChecks.test.js +31 -0
- package/lib-commonjs/e2etest/healthChecks.test.js.map +1 -0
- package/lib-commonjs/e2etest/initWindows.test.d.ts +6 -0
- package/lib-commonjs/e2etest/initWindows.test.js +43 -0
- package/lib-commonjs/e2etest/initWindows.test.js.map +1 -0
- package/lib-commonjs/e2etest/projectConfig.test.d.ts +6 -0
- package/lib-commonjs/e2etest/projectConfig.test.js +111 -0
- package/lib-commonjs/e2etest/projectConfig.test.js.map +1 -0
- package/lib-commonjs/e2etest/projectConfig.utils.d.ts +8 -0
- package/lib-commonjs/e2etest/projectConfig.utils.js +77 -0
- package/lib-commonjs/e2etest/projectConfig.utils.js.map +1 -0
- package/lib-commonjs/e2etest/runWindows.test.d.ts +6 -0
- package/lib-commonjs/e2etest/runWindows.test.js +61 -0
- package/lib-commonjs/e2etest/runWindows.test.js.map +1 -0
- package/lib-commonjs/e2etest/typesUpToDate.test.d.ts +6 -0
- package/lib-commonjs/e2etest/typesUpToDate.test.js +21 -0
- package/lib-commonjs/e2etest/typesUpToDate.test.js.map +1 -0
- package/lib-commonjs/generator-common/index.d.ts +39 -23
- package/lib-commonjs/generator-common/index.js +242 -221
- package/lib-commonjs/generator-common/index.js.map +1 -1
- package/lib-commonjs/generator-windows/index.d.ts +10 -10
- package/lib-commonjs/generator-windows/index.js +316 -352
- package/lib-commonjs/generator-windows/index.js.map +1 -1
- package/lib-commonjs/index.d.ts +50 -46
- package/lib-commonjs/index.js +77 -39
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/{runWindows/utils → utils}/build.d.ts +12 -13
- package/lib-commonjs/{runWindows/utils → utils}/build.js +84 -91
- package/lib-commonjs/utils/build.js.map +1 -0
- package/lib-commonjs/{runWindows/utils → utils}/checkRequirements.d.ts +6 -6
- package/lib-commonjs/{runWindows/utils → utils}/checkRequirements.js +69 -65
- package/lib-commonjs/utils/checkRequirements.js.map +1 -0
- package/lib-commonjs/{runWindows/utils → utils}/commandWithProgress.d.ts +21 -13
- package/lib-commonjs/{runWindows/utils → utils}/commandWithProgress.js +149 -113
- package/lib-commonjs/utils/commandWithProgress.js.map +1 -0
- package/lib-commonjs/{runWindows/utils → utils}/deploy.d.ts +12 -12
- package/lib-commonjs/utils/deploy.js +354 -0
- package/lib-commonjs/utils/deploy.js.map +1 -0
- package/lib-commonjs/{runWindows/utils → utils}/info.d.ts +6 -6
- package/lib-commonjs/{runWindows/utils → utils}/info.js +28 -25
- package/lib-commonjs/utils/info.js.map +1 -0
- package/lib-commonjs/utils/msbuildtools.d.ts +28 -0
- package/lib-commonjs/utils/msbuildtools.js +274 -0
- package/lib-commonjs/utils/msbuildtools.js.map +1 -0
- package/lib-commonjs/utils/pathHelpers.d.ts +9 -0
- package/lib-commonjs/utils/pathHelpers.js +37 -0
- package/lib-commonjs/utils/pathHelpers.js.map +1 -0
- package/lib-commonjs/utils/telemetryHelpers.d.ts +29 -0
- package/lib-commonjs/utils/telemetryHelpers.js +121 -0
- package/lib-commonjs/utils/telemetryHelpers.js.map +1 -0
- package/lib-commonjs/{runWindows/utils → utils}/version.d.ts +19 -19
- package/lib-commonjs/{runWindows/utils → utils}/version.js +109 -109
- package/lib-commonjs/utils/version.js.map +1 -0
- package/lib-commonjs/{runWindows/utils → utils}/vsInstalls.d.ts +34 -34
- package/lib-commonjs/utils/vsInstalls.js +100 -0
- package/lib-commonjs/utils/vsInstalls.js.map +1 -0
- package/lib-commonjs/{runWindows/utils → utils}/vstools.d.ts +16 -15
- package/lib-commonjs/utils/vstools.js +190 -0
- package/lib-commonjs/utils/vstools.js.map +1 -0
- package/lib-commonjs/{runWindows/utils → utils}/winappdeploytool.d.ts +24 -24
- package/lib-commonjs/{runWindows/utils → utils}/winappdeploytool.js +108 -105
- package/lib-commonjs/utils/winappdeploytool.js.map +1 -0
- package/package.json +50 -30
- package/{powershell → src/powershell}/Add-AppDevPackage.ps1 +2 -2
- package/src/powershell/Eval-MsBuildProperties.ps1 +156 -0
- package/{powershell → src/powershell}/WindowsStoreAppUtils.ps1 +10 -0
- package/CHANGELOG.json +0 -317
- package/CHANGELOG.md +0 -159
- package/lib-commonjs/config/configUtils.js +0 -253
- package/lib-commonjs/config/configUtils.js.map +0 -1
- package/lib-commonjs/config/dependencyConfig.js +0 -167
- package/lib-commonjs/config/dependencyConfig.js.map +0 -1
- package/lib-commonjs/config/projectConfig.js.map +0 -1
- package/lib-commonjs/runWindows/runWindows.js +0 -159
- package/lib-commonjs/runWindows/runWindows.js.map +0 -1
- package/lib-commonjs/runWindows/runWindowsOptions.js.map +0 -1
- package/lib-commonjs/runWindows/utils/autolink.d.ts +0 -7
- package/lib-commonjs/runWindows/utils/autolink.js +0 -353
- package/lib-commonjs/runWindows/utils/autolink.js.map +0 -1
- package/lib-commonjs/runWindows/utils/build.js.map +0 -1
- package/lib-commonjs/runWindows/utils/checkRequirements.js.map +0 -1
- package/lib-commonjs/runWindows/utils/commandWithProgress.js.map +0 -1
- package/lib-commonjs/runWindows/utils/deploy.js +0 -247
- package/lib-commonjs/runWindows/utils/deploy.js.map +0 -1
- package/lib-commonjs/runWindows/utils/info.js.map +0 -1
- package/lib-commonjs/runWindows/utils/msbuildtools.d.ts +0 -22
- package/lib-commonjs/runWindows/utils/msbuildtools.js +0 -195
- package/lib-commonjs/runWindows/utils/msbuildtools.js.map +0 -1
- package/lib-commonjs/runWindows/utils/version.js.map +0 -1
- package/lib-commonjs/runWindows/utils/vsInstalls.js +0 -70
- package/lib-commonjs/runWindows/utils/vsInstalls.js.map +0 -1
- package/lib-commonjs/runWindows/utils/vstools.js +0 -150
- package/lib-commonjs/runWindows/utils/vstools.js.map +0 -1
- package/lib-commonjs/runWindows/utils/winappdeploytool.js.map +0 -1
|
@@ -1,132 +1,133 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) Microsoft Corporation.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
* @format
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.runWindowsOptions = void 0;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
name: '--no-packager',
|
|
52
|
-
description: 'Do not launch packager while building',
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
name: '--no-
|
|
72
|
-
description: 'Do not
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Microsoft Corporation.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
* @format
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.runWindowsOptions = void 0;
|
|
9
|
+
const telemetry_1 = require("@react-native-windows/telemetry");
|
|
10
|
+
exports.runWindowsOptions = [
|
|
11
|
+
{
|
|
12
|
+
name: '--release',
|
|
13
|
+
description: 'Specifies a release build',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: '--root [string]',
|
|
17
|
+
description: 'Override the root directory for the windows build which contains the windows folder.',
|
|
18
|
+
default: config => config.root,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: '--arch [string]',
|
|
22
|
+
description: 'The build architecture (ARM64, x86, x64)',
|
|
23
|
+
default: parseBuildArch((0, telemetry_1.deviceArchitecture)()),
|
|
24
|
+
parse: parseBuildArch,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: '--singleproc',
|
|
28
|
+
description: 'Disables multi-proc build',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: '--emulator',
|
|
32
|
+
description: 'Deploys the app to an emulator',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: '--device',
|
|
36
|
+
description: 'Deploys the app to a connected device',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: '--target [string]',
|
|
40
|
+
description: 'Deploys the app to the specified GUID for a device.',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: '--remote-debugging',
|
|
44
|
+
description: 'Deploys the app in remote debugging mode.',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: '--logging',
|
|
48
|
+
description: 'Enables logging',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: '--no-packager',
|
|
52
|
+
description: 'Do not launch packager while building',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: '--bundle',
|
|
56
|
+
description: 'Enable Bundle configuration and it would be ReleaseBundle/DebugBundle other than Release/Debug',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: '--no-launch',
|
|
60
|
+
description: 'Do not launch the app after deployment',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: '--no-autolink',
|
|
64
|
+
description: 'Do not run autolinking',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: '--no-build',
|
|
68
|
+
description: 'Do not build the solution',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: '--no-deploy',
|
|
72
|
+
description: 'Do not deploy the app',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: '--deploy-from-layout',
|
|
76
|
+
description: 'Force deploy from layout',
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: '--sln [string]',
|
|
80
|
+
description: "Override the app solution file determined by 'react-native config', e.g. windows\\myApp.sln",
|
|
81
|
+
default: undefined,
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: '--proj [string]',
|
|
85
|
+
description: "Override the app project file determined by 'react-native config', e.g. windows\\myApp\\myApp.vcxproj",
|
|
86
|
+
default: undefined,
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: '--msbuildprops [string]',
|
|
90
|
+
description: 'Comma separated props to pass to msbuild, eg: prop1=value1,prop2=value2',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: '--buildLogDirectory [string]',
|
|
94
|
+
description: 'Optional directory where msbuild log files should be stored',
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: '--info',
|
|
98
|
+
description: 'Dump environment information',
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: '--direct-debugging [number]',
|
|
102
|
+
description: 'Enable direct debugging on specified port',
|
|
103
|
+
parse: parseDirectDebuggingPort,
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: '--no-telemetry',
|
|
107
|
+
description: 'Disables sending telemetry that allows analysis of usage and failures of the react-native-windows CLI',
|
|
108
|
+
},
|
|
109
|
+
];
|
|
110
|
+
function parseBuildArch(arg) {
|
|
111
|
+
const supportedArches = ['x86', 'x64', 'ARM64'];
|
|
112
|
+
for (const supported of supportedArches) {
|
|
113
|
+
if (arg.toLowerCase() === supported.toLowerCase()) {
|
|
114
|
+
return supported;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
errorOut(`Unrecognized --arch '${arg}'. Expected one of ${supportedArches}`);
|
|
118
|
+
}
|
|
119
|
+
function parseDirectDebuggingPort(arg) {
|
|
120
|
+
const num = parseInt(arg, 10);
|
|
121
|
+
if (!Number.isInteger(num)) {
|
|
122
|
+
errorOut(`Expected argument '--direct-debugging' to be a number`);
|
|
123
|
+
}
|
|
124
|
+
if (num < 1024 || num >= 65535) {
|
|
125
|
+
errorOut('Direct debugging port it out of range');
|
|
126
|
+
}
|
|
127
|
+
return num;
|
|
128
|
+
}
|
|
129
|
+
function errorOut(arg) {
|
|
130
|
+
console.error(arg);
|
|
131
|
+
process.exit(1);
|
|
132
|
+
}
|
|
132
133
|
//# sourceMappingURL=runWindowsOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runWindowsOptions.js","sourceRoot":"","sources":["../../../src/commands/runWindows/runWindowsOptions.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport {CommandOption} from '@react-native-community/cli-types';\nimport {deviceArchitecture} from '@react-native-windows/telemetry';\n\nexport type BuildArch = 'x86' | 'x64' | 'ARM64';\nexport type BuildConfig = 'Debug' | 'DebugBundle' | 'Release' | 'ReleaseBundle';\n\n/**\n * * Options are the following:\n * release: Boolean - Specifies release build\n * root: String - The root of the application\n * arch: String - The build architecture (ARM64, x86, x64)\n * singleproc: Boolean - opt out of multi-proc builds\n * emulator: Boolean - Deploy to the emulator\n * device: Boolean - Deploy to a device\n * target: String - Device GUID to deploy to\n * remote-debugging: Boolean - Run using remote JS proxy\n * logging: Boolean - Enables logging\n * no-packager: Boolean - Do not launch packager while building\n * bundle: Boolean - Enable Bundle configuration.\n * no-launch: Boolean - Do not launch the app after deployment\n * no-build: Boolean - Do not build the solution\n * no-deploy: Boolean - Do not deploy the app\n * deploy-from-layout: Force deploy from layout, even in release builds\n * sln: String - Solution file to build\n * msbuildprops: String - Comma separated props to pass to msbuild, eg: prop1=value1,prop2=value2\n * direct-debugging: Number - Enable direct debugging on specified port\n * no-telemetry: Boolean - Disables sending telemetry that allows analysis of usage and failures of the react-native-windows CLI\n */\nexport interface RunWindowsOptions {\n release?: boolean;\n root: string;\n arch: BuildArch;\n singleproc?: boolean;\n emulator?: boolean;\n device?: boolean;\n target?: string;\n remoteDebugging?: string;\n logging?: boolean;\n packager?: boolean;\n bundle?: boolean;\n launch?: boolean;\n autolink?: boolean;\n build?: boolean;\n deploy?: boolean;\n deployFromLayout?: boolean;\n sln?: string;\n proj?: string;\n msbuildprops?: string;\n buildLogDirectory?: string;\n info?: boolean;\n directDebugging?: number;\n telemetry?: boolean;\n}\n\nexport const runWindowsOptions: CommandOption[] = [\n {\n name: '--release',\n description: 'Specifies a release build',\n },\n {\n name: '--root [string]',\n description:\n 'Override the root directory for the windows build which contains the windows folder.',\n default: config => config.root,\n },\n {\n name: '--arch [string]',\n description: 'The build architecture (ARM64, x86, x64)',\n default: parseBuildArch(deviceArchitecture()),\n parse: parseBuildArch,\n },\n {\n name: '--singleproc',\n description: 'Disables multi-proc build',\n },\n {\n name: '--emulator',\n description: 'Deploys the app to an emulator',\n },\n {\n name: '--device',\n description: 'Deploys the app to a connected device',\n },\n {\n name: '--target [string]',\n description: 'Deploys the app to the specified GUID for a device.',\n },\n {\n name: '--remote-debugging',\n description: 'Deploys the app in remote debugging mode.',\n },\n {\n name: '--logging',\n description: 'Enables logging',\n },\n {\n name: '--no-packager',\n description: 'Do not launch packager while building',\n },\n {\n name: '--bundle',\n description:\n 'Enable Bundle configuration and it would be ReleaseBundle/DebugBundle other than Release/Debug',\n },\n {\n name: '--no-launch',\n description: 'Do not launch the app after deployment',\n },\n {\n name: '--no-autolink',\n description: 'Do not run autolinking',\n },\n {\n name: '--no-build',\n description: 'Do not build the solution',\n },\n {\n name: '--no-deploy',\n description: 'Do not deploy the app',\n },\n {\n name: '--deploy-from-layout',\n description: 'Force deploy from layout',\n },\n {\n name: '--sln [string]',\n description:\n \"Override the app solution file determined by 'react-native config', e.g. windows\\\\myApp.sln\",\n default: undefined,\n },\n {\n name: '--proj [string]',\n description:\n \"Override the app project file determined by 'react-native config', e.g. windows\\\\myApp\\\\myApp.vcxproj\",\n default: undefined,\n },\n {\n name: '--msbuildprops [string]',\n description:\n 'Comma separated props to pass to msbuild, eg: prop1=value1,prop2=value2',\n },\n {\n name: '--buildLogDirectory [string]',\n description: 'Optional directory where msbuild log files should be stored',\n },\n {\n name: '--info',\n description: 'Dump environment information',\n },\n {\n name: '--direct-debugging [number]',\n description: 'Enable direct debugging on specified port',\n parse: parseDirectDebuggingPort,\n },\n {\n name: '--no-telemetry',\n description:\n 'Disables sending telemetry that allows analysis of usage and failures of the react-native-windows CLI',\n },\n];\n\nfunction parseBuildArch(arg: string): BuildArch {\n const supportedArches: BuildArch[] = ['x86', 'x64', 'ARM64'];\n for (const supported of supportedArches) {\n if (arg.toLowerCase() === supported.toLowerCase()) {\n return supported;\n }\n }\n\n errorOut(`Unrecognized --arch '${arg}'. Expected one of ${supportedArches}`);\n}\n\nfunction parseDirectDebuggingPort(arg: string): number {\n const num = parseInt(arg, 10);\n\n if (!Number.isInteger(num)) {\n errorOut(`Expected argument '--direct-debugging' to be a number`);\n }\n if (num < 1024 || num >= 65535) {\n errorOut('Direct debugging port it out of range');\n }\n\n return num;\n}\n\nfunction errorOut(arg: string): never {\n console.error(arg);\n process.exit(1);\n}\n"]}
|
|
@@ -0,0 +1,367 @@
|
|
|
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
|
+
const path_1 = __importDefault(require("path"));
|
|
12
|
+
const telemetry_1 = require("@react-native-windows/telemetry");
|
|
13
|
+
const projectConfig_1 = require("../commands/config/projectConfig");
|
|
14
|
+
const autolinkWindows_1 = require("../commands/autolinkWindows/autolinkWindows");
|
|
15
|
+
const autolinkWindowsOptions_1 = require("../commands/autolinkWindows/autolinkWindowsOptions");
|
|
16
|
+
const xmldom_1 = require("@xmldom/xmldom");
|
|
17
|
+
const projectConfig_utils_1 = require("./projectConfig.utils");
|
|
18
|
+
test('autolink with no windows project', () => {
|
|
19
|
+
expect(() => {
|
|
20
|
+
// eslint-disable-next-line no-new
|
|
21
|
+
new AutoLinkTest({}, {}, { check: true, logging: false });
|
|
22
|
+
}).toThrowError();
|
|
23
|
+
});
|
|
24
|
+
test('autolink with incomplete windows project', () => {
|
|
25
|
+
expect(() => {
|
|
26
|
+
const autolink = new AutoLinkTest({ windows: {} }, {}, { check: true, logging: false });
|
|
27
|
+
autolink.validateRequiredAppProperties();
|
|
28
|
+
}).toThrowError();
|
|
29
|
+
});
|
|
30
|
+
class AutoLinkTest extends autolinkWindows_1.AutoLinkWindows {
|
|
31
|
+
constructor() {
|
|
32
|
+
super(...arguments);
|
|
33
|
+
this.packagesConfig = '';
|
|
34
|
+
this.experimentalFeaturesProps = '';
|
|
35
|
+
}
|
|
36
|
+
getWindowsProjectConfig() {
|
|
37
|
+
return this.windowsAppConfig;
|
|
38
|
+
}
|
|
39
|
+
getPackagesConfigXml() {
|
|
40
|
+
return {
|
|
41
|
+
path: 'packages.config',
|
|
42
|
+
content: new xmldom_1.DOMParser().parseFromString(this.packagesConfig, 'application/xml'),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
getExperimentalFeaturesPropsXml() {
|
|
46
|
+
return {
|
|
47
|
+
path: 'ExperimentalFeatures.props',
|
|
48
|
+
content: new xmldom_1.DOMParser().parseFromString(this.experimentalFeaturesProps, 'application/xml'),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
async updateFile(filepath, content) {
|
|
52
|
+
if (filepath === 'packages.config') {
|
|
53
|
+
this.packagesConfig = content;
|
|
54
|
+
}
|
|
55
|
+
else if (filepath === 'ExperimentalFeatures.props') {
|
|
56
|
+
this.experimentalFeaturesProps = content;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
throw new Error(`Unknown path: ${filepath}`);
|
|
60
|
+
}
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
test('autolink fixup sln', () => {
|
|
65
|
+
const autolink = new AutoLinkTest({ windows: { folder: __dirname, sourceDir: '.' } }, {}, { check: true, logging: false, sln: 'foo' });
|
|
66
|
+
expect(autolink.getWindowsProjectConfig().solutionFile).toBeUndefined();
|
|
67
|
+
expect(() => {
|
|
68
|
+
autolink.validateRequiredAppProperties();
|
|
69
|
+
}).toThrow();
|
|
70
|
+
autolink.fixUpForSlnOption();
|
|
71
|
+
expect(autolink.getWindowsProjectConfig().solutionFile).toEqual('foo');
|
|
72
|
+
expect(() => {
|
|
73
|
+
autolink.validateRequiredAppProperties();
|
|
74
|
+
}).toThrow();
|
|
75
|
+
});
|
|
76
|
+
test('autolink fixup proj', async () => {
|
|
77
|
+
const autolink = new AutoLinkTest({ windows: { folder: __dirname, sourceDir: '.', solutionFile: 'foo.sln' } }, {}, {
|
|
78
|
+
check: true,
|
|
79
|
+
logging: false,
|
|
80
|
+
proj: 'projects/WithWinUI3/windows/WithWinUI3/WithWinUI3.vcxproj',
|
|
81
|
+
});
|
|
82
|
+
expect(autolink.getWindowsProjectConfig().solutionFile).toEqual('foo.sln');
|
|
83
|
+
expect(autolink.getWindowsProjectConfig().project).toBeUndefined();
|
|
84
|
+
const folder = path_1.default.resolve('src/e2etest/projects/', 'WithWinUI3');
|
|
85
|
+
await (0, projectConfig_utils_1.ensureWinUI3Project)(folder);
|
|
86
|
+
expect(() => {
|
|
87
|
+
autolink.validateRequiredProjectProperties();
|
|
88
|
+
}).toThrow();
|
|
89
|
+
autolink.fixUpForProjOption();
|
|
90
|
+
const projectConfig = autolink.getWindowsProjectConfig().project;
|
|
91
|
+
expect(projectConfig).not.toBeUndefined();
|
|
92
|
+
expect(projectConfig.projectName).toEqual('WithWinUI3');
|
|
93
|
+
autolink.validateRequiredProjectProperties();
|
|
94
|
+
});
|
|
95
|
+
test('empty cpp autolink dependencies', () => {
|
|
96
|
+
const autolink = new AutoLinkTest({ windows: { folder: __dirname, sourceDir: '.', solutionFile: 'foo.sln' } }, {}, {
|
|
97
|
+
check: true,
|
|
98
|
+
logging: false,
|
|
99
|
+
proj: 'projects/WithWinUI3/windows/WithWinUI3/WithWinUI3.vcxproj',
|
|
100
|
+
});
|
|
101
|
+
const replacements = autolink.getCppReplacements();
|
|
102
|
+
expect(replacements.cppIncludes).toEqual('');
|
|
103
|
+
expect(replacements.cppPackageProviders).toEqual('\n UNREFERENCED_PARAMETER(packageProviders);');
|
|
104
|
+
});
|
|
105
|
+
test('one invalid cpp autolink dependency', () => {
|
|
106
|
+
const autolink = new AutoLinkTest({ windows: { folder: __dirname, sourceDir: '.', solutionFile: 'foo.sln' } }, {
|
|
107
|
+
superModule: {
|
|
108
|
+
name: 'superModule',
|
|
109
|
+
root: 'theRoot',
|
|
110
|
+
platforms: {
|
|
111
|
+
windows: {},
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
}, {
|
|
115
|
+
check: true,
|
|
116
|
+
logging: false,
|
|
117
|
+
proj: 'projects/WithWinUI3/windows/WithWinUI3/WithWinUI3.vcxproj',
|
|
118
|
+
});
|
|
119
|
+
const replacements = autolink.getCppReplacements();
|
|
120
|
+
expect(replacements.cppIncludes).toEqual('');
|
|
121
|
+
expect(replacements.cppPackageProviders).toEqual('\n UNREFERENCED_PARAMETER(packageProviders);');
|
|
122
|
+
});
|
|
123
|
+
test('one invalid cs autolink dependency', () => {
|
|
124
|
+
const autolink = new AutoLinkTest({ windows: { folder: __dirname, sourceDir: '.', solutionFile: 'foo.sln' } }, {
|
|
125
|
+
superModule: {
|
|
126
|
+
name: 'superModule',
|
|
127
|
+
root: 'theRoot',
|
|
128
|
+
platforms: {
|
|
129
|
+
windows: {},
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
}, {
|
|
133
|
+
check: true,
|
|
134
|
+
logging: false,
|
|
135
|
+
proj: 'projects/SimpleCSharpApp/windows/SimpleCSharpApp/SimpleCSharpApp.csproj',
|
|
136
|
+
});
|
|
137
|
+
const replacements = autolink.getCsReplacements();
|
|
138
|
+
expect(replacements.csUsingNamespaces).toEqual('');
|
|
139
|
+
expect(replacements.csReactPackageProviders).toEqual('');
|
|
140
|
+
});
|
|
141
|
+
test('one valid cpp autolink dependency', () => {
|
|
142
|
+
const autolink = new AutoLinkTest({ windows: { folder: __dirname, sourceDir: '.', solutionFile: 'foo.sln' } }, {
|
|
143
|
+
superModule: {
|
|
144
|
+
name: 'superModule',
|
|
145
|
+
root: 'theRoot',
|
|
146
|
+
platforms: {
|
|
147
|
+
windows: {
|
|
148
|
+
sourceDir: __dirname,
|
|
149
|
+
projects: [
|
|
150
|
+
{
|
|
151
|
+
directDependency: true,
|
|
152
|
+
projectFile: 'superModule.vcxproj',
|
|
153
|
+
cppHeaders: ['Garfield.h', 'Snoopy.h'],
|
|
154
|
+
cppPackageProviders: ['FamousAnimalCartoons'],
|
|
155
|
+
},
|
|
156
|
+
],
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
}, {
|
|
161
|
+
check: true,
|
|
162
|
+
logging: false,
|
|
163
|
+
proj: 'projects/WithWinUI3/windows/WithWinUI3/WithWinUI3.vcxproj',
|
|
164
|
+
});
|
|
165
|
+
const replacements = autolink.getCppReplacements();
|
|
166
|
+
expect(replacements.cppIncludes).toMatch(/#include <Garfield.h>/);
|
|
167
|
+
expect(replacements.cppIncludes).toMatch(/#include <Snoopy.h>/);
|
|
168
|
+
expect(replacements.cppPackageProviders).toContain('packageProviders.Append(winrt::FamousAnimalCartoons())');
|
|
169
|
+
});
|
|
170
|
+
test('one valid cs autolink dependency', () => {
|
|
171
|
+
const autolink = new AutoLinkTest({ windows: { folder: __dirname, sourceDir: '.', solutionFile: 'foo.sln' } }, {
|
|
172
|
+
superModule: {
|
|
173
|
+
name: 'superModule',
|
|
174
|
+
root: 'theRoot',
|
|
175
|
+
platforms: {
|
|
176
|
+
windows: {
|
|
177
|
+
sourceDir: __dirname,
|
|
178
|
+
projects: [
|
|
179
|
+
{
|
|
180
|
+
directDependency: true,
|
|
181
|
+
csNamespaces: ['Garfield'],
|
|
182
|
+
projectFile: 'superModule.vcxproj',
|
|
183
|
+
cppHeaders: ['Garfield.h', 'Snoopy.h'],
|
|
184
|
+
csPackageProviders: ['FamousAnimalCartoons'],
|
|
185
|
+
},
|
|
186
|
+
],
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
}, {
|
|
191
|
+
check: true,
|
|
192
|
+
logging: false,
|
|
193
|
+
proj: 'projects/SimpleCSharpApp/windows/SimpleCSharpApp/SimpleCSharpApp.csproj',
|
|
194
|
+
});
|
|
195
|
+
const replacements = autolink.getCsReplacements();
|
|
196
|
+
expect(replacements.csUsingNamespaces).toContain('using Garfield;');
|
|
197
|
+
expect(replacements.csReactPackageProviders).toContain('packageProviders.Add(new FamousAnimalCartoons())');
|
|
198
|
+
});
|
|
199
|
+
test('ensureXAMLDialect - useWinUI3=true in react-native.config.js, useWinUI3=false in ExperimentalFeatures.props', async () => {
|
|
200
|
+
const folder = path_1.default.resolve('src/e2etest/projects/WithWinUI3');
|
|
201
|
+
// Create project with UseWinUI3 == false in ExperimentalFeatures.props
|
|
202
|
+
await (0, projectConfig_utils_1.ensureCppAppProject)(folder, 'WithWinUI3', false, false, false);
|
|
203
|
+
const rnc = require(path_1.default.join(folder, 'react-native.config.js'));
|
|
204
|
+
const config = (0, projectConfig_1.projectConfigWindows)(folder, rnc.project.windows);
|
|
205
|
+
// Set useWinUI3=true in react-native.config.js
|
|
206
|
+
config.useWinUI3 = true;
|
|
207
|
+
const al = new AutoLinkTest({ windows: config }, {}, {
|
|
208
|
+
check: false,
|
|
209
|
+
logging: false,
|
|
210
|
+
});
|
|
211
|
+
al.experimentalFeaturesProps = `<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"><PropertyGroup><UseWinUI3>false</UseWinUI3></PropertyGroup></Project>`;
|
|
212
|
+
al.packagesConfig = `<packages><package id="SuperPkg" version="42"/></packages>`;
|
|
213
|
+
const exd = await al.ensureXAMLDialect();
|
|
214
|
+
expect(exd).toBeTruthy();
|
|
215
|
+
const expectedExperimentalFeatures = '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"><PropertyGroup><UseWinUI3>true</UseWinUI3></PropertyGroup></Project>';
|
|
216
|
+
expect(al.experimentalFeaturesProps).toEqual(expectedExperimentalFeatures);
|
|
217
|
+
// example packages.config:
|
|
218
|
+
// <packages>
|
|
219
|
+
// <package id="SuperPkg" version="42"/>
|
|
220
|
+
// <package id="Microsoft.WindowsAppSDK" version="1.0.0" targetFramework="native"/>
|
|
221
|
+
// </packages>
|
|
222
|
+
//
|
|
223
|
+
expect(al.packagesConfig).toContain('Microsoft.WindowsAppSDK');
|
|
224
|
+
expect(al.packagesConfig).toContain('<package id="SuperPkg" version="42"/>');
|
|
225
|
+
expect(al.packagesConfig).not.toContain('Microsoft.UI.Xaml');
|
|
226
|
+
});
|
|
227
|
+
test('ensureXAMLDialect - useWinUI3=false in react-native.config.js, useWinUI3=true in ExperimentalFeatures.props', async () => {
|
|
228
|
+
const folder = path_1.default.resolve('src/e2etest/projects/WithWinUI3');
|
|
229
|
+
const rnc = require(path_1.default.join(folder, 'react-native.config.js'));
|
|
230
|
+
const config = (0, projectConfig_1.projectConfigWindows)(folder, rnc.project.windows);
|
|
231
|
+
config.useWinUI3 = false;
|
|
232
|
+
const al = new AutoLinkTest({ windows: config }, {}, {
|
|
233
|
+
check: false,
|
|
234
|
+
logging: false,
|
|
235
|
+
});
|
|
236
|
+
al.experimentalFeaturesProps = `<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"><PropertyGroup><UseWinUI3>true</UseWinUI3></PropertyGroup></Project>`;
|
|
237
|
+
al.packagesConfig = `<packages><package id="SuperPkg" version="42"/></packages>`;
|
|
238
|
+
const exd = await al.ensureXAMLDialect();
|
|
239
|
+
expect(exd).toBeTruthy();
|
|
240
|
+
const expectedExperimentalFeatures = '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"><PropertyGroup><UseWinUI3>false</UseWinUI3></PropertyGroup></Project>';
|
|
241
|
+
expect(al.experimentalFeaturesProps).toEqual(expectedExperimentalFeatures);
|
|
242
|
+
// example packages.config:
|
|
243
|
+
// <packages>
|
|
244
|
+
// <package id="SuperPkg" version="42"/>
|
|
245
|
+
// <package id="Microsoft.WindowsAppSDK" version="1.0.0" targetFramework="native"/>
|
|
246
|
+
// </packages>
|
|
247
|
+
//
|
|
248
|
+
expect(al.packagesConfig).not.toContain('Microsoft.WindowsAppSDK');
|
|
249
|
+
expect(al.packagesConfig).toContain('<package id="SuperPkg" version="42"/>');
|
|
250
|
+
expect(al.packagesConfig).toContain('Microsoft.UI.Xaml');
|
|
251
|
+
});
|
|
252
|
+
test('ensureXAMLDialect - useWinUI3 not in react-native.config.js, useWinUI3=true in ExperimentalFeatures.props', async () => {
|
|
253
|
+
const folder = path_1.default.resolve('src/e2etest/projects/WithWinUI3');
|
|
254
|
+
const rnc = require(path_1.default.join(folder, 'react-native.config.js'));
|
|
255
|
+
const config = (0, projectConfig_1.projectConfigWindows)(folder, rnc.project.windows);
|
|
256
|
+
delete config.useWinUI3;
|
|
257
|
+
const al = new AutoLinkTest({ windows: config }, {}, {
|
|
258
|
+
check: false,
|
|
259
|
+
logging: false,
|
|
260
|
+
});
|
|
261
|
+
al.experimentalFeaturesProps = `<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"><PropertyGroup><UseWinUI3>true</UseWinUI3></PropertyGroup></Project>`;
|
|
262
|
+
al.packagesConfig = `<packages><package id="SuperPkg" version="42"/></packages>`;
|
|
263
|
+
const exd = await al.ensureXAMLDialect();
|
|
264
|
+
expect(exd).toBeTruthy();
|
|
265
|
+
const expectedExperimentalFeatures = '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"><PropertyGroup><UseWinUI3>true</UseWinUI3></PropertyGroup></Project>';
|
|
266
|
+
expect(al.experimentalFeaturesProps).toEqual(expectedExperimentalFeatures);
|
|
267
|
+
// example packages.config:
|
|
268
|
+
// <packages>
|
|
269
|
+
// <package id="SuperPkg" version="42"/>
|
|
270
|
+
// <package id="Microsoft.WindowsAppSDK" version="1.0.0" targetFramework="native"/>
|
|
271
|
+
// </packages>
|
|
272
|
+
//
|
|
273
|
+
expect(al.packagesConfig).toContain('Microsoft.WindowsAppSDK');
|
|
274
|
+
expect(al.packagesConfig).toContain('<package id="SuperPkg" version="42"/>');
|
|
275
|
+
expect(al.packagesConfig).not.toContain('Microsoft.UI.Xaml');
|
|
276
|
+
});
|
|
277
|
+
test('ensureXAMLDialect - useWinUI3 not in react-native.config.js, useWinUI3=false in ExperimentalFeatures.props', async () => {
|
|
278
|
+
const folder = path_1.default.resolve('src/e2etest/projects/WithWinUI3');
|
|
279
|
+
const rnc = require(path_1.default.join(folder, 'react-native.config.js'));
|
|
280
|
+
const config = (0, projectConfig_1.projectConfigWindows)(folder, rnc.project.windows);
|
|
281
|
+
delete config.useWinUI3;
|
|
282
|
+
const al = new AutoLinkTest({ windows: config }, {}, {
|
|
283
|
+
check: false,
|
|
284
|
+
logging: false,
|
|
285
|
+
});
|
|
286
|
+
al.experimentalFeaturesProps = `<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"><PropertyGroup><UseWinUI3>false</UseWinUI3></PropertyGroup></Project>`;
|
|
287
|
+
al.packagesConfig = `<packages><package id="SuperPkg" version="42"/><package id="Microsoft.WindowsAppSDK"/></packages>`;
|
|
288
|
+
const exd = await al.ensureXAMLDialect();
|
|
289
|
+
expect(exd).toBeTruthy();
|
|
290
|
+
const expectedExperimentalFeatures = `<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"><PropertyGroup><UseWinUI3>false</UseWinUI3></PropertyGroup></Project>`;
|
|
291
|
+
expect(al.experimentalFeaturesProps).toEqual(expectedExperimentalFeatures);
|
|
292
|
+
// example packages.config:
|
|
293
|
+
// <packages>
|
|
294
|
+
// <package id="SuperPkg" version="42"/>
|
|
295
|
+
// <package id="Microsoft.WindowsAppSDK" version="1.0.0" targetFramework="native"/>
|
|
296
|
+
// </packages>
|
|
297
|
+
//
|
|
298
|
+
expect(al.packagesConfig).not.toContain('Microsoft.WindowsAppSDK');
|
|
299
|
+
expect(al.packagesConfig).toContain('<package id="SuperPkg" version="42"/>');
|
|
300
|
+
expect(al.packagesConfig).toContain('Microsoft.UI.Xaml');
|
|
301
|
+
});
|
|
302
|
+
test('Indirect autolink dependency', () => {
|
|
303
|
+
const autolink = new AutoLinkTest({ windows: { folder: __dirname, sourceDir: '.', solutionFile: 'foo.sln' } }, {
|
|
304
|
+
superModule: {
|
|
305
|
+
name: 'superModule',
|
|
306
|
+
root: 'theRoot',
|
|
307
|
+
platforms: {
|
|
308
|
+
windows: {
|
|
309
|
+
sourceDir: __dirname,
|
|
310
|
+
projects: [
|
|
311
|
+
{
|
|
312
|
+
directDependency: true,
|
|
313
|
+
projectFile: 'superModule.vcxproj',
|
|
314
|
+
cppHeaders: ['Garfield.h', 'Snoopy.h'],
|
|
315
|
+
cppPackageProviders: ['FamousAnimalCartoons'],
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
directDependency: false,
|
|
319
|
+
projectFile: 'indirect.vcxproj',
|
|
320
|
+
},
|
|
321
|
+
],
|
|
322
|
+
},
|
|
323
|
+
},
|
|
324
|
+
},
|
|
325
|
+
}, {
|
|
326
|
+
check: true,
|
|
327
|
+
logging: false,
|
|
328
|
+
proj: 'projects/WithIndirectDependency/windows/WithIndirectDependency/WithIndirectDependency.vcxproj',
|
|
329
|
+
});
|
|
330
|
+
const replacements = autolink.getCppReplacements();
|
|
331
|
+
expect(replacements.cppIncludes).toMatch(/#include <Garfield.h>/);
|
|
332
|
+
expect(replacements.cppIncludes).toMatch(/#include <Snoopy.h>/);
|
|
333
|
+
expect(replacements.cppPackageProviders).toContain('packageProviders.Append(winrt::FamousAnimalCartoons())');
|
|
334
|
+
});
|
|
335
|
+
function validateOptionName(name, optionName) {
|
|
336
|
+
// Do not add a default case here. Every item must explicitly return true
|
|
337
|
+
switch (optionName) {
|
|
338
|
+
case 'check':
|
|
339
|
+
case 'logging':
|
|
340
|
+
case 'sln':
|
|
341
|
+
case 'proj':
|
|
342
|
+
case 'telemetry':
|
|
343
|
+
return true;
|
|
344
|
+
}
|
|
345
|
+
throw new Error(`Unable to find ${optionName} to match '${name}' in AutoLinkOptions.`);
|
|
346
|
+
}
|
|
347
|
+
test('autolinkOptions - validate options', () => {
|
|
348
|
+
for (const commandOption of autolinkWindowsOptions_1.autolinkOptions) {
|
|
349
|
+
// Validate names
|
|
350
|
+
expect(commandOption.name).not.toBeNull();
|
|
351
|
+
expect(commandOption.name.startsWith('--')).toBe(true);
|
|
352
|
+
expect(commandOption.name).toBe(commandOption.name.trim());
|
|
353
|
+
// Validate defaults
|
|
354
|
+
if (!commandOption.name.endsWith(' [string]') &&
|
|
355
|
+
!commandOption.name.endsWith(' [number]')) {
|
|
356
|
+
// Commander ignores defaults for flags, so leave undefined to prevent confusion
|
|
357
|
+
expect(commandOption.default).toBeUndefined();
|
|
358
|
+
}
|
|
359
|
+
// Validate description
|
|
360
|
+
expect(commandOption.description).not.toBeNull();
|
|
361
|
+
expect(commandOption.description).toBe(commandOption.description.trim());
|
|
362
|
+
// Validate all command options are present in AutoLinkOptions
|
|
363
|
+
const optionName = (0, telemetry_1.commanderNameToOptionName)(commandOption.name);
|
|
364
|
+
expect(validateOptionName(commandOption.name, optionName)).toBe(true);
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
//# sourceMappingURL=autolink.test.js.map
|