react-native-update-cli 2.2.3 → 2.3.1

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/cli.json CHANGED
@@ -213,7 +213,7 @@
213
213
  "rncli": {
214
214
  "default": false
215
215
  },
216
- "disableHermes": {
216
+ "hermes": {
217
217
  "default": false
218
218
  },
219
219
  "name": {
@@ -299,15 +299,6 @@
299
299
  }
300
300
  }
301
301
  },
302
- "hdiffFromPPK": {
303
- "description": "Create hdiff patch from a Prepare package(.ppk)",
304
- "options": {
305
- "output": {
306
- "default": "${tempDir}/output/hdiff-${time}.ppk-patch",
307
- "hasValue": true
308
- }
309
- }
310
- },
311
302
  "hdiffFromApp": {
312
303
  "description": "Create hdiff patch from a Harmony package(.app)",
313
304
  "options": {
@@ -343,6 +334,10 @@
343
334
  "hasValue": true
344
335
  }
345
336
  }
337
+ },
338
+ "install": {
339
+ "description": "Install optional dependencies to the CLI",
340
+ "options": {}
346
341
  }
347
342
  },
348
343
  "globalOptions": {
package/lib/bundle.js CHANGED
@@ -91,7 +91,7 @@ try {
91
91
  try {
92
92
  hdiff = require('node-hdiffpatch').diff;
93
93
  } catch (e) {}
94
- async function runReactNativeBundleCommand({ bundleName, dev, entryFile, outputFolder, platform, sourcemapOutput, config, disableHermes, cli }) {
94
+ async function runReactNativeBundleCommand({ bundleName, dev, entryFile, outputFolder, platform, sourcemapOutput, config, forceHermes, cli }) {
95
95
  let gradleConfig = {};
96
96
  if (platform === 'android') {
97
97
  gradleConfig = await checkGradleConfig();
@@ -183,9 +183,16 @@ async function runReactNativeBundleCommand({ bundleName, dev, entryFile, outputF
183
183
  } else if (cli.taro) {
184
184
  bundleCommand = 'build';
185
185
  }
186
- reactNativeBundleArgs.push(cliPath, bundleCommand);
186
+ if (platform === 'harmony') {
187
+ bundleName = 'bundle.harmony.js';
188
+ if (forceHermes === undefined) {
189
+ // enable hermes by default for harmony
190
+ forceHermes = true;
191
+ }
192
+ }
193
+ reactNativeBundleArgs.push(cliPath, bundleCommand, '--assets-dest', outputFolder, '--bundle-output', _path.default.join(outputFolder, bundleName));
187
194
  if (platform !== 'harmony') {
188
- reactNativeBundleArgs.push('--platform', platform, '--assets-dest', outputFolder, '--bundle-output', _path.default.join(outputFolder, bundleName), '--reset-cache');
195
+ reactNativeBundleArgs.push('--platform', platform, '--reset-cache');
189
196
  }
190
197
  if (cli.taro) {
191
198
  reactNativeBundleArgs.push('--type', 'rn');
@@ -214,9 +221,9 @@ async function runReactNativeBundleCommand({ bundleName, dev, entryFile, outputF
214
221
  })));
215
222
  } else {
216
223
  let hermesEnabled = false;
217
- if (disableHermes) {
218
- hermesEnabled = false;
219
- console.log((0, _i18n.t)('hermesDisabled'));
224
+ if (forceHermes) {
225
+ hermesEnabled = true;
226
+ console.log((0, _i18n.t)('forceHermes'));
220
227
  } else if (platform === 'android') {
221
228
  const gradlePropeties = await new Promise((resolve)=>{
222
229
  properties.parse('./android/gradle.properties', {
@@ -233,66 +240,27 @@ async function runReactNativeBundleCommand({ bundleName, dev, entryFile, outputF
233
240
  if (typeof hermesEnabled !== 'boolean') hermesEnabled = gradleConfig.enableHermes;
234
241
  } else if (platform === 'ios' && _fsextra.existsSync('ios/Pods/hermes-engine')) {
235
242
  hermesEnabled = true;
236
- } else if (platform === 'harmony') {
237
- await copyHarmonyBundle(outputFolder);
238
243
  }
239
244
  if (hermesEnabled) {
240
245
  await compileHermesByteCode(bundleName, outputFolder, sourcemapOutput, !isSentry);
241
246
  }
247
+ if (platform === 'harmony') {
248
+ const harmonyRawAssetsPath = 'harmony/entry/src/main/resources/rawfile/assets';
249
+ // copy all files in outputFolder to harmonyRawPath
250
+ // assets should be in rawfile/assets
251
+ _fsextra.ensureDirSync(harmonyRawAssetsPath);
252
+ _fsextra.copySync(outputFolder, harmonyRawAssetsPath, {
253
+ overwrite: true
254
+ });
255
+ _fsextra.moveSync(`${harmonyRawAssetsPath}/bundle.harmony.js`, `${harmonyRawAssetsPath}/../bundle.harmony.js`, {
256
+ overwrite: true
257
+ });
258
+ }
242
259
  resolve(null);
243
260
  }
244
261
  });
245
262
  });
246
263
  }
247
- async function copyHarmonyBundle(outputFolder) {
248
- const harmonyRawPath = 'harmony/entry/src/main/resources/rawfile';
249
- try {
250
- await _fsextra.ensureDir(harmonyRawPath);
251
- try {
252
- await _fsextra.access(harmonyRawPath, _fsextra.constants.W_OK);
253
- } catch (error) {
254
- await _fsextra.chmod(harmonyRawPath, 0o755);
255
- }
256
- await _fsextra.remove(_path.default.join(harmonyRawPath, 'update.json'));
257
- await _fsextra.copy('update.json', _path.default.join(harmonyRawPath, 'update.json'));
258
- await _fsextra.ensureDir(outputFolder);
259
- // Recursively copy files with special handling for assets directory
260
- async function copyFilesRecursively(srcDir, destDir, relativePath = '') {
261
- const fullSrcPath = _path.default.join(srcDir, relativePath);
262
- const items = await _fsextra.readdir(fullSrcPath);
263
- for (const item of items){
264
- const itemRelativePath = _path.default.join(relativePath, item);
265
- const itemSrcPath = _path.default.join(srcDir, itemRelativePath);
266
- // Skip update.json and meta.json at root level
267
- if (!relativePath && (item === 'update.json' || item === 'meta.json')) {
268
- continue;
269
- }
270
- const stat = await _fsextra.stat(itemSrcPath);
271
- if (stat.isFile()) {
272
- // Special handling: remove 'assets/' prefix to move files up one level
273
- let itemDestPath = itemRelativePath;
274
- if (itemDestPath.startsWith('assets/') || itemDestPath.startsWith('assets\\')) {
275
- itemDestPath = itemDestPath.replace(/^assets[\\/]/, '');
276
- }
277
- const fullDestPath = _path.default.join(destDir, itemDestPath);
278
- await _fsextra.ensureDir(_path.default.dirname(fullDestPath));
279
- await _fsextra.copy(itemSrcPath, fullDestPath);
280
- } else if (stat.isDirectory()) {
281
- // Recursively process subdirectories
282
- await copyFilesRecursively(srcDir, destDir, itemRelativePath);
283
- }
284
- }
285
- }
286
- await copyFilesRecursively(harmonyRawPath, outputFolder);
287
- } catch (error) {
288
- console.error((0, _i18n.t)('copyHarmonyBundleError', {
289
- error
290
- }));
291
- throw new Error((0, _i18n.t)('copyFileFailed', {
292
- error: error.message
293
- }));
294
- }
295
- }
296
264
  function getHermesOSBin() {
297
265
  if (_os.default.platform() === 'win32') return 'win64-bin';
298
266
  if (_os.default.platform() === 'darwin') return 'osx-bin';
@@ -445,7 +413,8 @@ async function uploadSourcemapForSentry(bundleName, outputFolder, sourcemapOutpu
445
413
  const ignorePackingFileNames = [
446
414
  '.',
447
415
  '..',
448
- 'index.bundlejs.map'
416
+ 'index.bundlejs.map',
417
+ 'bundle.harmony.js.map'
449
418
  ];
450
419
  const ignorePackingExtensions = [
451
420
  'DS_Store',
@@ -517,14 +486,14 @@ async function diffFromPPK(origin, next, output) {
517
486
  if (!/\/$/.test(entry.fileName)) {
518
487
  // isFile
519
488
  originMap[entry.crc32] = entry.fileName;
520
- if (entry.fileName === 'index.bundlejs' || entry.fileName === 'bundle.harmony.js') {
489
+ if ((0, _constants.isPPKBundleFileName)(entry.fileName)) {
521
490
  // This is source.
522
491
  return readEntry(entry, zipFile).then((v)=>originSource = v);
523
492
  }
524
493
  }
525
494
  });
526
495
  if (!originSource) {
527
- throw new Error('Bundle file not found! Please use default bundle file name and path.');
496
+ throw new Error((0, _i18n.t)('bundleFileNotFound'));
528
497
  }
529
498
  const copies = {};
530
499
  const copiesv2 = {};
@@ -557,18 +526,11 @@ async function diffFromPPK(origin, next, output) {
557
526
  if (!originEntries[entry.fileName]) {
558
527
  addEntry(entry.fileName);
559
528
  }
560
- } else if (entry.fileName === 'index.bundlejs') {
529
+ } else if ((0, _constants.isPPKBundleFileName)(entry.fileName)) {
561
530
  //console.log('Found bundle');
562
531
  return readEntry(entry, nextZipfile).then((newSource)=>{
563
532
  //console.log('Begin diff');
564
- zipfile.addBuffer(diff(originSource, newSource), 'index.bundlejs.patch');
565
- //console.log('End diff');
566
- });
567
- } else if (entry.fileName === 'bundle.harmony.js') {
568
- //console.log('Found bundle');
569
- return readEntry(entry, nextZipfile).then((newSource)=>{
570
- //console.log('Begin diff');
571
- zipfile.addBuffer(diff(originSource, newSource), 'bundle.harmony.js.patch');
533
+ zipfile.addBuffer(diff(originSource, newSource), `${entry.fileName}.patch`);
572
534
  //console.log('End diff');
573
535
  });
574
536
  } else {
@@ -644,7 +606,7 @@ async function diffFromPackage(origin, next, output, originBundleName, transform
644
606
  }
645
607
  });
646
608
  if (!originSource) {
647
- throw new Error('Bundle file not found! Please use default bundle file name and path.');
609
+ throw new Error((0, _i18n.t)('bundleFileNotFound'));
648
610
  }
649
611
  const copies = {};
650
612
  const copiesv2 = {};
@@ -661,18 +623,11 @@ async function diffFromPackage(origin, next, output, originBundleName, transform
661
623
  if (/\/$/.test(entry.fileName)) {
662
624
  // Directory
663
625
  zipfile.addEmptyDirectory(entry.fileName);
664
- } else if (entry.fileName === 'index.bundlejs') {
626
+ } else if ((0, _constants.isPPKBundleFileName)(entry.fileName)) {
665
627
  //console.log('Found bundle');
666
628
  return readEntry(entry, nextZipfile).then((newSource)=>{
667
629
  //console.log('Begin diff');
668
- zipfile.addBuffer(diff(originSource, newSource), 'index.bundlejs.patch');
669
- //console.log('End diff');
670
- });
671
- } else if (entry.fileName === 'bundle.harmony.js') {
672
- //console.log('Found bundle');
673
- return readEntry(entry, nextZipfile).then((newSource)=>{
674
- //console.log('Begin diff');
675
- zipfile.addBuffer(diff(originSource, newSource), 'bundle.harmony.js.patch');
630
+ zipfile.addBuffer(diff(originSource, newSource), `${entry.fileName}.patch`);
676
631
  //console.log('End diff');
677
632
  });
678
633
  } else {
@@ -762,20 +717,25 @@ function diffArgsCheck(args, options, diffFn) {
762
717
  }
763
718
  if (diffFn.startsWith('hdiff')) {
764
719
  if (!hdiff) {
765
- console.error(`This function needs "node-hdiffpatch".
766
- Please run "npm i node-hdiffpatch" to install`);
720
+ console.error((0, _i18n.t)('nodeHdiffpatchRequired', {
721
+ scriptName: _constants.scriptName
722
+ }));
767
723
  process.exit(1);
768
724
  }
769
725
  diff = hdiff;
770
726
  } else {
771
727
  if (!bsdiff) {
772
- console.error(`This function needs "node-bsdiff".
773
- Please run "npm i node-bsdiff" to install`);
728
+ console.error((0, _i18n.t)('nodeBsdiffRequired', {
729
+ scriptName: _constants.scriptName
730
+ }));
774
731
  process.exit(1);
775
732
  }
776
733
  diff = bsdiff;
777
734
  }
778
- const { output } = options;
735
+ const { output } = (0, _utils.translateOptions)({
736
+ ...options,
737
+ tempDir: _constants.tempDir
738
+ });
779
739
  return {
780
740
  origin,
781
741
  next,
@@ -785,7 +745,7 @@ function diffArgsCheck(args, options, diffFn) {
785
745
  const bundleCommands = {
786
746
  bundle: async ({ options })=>{
787
747
  const platform = await (0, _app.getPlatform)(options.platform);
788
- const { bundleName, entryFile, intermediaDir, output, dev, sourcemap, taro, expo, rncli, disableHermes, name, description, metaInfo, packageId, packageVersion, minPackageVersion, maxPackageVersion, packageVersionRange, rollout, dryRun } = (0, _utils.translateOptions)({
748
+ const { bundleName, entryFile, intermediaDir, output, dev, sourcemap, taro, expo, rncli, hermes, name, description, metaInfo, packageId, packageVersion, minPackageVersion, maxPackageVersion, packageVersionRange, rollout, dryRun } = (0, _utils.translateOptions)({
789
749
  ...options,
790
750
  tempDir: _constants.tempDir,
791
751
  platform
@@ -808,7 +768,7 @@ const bundleCommands = {
808
768
  outputFolder: intermediaDir,
809
769
  platform,
810
770
  sourcemapOutput: sourcemap || sourcemapPlugin ? sourcemapOutput : '',
811
- disableHermes: !!disableHermes,
771
+ forceHermes: hermes,
812
772
  cli: {
813
773
  taro: !!taro,
814
774
  expo: !!expo,
@@ -860,32 +820,44 @@ const bundleCommands = {
860
820
  async diff ({ args, options }) {
861
821
  const { origin, next, realOutput } = diffArgsCheck(args, options, 'diff');
862
822
  await diffFromPPK(origin, next, realOutput);
863
- console.log(`${realOutput} generated.`);
823
+ console.log((0, _i18n.t)('diffPackageGenerated', {
824
+ output: realOutput
825
+ }));
864
826
  },
865
827
  async hdiff ({ args, options }) {
866
828
  const { origin, next, realOutput } = diffArgsCheck(args, options, 'hdiff');
867
829
  await diffFromPPK(origin, next, realOutput);
868
- console.log(`${realOutput} generated.`);
830
+ console.log((0, _i18n.t)('diffPackageGenerated', {
831
+ output: realOutput
832
+ }));
869
833
  },
870
834
  async diffFromApk ({ args, options }) {
871
835
  const { origin, next, realOutput } = diffArgsCheck(args, options, 'diffFromApk');
872
836
  await diffFromPackage(origin, next, realOutput, 'assets/index.android.bundle');
873
- console.log(`${realOutput} generated.`);
837
+ console.log((0, _i18n.t)('diffPackageGenerated', {
838
+ output: realOutput
839
+ }));
874
840
  },
875
841
  async hdiffFromApk ({ args, options }) {
876
842
  const { origin, next, realOutput } = diffArgsCheck(args, options, 'hdiffFromApk');
877
843
  await diffFromPackage(origin, next, realOutput, 'assets/index.android.bundle');
878
- console.log(`${realOutput} generated.`);
844
+ console.log((0, _i18n.t)('diffPackageGenerated', {
845
+ output: realOutput
846
+ }));
879
847
  },
880
848
  async diffFromApp ({ args, options }) {
881
849
  const { origin, next, realOutput } = diffArgsCheck(args, options, 'diffFromApp');
882
850
  await diffFromPackage(origin, next, realOutput, 'resources/rawfile/bundle.harmony.js');
883
- console.log(`${realOutput} generated.`);
851
+ console.log((0, _i18n.t)('diffPackageGenerated', {
852
+ output: realOutput
853
+ }));
884
854
  },
885
855
  async hdiffFromApp ({ args, options }) {
886
856
  const { origin, next, realOutput } = diffArgsCheck(args, options, 'hdiffFromApp');
887
857
  await diffFromPackage(origin, next, realOutput, 'resources/rawfile/bundle.harmony.js');
888
- console.log(`${realOutput} generated.`);
858
+ console.log((0, _i18n.t)('diffPackageGenerated', {
859
+ output: realOutput
860
+ }));
889
861
  },
890
862
  async diffFromIpa ({ args, options }) {
891
863
  const { origin, next, realOutput } = diffArgsCheck(args, options, 'diffFromIpa');
@@ -893,7 +865,9 @@ const bundleCommands = {
893
865
  const m = /^Payload\/[^/]+\/(.+)$/.exec(v);
894
866
  return m == null ? void 0 : m[1];
895
867
  });
896
- console.log(`${realOutput} generated.`);
868
+ console.log((0, _i18n.t)('diffPackageGenerated', {
869
+ output: realOutput
870
+ }));
897
871
  },
898
872
  async hdiffFromIpa ({ args, options }) {
899
873
  const { origin, next, realOutput } = diffArgsCheck(args, options, 'hdiffFromIpa');
@@ -901,6 +875,8 @@ const bundleCommands = {
901
875
  const m = /^Payload\/[^/]+\/(.+)$/.exec(v);
902
876
  return m == null ? void 0 : m[1];
903
877
  });
904
- console.log(`${realOutput} generated.`);
878
+ console.log((0, _i18n.t)('diffPackageGenerated', {
879
+ output: realOutput
880
+ }));
905
881
  }
906
882
  };
package/lib/index.js CHANGED
@@ -20,6 +20,7 @@ _export(exports, {
20
20
  const _api = require("./api");
21
21
  const _app = require("./app");
22
22
  const _bundle = require("./bundle");
23
+ const _install = require("./install");
23
24
  const _modulemanager = require("./module-manager");
24
25
  const _modules = require("./modules");
25
26
  const _package = require("./package");
@@ -46,7 +47,8 @@ function printUsage() {
46
47
  ..._bundle.bundleCommands,
47
48
  ..._app.appCommands,
48
49
  ..._package.packageCommands,
49
- ..._versions.versionCommands
50
+ ..._versions.versionCommands,
51
+ ..._install.installCommands
50
52
  };
51
53
  for (const [name, handler] of Object.entries(legacyCommands)){
52
54
  console.log(` ${name}: Legacy command`);
@@ -78,6 +80,7 @@ const legacyCommands = {
78
80
  ..._app.appCommands,
79
81
  ..._package.packageCommands,
80
82
  ..._versions.versionCommands,
83
+ ..._install.installCommands,
81
84
  help: printUsage
82
85
  };
83
86
  async function run() {
package/lib/install.js ADDED
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "installCommands", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return installCommands;
9
+ }
10
+ });
11
+ const _child_process = require("child_process");
12
+ const _path = /*#__PURE__*/ _interop_require_default(require("path"));
13
+ function _interop_require_default(obj) {
14
+ return obj && obj.__esModule ? obj : {
15
+ default: obj
16
+ };
17
+ }
18
+ const installCommands = {
19
+ install: async ({ args })=>{
20
+ if (args.length === 0) {
21
+ return;
22
+ }
23
+ const cliDir = _path.default.resolve(__dirname, '..');
24
+ (0, _child_process.spawnSync)('npm', [
25
+ 'install',
26
+ ...args
27
+ ], {
28
+ cwd: cliDir,
29
+ stdio: 'inherit',
30
+ shell: true
31
+ });
32
+ }
33
+ };
package/lib/locales/en.js CHANGED
@@ -44,7 +44,7 @@ const _default = {
44
44
  failedToParseUpdateJson: 'Failed to parse file `update.json`. Try to remove it manually.',
45
45
  fileGenerated: '{{- file}} generated.',
46
46
  fileSizeExceeded: 'This file size is {{fileSize}} , exceeding the current quota {{maxSize}} . You may consider upgrading to a higher plan to increase this quota. Details can be found at: {{- pricingPageUrl}}',
47
- hermesDisabled: 'Hermes disabled',
47
+ forceHermes: 'Forcing Hermes enabled for this build',
48
48
  hermesEnabledCompiling: 'Hermes enabled, now compiling to hermes bytecode:\n',
49
49
  ipaUploadSuccess: 'Successfully uploaded IPA native package (id: {{id}}, version: {{version}}, buildTime: {{buildTime}})',
50
50
  keyStrings: 'Key strings:',
@@ -118,5 +118,9 @@ This can reduce the risk of inconsistent dependencies and supply chain attacks.
118
118
  confirmDeletePackage: 'Confirm delete native package {{packageId}}? This operation cannot be undone (Y/N):',
119
119
  deletePackageSuccess: 'Native package {{packageId}} deleted successfully',
120
120
  deletePackageError: 'Failed to delete native package {{packageId}}: {{error}}',
121
- usageDeletePackage: 'Usage: cresc deletePackage [packageId] --appId [appId]'
121
+ usageDeletePackage: 'Usage: cresc deletePackage [packageId] --appId [appId]',
122
+ bundleFileNotFound: 'Bundle file not found! Please use default bundle file name and path.',
123
+ diffPackageGenerated: '{{- output}} generated.',
124
+ nodeBsdiffRequired: 'This function needs "node-bsdiff". Please run "{{scriptName}} install node-bsdiff" to install',
125
+ nodeHdiffpatchRequired: 'This function needs "node-hdiffpatch". Please run "{{scriptName}} install node-hdiffpatch" to install'
122
126
  };
package/lib/locales/zh.js CHANGED
@@ -44,7 +44,7 @@ const _default = {
44
44
  failedToParseUpdateJson: '无法解析文件 `update.json`。请手动删除它。',
45
45
  fileGenerated: '已生成 {{- file}}',
46
46
  fileSizeExceeded: '此文件大小 {{fileSize}} , 超出当前额度 {{maxSize}} 。您可以考虑升级付费业务以提升此额度。详情请访问: {{- pricingPageUrl}}',
47
- hermesDisabled: 'Hermes 已禁用',
47
+ forceHermes: '强制启用 Hermes 编译',
48
48
  hermesEnabledCompiling: 'Hermes 已启用,正在编译为 hermes 字节码:\n',
49
49
  ipaUploadSuccess: '已成功上传ipa原生包(id: {{id}}, version: {{version}}, buildTime: {{buildTime}})',
50
50
  keyStrings: '键字符串:',
@@ -117,5 +117,9 @@ const _default = {
117
117
  confirmDeletePackage: '确认删除原生包 {{packageId}}? 此操作不可撤销 (Y/N):',
118
118
  deletePackageSuccess: '原生包 {{packageId}} 删除成功',
119
119
  deletePackageError: '删除原生包 {{packageId}} 失败: {{error}}',
120
- usageDeletePackage: '使用方法: pushy deletePackage [packageId] --appId [appId]'
120
+ usageDeletePackage: '使用方法: pushy deletePackage [packageId] --appId [appId]',
121
+ bundleFileNotFound: '未找到 bundle 文件!请使用默认的 bundle 文件名和路径。',
122
+ diffPackageGenerated: '{{- output}} 已生成。',
123
+ nodeBsdiffRequired: '此功能需要 "node-bsdiff"。请运行 "{{scriptName}} install node-bsdiff" 来安装',
124
+ nodeHdiffpatchRequired: '此功能需要 "node-hdiffpatch"。请运行 "{{scriptName}} install node-hdiffpatch" 来安装'
121
125
  };
@@ -46,7 +46,7 @@ const bundleModule = {
46
46
  description: 'Build current version',
47
47
  execute: async (context, previousResult)=>{
48
48
  console.log('🏗️ Building current version...');
49
- const { platform, dev = false, sourcemap = false, bundleName = 'index.bundlejs', entryFile = 'index.js', intermediaDir, taro = false, expo = false, rncli = false, disableHermes = false, output } = context.options;
49
+ const { platform, dev = false, sourcemap = false, bundleName = 'index.bundlejs', entryFile = 'index.js', intermediaDir, taro = false, expo = false, rncli = false, hermes = false, output } = context.options;
50
50
  console.log(`Building ${platform} platform...`);
51
51
  console.log(` Entry file: ${entryFile}`);
52
52
  console.log(` Bundle name: ${bundleName}`);
@@ -62,7 +62,7 @@ const bundleModule = {
62
62
  taro,
63
63
  expo,
64
64
  rncli,
65
- disableHermes,
65
+ hermes,
66
66
  intermediaDir: '${tempDir}/intermedia/${platform}',
67
67
  output: '${tempDir}/output/${platform}.${time}.ppk'
68
68
  };
@@ -156,10 +156,10 @@ const bundleModule = {
156
156
  default: false,
157
157
  description: 'Use React Native CLI'
158
158
  },
159
- disableHermes: {
159
+ hermes: {
160
160
  hasValue: false,
161
161
  default: false,
162
- description: 'Disable Hermes'
162
+ description: 'Force enable Hermes'
163
163
  },
164
164
  name: {
165
165
  hasValue: true,
package/lib/provider.js CHANGED
@@ -72,7 +72,7 @@ class CLIProviderImpl {
72
72
  taro: options.taro || false,
73
73
  expo: options.expo || false,
74
74
  rncli: options.rncli || false,
75
- disableHermes: options.disableHermes || false
75
+ hermes: options.hermes || false
76
76
  }
77
77
  };
78
78
  const { bundleCommands } = await Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("./bundle")));
@@ -18,9 +18,18 @@ _export(exports, {
18
18
  defaultEndpoints: function() {
19
19
  return defaultEndpoints;
20
20
  },
21
+ isPPKBundleFileName: function() {
22
+ return isPPKBundleFileName;
23
+ },
24
+ ppkBundleFileNames: function() {
25
+ return ppkBundleFileNames;
26
+ },
21
27
  pricingPageUrl: function() {
22
28
  return pricingPageUrl;
23
29
  },
30
+ scriptName: function() {
31
+ return scriptName;
32
+ },
24
33
  tempDir: function() {
25
34
  return tempDir;
26
35
  },
@@ -36,6 +45,11 @@ function _interop_require_default(obj) {
36
45
  }
37
46
  const scriptName = _path.default.basename(process.argv[1]);
38
47
  const IS_CRESC = scriptName === 'cresc';
48
+ const ppkBundleFileNames = [
49
+ 'index.bundlejs',
50
+ 'bundle.harmony.js'
51
+ ];
52
+ const isPPKBundleFileName = (fileName)=>ppkBundleFileNames.includes(fileName);
39
53
  const credentialFile = IS_CRESC ? '.cresc.token' : '.update';
40
54
  const updateJson = IS_CRESC ? 'cresc.config.json' : 'update.json';
41
55
  const tempDir = IS_CRESC ? '.cresc.temp' : '.pushy';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-update-cli",
3
- "version": "2.2.3",
3
+ "version": "2.3.1",
4
4
  "description": "command line tool for react-native-update (remote updates for react native)",
5
5
  "main": "index.js",
6
6
  "bin": {
package/src/bundle.ts CHANGED
@@ -16,7 +16,7 @@ import os from 'os';
16
16
  const properties = require('properties');
17
17
  import { addGitIgnore } from './utils/add-gitignore';
18
18
  import { checkLockFiles } from './utils/check-lockfile';
19
- import { tempDir } from './utils/constants';
19
+ import { isPPKBundleFileName, scriptName, tempDir } from './utils/constants';
20
20
  import { depVersions } from './utils/dep-versions';
21
21
  import { t } from './utils/i18n';
22
22
  import { versionCommands } from './versions';
@@ -42,7 +42,7 @@ async function runReactNativeBundleCommand({
42
42
  platform,
43
43
  sourcemapOutput,
44
44
  config,
45
- disableHermes,
45
+ forceHermes,
46
46
  cli,
47
47
  }: {
48
48
  bundleName: string;
@@ -52,7 +52,7 @@ async function runReactNativeBundleCommand({
52
52
  platform: string;
53
53
  sourcemapOutput: string;
54
54
  config?: string;
55
- disableHermes?: boolean;
55
+ forceHermes?: boolean;
56
56
  cli: {
57
57
  taro?: boolean;
58
58
  expo?: boolean;
@@ -163,18 +163,25 @@ async function runReactNativeBundleCommand({
163
163
  bundleCommand = 'build';
164
164
  }
165
165
 
166
- reactNativeBundleArgs.push(cliPath, bundleCommand);
166
+ if (platform === 'harmony') {
167
+ bundleName = 'bundle.harmony.js';
168
+ if (forceHermes === undefined) {
169
+ // enable hermes by default for harmony
170
+ forceHermes = true;
171
+ }
172
+ }
173
+
174
+ reactNativeBundleArgs.push(
175
+ cliPath,
176
+ bundleCommand,
177
+ '--assets-dest',
178
+ outputFolder,
179
+ '--bundle-output',
180
+ path.join(outputFolder, bundleName),
181
+ );
167
182
 
168
183
  if (platform !== 'harmony') {
169
- reactNativeBundleArgs.push(
170
- '--platform',
171
- platform,
172
- '--assets-dest',
173
- outputFolder,
174
- '--bundle-output',
175
- path.join(outputFolder, bundleName),
176
- '--reset-cache',
177
- );
184
+ reactNativeBundleArgs.push('--platform', platform, '--reset-cache');
178
185
  }
179
186
 
180
187
  if (cli.taro) {
@@ -211,9 +218,9 @@ async function runReactNativeBundleCommand({
211
218
  } else {
212
219
  let hermesEnabled: boolean | undefined = false;
213
220
 
214
- if (disableHermes) {
215
- hermesEnabled = false;
216
- console.log(t('hermesDisabled'));
221
+ if (forceHermes) {
222
+ hermesEnabled = true;
223
+ console.log(t('forceHermes'));
217
224
  } else if (platform === 'android') {
218
225
  const gradlePropeties = await new Promise<{
219
226
  hermesEnabled?: boolean;
@@ -240,8 +247,6 @@ async function runReactNativeBundleCommand({
240
247
  fs.existsSync('ios/Pods/hermes-engine')
241
248
  ) {
242
249
  hermesEnabled = true;
243
- } else if (platform === 'harmony') {
244
- await copyHarmonyBundle(outputFolder);
245
250
  }
246
251
  if (hermesEnabled) {
247
252
  await compileHermesByteCode(
@@ -251,72 +256,25 @@ async function runReactNativeBundleCommand({
251
256
  !isSentry,
252
257
  );
253
258
  }
259
+ if (platform === 'harmony') {
260
+ const harmonyRawAssetsPath =
261
+ 'harmony/entry/src/main/resources/rawfile/assets';
262
+ // copy all files in outputFolder to harmonyRawPath
263
+ // assets should be in rawfile/assets
264
+ fs.ensureDirSync(harmonyRawAssetsPath);
265
+ fs.copySync(outputFolder, harmonyRawAssetsPath, { overwrite: true });
266
+ fs.moveSync(
267
+ `${harmonyRawAssetsPath}/bundle.harmony.js`,
268
+ `${harmonyRawAssetsPath}/../bundle.harmony.js`,
269
+ { overwrite: true },
270
+ );
271
+ }
254
272
  resolve(null);
255
273
  }
256
274
  });
257
275
  });
258
276
  }
259
277
 
260
- async function copyHarmonyBundle(outputFolder: string) {
261
- const harmonyRawPath = 'harmony/entry/src/main/resources/rawfile';
262
- try {
263
- await fs.ensureDir(harmonyRawPath);
264
- try {
265
- await fs.access(harmonyRawPath, fs.constants.W_OK);
266
- } catch (error) {
267
- await fs.chmod(harmonyRawPath, 0o755);
268
- }
269
- await fs.remove(path.join(harmonyRawPath, 'update.json'));
270
- await fs.copy('update.json', path.join(harmonyRawPath, 'update.json'));
271
- await fs.ensureDir(outputFolder);
272
-
273
- // Recursively copy files with special handling for assets directory
274
- async function copyFilesRecursively(
275
- srcDir: string,
276
- destDir: string,
277
- relativePath = '',
278
- ) {
279
- const fullSrcPath = path.join(srcDir, relativePath);
280
- const items = await fs.readdir(fullSrcPath);
281
-
282
- for (const item of items) {
283
- const itemRelativePath = path.join(relativePath, item);
284
- const itemSrcPath = path.join(srcDir, itemRelativePath);
285
-
286
- // Skip update.json and meta.json at root level
287
- if (!relativePath && (item === 'update.json' || item === 'meta.json')) {
288
- continue;
289
- }
290
-
291
- const stat = await fs.stat(itemSrcPath);
292
-
293
- if (stat.isFile()) {
294
- // Special handling: remove 'assets/' prefix to move files up one level
295
- let itemDestPath = itemRelativePath;
296
- if (
297
- itemDestPath.startsWith('assets/') ||
298
- itemDestPath.startsWith('assets\\')
299
- ) {
300
- itemDestPath = itemDestPath.replace(/^assets[\\/]/, '');
301
- }
302
-
303
- const fullDestPath = path.join(destDir, itemDestPath);
304
- await fs.ensureDir(path.dirname(fullDestPath));
305
- await fs.copy(itemSrcPath, fullDestPath);
306
- } else if (stat.isDirectory()) {
307
- // Recursively process subdirectories
308
- await copyFilesRecursively(srcDir, destDir, itemRelativePath);
309
- }
310
- }
311
- }
312
-
313
- await copyFilesRecursively(harmonyRawPath, outputFolder);
314
- } catch (error: any) {
315
- console.error(t('copyHarmonyBundleError', { error }));
316
- throw new Error(t('copyFileFailed', { error: error.message }));
317
- }
318
- }
319
-
320
278
  function getHermesOSBin() {
321
279
  if (os.platform() === 'win32') return 'win64-bin';
322
280
  if (os.platform() === 'darwin') return 'osx-bin';
@@ -505,7 +463,12 @@ async function uploadSourcemapForSentry(
505
463
  }
506
464
  }
507
465
 
508
- const ignorePackingFileNames = ['.', '..', 'index.bundlejs.map'];
466
+ const ignorePackingFileNames = [
467
+ '.',
468
+ '..',
469
+ 'index.bundlejs.map',
470
+ 'bundle.harmony.js.map',
471
+ ];
509
472
  const ignorePackingExtensions = ['DS_Store', 'txt.map'];
510
473
  async function pack(dir: string, output: string) {
511
474
  console.log(t('packing'));
@@ -587,10 +550,7 @@ async function diffFromPPK(origin: string, next: string, output: string) {
587
550
  // isFile
588
551
  originMap[entry.crc32] = entry.fileName;
589
552
 
590
- if (
591
- entry.fileName === 'index.bundlejs' ||
592
- entry.fileName === 'bundle.harmony.js'
593
- ) {
553
+ if (isPPKBundleFileName(entry.fileName)) {
594
554
  // This is source.
595
555
  return readEntry(entry, zipFile).then((v) => (originSource = v));
596
556
  }
@@ -598,9 +558,7 @@ async function diffFromPPK(origin: string, next: string, output: string) {
598
558
  });
599
559
 
600
560
  if (!originSource) {
601
- throw new Error(
602
- 'Bundle file not found! Please use default bundle file name and path.',
603
- );
561
+ throw new Error(t('bundleFileNotFound'));
604
562
  }
605
563
 
606
564
  const copies = {};
@@ -641,23 +599,13 @@ async function diffFromPPK(origin: string, next: string, output: string) {
641
599
  if (!originEntries[entry.fileName]) {
642
600
  addEntry(entry.fileName);
643
601
  }
644
- } else if (entry.fileName === 'index.bundlejs') {
645
- //console.log('Found bundle');
646
- return readEntry(entry, nextZipfile).then((newSource) => {
647
- //console.log('Begin diff');
648
- zipfile.addBuffer(
649
- diff(originSource, newSource),
650
- 'index.bundlejs.patch',
651
- );
652
- //console.log('End diff');
653
- });
654
- } else if (entry.fileName === 'bundle.harmony.js') {
602
+ } else if (isPPKBundleFileName(entry.fileName)) {
655
603
  //console.log('Found bundle');
656
604
  return readEntry(entry, nextZipfile).then((newSource) => {
657
605
  //console.log('Begin diff');
658
606
  zipfile.addBuffer(
659
607
  diff(originSource, newSource),
660
- 'bundle.harmony.js.patch',
608
+ `${entry.fileName}.patch`,
661
609
  );
662
610
  //console.log('End diff');
663
611
  });
@@ -750,9 +698,7 @@ async function diffFromPackage(
750
698
  });
751
699
 
752
700
  if (!originSource) {
753
- throw new Error(
754
- 'Bundle file not found! Please use default bundle file name and path.',
755
- );
701
+ throw new Error(t('bundleFileNotFound'));
756
702
  }
757
703
 
758
704
  const copies = {};
@@ -773,23 +719,13 @@ async function diffFromPackage(
773
719
  if (/\/$/.test(entry.fileName)) {
774
720
  // Directory
775
721
  zipfile.addEmptyDirectory(entry.fileName);
776
- } else if (entry.fileName === 'index.bundlejs') {
777
- //console.log('Found bundle');
778
- return readEntry(entry, nextZipfile).then((newSource) => {
779
- //console.log('Begin diff');
780
- zipfile.addBuffer(
781
- diff(originSource, newSource),
782
- 'index.bundlejs.patch',
783
- );
784
- //console.log('End diff');
785
- });
786
- } else if (entry.fileName === 'bundle.harmony.js') {
722
+ } else if (isPPKBundleFileName(entry.fileName)) {
787
723
  //console.log('Found bundle');
788
724
  return readEntry(entry, nextZipfile).then((newSource) => {
789
725
  //console.log('Begin diff');
790
726
  zipfile.addBuffer(
791
727
  diff(originSource, newSource),
792
- 'bundle.harmony.js.patch',
728
+ `${entry.fileName}.patch`,
793
729
  );
794
730
  //console.log('End diff');
795
731
  });
@@ -906,24 +842,21 @@ function diffArgsCheck(args: string[], options: any, diffFn: string) {
906
842
 
907
843
  if (diffFn.startsWith('hdiff')) {
908
844
  if (!hdiff) {
909
- console.error(
910
- `This function needs "node-hdiffpatch".
911
- Please run "npm i node-hdiffpatch" to install`,
912
- );
845
+ console.error(t('nodeHdiffpatchRequired', { scriptName }));
913
846
  process.exit(1);
914
847
  }
915
848
  diff = hdiff;
916
849
  } else {
917
850
  if (!bsdiff) {
918
- console.error(
919
- `This function needs "node-bsdiff".
920
- Please run "npm i node-bsdiff" to install`,
921
- );
851
+ console.error(t('nodeBsdiffRequired', { scriptName }));
922
852
  process.exit(1);
923
853
  }
924
854
  diff = bsdiff;
925
855
  }
926
- const { output } = options;
856
+ const { output } = translateOptions({
857
+ ...options,
858
+ tempDir,
859
+ });
927
860
 
928
861
  return {
929
862
  origin,
@@ -946,7 +879,7 @@ export const bundleCommands = {
946
879
  taro,
947
880
  expo,
948
881
  rncli,
949
- disableHermes,
882
+ hermes,
950
883
  name,
951
884
  description,
952
885
  metaInfo,
@@ -987,7 +920,7 @@ export const bundleCommands = {
987
920
  outputFolder: intermediaDir,
988
921
  platform,
989
922
  sourcemapOutput: sourcemap || sourcemapPlugin ? sourcemapOutput : '',
990
- disableHermes: !!disableHermes,
923
+ forceHermes: hermes as unknown as boolean,
991
924
  cli: {
992
925
  taro: !!taro,
993
926
  expo: !!expo,
@@ -1054,14 +987,14 @@ export const bundleCommands = {
1054
987
  const { origin, next, realOutput } = diffArgsCheck(args, options, 'diff');
1055
988
 
1056
989
  await diffFromPPK(origin, next, realOutput);
1057
- console.log(`${realOutput} generated.`);
990
+ console.log(t('diffPackageGenerated', { output: realOutput }));
1058
991
  },
1059
992
 
1060
993
  async hdiff({ args, options }) {
1061
994
  const { origin, next, realOutput } = diffArgsCheck(args, options, 'hdiff');
1062
995
 
1063
996
  await diffFromPPK(origin, next, realOutput);
1064
- console.log(`${realOutput} generated.`);
997
+ console.log(t('diffPackageGenerated', { output: realOutput }));
1065
998
  },
1066
999
 
1067
1000
  async diffFromApk({ args, options }) {
@@ -1077,7 +1010,7 @@ export const bundleCommands = {
1077
1010
  realOutput,
1078
1011
  'assets/index.android.bundle',
1079
1012
  );
1080
- console.log(`${realOutput} generated.`);
1013
+ console.log(t('diffPackageGenerated', { output: realOutput }));
1081
1014
  },
1082
1015
 
1083
1016
  async hdiffFromApk({ args, options }) {
@@ -1093,7 +1026,7 @@ export const bundleCommands = {
1093
1026
  realOutput,
1094
1027
  'assets/index.android.bundle',
1095
1028
  );
1096
- console.log(`${realOutput} generated.`);
1029
+ console.log(t('diffPackageGenerated', { output: realOutput }));
1097
1030
  },
1098
1031
 
1099
1032
  async diffFromApp({ args, options }) {
@@ -1108,7 +1041,7 @@ export const bundleCommands = {
1108
1041
  realOutput,
1109
1042
  'resources/rawfile/bundle.harmony.js',
1110
1043
  );
1111
- console.log(`${realOutput} generated.`);
1044
+ console.log(t('diffPackageGenerated', { output: realOutput }));
1112
1045
  },
1113
1046
 
1114
1047
  async hdiffFromApp({ args, options }) {
@@ -1123,7 +1056,7 @@ export const bundleCommands = {
1123
1056
  realOutput,
1124
1057
  'resources/rawfile/bundle.harmony.js',
1125
1058
  );
1126
- console.log(`${realOutput} generated.`);
1059
+ console.log(t('diffPackageGenerated', { output: realOutput }));
1127
1060
  },
1128
1061
 
1129
1062
  async diffFromIpa({ args, options }) {
@@ -1138,7 +1071,7 @@ export const bundleCommands = {
1138
1071
  return m?.[1];
1139
1072
  });
1140
1073
 
1141
- console.log(`${realOutput} generated.`);
1074
+ console.log(t('diffPackageGenerated', { output: realOutput }));
1142
1075
  },
1143
1076
 
1144
1077
  async hdiffFromIpa({ args, options }) {
@@ -1153,6 +1086,6 @@ export const bundleCommands = {
1153
1086
  return m?.[1];
1154
1087
  });
1155
1088
 
1156
- console.log(`${realOutput} generated.`);
1089
+ console.log(t('diffPackageGenerated', { output: realOutput }));
1157
1090
  },
1158
1091
  };
package/src/index.ts CHANGED
@@ -3,6 +3,7 @@
3
3
  import { loadSession } from './api';
4
4
  import { appCommands } from './app';
5
5
  import { bundleCommands } from './bundle';
6
+ import { installCommands } from './install';
6
7
  import { moduleManager } from './module-manager';
7
8
  import { builtinModules } from './modules';
8
9
  import { packageCommands } from './package';
@@ -26,15 +27,16 @@ function printUsage() {
26
27
  console.log('React Native Update CLI');
27
28
  console.log('');
28
29
  console.log('Traditional commands:');
29
-
30
+
30
31
  const legacyCommands = {
31
32
  ...userCommands,
32
33
  ...bundleCommands,
33
34
  ...appCommands,
34
35
  ...packageCommands,
35
36
  ...versionCommands,
37
+ ...installCommands,
36
38
  };
37
-
39
+
38
40
  for (const [name, handler] of Object.entries(legacyCommands)) {
39
41
  console.log(` ${name}: Legacy command`);
40
42
  }
@@ -62,7 +64,7 @@ function printUsage() {
62
64
  console.log(' list: List all available commands and workflows');
63
65
  console.log(' workflow <name>: Execute a specific workflow');
64
66
  console.log(' help: Show this help message');
65
-
67
+
66
68
  console.log('');
67
69
  console.log(
68
70
  'Visit `https://github.com/reactnativecn/react-native-update` for document.',
@@ -76,6 +78,7 @@ const legacyCommands = {
76
78
  ...appCommands,
77
79
  ...packageCommands,
78
80
  ...versionCommands,
81
+ ...installCommands,
79
82
  help: printUsage,
80
83
  };
81
84
 
@@ -118,7 +121,7 @@ async function run() {
118
121
  process.exit(1);
119
122
  }
120
123
  console.log('Workflow completed successfully:', result.data);
121
- }
124
+ }
122
125
  // Try legacy commands first for backward compatibility
123
126
  else if (legacyCommands[argv.command]) {
124
127
  await legacyCommands[argv.command](argv);
package/src/install.ts ADDED
@@ -0,0 +1,19 @@
1
+ import { spawnSync } from 'child_process';
2
+ import path from 'path';
3
+ import type { CommandContext } from './types';
4
+
5
+ export const installCommands = {
6
+ install: async ({ args }: CommandContext) => {
7
+ if (args.length === 0) {
8
+ return;
9
+ }
10
+
11
+ const cliDir = path.resolve(__dirname, '..');
12
+
13
+ spawnSync('npm', ['install', ...args], {
14
+ cwd: cliDir,
15
+ stdio: 'inherit',
16
+ shell: true,
17
+ });
18
+ },
19
+ };
package/src/locales/en.ts CHANGED
@@ -49,7 +49,7 @@ export default {
49
49
  fileGenerated: '{{- file}} generated.',
50
50
  fileSizeExceeded:
51
51
  'This file size is {{fileSize}} , exceeding the current quota {{maxSize}} . You may consider upgrading to a higher plan to increase this quota. Details can be found at: {{- pricingPageUrl}}',
52
- hermesDisabled: 'Hermes disabled',
52
+ forceHermes: 'Forcing Hermes enabled for this build',
53
53
  hermesEnabledCompiling: 'Hermes enabled, now compiling to hermes bytecode:\n',
54
54
  ipaUploadSuccess:
55
55
  'Successfully uploaded IPA native package (id: {{id}}, version: {{version}}, buildTime: {{buildTime}})',
@@ -137,4 +137,11 @@ This can reduce the risk of inconsistent dependencies and supply chain attacks.
137
137
  deletePackageError:
138
138
  'Failed to delete native package {{packageId}}: {{error}}',
139
139
  usageDeletePackage: 'Usage: cresc deletePackage [packageId] --appId [appId]',
140
+ bundleFileNotFound:
141
+ 'Bundle file not found! Please use default bundle file name and path.',
142
+ diffPackageGenerated: '{{- output}} generated.',
143
+ nodeBsdiffRequired:
144
+ 'This function needs "node-bsdiff". Please run "{{scriptName}} install node-bsdiff" to install',
145
+ nodeHdiffpatchRequired:
146
+ 'This function needs "node-hdiffpatch". Please run "{{scriptName}} install node-hdiffpatch" to install',
140
147
  };
package/src/locales/zh.ts CHANGED
@@ -47,7 +47,7 @@ export default {
47
47
  fileGenerated: '已生成 {{- file}}',
48
48
  fileSizeExceeded:
49
49
  '此文件大小 {{fileSize}} , 超出当前额度 {{maxSize}} 。您可以考虑升级付费业务以提升此额度。详情请访问: {{- pricingPageUrl}}',
50
- hermesDisabled: 'Hermes 已禁用',
50
+ forceHermes: '强制启用 Hermes 编译',
51
51
  hermesEnabledCompiling: 'Hermes 已启用,正在编译为 hermes 字节码:\n',
52
52
  ipaUploadSuccess:
53
53
  '已成功上传ipa原生包(id: {{id}}, version: {{version}}, buildTime: {{buildTime}})',
@@ -129,4 +129,10 @@ export default {
129
129
  deletePackageError: '删除原生包 {{packageId}} 失败: {{error}}',
130
130
  usageDeletePackage:
131
131
  '使用方法: pushy deletePackage [packageId] --appId [appId]',
132
+ bundleFileNotFound: '未找到 bundle 文件!请使用默认的 bundle 文件名和路径。',
133
+ diffPackageGenerated: '{{- output}} 已生成。',
134
+ nodeBsdiffRequired:
135
+ '此功能需要 "node-bsdiff"。请运行 "{{scriptName}} install node-bsdiff" 来安装',
136
+ nodeHdiffpatchRequired:
137
+ '此功能需要 "node-hdiffpatch"。请运行 "{{scriptName}} install node-hdiffpatch" 来安装',
132
138
  };
@@ -53,7 +53,7 @@ export const bundleModule: CLIModule = {
53
53
  taro = false,
54
54
  expo = false,
55
55
  rncli = false,
56
- disableHermes = false,
56
+ hermes = false,
57
57
  output,
58
58
  } = context.options;
59
59
 
@@ -73,7 +73,7 @@ export const bundleModule: CLIModule = {
73
73
  taro,
74
74
  expo,
75
75
  rncli,
76
- disableHermes,
76
+ hermes,
77
77
  intermediaDir: '${tempDir}/intermedia/${platform}',
78
78
  output: '${tempDir}/output/${platform}.${time}.ppk',
79
79
  };
@@ -170,10 +170,10 @@ export const bundleModule: CLIModule = {
170
170
  default: false,
171
171
  description: 'Use React Native CLI',
172
172
  },
173
- disableHermes: {
173
+ hermes: {
174
174
  hasValue: false,
175
175
  default: false,
176
- description: 'Disable Hermes',
176
+ description: 'Force enable Hermes',
177
177
  },
178
178
  name: {
179
179
  hasValue: true,
package/src/provider.ts CHANGED
@@ -42,7 +42,7 @@ export class CLIProviderImpl implements CLIProvider {
42
42
  taro: options.taro || false,
43
43
  expo: options.expo || false,
44
44
  rncli: options.rncli || false,
45
- disableHermes: options.disableHermes || false,
45
+ hermes: options.hermes || false,
46
46
  },
47
47
  };
48
48
 
package/src/types.ts CHANGED
@@ -65,7 +65,7 @@ export interface BundleOptions {
65
65
  taro?: boolean;
66
66
  expo?: boolean;
67
67
  rncli?: boolean;
68
- disableHermes?: boolean;
68
+ hermes?: boolean;
69
69
  }
70
70
 
71
71
  export interface PublishOptions {
@@ -1,8 +1,12 @@
1
1
  import path from 'path';
2
2
 
3
- const scriptName = path.basename(process.argv[1]) as 'cresc' | 'pushy';
3
+ export const scriptName = path.basename(process.argv[1]) as 'cresc' | 'pushy';
4
4
  export const IS_CRESC = scriptName === 'cresc';
5
5
 
6
+ export const ppkBundleFileNames = ['index.bundlejs', 'bundle.harmony.js'];
7
+ export const isPPKBundleFileName = (fileName: string) =>
8
+ ppkBundleFileNames.includes(fileName);
9
+
6
10
  export const credentialFile = IS_CRESC ? '.cresc.token' : '.update';
7
11
  export const updateJson = IS_CRESC ? 'cresc.config.json' : 'update.json';
8
12
  export const tempDir = IS_CRESC ? '.cresc.temp' : '.pushy';