@react-native-oh/react-native-harmony-cli 0.0.37 → 0.0.40

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 (138) hide show
  1. package/README.md +11 -11
  2. package/dist/assetResolver.js +74 -43
  3. package/dist/autolinking/Autolinking.js +183 -179
  4. package/dist/codegen/core/CodegenError.js +23 -3
  5. package/dist/codegen/core/EventUtils.js +3 -3
  6. package/dist/codegen/core/TypeAnnotationToTS.js +28 -24
  7. package/dist/codegen/core/UberSchema.js +96 -57
  8. package/dist/codegen/generators/AppBuildTimeGlueCodeGenerator.js +41 -28
  9. package/dist/codegen/generators/ArkTSComponentCodeGeneratorArkTS.js +34 -27
  10. package/dist/codegen/generators/ArkTSComponentCodeGeneratorCAPI.js +33 -25
  11. package/dist/codegen/generators/CppComponentCodeGenerator.js +28 -23
  12. package/dist/codegen/generators/LibGlueCodeGenerator.js +29 -26
  13. package/dist/codegen/generators/NativeModuleCodeGenerator.js +30 -25
  14. package/dist/codegen/generators/SharedComponentCodeGenerator.js +15 -15
  15. package/dist/codegen/generators/UberGeneratorV1.js +24 -18
  16. package/dist/codegen/generators/UberGeneratorV2.js +36 -28
  17. package/dist/codegen/templates/BaseComponentInstanceHTemplate.js +24 -50
  18. package/dist/codegen/templates/BasePackageHTemplate.js +21 -120
  19. package/dist/codegen/templates/ComponentDescriptorHTemplate.js +8 -53
  20. package/dist/codegen/templates/ComponentJSIBinderHTemplate.js +27 -75
  21. package/dist/codegen/templates/ComponentUtilsTSTemplate.js +29 -162
  22. package/dist/codegen/templates/IndexTSTemplate.js +17 -37
  23. package/dist/codegen/templates/RNOHGeneratedPackageHTemplate.js +24 -119
  24. package/dist/codegen/templates/TurboModuleCppTemplate.js +15 -38
  25. package/dist/codegen/templates/TurboModuleHTemplate.js +11 -32
  26. package/dist/codegen/templates/TurboModuleSpecTSTemplate.js +19 -52
  27. package/dist/commands/bundle-harmony.js +138 -53
  28. package/dist/commands/codegen-harmony.js +175 -104
  29. package/dist/commands/codegen-lib-harmony.js +116 -76
  30. package/dist/commands/create-metro-host-constants.js +47 -18
  31. package/dist/commands/init.js +961 -537
  32. package/dist/commands/link-harmony.js +71 -33
  33. package/dist/commands/pack-harmony.js +108 -47
  34. package/dist/commands/run-harmony.js +518 -374
  35. package/dist/commands/unpack-harmony.js +198 -105
  36. package/dist/commands/verify-package-harmony.js +108 -54
  37. package/dist/core/AbsolutePath.js +47 -31
  38. package/dist/core/CodegenConfig.js +22 -24
  39. package/dist/core/DescriptiveError.js +37 -18
  40. package/dist/core/FileSystem.js +18 -14
  41. package/dist/core/OHPackageJSON5.js +23 -17
  42. package/dist/core/PackageJSON.js +42 -26
  43. package/dist/core/ProjectDependenciesManager.js +96 -46
  44. package/dist/core/ValidationError.js +22 -2
  45. package/dist/core/fs.js +6 -9
  46. package/dist/index.js +1 -1
  47. package/dist/io/CliExecutor.js +98 -46
  48. package/dist/io/Logger.js +46 -40
  49. package/dist/io/RealFS.js +88 -35
  50. package/dist/io/TarGz.js +8 -11
  51. package/dist/io/__fixtures__.js +141 -79
  52. package/dist/io/fsUtils.js +12 -13
  53. package/dist/package-verifier/checks/HarmonyDirContainsOnlyHarsCheck.js +47 -19
  54. package/dist/package-verifier/checks/HarmonyDirExistsCheck.js +41 -13
  55. package/dist/package-verifier/checks/NpmAnAndOhPackageVersionsAreEqual.js +38 -8
  56. package/dist/package-verifier/checks/OhPackageNameFollowsNamingConventionCheck.js +54 -22
  57. package/dist/package-verifier/verify-package.js +132 -55
  58. package/dist/simulator/LaunchSimulator.js +301 -217
  59. package/jest.config.js +12 -12
  60. package/package.json +78 -70
  61. package/react-native.config.js +17 -17
  62. package/tsconfig.build.json +6 -6
  63. package/tsconfig.json +2 -2
  64. package/.prettierrc +0 -6
  65. package/src/assetResolver.ts +0 -134
  66. package/src/autolinking/Autolinking.test.ts +0 -483
  67. package/src/autolinking/Autolinking.ts +0 -382
  68. package/src/autolinking/index.ts +0 -8
  69. package/src/codegen/core/CodeGenerator.ts +0 -16
  70. package/src/codegen/core/CodegenError.ts +0 -10
  71. package/src/codegen/core/EventUtils.ts +0 -23
  72. package/src/codegen/core/TypeAnnotationToTS.test.ts +0 -82
  73. package/src/codegen/core/TypeAnnotationToTS.ts +0 -195
  74. package/src/codegen/core/UberSchema.ts +0 -152
  75. package/src/codegen/core/index.ts +0 -12
  76. package/src/codegen/generators/AppBuildTimeGlueCodeGenerator.ts +0 -124
  77. package/src/codegen/generators/ArkTSComponentCodeGeneratorArkTS.ts +0 -128
  78. package/src/codegen/generators/ArkTSComponentCodeGeneratorCAPI.ts +0 -122
  79. package/src/codegen/generators/CppComponentCodeGenerator.ts +0 -95
  80. package/src/codegen/generators/LibGlueCodeGenerator.ts +0 -98
  81. package/src/codegen/generators/NativeModuleCodeGenerator.ts +0 -124
  82. package/src/codegen/generators/SharedComponentCodeGenerator.ts +0 -57
  83. package/src/codegen/generators/UberGeneratorV1.ts +0 -75
  84. package/src/codegen/generators/UberGeneratorV2.ts +0 -114
  85. package/src/codegen/generators/index.ts +0 -15
  86. package/src/codegen/index.ts +0 -9
  87. package/src/codegen/templates/BaseComponentInstanceHTemplate.ts +0 -128
  88. package/src/codegen/templates/BasePackageHTemplate.ts +0 -159
  89. package/src/codegen/templates/ComponentDescriptorHTemplate.ts +0 -63
  90. package/src/codegen/templates/ComponentJSIBinderHTemplate.ts +0 -121
  91. package/src/codegen/templates/ComponentUtilsTSTemplate.ts +0 -222
  92. package/src/codegen/templates/IndexTSTemplate.ts +0 -62
  93. package/src/codegen/templates/RNOHGeneratedPackageHTemplate.ts +0 -150
  94. package/src/codegen/templates/TurboModuleCppTemplate.ts +0 -61
  95. package/src/codegen/templates/TurboModuleHTemplate.ts +0 -42
  96. package/src/codegen/templates/TurboModuleSpecTSTemplate.ts +0 -101
  97. package/src/codegen/templates/index.ts +0 -16
  98. package/src/commands/bundle-harmony.ts +0 -134
  99. package/src/commands/codegen-harmony.ts +0 -297
  100. package/src/commands/codegen-lib-harmony.ts +0 -389
  101. package/src/commands/create-metro-host-constants.ts +0 -55
  102. package/src/commands/index.ts +0 -16
  103. package/src/commands/init.ts +0 -755
  104. package/src/commands/link-harmony.ts +0 -102
  105. package/src/commands/pack-harmony.ts +0 -128
  106. package/src/commands/run-harmony.ts +0 -506
  107. package/src/commands/types.ts +0 -21
  108. package/src/commands/unpack-harmony.ts +0 -238
  109. package/src/commands/verify-package-harmony.ts +0 -113
  110. package/src/core/AbsolutePath.ts +0 -66
  111. package/src/core/CodegenConfig.ts +0 -67
  112. package/src/core/DescriptiveError.ts +0 -68
  113. package/src/core/FileSystem.ts +0 -57
  114. package/src/core/OHPackageJSON5.ts +0 -30
  115. package/src/core/PackageJSON.ts +0 -104
  116. package/src/core/ProjectDependenciesManager.ts +0 -103
  117. package/src/core/ValidationError.ts +0 -8
  118. package/src/core/ValueObject.ts +0 -9
  119. package/src/core/fs.ts +0 -38
  120. package/src/core/index.ts +0 -17
  121. package/src/index.ts +0 -33
  122. package/src/io/CliExecutor.ts +0 -69
  123. package/src/io/Logger.ts +0 -112
  124. package/src/io/RealFS.ts +0 -62
  125. package/src/io/TarGz.ts +0 -33
  126. package/src/io/__fixtures__.ts +0 -139
  127. package/src/io/fsUtils.ts +0 -44
  128. package/src/io/index.ts +0 -11
  129. package/src/package-verifier/checks/HarmonyDirContainsOnlyHarsCheck.ts +0 -35
  130. package/src/package-verifier/checks/HarmonyDirExistsCheck.ts +0 -31
  131. package/src/package-verifier/checks/NpmAnAndOhPackageVersionsAreEqual.ts +0 -25
  132. package/src/package-verifier/checks/OhPackageNameFollowsNamingConventionCheck.ts +0 -54
  133. package/src/package-verifier/checks/index.ts +0 -11
  134. package/src/package-verifier/index.ts +0 -9
  135. package/src/package-verifier/types.ts +0 -19
  136. package/src/package-verifier/verify-package.ts +0 -123
  137. package/src/simulator/LaunchSimulator.ts +0 -352
  138. package/src/simulator/index.ts +0 -8
