react-native-update-cli 2.2.3 → 2.3.0

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,8 +240,6 @@ 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);
@@ -244,55 +249,6 @@ async function runReactNativeBundleCommand({ bundleName, dev, entryFile, outputF
244
249
  });
245
250
  });
246
251
  }
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
252
  function getHermesOSBin() {
297
253
  if (_os.default.platform() === 'win32') return 'win64-bin';
298
254
  if (_os.default.platform() === 'darwin') return 'osx-bin';
@@ -445,7 +401,8 @@ async function uploadSourcemapForSentry(bundleName, outputFolder, sourcemapOutpu
445
401
  const ignorePackingFileNames = [
446
402
  '.',
447
403
  '..',
448
- 'index.bundlejs.map'
404
+ 'index.bundlejs.map',
405
+ 'bundle.harmony.js.map'
449
406
  ];
450
407
  const ignorePackingExtensions = [
451
408
  'DS_Store',
@@ -517,14 +474,14 @@ async function diffFromPPK(origin, next, output) {
517
474
  if (!/\/$/.test(entry.fileName)) {
518
475
  // isFile
519
476
  originMap[entry.crc32] = entry.fileName;
520
- if (entry.fileName === 'index.bundlejs' || entry.fileName === 'bundle.harmony.js') {
477
+ if ((0, _constants.isPPKBundleFileName)(entry.fileName)) {
521
478
  // This is source.
522
479
  return readEntry(entry, zipFile).then((v)=>originSource = v);
523
480
  }
524
481
  }
525
482
  });
526
483
  if (!originSource) {
527
- throw new Error('Bundle file not found! Please use default bundle file name and path.');
484
+ throw new Error((0, _i18n.t)('bundleFileNotFound'));
528
485
  }
529
486
  const copies = {};
530
487
  const copiesv2 = {};
@@ -557,18 +514,11 @@ async function diffFromPPK(origin, next, output) {
557
514
  if (!originEntries[entry.fileName]) {
558
515
  addEntry(entry.fileName);
559
516
  }
560
- } else if (entry.fileName === 'index.bundlejs') {
561
- //console.log('Found bundle');
562
- return readEntry(entry, nextZipfile).then((newSource)=>{
563
- //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') {
517
+ } else if ((0, _constants.isPPKBundleFileName)(entry.fileName)) {
568
518
  //console.log('Found bundle');
569
519
  return readEntry(entry, nextZipfile).then((newSource)=>{
570
520
  //console.log('Begin diff');
571
- zipfile.addBuffer(diff(originSource, newSource), 'bundle.harmony.js.patch');
521
+ zipfile.addBuffer(diff(originSource, newSource), `${entry.fileName}.patch`);
572
522
  //console.log('End diff');
573
523
  });
574
524
  } else {
@@ -644,7 +594,7 @@ async function diffFromPackage(origin, next, output, originBundleName, transform
644
594
  }
645
595
  });
646
596
  if (!originSource) {
647
- throw new Error('Bundle file not found! Please use default bundle file name and path.');
597
+ throw new Error((0, _i18n.t)('bundleFileNotFound'));
648
598
  }
649
599
  const copies = {};
650
600
  const copiesv2 = {};
@@ -661,18 +611,11 @@ async function diffFromPackage(origin, next, output, originBundleName, transform
661
611
  if (/\/$/.test(entry.fileName)) {
662
612
  // Directory
663
613
  zipfile.addEmptyDirectory(entry.fileName);
664
- } else if (entry.fileName === 'index.bundlejs') {
665
- //console.log('Found bundle');
666
- return readEntry(entry, nextZipfile).then((newSource)=>{
667
- //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') {
614
+ } else if ((0, _constants.isPPKBundleFileName)(entry.fileName)) {
672
615
  //console.log('Found bundle');
673
616
  return readEntry(entry, nextZipfile).then((newSource)=>{
674
617
  //console.log('Begin diff');
675
- zipfile.addBuffer(diff(originSource, newSource), 'bundle.harmony.js.patch');
618
+ zipfile.addBuffer(diff(originSource, newSource), `${entry.fileName}.patch`);
676
619
  //console.log('End diff');
677
620
  });
678
621
  } else {
@@ -762,20 +705,25 @@ function diffArgsCheck(args, options, diffFn) {
762
705
  }
763
706
  if (diffFn.startsWith('hdiff')) {
764
707
  if (!hdiff) {
765
- console.error(`This function needs "node-hdiffpatch".
766
- Please run "npm i node-hdiffpatch" to install`);
708
+ console.error((0, _i18n.t)('nodeHdiffpatchRequired', {
709
+ scriptName: _constants.scriptName
710
+ }));
767
711
  process.exit(1);
768
712
  }
769
713
  diff = hdiff;
770
714
  } else {
771
715
  if (!bsdiff) {
772
- console.error(`This function needs "node-bsdiff".
773
- Please run "npm i node-bsdiff" to install`);
716
+ console.error((0, _i18n.t)('nodeBsdiffRequired', {
717
+ scriptName: _constants.scriptName
718
+ }));
774
719
  process.exit(1);
775
720
  }
776
721
  diff = bsdiff;
777
722
  }
778
- const { output } = options;
723
+ const { output } = (0, _utils.translateOptions)({
724
+ ...options,
725
+ tempDir: _constants.tempDir
726
+ });
779
727
  return {
780
728
  origin,
781
729
  next,
@@ -785,7 +733,7 @@ function diffArgsCheck(args, options, diffFn) {
785
733
  const bundleCommands = {
786
734
  bundle: async ({ options })=>{
787
735
  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)({
736
+ 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
737
  ...options,
790
738
  tempDir: _constants.tempDir,
791
739
  platform
@@ -808,7 +756,7 @@ const bundleCommands = {
808
756
  outputFolder: intermediaDir,
809
757
  platform,
810
758
  sourcemapOutput: sourcemap || sourcemapPlugin ? sourcemapOutput : '',
811
- disableHermes: !!disableHermes,
759
+ forceHermes: hermes,
812
760
  cli: {
813
761
  taro: !!taro,
814
762
  expo: !!expo,
@@ -860,32 +808,44 @@ const bundleCommands = {
860
808
  async diff ({ args, options }) {
861
809
  const { origin, next, realOutput } = diffArgsCheck(args, options, 'diff');
862
810
  await diffFromPPK(origin, next, realOutput);
863
- console.log(`${realOutput} generated.`);
811
+ console.log((0, _i18n.t)('diffPackageGenerated', {
812
+ output: realOutput
813
+ }));
864
814
  },
865
815
  async hdiff ({ args, options }) {
866
816
  const { origin, next, realOutput } = diffArgsCheck(args, options, 'hdiff');
867
817
  await diffFromPPK(origin, next, realOutput);
868
- console.log(`${realOutput} generated.`);
818
+ console.log((0, _i18n.t)('diffPackageGenerated', {
819
+ output: realOutput
820
+ }));
869
821
  },
870
822
  async diffFromApk ({ args, options }) {
871
823
  const { origin, next, realOutput } = diffArgsCheck(args, options, 'diffFromApk');
872
824
  await diffFromPackage(origin, next, realOutput, 'assets/index.android.bundle');
873
- console.log(`${realOutput} generated.`);
825
+ console.log((0, _i18n.t)('diffPackageGenerated', {
826
+ output: realOutput
827
+ }));
874
828
  },
875
829
  async hdiffFromApk ({ args, options }) {
876
830
  const { origin, next, realOutput } = diffArgsCheck(args, options, 'hdiffFromApk');
877
831
  await diffFromPackage(origin, next, realOutput, 'assets/index.android.bundle');
878
- console.log(`${realOutput} generated.`);
832
+ console.log((0, _i18n.t)('diffPackageGenerated', {
833
+ output: realOutput
834
+ }));
879
835
  },
880
836
  async diffFromApp ({ args, options }) {
881
837
  const { origin, next, realOutput } = diffArgsCheck(args, options, 'diffFromApp');
882
838
  await diffFromPackage(origin, next, realOutput, 'resources/rawfile/bundle.harmony.js');
883
- console.log(`${realOutput} generated.`);
839
+ console.log((0, _i18n.t)('diffPackageGenerated', {
840
+ output: realOutput
841
+ }));
884
842
  },
885
843
  async hdiffFromApp ({ args, options }) {
886
844
  const { origin, next, realOutput } = diffArgsCheck(args, options, 'hdiffFromApp');
887
845
  await diffFromPackage(origin, next, realOutput, 'resources/rawfile/bundle.harmony.js');
888
- console.log(`${realOutput} generated.`);
846
+ console.log((0, _i18n.t)('diffPackageGenerated', {
847
+ output: realOutput
848
+ }));
889
849
  },
890
850
  async diffFromIpa ({ args, options }) {
891
851
  const { origin, next, realOutput } = diffArgsCheck(args, options, 'diffFromIpa');
@@ -893,7 +853,9 @@ const bundleCommands = {
893
853
  const m = /^Payload\/[^/]+\/(.+)$/.exec(v);
894
854
  return m == null ? void 0 : m[1];
895
855
  });
896
- console.log(`${realOutput} generated.`);
856
+ console.log((0, _i18n.t)('diffPackageGenerated', {
857
+ output: realOutput
858
+ }));
897
859
  },
898
860
  async hdiffFromIpa ({ args, options }) {
899
861
  const { origin, next, realOutput } = diffArgsCheck(args, options, 'hdiffFromIpa');
@@ -901,6 +863,8 @@ const bundleCommands = {
901
863
  const m = /^Payload\/[^/]+\/(.+)$/.exec(v);
902
864
  return m == null ? void 0 : m[1];
903
865
  });
904
- console.log(`${realOutput} generated.`);
866
+ console.log((0, _i18n.t)('diffPackageGenerated', {
867
+ output: realOutput
868
+ }));
905
869
  }
906
870
  };
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.0",
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(
@@ -257,66 +262,6 @@ async function runReactNativeBundleCommand({
257
262
  });
258
263
  }
259
264
 
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
265
  function getHermesOSBin() {
321
266
  if (os.platform() === 'win32') return 'win64-bin';
322
267
  if (os.platform() === 'darwin') return 'osx-bin';
@@ -505,7 +450,12 @@ async function uploadSourcemapForSentry(
505
450
  }
506
451
  }
507
452
 
508
- const ignorePackingFileNames = ['.', '..', 'index.bundlejs.map'];
453
+ const ignorePackingFileNames = [
454
+ '.',
455
+ '..',
456
+ 'index.bundlejs.map',
457
+ 'bundle.harmony.js.map',
458
+ ];
509
459
  const ignorePackingExtensions = ['DS_Store', 'txt.map'];
510
460
  async function pack(dir: string, output: string) {
511
461
  console.log(t('packing'));
@@ -587,10 +537,7 @@ async function diffFromPPK(origin: string, next: string, output: string) {
587
537
  // isFile
588
538
  originMap[entry.crc32] = entry.fileName;
589
539
 
590
- if (
591
- entry.fileName === 'index.bundlejs' ||
592
- entry.fileName === 'bundle.harmony.js'
593
- ) {
540
+ if (isPPKBundleFileName(entry.fileName)) {
594
541
  // This is source.
595
542
  return readEntry(entry, zipFile).then((v) => (originSource = v));
596
543
  }
@@ -598,9 +545,7 @@ async function diffFromPPK(origin: string, next: string, output: string) {
598
545
  });
599
546
 
600
547
  if (!originSource) {
601
- throw new Error(
602
- 'Bundle file not found! Please use default bundle file name and path.',
603
- );
548
+ throw new Error(t('bundleFileNotFound'));
604
549
  }
605
550
 
606
551
  const copies = {};
@@ -641,23 +586,13 @@ async function diffFromPPK(origin: string, next: string, output: string) {
641
586
  if (!originEntries[entry.fileName]) {
642
587
  addEntry(entry.fileName);
643
588
  }
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') {
589
+ } else if (isPPKBundleFileName(entry.fileName)) {
655
590
  //console.log('Found bundle');
656
591
  return readEntry(entry, nextZipfile).then((newSource) => {
657
592
  //console.log('Begin diff');
658
593
  zipfile.addBuffer(
659
594
  diff(originSource, newSource),
660
- 'bundle.harmony.js.patch',
595
+ `${entry.fileName}.patch`,
661
596
  );
662
597
  //console.log('End diff');
663
598
  });
@@ -750,9 +685,7 @@ async function diffFromPackage(
750
685
  });
751
686
 
752
687
  if (!originSource) {
753
- throw new Error(
754
- 'Bundle file not found! Please use default bundle file name and path.',
755
- );
688
+ throw new Error(t('bundleFileNotFound'));
756
689
  }
757
690
 
758
691
  const copies = {};
@@ -773,23 +706,13 @@ async function diffFromPackage(
773
706
  if (/\/$/.test(entry.fileName)) {
774
707
  // Directory
775
708
  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') {
709
+ } else if (isPPKBundleFileName(entry.fileName)) {
787
710
  //console.log('Found bundle');
788
711
  return readEntry(entry, nextZipfile).then((newSource) => {
789
712
  //console.log('Begin diff');
790
713
  zipfile.addBuffer(
791
714
  diff(originSource, newSource),
792
- 'bundle.harmony.js.patch',
715
+ `${entry.fileName}.patch`,
793
716
  );
794
717
  //console.log('End diff');
795
718
  });
@@ -906,24 +829,21 @@ function diffArgsCheck(args: string[], options: any, diffFn: string) {
906
829
 
907
830
  if (diffFn.startsWith('hdiff')) {
908
831
  if (!hdiff) {
909
- console.error(
910
- `This function needs "node-hdiffpatch".
911
- Please run "npm i node-hdiffpatch" to install`,
912
- );
832
+ console.error(t('nodeHdiffpatchRequired', { scriptName }));
913
833
  process.exit(1);
914
834
  }
915
835
  diff = hdiff;
916
836
  } else {
917
837
  if (!bsdiff) {
918
- console.error(
919
- `This function needs "node-bsdiff".
920
- Please run "npm i node-bsdiff" to install`,
921
- );
838
+ console.error(t('nodeBsdiffRequired', { scriptName }));
922
839
  process.exit(1);
923
840
  }
924
841
  diff = bsdiff;
925
842
  }
926
- const { output } = options;
843
+ const { output } = translateOptions({
844
+ ...options,
845
+ tempDir,
846
+ });
927
847
 
928
848
  return {
929
849
  origin,
@@ -946,7 +866,7 @@ export const bundleCommands = {
946
866
  taro,
947
867
  expo,
948
868
  rncli,
949
- disableHermes,
869
+ hermes,
950
870
  name,
951
871
  description,
952
872
  metaInfo,
@@ -987,7 +907,7 @@ export const bundleCommands = {
987
907
  outputFolder: intermediaDir,
988
908
  platform,
989
909
  sourcemapOutput: sourcemap || sourcemapPlugin ? sourcemapOutput : '',
990
- disableHermes: !!disableHermes,
910
+ forceHermes: hermes as unknown as boolean,
991
911
  cli: {
992
912
  taro: !!taro,
993
913
  expo: !!expo,
@@ -1054,14 +974,14 @@ export const bundleCommands = {
1054
974
  const { origin, next, realOutput } = diffArgsCheck(args, options, 'diff');
1055
975
 
1056
976
  await diffFromPPK(origin, next, realOutput);
1057
- console.log(`${realOutput} generated.`);
977
+ console.log(t('diffPackageGenerated', { output: realOutput }));
1058
978
  },
1059
979
 
1060
980
  async hdiff({ args, options }) {
1061
981
  const { origin, next, realOutput } = diffArgsCheck(args, options, 'hdiff');
1062
982
 
1063
983
  await diffFromPPK(origin, next, realOutput);
1064
- console.log(`${realOutput} generated.`);
984
+ console.log(t('diffPackageGenerated', { output: realOutput }));
1065
985
  },
1066
986
 
1067
987
  async diffFromApk({ args, options }) {
@@ -1077,7 +997,7 @@ export const bundleCommands = {
1077
997
  realOutput,
1078
998
  'assets/index.android.bundle',
1079
999
  );
1080
- console.log(`${realOutput} generated.`);
1000
+ console.log(t('diffPackageGenerated', { output: realOutput }));
1081
1001
  },
1082
1002
 
1083
1003
  async hdiffFromApk({ args, options }) {
@@ -1093,7 +1013,7 @@ export const bundleCommands = {
1093
1013
  realOutput,
1094
1014
  'assets/index.android.bundle',
1095
1015
  );
1096
- console.log(`${realOutput} generated.`);
1016
+ console.log(t('diffPackageGenerated', { output: realOutput }));
1097
1017
  },
1098
1018
 
1099
1019
  async diffFromApp({ args, options }) {
@@ -1108,7 +1028,7 @@ export const bundleCommands = {
1108
1028
  realOutput,
1109
1029
  'resources/rawfile/bundle.harmony.js',
1110
1030
  );
1111
- console.log(`${realOutput} generated.`);
1031
+ console.log(t('diffPackageGenerated', { output: realOutput }));
1112
1032
  },
1113
1033
 
1114
1034
  async hdiffFromApp({ args, options }) {
@@ -1123,7 +1043,7 @@ export const bundleCommands = {
1123
1043
  realOutput,
1124
1044
  'resources/rawfile/bundle.harmony.js',
1125
1045
  );
1126
- console.log(`${realOutput} generated.`);
1046
+ console.log(t('diffPackageGenerated', { output: realOutput }));
1127
1047
  },
1128
1048
 
1129
1049
  async diffFromIpa({ args, options }) {
@@ -1138,7 +1058,7 @@ export const bundleCommands = {
1138
1058
  return m?.[1];
1139
1059
  });
1140
1060
 
1141
- console.log(`${realOutput} generated.`);
1061
+ console.log(t('diffPackageGenerated', { output: realOutput }));
1142
1062
  },
1143
1063
 
1144
1064
  async hdiffFromIpa({ args, options }) {
@@ -1153,6 +1073,6 @@ export const bundleCommands = {
1153
1073
  return m?.[1];
1154
1074
  });
1155
1075
 
1156
- console.log(`${realOutput} generated.`);
1076
+ console.log(t('diffPackageGenerated', { output: realOutput }));
1157
1077
  },
1158
1078
  };
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';