@react-native-windows/cli 0.0.0-canary.13 → 0.0.0-canary.130

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.
Files changed (80) hide show
  1. package/README.md +47 -0
  2. package/lib-commonjs/config/configUtils.d.ts +25 -2
  3. package/lib-commonjs/config/configUtils.js +138 -30
  4. package/lib-commonjs/config/configUtils.js.map +1 -1
  5. package/lib-commonjs/config/dependencyConfig.js +104 -43
  6. package/lib-commonjs/config/dependencyConfig.js.map +1 -1
  7. package/lib-commonjs/config/projectConfig.d.ts +4 -1
  8. package/lib-commonjs/config/projectConfig.js +72 -12
  9. package/lib-commonjs/config/projectConfig.js.map +1 -1
  10. package/lib-commonjs/e2etest/autolink.test.d.ts +6 -0
  11. package/lib-commonjs/e2etest/autolink.test.js +386 -0
  12. package/lib-commonjs/e2etest/autolink.test.js.map +1 -0
  13. package/lib-commonjs/e2etest/dependencyConfig.test.d.ts +6 -0
  14. package/lib-commonjs/e2etest/dependencyConfig.test.js +130 -0
  15. package/lib-commonjs/e2etest/dependencyConfig.test.js.map +1 -0
  16. package/lib-commonjs/e2etest/projectConfig.test.d.ts +6 -0
  17. package/lib-commonjs/e2etest/projectConfig.test.js +111 -0
  18. package/lib-commonjs/e2etest/projectConfig.test.js.map +1 -0
  19. package/lib-commonjs/e2etest/projectConfig.utils.d.ts +8 -0
  20. package/lib-commonjs/e2etest/projectConfig.utils.js +77 -0
  21. package/lib-commonjs/e2etest/projectConfig.utils.js.map +1 -0
  22. package/lib-commonjs/e2etest/runWindows.test.d.ts +6 -0
  23. package/lib-commonjs/e2etest/runWindows.test.js +61 -0
  24. package/lib-commonjs/e2etest/runWindows.test.js.map +1 -0
  25. package/lib-commonjs/generator-common/index.d.ts +16 -0
  26. package/lib-commonjs/generator-common/index.js +60 -39
  27. package/lib-commonjs/generator-common/index.js.map +1 -1
  28. package/lib-commonjs/generator-windows/index.d.ts +2 -2
  29. package/lib-commonjs/generator-windows/index.js +265 -182
  30. package/lib-commonjs/generator-windows/index.js.map +1 -1
  31. package/lib-commonjs/healthChecks.d.ts +2 -0
  32. package/lib-commonjs/healthChecks.js +88 -0
  33. package/lib-commonjs/healthChecks.js.map +1 -0
  34. package/lib-commonjs/index.d.ts +5 -0
  35. package/lib-commonjs/index.js +28 -8
  36. package/lib-commonjs/index.js.map +1 -1
  37. package/lib-commonjs/runWindows/runWindows.js +239 -52
  38. package/lib-commonjs/runWindows/runWindows.js.map +1 -1
  39. package/lib-commonjs/runWindows/runWindowsOptions.d.ts +14 -10
  40. package/lib-commonjs/runWindows/runWindowsOptions.js +15 -11
  41. package/lib-commonjs/runWindows/runWindowsOptions.js.map +1 -1
  42. package/lib-commonjs/runWindows/utils/autolink.d.ts +88 -1
  43. package/lib-commonjs/runWindows/utils/autolink.js +594 -260
  44. package/lib-commonjs/runWindows/utils/autolink.js.map +1 -1
  45. package/lib-commonjs/runWindows/utils/build.d.ts +1 -2
  46. package/lib-commonjs/runWindows/utils/build.js +24 -31
  47. package/lib-commonjs/runWindows/utils/build.js.map +1 -1
  48. package/lib-commonjs/runWindows/utils/checkRequirements.js +11 -7
  49. package/lib-commonjs/runWindows/utils/checkRequirements.js.map +1 -1
  50. package/lib-commonjs/runWindows/utils/commandWithProgress.d.ts +11 -3
  51. package/lib-commonjs/runWindows/utils/commandWithProgress.js +58 -22
  52. package/lib-commonjs/runWindows/utils/commandWithProgress.js.map +1 -1
  53. package/lib-commonjs/runWindows/utils/deploy.d.ts +1 -1
  54. package/lib-commonjs/runWindows/utils/deploy.js +168 -82
  55. package/lib-commonjs/runWindows/utils/deploy.js.map +1 -1
  56. package/lib-commonjs/runWindows/utils/info.js +5 -2
  57. package/lib-commonjs/runWindows/utils/info.js.map +1 -1
  58. package/lib-commonjs/runWindows/utils/msbuildtools.d.ts +11 -5
  59. package/lib-commonjs/runWindows/utils/msbuildtools.js +148 -64
  60. package/lib-commonjs/runWindows/utils/msbuildtools.js.map +1 -1
  61. package/lib-commonjs/runWindows/utils/telemetryHelpers.d.ts +29 -0
  62. package/lib-commonjs/runWindows/utils/telemetryHelpers.js +113 -0
  63. package/lib-commonjs/runWindows/utils/telemetryHelpers.js.map +1 -0
  64. package/lib-commonjs/runWindows/utils/version.d.ts +4 -4
  65. package/lib-commonjs/runWindows/utils/version.js.map +1 -1
  66. package/lib-commonjs/runWindows/utils/vsInstalls.d.ts +4 -1
  67. package/lib-commonjs/runWindows/utils/vsInstalls.js +22 -7
  68. package/lib-commonjs/runWindows/utils/vsInstalls.js.map +1 -1
  69. package/lib-commonjs/runWindows/utils/vstools.d.ts +1 -0
  70. package/lib-commonjs/runWindows/utils/vstools.js +40 -27
  71. package/lib-commonjs/runWindows/utils/vstools.js.map +1 -1
  72. package/lib-commonjs/runWindows/utils/winappdeploytool.d.ts +3 -3
  73. package/lib-commonjs/runWindows/utils/winappdeploytool.js +17 -14
  74. package/lib-commonjs/runWindows/utils/winappdeploytool.js.map +1 -1
  75. package/package.json +40 -22
  76. package/powershell/Add-AppDevPackage.ps1 +2 -2
  77. package/powershell/Eval-MsBuildProperties.ps1 +156 -0
  78. package/powershell/WindowsStoreAppUtils.ps1 +10 -0
  79. package/CHANGELOG.json +0 -185
  80. package/CHANGELOG.md +0 -93
