已开启
feat:25P3 add contacts Demos in 0.82 branch #743
feat:25P3 add contacts Demos in 0.82 branch #743
已开启
gongjunqiang创建于 3月3日
11 个文件变更+111-21
M25P3/harmony/entry/oh-package.json5+1-1文件内容审核中,请稍后刷新重试
M25P3/harmony/entry/src/main/cpp/CMakeLists.txt+2-2文件内容审核中,请稍后刷新重试
M25P3/harmony/entry/src/main/cpp/PackageProvider.cpp+2-2文件内容审核中,请稍后刷新重试
M25P3/harmony/entry/src/main/ets/RNPackagesFactory.ets+2-2文件内容审核中,请稍后刷新重试
M25P3/harmony/entry/src/main/ets/pages/Index.ets+3-0文件内容审核中,请稍后刷新重试
M25P3/package.json+3-2文件内容审核中,请稍后刷新重试
M25P3/rn-tester/examples/react-native-contacts/ContactsDemo.tsx+9-6文件内容审核中,请稍后刷新重试
M25P3/rn-tester/utils/RNTesterList.ts+5-6文件内容审核中,请稍后刷新重试
A25P3/scripts/testPackages.json+5-0文件内容审核中,请稍后刷新重试
@@ -0,0 +1,79 @@
1+#!/usr/bin/env node
2+/*
3+ * Copyright (c) 2026 Huawei Device Co., Ltd.
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+const { execSync } = require('child_process');
17+const fs = require('fs');
18+const path = require('path');
19+ 
20+const targetUrl = 'https://w3.h u a w e i.com';
21+ 
22+function checkEnv() {
23+ try {
24+ const output = execSync(`curl -I "${targetUrl.replaceAll(' ', '')}" --max-time 5`, { stdio: 'pipe' }).toString();
25+ if (output.includes('200 OK')) {
26+ // 需要替换
27+ return true;
28+ } else {
29+ // 无需替换
30+ return false;
31+ }
32+ } catch (e) {
33+ console.error('curl is not installed or not found in PATH');
34+ process.exit(1);
35+ }
36+ return false;
37+}
38+ 
39+ 
40+async function main() {
41+ if (!checkEnv()) {
42+ console.log('Environment check failed');
43+ process.exit(1);
44+ }
45+ 
46+ const scriptDir = __dirname;
47+ 
48+ const rootPkgPath = path.join(scriptDir, '..', 'package.json');
49+ const packagesJson = JSON.parse(fs.readFileSync(rootPkgPath, 'utf8'));
50+ 
51+ const testPackagesPath = path.join(scriptDir, 'testPackages.json');
52+ const testPackages = require(testPackagesPath).packages;
53+ console.log(testPackages);
54+ const privateRegistryUrl = 'https://cmc.centralrepo.rnd.h u a w e i.com/artifactory/api/npm/product_npm';
55+ 
56+ 
57+ // @ts-ignore
58+ testPackages.forEach((pkg) => {
59+ const packageName = pkg.name;
60+ const tempversion = pkg.version;
61+ 
62+ if (tempversion) {
63+ const newVal = `${privateRegistryUrl.replaceAll(' ', '')}/${packageName}/-/${packageName}-${tempversion}.tgz`;
64+ packagesJson.dependencies[packageName] = newVal;
65+ } else {
66+ console.warn(`Skipping ${packageName}: no tempversion found`);
67+ }
68+ });
69+ 
70+ // Write the updated package.json back to disk
71+ fs.writeFileSync(rootPkgPath, JSON.stringify(packagesJson, null, 2), 'utf8');
72+ console.log('Done.');
73+}
74+ 
75+main().catch((e) => {
76+ console.error('Unexpected error:', e && e.stack ? e.stack : e);
77+ process.exit(3);
78+});
79+