@@ -1,55 +0,0 @@
1
- /**
2
- * Copyright (c) 2024-2025 Huawei Technologies Co., Ltd.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE-MIT file in the root directory of this source tree.
6
- */
7
-
8
- import { Command } from './types';
9
- import os from 'node:os';
10
- import fs from 'node:fs';
11
- import pathUtils from 'node:path';
12
-
13
- export const commandCreateMetroConstantsHarmony: Command = {
14
- name: 'create-metro-host-constants-harmony',
15
- description:
16
- 'Creates a Typescript file that exports constant with IP of the host machine. That IP is later used to connect to the Metro server from a physical device.',
17
- options: [
18
- {
19
- name: '--output <string>',
20
- description: 'Output file',
21
- default: './harmony/entry/src/main/ets/codegen/MetroHostConstants.ts',
22
- },
23
- ],
24
- func: async (argv, config, args: any) => {
25
- createMetroHostConstants(pathUtils.resolve(args.output));
26
- },
27
- };
28
-
29
- function createMetroHostConstants(outputPath: string): void {
30
- const networkInterfacesByName = os.networkInterfaces();
31
- const getIP = () => {
32
- for (let name of Object.keys(networkInterfacesByName)) {
33
- for (let net of networkInterfacesByName[name] ?? []) {
34
- // skip over non-ipv4 and internal (i.e. 127.0.0.1) addresses
35
- if (net.family === 'IPv4' && !net.internal) {
36
- return net.address;
37
- }
38
- }
39
- }
40
- return;
41
- };
42
- const ip = getIP();
43
- const tsCode = [
44
- '// This file is autogenerated. Do not modify it manually.',
45
- '',
46
- `export const METRO_SERVER_IP = '${ip}';\n`,
47
- ];
48
- fs.writeFile(outputPath, tsCode.join('\n'), (err) => {
49
- if (err) {
50
- console.error(`Error writing to ${outputPath}:`, err);
51
- } else {
52
- console.log(`Created file at ${outputPath}`);
53
- }
54
- });
55
- }
@@ -1,16 +0,0 @@
1
- /**
2
- * Copyright (c) 2024-2025 Huawei Technologies Co., Ltd.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE-MIT file in the root directory of this source tree.
6
- */
7
-
8
- export * from './bundle-harmony';
9
- export * from './pack-harmony';
10
- export * from './unpack-harmony';
11
- export * from './create-metro-host-constants';
12
- export * from './codegen-harmony';
13
- export * from './verify-package-harmony';
14
- export * from './codegen-lib-harmony';
15
- export * from './link-harmony';
16
- export * from './run-harmony';