@react-native-oh/react-native-harmony-cli 0.72.141 → 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.
- package/dist/assetResolver.js +1 -1
- package/dist/autolinking/Autolinking.js +4 -2
- package/dist/codegen/core/TypeAnnotationToTS.js +1 -0
- package/dist/codegen/generators/LibGlueCodeGenerator.js +16 -6
- package/dist/commands/codegen-lib-harmony.js +78 -40
- package/dist/commands/create-metro-host-constants.js +1 -1
- package/dist/commands/init.js +2 -2
- package/dist/commands/pack-harmony.js +1 -1
- package/dist/commands/unpack-harmony.js +8 -4
- package/dist/commands/verify-package-harmony.js +1 -0
- package/dist/package-verifier/verify-package.js +1 -1
- package/dist/simulator/LaunchSimulator.js +13 -7
- package/harmony/rnoh-hvigor-plugin-0.3.0.tgz +0 -0
- package/package.json +3 -3
package/dist/assetResolver.js
CHANGED
|
@@ -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
|
-
|
|
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]);
|
|
@@ -42,12 +42,22 @@ class LibGlueCodeGenerator {
|
|
|
42
42
|
basePackageTemplate.addComponent({ name: componentName, libraryCppName, isArkTSComponent: false });
|
|
43
43
|
});
|
|
44
44
|
fileContentByPath.set(this.cppOutputPath.copyWithNewSegment('RNOH', 'generated', `${basePackageClassName}.h`), basePackageTemplate.build());
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
.
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
const hasFabricComponents = arkTSComponents.length > 0 || cppComponents.length > 0;
|
|
46
|
+
const hasTurboModules = turboModules.length > 0;
|
|
47
|
+
if (hasFabricComponents) {
|
|
48
|
+
fileContentByPath.set(this.etsOutputPath.copyWithNewSegment('components', 'ts.ts'), components_indexTS.build());
|
|
49
|
+
}
|
|
50
|
+
if (hasTurboModules) {
|
|
51
|
+
fileContentByPath.set(this.etsOutputPath.copyWithNewSegment('turboModules', 'ts.ts'), turboModules_indexTS.build());
|
|
52
|
+
}
|
|
53
|
+
const rootTS = new templates_1.IndexTSTemplate(this.codegenNoticeLines);
|
|
54
|
+
if (hasFabricComponents) {
|
|
55
|
+
rootTS.addReexport({ from: './components/ts', as: 'RNC' });
|
|
56
|
+
}
|
|
57
|
+
if (hasTurboModules) {
|
|
58
|
+
rootTS.addReexport({ from: './turboModules/ts', as: 'TM' });
|
|
59
|
+
}
|
|
60
|
+
fileContentByPath.set(this.etsOutputPath.copyWithNewSegment('ts.ts'), rootTS.build());
|
|
51
61
|
generated_indexETS.addReexport({ from: './ts' });
|
|
52
62
|
fileContentByPath.set(this.etsOutputPath.copyWithNewSegment('index.ets'), generated_indexETS.build());
|
|
53
63
|
return fileContentByPath;
|
|
@@ -26,6 +26,7 @@ const codegen_1 = require("../codegen");
|
|
|
26
26
|
const case_1 = __importDefault(require("case"));
|
|
27
27
|
const LibGlueCodeGenerator_1 = require("../codegen/generators/LibGlueCodeGenerator");
|
|
28
28
|
const COMMAND_NAME = 'codegen-lib-harmony';
|
|
29
|
+
const VALID_GENERATE_TYPES = ['all', 'turbo-module', 'fabric'];
|
|
29
30
|
exports.commandCodegenLibHarmony = {
|
|
30
31
|
name: COMMAND_NAME,
|
|
31
32
|
description: 'Generates boilerplate, types, and utilities from Turbo Module and Fabric Component specifications. Designed for library developers who want to include generated code in their libraries.',
|
|
@@ -61,6 +62,13 @@ exports.commandCodegenLibHarmony = {
|
|
|
61
62
|
name: '--no-safety-check [boolean]',
|
|
62
63
|
description: 'Skips the check that prevents file operations outside the current working directory. This command permanently deletes previously generated files. Files are generated in the path specified by cpp-output-path.',
|
|
63
64
|
},
|
|
65
|
+
{
|
|
66
|
+
name: '--generate-type <string>',
|
|
67
|
+
description: 'Controls which type of code to generate. ' +
|
|
68
|
+
'Possible values: "all" (default, generates both TurboModule and Fabric code), ' +
|
|
69
|
+
'"turbo-module" (generates only TurboModule code), ' +
|
|
70
|
+
'"fabric" (generates only Fabric component code).',
|
|
71
|
+
},
|
|
64
72
|
],
|
|
65
73
|
func: (_argv, _config, rawArgs) => __awaiter(void 0, void 0, void 0, function* () {
|
|
66
74
|
const logger = new io_1.Logger();
|
|
@@ -103,7 +111,7 @@ function validateArgsAndRetrieveUberSchemaByType(rawArgs) {
|
|
|
103
111
|
};
|
|
104
112
|
}
|
|
105
113
|
function validateRawArgs(rawArgs) {
|
|
106
|
-
var _a, _b, _c;
|
|
114
|
+
var _a, _b, _c, _d;
|
|
107
115
|
if (!rawArgs.npmPackageName) {
|
|
108
116
|
throw new core_1.DescriptiveError({
|
|
109
117
|
whatHappened: '--npm-package-name is required',
|
|
@@ -122,14 +130,24 @@ function validateRawArgs(rawArgs) {
|
|
|
122
130
|
whatCanUserDo: ['Please specify --ets-output-path'],
|
|
123
131
|
});
|
|
124
132
|
}
|
|
133
|
+
const generateType = ((_a = rawArgs.generateType) !== null && _a !== void 0 ? _a : 'all');
|
|
134
|
+
if (!VALID_GENERATE_TYPES.includes(generateType)) {
|
|
135
|
+
throw new core_1.DescriptiveError({
|
|
136
|
+
whatHappened: `Invalid --generate-type value: "${rawArgs.generateType}". Valid values are: ${VALID_GENERATE_TYPES.join(', ')}`,
|
|
137
|
+
whatCanUserDo: [
|
|
138
|
+
`Please specify one of: ${VALID_GENERATE_TYPES.join(', ')}`,
|
|
139
|
+
],
|
|
140
|
+
});
|
|
141
|
+
}
|
|
125
142
|
return {
|
|
126
143
|
npmPackageName: rawArgs.npmPackageName,
|
|
127
|
-
tmSpecPaths: ((
|
|
128
|
-
arkTSComponentsSpecPaths: ((
|
|
129
|
-
cppComponentsSpecPaths: ((
|
|
144
|
+
tmSpecPaths: ((_b = rawArgs.turboModulesSpecPaths) !== null && _b !== void 0 ? _b : []).map((path) => new core_1.AbsolutePath(path)),
|
|
145
|
+
arkTSComponentsSpecPaths: ((_c = rawArgs.arktsComponentsSpecPaths) !== null && _c !== void 0 ? _c : []).map((path) => new core_1.AbsolutePath(path)),
|
|
146
|
+
cppComponentsSpecPaths: ((_d = rawArgs.cppComponentsSpecPaths) !== null && _d !== void 0 ? _d : []).map((path) => new core_1.AbsolutePath(path)),
|
|
130
147
|
etsOutputPath: new core_1.AbsolutePath(rawArgs.etsOutputPath),
|
|
131
148
|
cppOutputPath: new core_1.AbsolutePath(rawArgs.cppOutputPath),
|
|
132
149
|
safetyCheck: !!rawArgs.safetyCheck,
|
|
150
|
+
generateType,
|
|
133
151
|
};
|
|
134
152
|
}
|
|
135
153
|
function specPathsToSpecFilePaths(specPaths) {
|
|
@@ -161,46 +179,60 @@ function generateCodeInMemory({ args, uberSchemaByType: { arkTSComponentsUberSch
|
|
|
161
179
|
const appendToFileContentByPath = (fileContent, path) => {
|
|
162
180
|
fileContentByPath.set(path, fileContent);
|
|
163
181
|
};
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
.
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
182
|
+
const { generateType } = args;
|
|
183
|
+
const shouldGenerateTurboModule = generateType === 'all' || generateType === 'turbo-module';
|
|
184
|
+
const shouldGenerateFabric = generateType === 'all' || generateType === 'fabric';
|
|
185
|
+
let turboModuleGlueCodeData = [];
|
|
186
|
+
if (shouldGenerateTurboModule) {
|
|
187
|
+
turboModuleGlueCodeData = turboModulesUberSchema
|
|
188
|
+
.findAllSpecSchemasByType('NativeModule')
|
|
189
|
+
.map((specSchema) => {
|
|
190
|
+
const nativeModuleCodeGenerator = new codegen_1.NativeModuleCodeGenerator(args.cppOutputPath.copyWithNewSegment('RNOH', 'generated', 'turbo_modules'), args.etsOutputPath.copyWithNewSegment('turboModules'), CODEGEN_NOTICE_LINES, '@rnoh/react-native-openharmony/ts');
|
|
191
|
+
nativeModuleCodeGenerator
|
|
192
|
+
.generate(specSchema)
|
|
193
|
+
.forEach(appendToFileContentByPath);
|
|
194
|
+
return nativeModuleCodeGenerator.getGlueCodeData();
|
|
195
|
+
})
|
|
196
|
+
.flat();
|
|
197
|
+
}
|
|
174
198
|
const arkTSComponentCodeGeneratorCAPI = new codegen_1.ArkTSComponentCodeGeneratorCAPI(args.cppOutputPath.copyWithNewSegment('RNOH', 'generated', 'components'), args.etsOutputPath.copyWithNewSegment('components'), CODEGEN_NOTICE_LINES, '@rnoh/react-native-openharmony/ts');
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
199
|
+
if (shouldGenerateFabric) {
|
|
200
|
+
arkTSComponentCodeGeneratorCAPI
|
|
201
|
+
.generate(arkTSComponentsUberSchema)
|
|
202
|
+
.forEach(appendToFileContentByPath);
|
|
203
|
+
}
|
|
178
204
|
const libraryCppName = deriveLibraryCppNameFromNpmPackageName(args.npmPackageName);
|
|
179
205
|
const cppComponentCodeGenerator = new codegen_1.CppComponentCodeGenerator((filename) => {
|
|
180
206
|
return args.cppOutputPath.copyWithNewSegment('RNOH', 'generated', 'components', filename);
|
|
181
207
|
}, CODEGEN_NOTICE_LINES);
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
208
|
+
if (shouldGenerateFabric) {
|
|
209
|
+
cppComponentCodeGenerator
|
|
210
|
+
.generate({
|
|
211
|
+
libraryCppName: libraryCppName,
|
|
212
|
+
uberSchema: cppComponentsUberSchema,
|
|
213
|
+
})
|
|
214
|
+
.forEach(appendToFileContentByPath);
|
|
215
|
+
new codegen_1.SharedComponentCodeGenerator((filename) => {
|
|
216
|
+
return args.cppOutputPath.copyWithNewSegment('react', 'renderer', 'components', libraryCppName, filename);
|
|
217
|
+
})
|
|
218
|
+
.generate({
|
|
219
|
+
libraryCppName: libraryCppName,
|
|
220
|
+
uberSchema: componentsUberSchema,
|
|
221
|
+
})
|
|
222
|
+
.forEach(appendToFileContentByPath);
|
|
223
|
+
}
|
|
196
224
|
new LibGlueCodeGenerator_1.LibGlueCodeGenerator(args.cppOutputPath, args.etsOutputPath, CODEGEN_NOTICE_LINES)
|
|
197
225
|
.generate({
|
|
198
226
|
libraryCppName,
|
|
199
|
-
arkTSComponents:
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
227
|
+
arkTSComponents: shouldGenerateFabric
|
|
228
|
+
? arkTSComponentCodeGeneratorCAPI.getLibGlueCodeData()
|
|
229
|
+
: [],
|
|
230
|
+
cppComponents: shouldGenerateFabric
|
|
231
|
+
? cppComponentCodeGenerator
|
|
232
|
+
.getGlueCodeData()
|
|
233
|
+
.map(({ name }) => ({ componentName: name }))
|
|
234
|
+
: [],
|
|
235
|
+
turboModules: shouldGenerateTurboModule ? turboModuleGlueCodeData : [],
|
|
204
236
|
})
|
|
205
237
|
.forEach(appendToFileContentByPath);
|
|
206
238
|
return fileContentByPath;
|
|
@@ -215,14 +247,20 @@ function deriveLibraryCppNameFromNpmPackageName(npmPackageName) {
|
|
|
215
247
|
return result;
|
|
216
248
|
}
|
|
217
249
|
function saveAndLogCodegenResult(args, logger, fileContentByPath) {
|
|
218
|
-
saveCodegenResultToFileSystem(fileContentByPath, args.cppOutputPath, args.etsOutputPath, args.safetyCheck);
|
|
250
|
+
saveCodegenResultToFileSystem(fileContentByPath, args.cppOutputPath, args.etsOutputPath, args.safetyCheck, args.generateType);
|
|
219
251
|
logCodegenResult(logger, fileContentByPath, new core_1.AbsolutePath(''));
|
|
220
252
|
}
|
|
221
|
-
function saveCodegenResultToFileSystem(fileContentByPath, cppOutputPath, etsOutputPath, enableSafetyCheck) {
|
|
253
|
+
function saveCodegenResultToFileSystem(fileContentByPath, cppOutputPath, etsOutputPath, enableSafetyCheck, generateType) {
|
|
254
|
+
const shouldGenerateTurboModule = generateType === 'all' || generateType === 'turbo-module';
|
|
255
|
+
const shouldGenerateFabric = generateType === 'all' || generateType === 'fabric';
|
|
222
256
|
prepareDirectory(cppOutputPath, enableSafetyCheck);
|
|
223
257
|
prepareDirectory(etsOutputPath, enableSafetyCheck);
|
|
224
|
-
|
|
225
|
-
|
|
258
|
+
if (shouldGenerateFabric) {
|
|
259
|
+
prepareDirectory(etsOutputPath.copyWithNewSegment('components'), enableSafetyCheck);
|
|
260
|
+
}
|
|
261
|
+
if (shouldGenerateTurboModule) {
|
|
262
|
+
prepareDirectory(etsOutputPath.copyWithNewSegment('turboModules'), enableSafetyCheck);
|
|
263
|
+
}
|
|
226
264
|
fileContentByPath.forEach((_fileContent, path) => {
|
|
227
265
|
prepareDirectory(path.getDirectoryPath(), enableSafetyCheck);
|
|
228
266
|
});
|
package/dist/commands/init.js
CHANGED
|
@@ -141,7 +141,7 @@ class ValidationHelper {
|
|
|
141
141
|
}
|
|
142
142
|
return reactNativeVersion;
|
|
143
143
|
}
|
|
144
|
-
return
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
|
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({
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-oh/react-native-harmony-cli",
|
|
3
|
-
"version": "0.72.
|
|
3
|
+
"version": "0.72.143",
|
|
4
4
|
"description": "",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -71,9 +71,9 @@
|
|
|
71
71
|
"tmp": "^0.2.1",
|
|
72
72
|
"metro": "0.82.5"
|
|
73
73
|
},
|
|
74
|
-
"homepage": "https://gitcode.com/
|
|
74
|
+
"homepage": "https://gitcode.com/CPF-RN/ohos_react_native",
|
|
75
75
|
"repository": {
|
|
76
76
|
"type": "gitcode",
|
|
77
|
-
"url": "https://gitcode.com/
|
|
77
|
+
"url": "https://gitcode.com/CPF-RN/ohos_react_native"
|
|
78
78
|
}
|
|
79
79
|
}
|