@react-native-oh/react-native-harmony-cli 0.72.142 → 0.72.143

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.
@@ -68,7 +68,7 @@ function copyAssets(logger, assetsData, assetsDest) {
68
68
  });
69
69
  };
70
70
  assetsData.forEach(addAssetToCopy);
71
- return copyFiles(logger, filesToCopy);
71
+ yield copyFiles(logger, filesToCopy);
72
72
  });
73
73
  }
74
74
  function getAssetDestRelativePath(asset, scale = 1) {
@@ -227,10 +227,12 @@ class Autolinking {
227
227
  return Object.assign(Object.assign({}, lib), { etsRNOHPackageClassName: (_a = lib.etsRNOHPackageClassName) !== null && _a !== void 0 ? _a : this.npmPackageNameToRNOHPackageClassName(lib.npmPackageName), cppRNOHPackageClassName: (_b = lib.cppRNOHPackageClassName) !== null && _b !== void 0 ? _b : this.npmPackageNameToRNOHPackageClassName(lib.npmPackageName), cmakeLibraryTargetName: (_c = lib.cmakeLibraryTargetName) !== null && _c !== void 0 ? _c : this.npmPackageNameToCMakeLibraryTargetName(lib.npmPackageName), resolvedHars: lib.resolvedHars });
228
228
  });
229
229
  autolinkableLibraries.sort((a, b) => {
230
- if (a.npmPackageName < b.npmPackageName)
230
+ if (a.npmPackageName < b.npmPackageName) {
231
231
  return -1;
232
- if (a.npmPackageName > b.npmPackageName)
232
+ }
233
+ if (a.npmPackageName > b.npmPackageName) {
233
234
  return 1;
235
+ }
234
236
  return 0;
235
237
  });
236
238
  const ohPackage = json5_1.default.parse(input.ohPackagePathAndContent[1]);
@@ -104,6 +104,7 @@ class TypeAnnotationToTS {
104
104
  case 'StringTypeAnnotation':
105
105
  return 'string';
106
106
  }
107
+ return 'unknown';
107
108
  }
108
109
  convertObjectTypeAnnotation(objectTypeAnnotation) {
109
110
  const props = objectTypeAnnotation.properties
@@ -48,7 +48,7 @@ function createMetroHostConstants(outputPath) {
48
48
  }
49
49
  }
50
50
  }
51
- return;
51
+ return undefined;
52
52
  };
53
53
  const ip = getIP();
54
54
  const tsCode = [
@@ -141,7 +141,7 @@ class ValidationHelper {
141
141
  }
142
142
  return reactNativeVersion;
143
143
  }
144
- return "0.77";
144
+ return '0.77';
145
145
  });
146
146
  }
147
147
  }
