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

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 (78) hide show
  1. package/dist/assetResolver.js +105 -10
  2. package/dist/autolinking/Autolinking.js +9 -11
  3. package/dist/codegen/core/EventUtils.js +5 -8
  4. package/dist/codegen/core/TypeAnnotationToTS.js +3 -3
  5. package/dist/codegen/core/UberSchema.js +7 -11
  6. package/dist/codegen/generators/AppBuildTimeGlueCodeGenerator.js +2 -1
  7. package/dist/codegen/generators/ArkTSComponentCodeGeneratorArkTS.js +3 -0
  8. package/dist/codegen/generators/ArkTSComponentCodeGeneratorCAPI.js +3 -0
  9. package/dist/codegen/generators/CppComponentCodeGenerator.js +3 -0
  10. package/dist/codegen/generators/LibGlueCodeGenerator.js +2 -2
  11. package/dist/codegen/templates/BasePackageHTemplate.js +12 -1
  12. package/dist/codegen/templates/ComponentJSIBinderHTemplate.js +15 -0
  13. package/dist/codegen/templates/RNOHGeneratedPackageHTemplate.js +12 -1
  14. package/dist/commands/bundle-harmony.js +4 -67
  15. package/dist/commands/codegen-harmony.js +13 -17
  16. package/dist/commands/codegen-lib-harmony.js +10 -14
  17. package/dist/commands/create-metro-host-constants.js +1 -1
  18. package/dist/commands/index.js +2 -1
  19. package/dist/commands/init.js +703 -0
  20. package/dist/commands/link-harmony.js +1 -1
  21. package/dist/commands/pack-harmony.js +1 -1
  22. package/dist/commands/run-harmony.js +462 -0
  23. package/dist/commands/types.js +8 -0
  24. package/dist/commands/unpack-harmony.js +2 -4
  25. package/dist/commands/verify-package-harmony.js +2 -2
  26. package/dist/core/CodegenConfig.js +4 -6
  27. package/dist/core/DescriptiveError.js +8 -4
  28. package/dist/core/PackageJSON.js +4 -7
  29. package/dist/core/fs.js +4 -5
  30. package/dist/index.js +2 -1
  31. package/dist/io/CliExecutor.js +57 -24
  32. package/dist/io/Logger.js +72 -42
  33. package/dist/io/TarGz.js +1 -2
  34. package/dist/io/__fixtures__.js +9 -3
  35. package/dist/io/fsUtils.js +1 -2
  36. package/dist/package-verifier/checks/HarmonyDirContainsOnlyHarsCheck.js +1 -2
  37. package/dist/package-verifier/checks/HarmonyDirExistsCheck.js +1 -2
  38. package/dist/package-verifier/checks/NpmAnAndOhPackageVersionsAreEqual.js +1 -2
  39. package/dist/package-verifier/checks/OhPackageNameFollowsNamingConventionCheck.js +1 -2
  40. package/dist/package-verifier/verify-package.js +7 -10
  41. package/dist/simulator/LaunchSimulator.js +311 -0
  42. package/dist/simulator/index.js +23 -0
  43. package/package.json +13 -6
  44. package/src/assetResolver.ts +117 -11
  45. package/src/autolinking/Autolinking.ts +10 -12
  46. package/src/codegen/core/EventUtils.ts +4 -6
  47. package/src/codegen/core/UberSchema.ts +7 -11
  48. package/src/codegen/generators/AppBuildTimeGlueCodeGenerator.ts +5 -1
  49. package/src/codegen/generators/ArkTSComponentCodeGeneratorArkTS.ts +3 -0
  50. package/src/codegen/generators/ArkTSComponentCodeGeneratorCAPI.ts +3 -0
  51. package/src/codegen/generators/CppComponentCodeGenerator.ts +3 -0
  52. package/src/codegen/generators/LibGlueCodeGenerator.ts +2 -2
  53. package/src/codegen/templates/BasePackageHTemplate.ts +13 -1
  54. package/src/codegen/templates/ComponentJSIBinderHTemplate.ts +24 -1
  55. package/src/codegen/templates/RNOHGeneratedPackageHTemplate.ts +13 -1
  56. package/src/commands/bundle-harmony.ts +6 -81
  57. package/src/commands/codegen-harmony.ts +14 -19
  58. package/src/commands/codegen-lib-harmony.ts +11 -16
  59. package/src/commands/create-metro-host-constants.ts +2 -2
  60. package/src/commands/index.ts +2 -1
  61. package/src/commands/init.ts +755 -0
  62. package/src/commands/link-harmony.ts +2 -2
  63. package/src/commands/pack-harmony.ts +2 -2
  64. package/src/commands/run-harmony.ts +506 -0
  65. package/src/commands/types.ts +21 -0
  66. package/src/commands/unpack-harmony.ts +3 -5
  67. package/src/commands/verify-package-harmony.ts +3 -3
  68. package/src/core/CodegenConfig.ts +4 -6
  69. package/src/core/DescriptiveError.ts +9 -9
  70. package/src/core/PackageJSON.ts +5 -8
  71. package/src/core/fs.ts +2 -2
  72. package/src/index.ts +5 -3
  73. package/src/io/CliExecutor.ts +56 -34
  74. package/src/io/Logger.ts +78 -45
  75. package/src/io/__fixtures__.ts +15 -11
  76. package/src/package-verifier/verify-package.ts +5 -7
  77. package/src/simulator/LaunchSimulator.ts +352 -0
  78. package/src/simulator/index.ts +8 -0
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * Copyright (c) 2024 Huawei Technologies Co., Ltd.
3
+ * Copyright (c) 2024-2025 Huawei Technologies Co., Ltd.
4
4
  *
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE-MIT file in the root directory of this source tree.
@@ -107,19 +107,19 @@ function validateRawArgs(rawArgs) {
107
107
  if (!rawArgs.npmPackageName) {
108
108
  throw new core_1.DescriptiveError({
109
109
  whatHappened: '--npm-package-name is required',
110
- whatCanUserDo: { default: ['Please specify --npm-package-name'] },
110
+ whatCanUserDo: ['Please specify --npm-package-name'],
111
111
  });
112
112
  }
113
113
  if (!rawArgs.cppOutputPath) {
114
114
  throw new core_1.DescriptiveError({
115
115
  whatHappened: '--cpp-output-path is required',
116
- whatCanUserDo: { default: ['Please specify --cpp-output-path'] },
116
+ whatCanUserDo: ['Please specify --cpp-output-path'],
117
117
  });
118
118
  }
119
119
  if (!rawArgs.etsOutputPath) {
120
120
  throw new core_1.DescriptiveError({
121
121
  whatHappened: '--ets-output-path is required',
122
- whatCanUserDo: { default: ['Please specify --ets-output-path'] },
122
+ whatCanUserDo: ['Please specify --ets-output-path'],
123
123
  });
124
124
  }
125
125
  return {
@@ -138,9 +138,7 @@ function specPathsToSpecFilePaths(specPaths) {
138
138
  if (!node_fs_1.default.existsSync(specPath.getValue())) {
139
139
  throw new core_1.DescriptiveError({
140
140
  whatHappened: `No such file or directory: ${specPath.getValue()}`,
141
- whatCanUserDo: {
142
- default: [`Are you sure provided specPath exists?`],
143
- },
141
+ whatCanUserDo: [`Are you sure provided specPath exists?`],
144
142
  });
145
143
  }
146
144
  if (node_fs_1.default.lstatSync(specPath.getValue()).isDirectory()) {
@@ -237,12 +235,10 @@ function prepareDirectory(path, enableSafetyCheck) {
237
235
  if (enableSafetyCheck && !path.getValue().startsWith(process.cwd())) {
238
236
  throw new core_1.DescriptiveError({
239
237
  whatHappened: `Tried to remove files in ${path.getValue()}\nand that path is outside current working directory`,
240
- whatCanUserDo: {
241
- default: [
242
- 'Run this command with --no-safety-check flag',
243
- 'Run codegen from different location',
244
- ],
245
- },
238
+ whatCanUserDo: [
239
+ 'Run this command with --no-safety-check flag',
240
+ 'Run codegen from different location',
241
+ ],
246
242
  });
247
243
  }
248
244
  (0, core_1.maybeRemoveFilesInDirectory)(path);
@@ -254,6 +250,6 @@ function logCodegenResult(logger, fileContentByPath, rootPath) {
254
250
  logger.info((styles) => styles.gray(`• ${pathStr}`));
255
251
  });
256
252
  logger.info(() => '');
257
- logger.info((styles) => `Generated ${styles.green(styles.bold(fileContentByPath.size))} file(s)`, { prefix: true });
253
+ logger.info((styles) => `Generated ${styles.green(styles.bold(fileContentByPath.size))} file(s)`);
258
254
  logger.info(() => '');
259
255
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * Copyright (c) 2024 Huawei Technologies Co., Ltd.
3
+ * Copyright (c) 2024-2025 Huawei Technologies Co., Ltd.
4
4
  *
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE-MIT file in the root directory of this source tree.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * Copyright (c) 2024 Huawei Technologies Co., Ltd.
3
+ * Copyright (c) 2024-2025 Huawei Technologies Co., Ltd.
4
4
  *
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE-MIT file in the root directory of this source tree.
@@ -28,3 +28,4 @@ __exportStar(require("./codegen-harmony"), exports);
28
28
  __exportStar(require("./verify-package-harmony"), exports);
29
29
  __exportStar(require("./codegen-lib-harmony"), exports);
30
30
  __exportStar(require("./link-harmony"), exports);
31
+ __exportStar(require("./run-harmony"), exports);