@@ -4,11 +4,15 @@
4
4
  * Licensed under the MIT License.
5
5
  * @format
6
6
  */
7
+ var __importDefault = (this && this.__importDefault) || function (mod) {
8
+ return (mod && mod.__esModule) ? mod : { "default": mod };
9
+ };
7
10
  Object.defineProperty(exports, "__esModule", { value: true });
8
11
  exports.findLatestVsInstall = exports.enumerateVsInstalls = void 0;
12
+ const telemetry_1 = require("@react-native-windows/telemetry");
9
13
  const child_process_1 = require("child_process");
10
- const fs = require("fs");
11
- const path = require("path");
14
+ const fs_1 = __importDefault(require("@react-native-windows/fs"));
15
+ const path_1 = __importDefault(require("path"));
12
16
  /**
13
17
  * Helper to run vswhere in JSON mode
14
18
  *
@@ -17,14 +21,19 @@ const path = require("path");
17
21
  */
18
22
  function vsWhere(args, verbose) {
19
23
  // This path is maintained and VS has promised to keep it valid.
20
- const vsWherePath = path.join(process.env['ProgramFiles(x86)'] || process.env.ProgramFiles, '/Microsoft Visual Studio/Installer/vswhere.exe');
24
+ const vsWherePath = path_1.default.join(process.env['ProgramFiles(x86)'] || process.env.ProgramFiles, '/Microsoft Visual Studio/Installer/vswhere.exe');
21
25
  if (verbose) {
22
26
  console.log('Looking for vswhere at: ' + vsWherePath);
23
27
  }
24
- if (!fs.existsSync(vsWherePath)) {
25
- throw new Error(`Unable to find vswhere at ${vsWherePath}`);
28
+ if (!fs_1.default.existsSync(vsWherePath)) {
29
+ throw new telemetry_1.CodedError('NoVSWhere', `Unable to find vswhere at ${vsWherePath}`);
26
30
  }
27
- return JSON.parse(child_process_1.execSync(`"${vsWherePath}" ${args.join(' ')} -format json -utf8`).toString('utf8'));
31
+ const cmdline = `"${vsWherePath}" ${args.join(' ')} -format json -utf8`;
32
+ const json = JSON.parse((0, child_process_1.execSync)(cmdline).toString('utf8'));
33
+ for (const entry of json) {
34
+ entry.prerelease = entry.catalog.productMilestoneIsPreRelease;
35
+ }
36
+ return json;
28
37
  }
29
38
  /**
30
39
  * Enumerate the installed versions of Visual Studio
@@ -40,6 +49,9 @@ function enumerateVsInstalls(opts) {
40
49
  if (opts.latest) {
41
50
  args.push('-latest');
42
51
  }
52
+ if (opts.prerelease) {
53
+ args.push('-prerelease');
54
+ }
43
55
  return vsWhere(args, opts.verbose);
44
56
  }
45
57
  exports.enumerateVsInstalls = enumerateVsInstalls;
@@ -47,7 +59,10 @@ exports.enumerateVsInstalls = enumerateVsInstalls;
47
59
  * Find the latest available VS installation that matches the given constraints
48
60
  */
49
61
  function findLatestVsInstall(opts) {
50
- const installs = enumerateVsInstalls(Object.assign(Object.assign({}, opts), { latest: true }));
62
+ let installs = enumerateVsInstalls({ ...opts, latest: true });
63
+ if (opts.prerelease && installs.length > 0) {
64
+ installs = installs.filter(x => x.prerelease === 'True');
65
+ }
51
66
  if (installs.length > 0) {
52
67
  return installs[0];
53
68
  }
@@ -1 +1 @@
1
- {"version":3,"file":"vsInstalls.js","sourceRoot":"","sources":["../../../src/runWindows/utils/vsInstalls.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,iDAAuC;AACvC,yBAAyB;AACzB,6BAA6B;AAW7B;;;;;GAKG;AACH,SAAS,OAAO,CAAC,IAAc,EAAE,OAAiB;IAChD,gEAAgE;IAChE,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAC3B,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,YAAa,EAC7D,gDAAgD,CACjD,CAAC;IAEF,IAAI,OAAO,EAAE;QACX,OAAO,CAAC,GAAG,CAAC,0BAA0B,GAAG,WAAW,CAAC,CAAC;KACvD;IAED,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE;QAC/B,MAAM,IAAI,KAAK,CAAC,6BAA6B,WAAW,EAAE,CAAC,CAAC;KAC7D;IAED,OAAO,IAAI,CAAC,KAAK,CACf,wBAAQ,CAAC,IAAI,WAAW,KAAK,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,QAAQ,CACxE,MAAM,CACP,CACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAgB,mBAAmB,CAAC,IAKnC;IACC,MAAM,IAAI,GAAa,EAAE,CAAC;IAE1B,IAAI,IAAI,CAAC,OAAO,EAAE;QAChB,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;KACrE;IAED,IAAI,IAAI,CAAC,QAAQ,EAAE;QACjB,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;KACnD;IAED,IAAI,IAAI,CAAC,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,MAAM,GAAG,CAAC,EAAE;QACvB,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC;KACpB;SAAM;QACL,OAAO,IAAI,CAAC;KACb;AACH,CAAC;AAjBD,kDAiBC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport {CodedError} from '@react-native-windows/telemetry';\nimport {execSync} from 'child_process';\nimport fs from '@react-native-windows/fs';\nimport path from 'path';\n\n/**\n * A subset of the per-instance properties returned by vswhere\n */\ninterface VisualStudioInstallation {\n instanceId: string;\n installationPath: string;\n installationVersion: string;\n prerelease: string;\n}\n\n/**\n * Helper to run vswhere in JSON mode\n *\n * @param args Arguments to pass to vsWhere\n * @param verbose enable verbose logging\n */\nfunction vsWhere(args: string[], verbose?: boolean): any[] {\n // This path is maintained and VS has promised to keep it valid.\n const vsWherePath = path.join(\n process.env['ProgramFiles(x86)'] || process.env.ProgramFiles!,\n '/Microsoft Visual Studio/Installer/vswhere.exe',\n );\n\n if (verbose) {\n console.log('Looking for vswhere at: ' + vsWherePath);\n }\n\n if (!fs.existsSync(vsWherePath)) {\n throw new CodedError(\n 'NoVSWhere',\n `Unable to find vswhere at ${vsWherePath}`,\n );\n }\n\n const cmdline = `\"${vsWherePath}\" ${args.join(' ')} -format json -utf8`;\n const json = JSON.parse(execSync(cmdline).toString('utf8'));\n\n for (const entry of json) {\n entry.prerelease = entry.catalog.productMilestoneIsPreRelease;\n }\n\n return json;\n}\n\n/**\n * Enumerate the installed versions of Visual Studio\n */\nexport function enumerateVsInstalls(opts: {\n requires?: string[];\n version?: string;\n verbose?: boolean;\n latest?: boolean;\n prerelease?: boolean;\n}): VisualStudioInstallation[] {\n const args: string[] = [];\n\n if (opts.version) {\n args.push(`-version [${opts.version},${Number(opts.version) + 1})`);\n }\n\n if (opts.requires) {\n args.push(`-requires ${opts.requires.join(' ')}`);\n }\n\n if (opts.latest) {\n args.push('-latest');\n }\n\n if (opts.prerelease) {\n args.push('-prerelease');\n }\n\n return vsWhere(args, opts.verbose);\n}\n\n/**\n * Find the latest available VS installation that matches the given constraints\n */\nexport function findLatestVsInstall(opts: {\n requires?: string[];\n minVersion?: string;\n verbose?: boolean;\n prerelease?: boolean;\n}): VisualStudioInstallation | null {\n let installs = enumerateVsInstalls({...opts, latest: true});\n\n if (opts.prerelease && installs.length > 0) {\n installs = installs.filter(x => x.prerelease === 'True');\n }\n\n if (installs.length > 0) {\n return installs[0];\n } else {\n return null;\n }\n}\n"]}
@@ -4,6 +4,7 @@
4
4
  * @format
5
5
  */
6
6
  import { Project } from '../../config/projectConfig';
7
+ export declare const dotNetCoreProjectTypeGuid = "{9A19103F-16F7-4668-BE54-9A1E7A4F7556}";
7
8
  /**
8
9
  * Adds the necessary info from a VS project into a VS solution file so that it will build.
9
10
  * @param slnFile The Absolute path to the target VS solution file.
@@ -4,15 +4,20 @@
4
4
  * Licensed under the MIT License.
5
5
  * @format
6
6
  */
7
+ var __importDefault = (this && this.__importDefault) || function (mod) {
8
+ return (mod && mod.__esModule) ? mod : { "default": mod };
9
+ };
7
10
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.addProjectToSolution = void 0;
9
- const fs = require("fs");
10
- const path = require("path");
11
- const chalk = require("chalk");
11
+ exports.addProjectToSolution = exports.dotNetCoreProjectTypeGuid = void 0;
12
+ const fs_1 = __importDefault(require("@react-native-windows/fs"));
13
+ const path_1 = __importDefault(require("path"));
14
+ const chalk_1 = __importDefault(require("chalk"));
15
+ const telemetry_1 = require("@react-native-windows/telemetry");
12
16
  const projectTypeGuidsByLanguage = {
13
17
  cpp: '{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}',
14
18
  cs: '{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}',
15
19
  };
20
+ exports.dotNetCoreProjectTypeGuid = '{9A19103F-16F7-4668-BE54-9A1E7A4F7556}';
16
21
  /**
17
22
  * Checks is the given block of lines exists within an array of lines.
18
23
  * @param lines The array of lines to search.
@@ -21,7 +26,7 @@ const projectTypeGuidsByLanguage = {
21
26
  */
22
27
  function linesContainsBlock(lines, block) {
23
28
  if (block.length > 0) {
24
- var startIndex = lines.indexOf(block[0]);
29
+ const startIndex = lines.indexOf(block[0]);
25
30
  if (startIndex >= 0) {
26
31
  for (let i = 1; i < block.length; i++) {
27
32
  if (lines[startIndex + i] !== block[i]) {
@@ -75,23 +80,24 @@ function getBlockContentsFromLines(lines, startLine, endLine, includeStartEnd =
75
80
  */
76
81
  function addProjectToSolution(slnFile, project, verbose = false, checkMode = false) {
77
82
  if (project.projectLang === null) {
78
- throw new Error('Unable to add project to solution, projectLang is null');
83
+ throw new telemetry_1.CodedError('AddProjectToSolution', 'Unable to add project to solution, projectLang is null');
79
84
  }
80
85
  if (project.projectGuid === null) {
81
- throw new Error('Unable to add project to solution, projectGuid is null');
86
+ throw new telemetry_1.CodedError('AddProjectToSolution', 'Unable to add project to solution, projectGuid is null');
82
87
  }
83
88
  if (verbose) {
84
- console.log(`Processing ${chalk.bold(path.basename(project.projectFile))}...`);
89
+ console.log(`Processing ${chalk_1.default.bold(path_1.default.basename(project.projectFile))}...`);
85
90
  }
86
- let slnLines = fs
87
- .readFileSync(slnFile)
88
- .toString()
89
- .split('\r\n');
91
+ const originalSlnContents = fs_1.default.readFileSync(slnFile).toString();
92
+ const isCRLF = originalSlnContents.includes('\r\n');
93
+ const slnLines = originalSlnContents.split(isCRLF ? '\r\n' : '\n');
90
94
  let contentsChanged = false;
91
95
  // Check for the project entry block
92
- const slnDir = path.dirname(slnFile);
93
- const relProjectFile = path.relative(slnDir, project.projectFile);
94
- const projectTypeGuid = projectTypeGuidsByLanguage[project.projectLang];
96
+ const slnDir = path_1.default.dirname(slnFile);
97
+ const relProjectFile = path_1.default.relative(slnDir, project.projectFile);
98
+ const projectTypeGuid = 'projectTypeGuid' in project
99
+ ? project.projectTypeGuid
100
+ : projectTypeGuidsByLanguage[project.projectLang];
95
101
  const projectGuid = project.projectGuid.toUpperCase();
96
102
  const projectEntryBlock = [
97
103
  `Project("${projectTypeGuid}") = "${project.projectName}", "${relProjectFile}", "${projectGuid}"`,
@@ -99,24 +105,31 @@ function addProjectToSolution(slnFile, project, verbose = false, checkMode = fal
99
105
  ];
100
106
  if (!linesContainsBlock(slnLines, projectEntryBlock)) {
101
107
  if (verbose) {
102
- console.log(chalk.yellow('Missing project entry block.'));
108
+ console.log(chalk_1.default.yellow('Missing project entry block.'));
103
109
  }
104
110
  const globalIndex = slnLines.indexOf('Global');
105
111
  insertBlockIntoLines(slnLines, projectEntryBlock, globalIndex);
106
112
  contentsChanged = true;
107
113
  }
108
114
  // Check for the project configuration platforms
109
- const slnConfigs = getBlockContentsFromLines(slnLines, '\tGlobalSection(SolutionConfigurationPlatforms) = preSolution', '\tEndGlobalSection', false).map(line => line.match(/\s+([\w|]+)\s=/)[1]);
110
- let projectConfigLines = [];
115
+ const slnConfigs = getBlockContentsFromLines(slnLines, '\tGlobalSection(SolutionConfigurationPlatforms) = preSolution', '\tEndGlobalSection', false).map(line => line.match(/\s+([\w\s|]+)\s=/)[1]);
116
+ const projectConfigLines = [];
111
117
  slnConfigs.forEach(slnConfig => {
112
- projectConfigLines.push(`\t\t${projectGuid}.${slnConfig}.ActiveCfg = ${slnConfig.replace('x86', 'Win32')}`);
113
- projectConfigLines.push(`\t\t${projectGuid}.${slnConfig}.Build.0 = ${slnConfig.replace('x86', 'Win32')}`);
118
+ if (!slnConfig.endsWith('|Any CPU')) {
119
+ projectConfigLines.push(`\t\t${projectGuid}.${slnConfig}.ActiveCfg = ${project.projectLang === 'cpp'
120
+ ? slnConfig.replace('x86', 'Win32')
121
+ : slnConfig}`);
122
+ projectConfigLines.push(`\t\t${projectGuid}.${slnConfig}.Build.0 = ${project.projectLang === 'cpp'
123
+ ? slnConfig.replace('x86', 'Win32')
124
+ : slnConfig}`);
125
+ }
114
126
  });
115
127
  const projectConfigStartIndex = slnLines.indexOf('\tGlobalSection(ProjectConfigurationPlatforms) = postSolution');
116
128
  projectConfigLines.forEach(projectConfigLine => {
117
- if (slnLines.indexOf(projectConfigLine) < 0) {
129
+ if (!slnLines.includes(projectConfigLine)) {
118
130
  if (verbose) {
119
- console.log(chalk.yellow('Missing project config block.'));
131
+ const configLine = projectConfigLine.substr(projectConfigLine.indexOf('= ') + 2);
132
+ console.log(chalk_1.default.yellow(`Missing ${configLine} config block.`));
120
133
  }
121
134
  const projectConfigEndIndex = slnLines.indexOf('\tEndGlobalSection', projectConfigStartIndex);
122
135
  slnLines.splice(projectConfigEndIndex, 0, projectConfigLine);
@@ -126,14 +139,14 @@ function addProjectToSolution(slnFile, project, verbose = false, checkMode = fal
126
139
  // Write out new solution file if there were changes
127
140
  if (contentsChanged) {
128
141
  if (verbose) {
129
- console.log(chalk.yellow(`${chalk.bold(path.basename(slnFile))} needs to be updated.`));
142
+ console.log(chalk_1.default.yellow(`${chalk_1.default.bold(path_1.default.basename(slnFile))} needs to be updated.`));
130
143
  }
131
144
  if (!checkMode) {
132
145
  if (verbose) {
133
- console.log(`Writing changes to ${chalk.bold(path.basename(slnFile))}...`);
146
+ console.log(`Writing changes to ${chalk_1.default.bold(path_1.default.basename(slnFile))}...`);
134
147
  }
135
- const slnContents = slnLines.join('\r\n');
136
- fs.writeFileSync(slnFile, slnContents, {
148
+ const slnContents = slnLines.join(isCRLF ? '\r\n' : '\n');
149
+ fs_1.default.writeFileSync(slnFile, slnContents, {
137
150
  encoding: 'utf8',
138
151
  flag: 'w',
139
152
  });
@@ -141,7 +154,7 @@ function addProjectToSolution(slnFile, project, verbose = false, checkMode = fal
141
154
  }
142
155
  else {
143
156
  if (verbose) {
144
- console.log(`No changes to ${chalk.bold(path.basename(slnFile))}.`);
157
+ console.log(`No changes to ${chalk_1.default.bold(path_1.default.basename(slnFile))}.`);
145
158
  }
146
159
  }
147
160
  return contentsChanged;
@@ -1 +1 @@
1
- {"version":3,"file":"vstools.js","sourceRoot":"","sources":["../../../src/runWindows/utils/vstools.ts"],"names":[],"mappings":";AAAA;;;;G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Q,CAAC,OAAO,CAAC,CAAC,uBAAuB,CAC7D,CACF,CAAC;SACH;QAED,IAAI,CAAC,SAAS,EAAE;YACd,IAAI,OAAO,EAAE;gBACX,OAAO,CAAC,GAAG,CACT,sBAAsB,eAAK,CAAC,IAAI,CAAC,cAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,CAC9D,CAAC;aACH;YAED,MAAM,WAAW,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YAC1D,YAAE,CAAC,aAAa,CAAC,OAAO,EAAE,WAAW,EAAE;gBACrC,QAAQ,EAAE,MAAM;gBAChB,IAAI,EAAE,GAAG;aACV,CAAC,CAAC;SACJ;KACF;SAAM;QACL,IAAI,OAAO,EAAE;YACX,OAAO,CAAC,GAAG,CAAC,iBAAiB,eAAK,CAAC,IAAI,CAAC,cAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC;SACrE;KACF;IAED,OAAO,eAAe,CAAC;AACzB,CAAC;AAhJD,oDAgJC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n * @format\n */\n\nimport fs from '@react-native-windows/fs';\nimport path from 'path';\nimport chalk from 'chalk';\nimport {Project} from '../../config/projectConfig';\nimport {CodedError} from '@react-native-windows/telemetry';\n\nconst projectTypeGuidsByLanguage = {\n cpp: '{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}',\n cs: '{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}',\n};\n\nexport const dotNetCoreProjectTypeGuid =\n '{9A19103F-16F7-4668-BE54-9A1E7A4F7556}';\n\n/**\n * Checks is the given block of lines exists within an array of lines.\n * @param lines The array of lines to search.\n * @param block The block of lines to search for.\n * @return True if the block of lines does exist within lines.\n */\nfunction linesContainsBlock(lines: string[], block: string[]): boolean {\n if (block.length > 0) {\n const startIndex = lines.indexOf(block[0]);\n\n if (startIndex >= 0) {\n for (let i = 1; i < block.length; i++) {\n if (lines[startIndex + i] !== block[i]) {\n return false;\n }\n }\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * Insert the given block of lines into an array of lines.\n * @param lines The array of lines to insert into.\n * @param block The block of lines to insert.\n * @param index The index to perform the insert.\n */\nfunction insertBlockIntoLines(lines: string[], block: string[], index: number) {\n for (let i = 0; i < block.length; i++) {\n lines.splice(index + i, 0, block[i]);\n }\n}\n\n/**\n * Search through an array of lines for a block of lines starting with startLine and ending with endLine.\n * @param lines The array of lines to search.\n * @param startLine The first line of the block.\n * @param endLine The last line of the block.\n * @param includeStartEnd Include the start and end lines in the result.\n * @return The found block of lines, if found.\n */\nfunction getBlockContentsFromLines(\n lines: string[],\n startLine: string,\n endLine: string,\n includeStartEnd: boolean = true,\n): string[] {\n const startIndex = lines.indexOf(startLine);\n const endIndex = lines.indexOf(endLine, startIndex);\n\n if (startIndex >= 0 && startIndex < endIndex) {\n if (includeStartEnd) {\n return lines.slice(startIndex, endIndex + 1);\n } else if (startIndex + 1 < endIndex) {\n return lines.slice(startIndex + 1, endIndex);\n }\n }\n\n return [];\n}\n\n/**\n * Adds the necessary info from a VS project into a VS solution file so that it will build.\n * @param slnFile The Absolute path to the target VS solution file.\n * @param project The object representing the project info.\n * @param verbose If true, enable verbose logging.\n * @param checkMode It true, don't make any changes.\n * @return Whether any changes were necessary.\n */\nexport function addProjectToSolution(\n slnFile: string,\n project: Project,\n verbose: boolean = false,\n checkMode: boolean = false,\n): boolean {\n if (project.projectLang === null) {\n throw new CodedError(\n 'AddProjectToSolution',\n 'Unable to add project to solution, projectLang is null',\n );\n }\n\n if (project.projectGuid === null) {\n throw new CodedError(\n 'AddProjectToSolution',\n 'Unable to add project to solution, projectGuid is null',\n );\n }\n\n if (verbose) {\n console.log(\n `Processing ${chalk.bold(path.basename(project.projectFile))}...`,\n );\n }\n\n const originalSlnContents = fs.readFileSync(slnFile).toString();\n\n const isCRLF = originalSlnContents.includes('\\r\\n');\n\n const slnLines = originalSlnContents.split(isCRLF ? '\\r\\n' : '\\n');\n\n let contentsChanged = false;\n\n // Check for the project entry block\n\n const slnDir = path.dirname(slnFile);\n const relProjectFile = path.relative(slnDir, project.projectFile);\n\n const projectTypeGuid =\n 'projectTypeGuid' in project\n ? project.projectTypeGuid!\n : projectTypeGuidsByLanguage[project.projectLang];\n\n const projectGuid = project.projectGuid.toUpperCase();\n\n const projectEntryBlock = [\n `Project(\"${projectTypeGuid}\") = \"${project.projectName}\", \"${relProjectFile}\", \"${projectGuid}\"`,\n 'EndProject',\n ];\n\n if (!linesContainsBlock(slnLines, projectEntryBlock)) {\n if (verbose) {\n console.log(chalk.yellow('Missing project entry block.'));\n }\n\n const globalIndex = slnLines.indexOf('Global');\n insertBlockIntoLines(slnLines, projectEntryBlock, globalIndex);\n contentsChanged = true;\n }\n\n // Check for the project configuration platforms\n\n const slnConfigs = getBlockContentsFromLines(\n slnLines,\n '\\tGlobalSection(SolutionConfigurationPlatforms) = preSolution',\n '\\tEndGlobalSection',\n false,\n ).map(line => line.match(/\\s+([\\w\\s|]+)\\s=/)![1]);\n\n const projectConfigLines: string[] = [];\n\n slnConfigs.forEach(slnConfig => {\n if (!slnConfig.endsWith('|Any CPU')) {\n projectConfigLines.push(\n `\\t\\t${projectGuid}.${slnConfig}.ActiveCfg = ${\n project.projectLang === 'cpp'\n ? slnConfig.replace('x86', 'Win32')\n : slnConfig\n }`,\n );\n projectConfigLines.push(\n `\\t\\t${projectGuid}.${slnConfig}.Build.0 = ${\n project.projectLang === 'cpp'\n ? slnConfig.replace('x86', 'Win32')\n : slnConfig\n }`,\n );\n }\n });\n\n const projectConfigStartIndex = slnLines.indexOf(\n '\\tGlobalSection(ProjectConfigurationPlatforms) = postSolution',\n );\n\n projectConfigLines.forEach(projectConfigLine => {\n if (!slnLines.includes(projectConfigLine)) {\n if (verbose) {\n const configLine = projectConfigLine.substr(\n projectConfigLine.indexOf('= ') + 2,\n );\n console.log(chalk.yellow(`Missing ${configLine} config block.`));\n }\n\n const projectConfigEndIndex = slnLines.indexOf(\n '\\tEndGlobalSection',\n projectConfigStartIndex,\n );\n\n slnLines.splice(projectConfigEndIndex, 0, projectConfigLine);\n contentsChanged = true;\n }\n });\n\n // Write out new solution file if there were changes\n if (contentsChanged) {\n if (verbose) {\n console.log(\n chalk.yellow(\n `${chalk.bold(path.basename(slnFile))} needs to be updated.`,\n ),\n );\n }\n\n if (!checkMode) {\n if (verbose) {\n console.log(\n `Writing changes to ${chalk.bold(path.basename(slnFile))}...`,\n );\n }\n\n const slnContents = slnLines.join(isCRLF ? '\\r\\n' : '\\n');\n fs.writeFileSync(slnFile, slnContents, {\n encoding: 'utf8',\n flag: 'w',\n });\n }\n } else {\n if (verbose) {\n console.log(`No changes to ${chalk.bold(path.basename(slnFile))}.`);\n }\n }\n\n return contentsChanged;\n}\n"]}
@@ -7,13 +7,13 @@ declare class DeviceInfo {
7
7
  readonly name: string;
8
8
  readonly guid: string;
9
9
  readonly ip: string;
10
- private index;
11
- private type;
10
+ private readonly index;
11
+ private readonly type;
12
12
  constructor(name: string, guid: string, ip: string, index: number, type: string);
13
13
  toString(): string;
14
14
  }
15
15
  export default class WinAppDeployTool {
16
- private path;
16
+ private readonly path;
17
17
  constructor();
18
18
  get isAvailable(): boolean;
19
19
  findDevice(target: string): DeviceInfo;
@@ -4,11 +4,15 @@
4
4
  * Licensed under the MIT License.
5
5
  * @format
6
6
  */
7
+ var __importDefault = (this && this.__importDefault) || function (mod) {
8
+ return (mod && mod.__esModule) ? mod : { "default": mod };
9
+ };
7
10
  Object.defineProperty(exports, "__esModule", { value: true });
8
- const fs = require("fs");
9
- const path = require("path");
11
+ const fs_1 = __importDefault(require("@react-native-windows/fs"));
12
+ const path_1 = __importDefault(require("path"));
10
13
  const child_process_1 = require("child_process");
11
14
  const commandWithProgress_1 = require("./commandWithProgress");
15
+ const telemetry_1 = require("@react-native-windows/telemetry");
12
16
  function sortDevices(l, r) {
13
17
  return l.toString().length - r.toString().length;
14
18
  }
@@ -27,21 +31,20 @@ class DeviceInfo {
27
31
  class WinAppDeployTool {
28
32
  constructor() {
29
33
  const programFilesPath = process.env['ProgramFiles(x86)'] || process.env.ProgramFiles;
30
- this.path = path.join(programFilesPath, 'Windows Kits', '10', 'bin', 'x86', 'WinAppDeployCmd.exe');
34
+ this.path = path_1.default.join(programFilesPath, 'Windows Kits', '10', 'bin', 'x86', 'WinAppDeployCmd.exe');
31
35
  }
32
36
  get isAvailable() {
33
- return fs.existsSync(this.path);
37
+ return fs_1.default.existsSync(this.path);
34
38
  }
35
39
  findDevice(target) {
36
40
  const devices = this.enumerateDevices();
37
41
  if (devices.length === 0) {
38
- throw new Error('No devices found');
42
+ throw new telemetry_1.CodedError('NoDevice', 'No devices found');
39
43
  }
40
44
  if (target === 'emulator') {
41
45
  const sortedList = devices.sort(sortDevices);
42
- for (let i = 0; i < sortedList.length; i++) {
43
- const sortedItem = sortedList[i];
44
- if (sortedItem.toString().indexOf(target) > -1) {
46
+ for (const sortedItem of sortedList) {
47
+ if (sortedItem.toString().includes(target)) {
45
48
  return sortedItem;
46
49
  }
47
50
  }
@@ -54,7 +57,7 @@ class WinAppDeployTool {
54
57
  return candidateList[0];
55
58
  }
56
59
  else {
57
- throw new Error('No devices found');
60
+ throw new telemetry_1.CodedError('NoDevice', 'No devices found');
58
61
  }
59
62
  }
60
63
  enumerateDevices() {
@@ -63,13 +66,13 @@ class WinAppDeployTool {
63
66
  // [(line), '127.0.0.1', '00000015-b21e-0da9-0000-000000000000', 'Lumia 1520 (RM-940)']
64
67
  // The expansion is: IP address, spaces, GUID, spaces, text name
65
68
  const LINE_TEST = /^([\d\.]+?)\s+([\da-fA-F\-]+?)\s+(.+)$/m; // eslint-disable-line no-useless-escape
66
- const result = child_process_1.execSync(`"${this.path}" devices`).toString();
69
+ const result = (0, child_process_1.execSync)(`"${this.path}" devices`).toString();
67
70
  const lines = result.split('\r\n');
68
71
  const matchedLines = lines.filter(line => LINE_TEST.test(line));
69
72
  const devices = matchedLines.map((line, arrayIndex) => {
70
73
  const match = line.match(LINE_TEST);
71
74
  if (!match) {
72
- throw new Error('Unexpected format of "devices" output');
75
+ throw new telemetry_1.CodedError('InvalidDevicesOutput', 'Unexpected format of "devices" output');
73
76
  }
74
77
  const ip = match[1];
75
78
  const guid = match[2];
@@ -83,7 +86,7 @@ class WinAppDeployTool {
83
86
  async installAppPackage(pathToAppxPackage, targetDevice, shouldLaunch, shouldUpdate, pin, verbose = false) {
84
87
  const text = `Installing app to ${targetDevice.name}`;
85
88
  if (shouldLaunch) {
86
- commandWithProgress_1.newWarn('Cannot launch app with current version of Windows 10 SDK tools. You will have to launch the app after installation is completed.');
89
+ (0, commandWithProgress_1.newWarn)('Cannot launch app with current version of Windows 10 SDK tools. You will have to launch the app after installation is completed.');
87
90
  }
88
91
  const args = [
89
92
  shouldUpdate ? 'update' : 'install',
@@ -95,11 +98,11 @@ class WinAppDeployTool {
95
98
  if (pin) {
96
99
  args.push('-pin', pin.toString());
97
100
  }
98
- await commandWithProgress_1.commandWithProgress(commandWithProgress_1.newSpinner(text), text, this.path, args, verbose);
101
+ await (0, commandWithProgress_1.commandWithProgress)((0, commandWithProgress_1.newSpinner)(text), text, this.path, args, verbose, 'InstallAppToDeviceFailure');
99
102
  }
100
103
  async uninstallAppPackage(appName, targetDevice, verbose) {
101
104
  const text = `Uninstalling app from ${targetDevice.name}`;
102
- await commandWithProgress_1.commandWithProgress(commandWithProgress_1.newSpinner(text), text, this.path, `uninstall -package ${appName} -ip {$targetDevice.ip}`.split(' '), verbose);
105
+ await (0, commandWithProgress_1.commandWithProgress)((0, commandWithProgress_1.newSpinner)(text), text, this.path, `uninstall -package ${appName} -ip {$targetDevice.ip}`.split(' '), verbose, 'UninstallAppOnDeviceFailure');
103
106
  }
104
107
  }
105
108
  exports.default = WinAppDeployTool;
@@ -1 +1 @@
1
- {"version":3,"file":"winappdeploytool.js","sourceRoot":"","sources":["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AAE;YACP,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;SACnC;QACD,MAAM,IAAA,yCAAmB,EACvB,IAAA,gCAAU,EAAC,IAAI,CAAC,EAChB,IAAI,EACJ,IAAI,CAAC,IAAI,EACT,IAAI,EACJ,OAAO,EACP,2BAA2B,CAC5B,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,mBAAmB,CACvB,OAAe,EACf,YAAwB,EACxB,OAAgB;QAEhB,MAAM,IAAI,GAAG,yBAAyB,YAAY,CAAC,IAAI,EAAE,CAAC;QAC1D,MAAM,IAAA,yCAAmB,EACvB,IAAA,gCAAU,EAAC,IAAI,CAAC,EAChB,IAAI,EACJ,IAAI,CAAC,IAAI,EACT,sBAAsB,OAAO,yBAAyB,CAAC,KAAK,CAAC,GAAG,CAAC,EACjE,OAAO,EACP,6BAA6B,CAC9B,CAAC;IACJ,CAAC;CACF;AArID,mCAqIC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport fs from '@react-native-windows/fs';\nimport path from 'path';\nimport {execSync} from 'child_process';\nimport {newSpinner, commandWithProgress, newWarn} from './commandWithProgress';\nimport {CodedError} from '@react-native-windows/telemetry';\n\nfunction sortDevices(l: DeviceInfo, r: DeviceInfo): number {\n return l.toString().length - r.toString().length;\n}\n\nclass DeviceInfo {\n constructor(\n public readonly name: string,\n public readonly guid: string,\n public readonly ip: string,\n\n private readonly index: number,\n private readonly type: string,\n ) {}\n\n toString() {\n return `${this.index}. ${this.name} (${this.type})`;\n }\n}\n\nexport default class WinAppDeployTool {\n private readonly path: string;\n\n constructor() {\n const programFilesPath =\n process.env['ProgramFiles(x86)'] || process.env.ProgramFiles;\n this.path = path.join(\n programFilesPath!,\n 'Windows Kits',\n '10',\n 'bin',\n 'x86',\n 'WinAppDeployCmd.exe',\n );\n }\n\n get isAvailable() {\n return fs.existsSync(this.path);\n }\n\n findDevice(target: string): DeviceInfo {\n const devices = this.enumerateDevices();\n\n if (devices.length === 0) {\n throw new CodedError('NoDevice', 'No devices found');\n }\n\n if (target === 'emulator') {\n const sortedList = devices.sort(sortDevices);\n for (const sortedItem of sortedList) {\n if (sortedItem.toString().includes(target)) {\n return sortedItem;\n }\n }\n }\n\n if (target === 'device') {\n return devices[0];\n }\n\n const candidateList = devices.filter(device => device.guid === target);\n\n if (candidateList.length > 0) {\n return candidateList[0];\n } else {\n throw new CodedError('NoDevice', 'No devices found');\n }\n }\n\n enumerateDevices(): DeviceInfo[] {\n // 127.0.0.1 00000015-b21e-0da9-0000-000000000000 Lumia 1520 (RM-940)\\r\n // maps to\n // [(line), '127.0.0.1', '00000015-b21e-0da9-0000-000000000000', 'Lumia 1520 (RM-940)']\n // The expansion is: IP address, spaces, GUID, spaces, text name\n const LINE_TEST = /^([\\d\\.]+?)\\s+([\\da-fA-F\\-]+?)\\s+(.+)$/m; // eslint-disable-line no-useless-escape\n\n const result = execSync(`\"${this.path}\" devices`).toString();\n const lines = result.split('\\r\\n');\n const matchedLines = lines.filter(line => LINE_TEST.test(line));\n\n const devices = matchedLines.map((line, arrayIndex) => {\n const match = line.match(LINE_TEST);\n if (!match) {\n throw new CodedError(\n 'InvalidDevicesOutput',\n 'Unexpected format of \"devices\" output',\n );\n }\n\n const ip = match[1];\n const guid = match[2];\n const name = match[3];\n const type = 'device';\n\n const deviceInfo = new DeviceInfo(name, guid, ip, arrayIndex, type);\n return deviceInfo;\n });\n\n return devices;\n }\n\n async installAppPackage(\n pathToAppxPackage: string,\n targetDevice: DeviceInfo,\n shouldLaunch: boolean,\n shouldUpdate: boolean,\n pin: boolean,\n verbose: boolean = false,\n ) {\n const text = `Installing app to ${targetDevice.name}`;\n\n if (shouldLaunch) {\n newWarn(\n 'Cannot launch app with current version of Windows 10 SDK tools. You will have to launch the app after installation is completed.',\n );\n }\n\n const args = [\n shouldUpdate ? 'update' : 'install',\n '-file',\n pathToAppxPackage,\n '-ip',\n targetDevice.ip,\n ];\n\n if (pin) {\n args.push('-pin', pin.toString());\n }\n await commandWithProgress(\n newSpinner(text),\n text,\n this.path,\n args,\n verbose,\n 'InstallAppToDeviceFailure',\n );\n }\n\n async uninstallAppPackage(\n appName: string,\n targetDevice: DeviceInfo,\n verbose: boolean,\n ) {\n const text = `Uninstalling app from ${targetDevice.name}`;\n await commandWithProgress(\n newSpinner(text),\n text,\n this.path,\n `uninstall -package ${appName} -ip {$targetDevice.ip}`.split(' '),\n verbose,\n 'UninstallAppOnDeviceFailure',\n );\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-windows/cli",
3
- "version": "0.0.0-canary.13",
3
+ "version": "0.0.0-canary.130",
4
4
  "license": "MIT",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "repository": {
@@ -9,46 +9,60 @@
9
9
  "directory": "packages/@react-native-windows/cli"
10
10
  },
11
11
  "scripts": {
12
- "build": "just-scripts build",
13
- "clean": "just-scripts clean",
14
- "lint": "just-scripts lint",
15
- "lint:fix": "just-scripts lint:fix",
16
- "watch": "just-scripts watch"
12
+ "build": "rnw-scripts build",
13
+ "clean": "rnw-scripts clean",
14
+ "lint": "rnw-scripts lint",
15
+ "lint:fix": "rnw-scripts lint:fix",
16
+ "test": "rnw-scripts test",
17
+ "watch": "rnw-scripts watch"
17
18
  },
18
19
  "dependencies": {
20
+ "@react-native-windows/fs": "^0.0.0-canary.4",
21
+ "@react-native-windows/package-utils": "^0.0.0-canary.30",
22
+ "@react-native-windows/telemetry": "^0.0.0-canary.42",
23
+ "@typescript-eslint/eslint-plugin": "^5.20.0",
24
+ "@typescript-eslint/parser": "^5.20.0",
25
+ "@xmldom/xmldom": "^0.7.5",
19
26
  "chalk": "^4.1.0",
20
27
  "cli-spinners": "^2.2.0",
21
28
  "envinfo": "^7.5.0",
29
+ "find-up": "^4.1.0",
22
30
  "glob": "^7.1.1",
23
- "inquirer": "^3.0.6",
31
+ "lodash": "^4.17.15",
24
32
  "mustache": "^4.0.1",
25
- "nuget-exe": "4.9.2",
26
33
  "ora": "^3.4.0",
34
+ "prompts": "^2.4.1",
27
35
  "semver": "^7.3.2",
28
- "shelljs": "^0.7.8",
36
+ "shelljs": "^0.8.4",
29
37
  "username": "^5.1.0",
30
38
  "uuid": "^3.3.2",
39
+ "xml-formatter": "^2.4.0",
31
40
  "xml-parser": "^1.2.1",
32
- "xmldom": "^0.3.0",
33
41
  "xpath": "^0.0.27"
34
42
  },
35
43
  "devDependencies": {
36
- "@react-native-community/cli-types": "^4.10.1",
37
- "@rnw-scripts/eslint-config": "0.1.2",
38
- "@rnw-scripts/just-task": "0.0.4",
39
- "@rnw-scripts/ts-config": "0.1.0",
44
+ "@react-native-community/cli-types": "^5.0.1-alpha.0",
45
+ "@rnw-scripts/eslint-config": "1.1.13",
46
+ "@rnw-scripts/jest-unittest-config": "1.2.7",
47
+ "@rnw-scripts/just-task": "2.2.4",
48
+ "@rnw-scripts/ts-config": "2.0.2",
40
49
  "@types/chalk": "^2.2.0",
41
- "@types/inquirer": "^6.5.0",
42
- "@types/mustache": "^4.0.1",
50
+ "@types/jest": "^26.0.20",
51
+ "@types/lodash": "^4.14.168",
52
+ "@types/mustache": "^4.1.1",
53
+ "@types/node": "^14.14.22",
43
54
  "@types/ora": "^3.2.0",
55
+ "@types/prompts": "2.0.10",
44
56
  "@types/semver": "^7.3.3",
45
57
  "@types/shelljs": "^0.8.8",
46
- "@types/uuid": "^8.0.0",
58
+ "@types/uuid": "^8.3.0",
47
59
  "@types/xml-parser": "^1.2.29",
48
- "@types/xmldom": "^0.1.29",
49
- "eslint": "6.8.0",
50
- "just-scripts": "^0.36.1",
51
- "typescript": "^3.8.3"
60
+ "@types/xmldom": "^0.1.30",
61
+ "babel-jest": "^26.3.0",
62
+ "eslint": "^7.32.0",
63
+ "jest": "^26.6.3",
64
+ "prettier": "^2.4.1",
65
+ "typescript": "^4.4.4"
52
66
  },
53
67
  "files": [
54
68
  "lib-commonjs",
@@ -62,5 +76,9 @@
62
76
  "patch"
63
77
  ]
64
78
  },
65
- "promoteRelease": true
79
+ "promoteRelease": true,
80
+ "windowsOnly": true,
81
+ "engines": {
82
+ "node": ">= 14"
83
+ }
66
84
  }
@@ -107,10 +107,10 @@ function PrintMessageAndExit($ErrorMessage, $ReturnCode)
107
107
  {
108
108
  # Log telemetry data regarding the use of the script if possible.
109
109
  # There are three ways that this can be disabled:
110
- # 1. If the "TelemetryDependencies" folder isn't present. This can be excluded at build time by setting the MSBuild property AppxLogTelemetryFromSideloadingScript to false
110
+ # 1. If the "TelDeps" folder isn't present. This can be excluded at build time by setting the MSBuild property AppxLogTelemetryFromSideloadingScript to false
111
111
  # 2. If the SkipLoggingTelemetry switch is passed to this script.
112
112
  # 3. If Visual Studio telemetry is disabled via the registry.
113
- $TelemetryAssembliesFolder = (Join-Path $PSScriptRoot "TelemetryDependencies")
113
+ $TelemetryAssembliesFolder = (Join-Path $PSScriptRoot "TelDeps")
114
114
  if (!$SkipLoggingTelemetry -And (Test-Path $TelemetryAssembliesFolder))
115
115
  {
116
116
  $job = Start-Job -FilePath (Join-Path $TelemetryAssembliesFolder "LogSideloadingTelemetry.ps1") -ArgumentList $TelemetryAssembliesFolder, "VS/DesignTools/SideLoadingScript/AddAppDevPackage", $ReturnCode, $ProcessorArchitecture