@@ -553,7 +553,7 @@ function getRNOHVersion(rnVersion) {
553
553
  return __awaiter(this, void 0, void 0, function* () {
554
554
  const versionParts = rnVersion.split('.');
555
555
  const majorMinorVersion = `${versionParts[0]}.${versionParts[1]}`;
556
- let versionInfos = "";
556
+ let versionInfos = '';
557
557
  yield runCliCommand(NPM_EXE, ['view', DEFAULT_TEMPLATE_PKG, 'versions', '--json'], process.cwd(), false, (data) => {
558
558
  versionInfos += data.toString();
559
559
  });
@@ -72,7 +72,7 @@ function syncVersions(packageJSONFilePath, ohPackageJSONFilePath) {
72
72
  const packageJSONFileContent = JSON.parse(fs_1.default.readFileSync(packageJSONFilePath, { encoding: 'utf-8' }));
73
73
  if (fs_1.default.existsSync(ohPackageJSONFilePath)) {
74
74
  const ohPackageJSONFileContent = json5_1.default.parse(fs_1.default.readFileSync(ohPackageJSONFilePath, { encoding: 'utf-8' }));
75
- ohPackageJSONFileContent['version'] = packageJSONFileContent['version'];
75
+ ohPackageJSONFileContent.version = packageJSONFileContent.version;
76
76
  fs_1.default.writeFileSync(ohPackageJSONFilePath, json5_1.default.stringify(ohPackageJSONFileContent, null, 2));
77
77
  }
78
78
  }
@@ -124,10 +124,12 @@ function unpack(projectRootPath, outputDirPath) {
124
124
  });
125
125
  }
126
126
  function shouldUnpack(harmonyArchivePath, pkgHarmonyDirPath, outputDirPath, nodePackageVersion) {
127
- if (!fs_1.default.existsSync(harmonyArchivePath.getValue()))
127
+ if (!fs_1.default.existsSync(harmonyArchivePath.getValue())) {
128
128
  return false;
129
- if (!fs_1.default.existsSync(pkgHarmonyDirPath.getValue()))
129
+ }
130
+ if (!fs_1.default.existsSync(pkgHarmonyDirPath.getValue())) {
130
131
  return true;
132
+ }
131
133
  const ohModulesInfo = getOhModulesInfo(pkgHarmonyDirPath, outputDirPath);
132
134
  for (const ohModuleInfo of ohModulesInfo) {
133
135
  if (!fs_1.default.existsSync(ohModuleInfo.computedModulePath.getValue()) ||
@@ -140,8 +142,9 @@ function shouldUnpack(harmonyArchivePath, pkgHarmonyDirPath, outputDirPath, node
140
142
  }
141
143
  function getOhPackageVersion(modulePath) {
142
144
  const ohPackagePath = modulePath.copyWithNewSegment('oh-package.json5');
143
- if (!fs_1.default.existsSync(ohPackagePath.getValue()))
145
+ if (!fs_1.default.existsSync(ohPackagePath.getValue())) {
144
146
  return null;
147
+ }
145
148
  const content = fs_1.default.readFileSync(ohPackagePath.getValue(), {
146
149
  encoding: 'utf-8',
147
150
  });
@@ -149,8 +152,9 @@ function getOhPackageVersion(modulePath) {
149
152
  }
150
153
  function getOhModulesInfo(pkgHarmonyDirPath, outputDirPath) {
151
154
  const results = [];
152
- if (!fs_1.default.existsSync(pkgHarmonyDirPath.getValue()))
155
+ if (!fs_1.default.existsSync(pkgHarmonyDirPath.getValue())) {
153
156
  return [];
157
+ }
154
158
  const names = fs_1.default.readdirSync(pkgHarmonyDirPath.getValue());
155
159
  for (const name of names) {
156
160
  if (name.endsWith('.tar.gz')) {
@@ -121,6 +121,7 @@ function logCheckResult(loader, checkResult) {
121
121
  case 'skip':
122
122
  return `${chalk_1.default.yellow('SKIP')}`;
123
123
  }
124
+ return '';
124
125
  })();
125
126
  loader.info(checkResult.message
126
127
  ? `[${chalk_1.default.bold(prefix)}] ${chalk_1.default.bold(checkResult.name)}\n${checkResult.message}`
@@ -97,7 +97,7 @@ function findHarPath(packagePath) {
97
97
  const packageHarmonyPath = packagePath.copyWithNewSegment('harmony');
98
98
  const fileOrDirNames = node_fs_1.default.readdirSync(packageHarmonyPath.getValue());
99
99
  const harFilenames = fileOrDirNames.filter((fileOrDirName) => fileOrDirName.endsWith('.har'));
100
- if (harFilenames.length != 1) {
100
+ if (harFilenames.length !== 1) {
101
101
  return null;
102
102
  }
103
103
  return packageHarmonyPath.copyWithNewSegment(harFilenames[0]);
@@ -29,15 +29,17 @@ function compareVersionTuple(a, b) {
29
29
  for (let i = 0; i < Math.max(a.length, b.length); i++) {
30
30
  const av = (_a = a[i]) !== null && _a !== void 0 ? _a : 0;
31
31
  const bv = (_b = b[i]) !== null && _b !== void 0 ? _b : 0;
32
- if (av !== bv)
32
+ if (av !== bv) {
33
33
  return av - bv;
34
+ }
34
35
  }
35
36
  return 0;
36
37
  }
37
38
  function isSupportedVersion(versionDir) {
38
39
  const m = versionDir.match(/^(\d+)\.(\d+)\.(\d+)\.(\d+)/);
39
- if (!m)
40
+ if (!m) {
40
41
  return false;
42
+ }
41
43
  const current = m.slice(1).map(n => parseInt(n, 10));
42
44
  return compareVersionTuple(current, MIN_SUPPORTED_VERSION) >= 0;
43
45
  }
@@ -56,7 +58,7 @@ function getCreatedSimulators(cli, emulator) {
56
58
  simulatorInfosFromStderr += msg;
57
59
  },
58
60
  });
59
- if (simulatorInfos == null || simulatorInfos.trim() === '') {
61
+ if (simulatorInfos === null || simulatorInfos === undefined || simulatorInfos.trim() === '') {
60
62
  simulatorInfos = simulatorInfosFromStderr;
61
63
  }
62
64
  if (!simulatorInfos || simulatorInfos.trim() === '' ||
@@ -128,11 +130,13 @@ function parseDeviceManagerXml(xmlContent) {
128
130
  while ((m = optionRegex.exec(xmlContent))) {
129
131
  const tag = m[0];
130
132
  const nameMatch = tag.match(/\bname=["']([^"']+)["']/i);
131
- if (!nameMatch)
133
+ if (!nameMatch) {
132
134
  continue;
135
+ }
133
136
  const valueMatch = tag.match(/\bvalue=["']([^"']+)["']/i);
134
- if (!valueMatch)
137
+ if (!valueMatch) {
135
138
  continue;
139
+ }
136
140
  const name = nameMatch[1];
137
141
  const value = valueMatch[1];
138
142
  if (name === 'imageDeployPath' && !info.imageRoot) {
@@ -141,8 +145,9 @@ function parseDeviceManagerXml(xmlContent) {
141
145
  else if (name === 'openharmonyDeployPath' && !info.instancePath) {
142
146
  info.instancePath = value;
143
147
  }
144
- if (info.imageRoot && info.instancePath)
148
+ if (info.imageRoot && info.instancePath) {
145
149
  break;
150
+ }
146
151
  }
147
152
  return info;
148
153
  }
@@ -186,8 +191,9 @@ function resolveInstanceAndImageRoot(env, devEcoVersion) {
186
191
  try {
187
192
  const content = yield fs_extra_1.default.readFile(xmlPath, 'utf-8');
188
193
  xmlInfo = parseDeviceManagerXml(content);
189
- if (xmlInfo.instancePath || xmlInfo.imageRoot)
194
+ if (xmlInfo.instancePath || xmlInfo.imageRoot) {
190
195
  break;
196
+ }
191
197
  }
192
198
  catch (error) {
193
199
  throw new core_1.DescriptiveError({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-oh/react-native-harmony-cli",
3
- "version": "0.72.142",
3
+ "version": "0.72.143",
4
4
  "description": "",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/",