react-native-update-cli 1.46.0 → 1.46.2

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/lib/app.js CHANGED
@@ -9,15 +9,15 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
+ appCommands: function() {
13
+ return appCommands;
14
+ },
12
15
  assertPlatform: function() {
13
16
  return assertPlatform;
14
17
  },
15
18
  chooseApp: function() {
16
19
  return chooseApp;
17
20
  },
18
- commands: function() {
19
- return commands;
20
- },
21
21
  getPlatform: function() {
22
22
  return getPlatform;
23
23
  },
@@ -108,7 +108,7 @@ async function chooseApp(platform) {
108
108
  }
109
109
  }
110
110
  }
111
- const commands = {
111
+ const appCommands = {
112
112
  createApp: async function({ options }) {
113
113
  const name = options.name || await (0, _utils.question)((0, _i18n.t)('appNameQuestion'));
114
114
  const { downloadUrl } = options;
package/lib/bundle.js CHANGED
@@ -9,8 +9,8 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- commands: function() {
13
- return commands;
12
+ bundleCommands: function() {
13
+ return bundleCommands;
14
14
  },
15
15
  enumZipEntries: function() {
16
16
  return enumZipEntries;
@@ -288,7 +288,19 @@ async function copyHarmonyBundle(outputFolder) {
288
288
  await _fsextra.remove(_path.default.join(harmonyRawPath, 'update.json'));
289
289
  await _fsextra.copy('update.json', _path.default.join(harmonyRawPath, 'update.json'));
290
290
  await _fsextra.ensureDir(outputFolder);
291
- await _fsextra.copy(harmonyRawPath, outputFolder);
291
+ const files = await _fsextra.readdir(harmonyRawPath);
292
+ for (const file of files){
293
+ if (file !== 'update.json' && file !== 'meta.json') {
294
+ const sourcePath = _path.default.join(harmonyRawPath, file);
295
+ const destPath = _path.default.join(outputFolder, file);
296
+ const stat = await _fsextra.stat(sourcePath);
297
+ if (stat.isFile()) {
298
+ await _fsextra.copy(sourcePath, destPath);
299
+ } else if (stat.isDirectory()) {
300
+ await _fsextra.copy(sourcePath, destPath);
301
+ }
302
+ }
303
+ }
292
304
  } catch (error) {
293
305
  console.error((0, _i18n.t)('copyHarmonyBundleError', {
294
306
  error
@@ -784,7 +796,7 @@ function diffArgsCheck(args, options, diffFn) {
784
796
  realOutput: output.replace(/\$\{time\}/g, `${Date.now()}`)
785
797
  };
786
798
  }
787
- const commands = {
799
+ const bundleCommands = {
788
800
  bundle: async ({ options })=>{
789
801
  const platform = await (0, _app.getPlatform)(options.platform);
790
802
  const { bundleName, entryFile, intermediaDir, output, dev, sourcemap, taro, expo, rncli, disableHermes, name, description, metaInfo, packageId, packageVersion, minPackageVersion, maxPackageVersion, packageVersionRange, rollout, dryRun } = (0, _utils.translateOptions)({
package/lib/index.js CHANGED
@@ -6,6 +6,11 @@ Object.defineProperty(exports, "__esModule", {
6
6
  const _api = require("./api");
7
7
  const _utils = require("./utils");
8
8
  const _i18n = require("./utils/i18n");
9
+ const _bundle = require("./bundle");
10
+ const _versions = require("./versions");
11
+ const _user = require("./user");
12
+ const _app = require("./app");
13
+ const _package = require("./package");
9
14
  function printUsage() {
10
15
  // const commandName = args[0];
11
16
  // TODO: print usage of commandName, or print global usage.
@@ -13,11 +18,11 @@ function printUsage() {
13
18
  process.exit(1);
14
19
  }
15
20
  const commands = {
16
- ...require('./user').commands,
17
- ...require('./bundle').commands,
18
- ...require('./app').commands,
19
- ...require('./package').commands,
20
- ...require('./versions').commands,
21
+ ..._user.userCommands,
22
+ ..._bundle.bundleCommands,
23
+ ..._app.appCommands,
24
+ ..._package.packageCommands,
25
+ ..._versions.versionCommands,
21
26
  help: printUsage
22
27
  };
23
28
  async function run() {
package/lib/package.js CHANGED
@@ -12,11 +12,11 @@ _export(exports, {
12
12
  choosePackage: function() {
13
13
  return choosePackage;
14
14
  },
15
- commands: function() {
16
- return commands;
17
- },
18
15
  listPackage: function() {
19
16
  return listPackage;
17
+ },
18
+ packageCommands: function() {
19
+ return packageCommands;
20
20
  }
21
21
  });
22
22
  const _api = require("./api");
@@ -80,7 +80,7 @@ async function choosePackage(appId) {
80
80
  }
81
81
  }
82
82
  }
83
- const commands = {
83
+ const packageCommands = {
84
84
  uploadIpa: async ({ args })=>{
85
85
  const fn = args[0];
86
86
  if (!fn || !fn.endsWith('.ipa')) {
package/lib/user.js CHANGED
@@ -2,10 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- Object.defineProperty(exports, "commands", {
5
+ Object.defineProperty(exports, "userCommands", {
6
6
  enumerable: true,
7
7
  get: function() {
8
- return commands;
8
+ return userCommands;
9
9
  }
10
10
  });
11
11
  const _utils = require("./utils");
@@ -20,7 +20,7 @@ function _interop_require_default(obj) {
20
20
  function md5(str) {
21
21
  return _crypto.default.createHash('md5').update(str).digest('hex');
22
22
  }
23
- const commands = {
23
+ const userCommands = {
24
24
  login: async ({ args })=>{
25
25
  const email = args[0] || await (0, _utils.question)('email:');
26
26
  const pwd = args[1] || await (0, _utils.question)('password:', true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-update-cli",
3
- "version": "1.46.0",
3
+ "version": "1.46.2",
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/app.ts CHANGED
@@ -66,7 +66,7 @@ export async function chooseApp(platform: Platform) {
66
66
  }
67
67
  }
68
68
 
69
- export const commands = {
69
+ export const appCommands = {
70
70
  createApp: async function ({
71
71
  options,
72
72
  }: {
package/src/bundle.ts CHANGED
@@ -288,9 +288,22 @@ async function copyHarmonyBundle(outputFolder: string) {
288
288
  }
289
289
  await fs.remove(path.join(harmonyRawPath, 'update.json'));
290
290
  await fs.copy('update.json', path.join(harmonyRawPath, 'update.json'));
291
-
292
291
  await fs.ensureDir(outputFolder);
293
- await fs.copy(harmonyRawPath, outputFolder);
292
+
293
+ const files = await fs.readdir(harmonyRawPath);
294
+ for (const file of files) {
295
+ if (file !== 'update.json' && file !== 'meta.json') {
296
+ const sourcePath = path.join(harmonyRawPath, file);
297
+ const destPath = path.join(outputFolder, file);
298
+ const stat = await fs.stat(sourcePath);
299
+
300
+ if (stat.isFile()) {
301
+ await fs.copy(sourcePath, destPath);
302
+ } else if (stat.isDirectory()) {
303
+ await fs.copy(sourcePath, destPath);
304
+ }
305
+ }
306
+ }
294
307
  } catch (error: any) {
295
308
  console.error(t('copyHarmonyBundleError', { error }));
296
309
  throw new Error(t('copyFileFailed', { error: error.message }));
@@ -908,7 +921,7 @@ function diffArgsCheck(args: string[], options: any, diffFn: string) {
908
921
  };
909
922
  }
910
923
 
911
- export const commands = {
924
+ export const bundleCommands = {
912
925
  bundle: async ({ options }) => {
913
926
  const platform = await getPlatform(options.platform);
914
927
 
package/src/index.ts CHANGED
@@ -3,6 +3,11 @@
3
3
  import { loadSession } from './api';
4
4
  import { printVersionCommand } from './utils';
5
5
  import { t } from './utils/i18n';
6
+ import { bundleCommands } from './bundle';
7
+ import { versionCommands } from './versions';
8
+ import { userCommands } from './user';
9
+ import { appCommands } from './app';
10
+ import { packageCommands } from './package';
6
11
 
7
12
  function printUsage() {
8
13
  // const commandName = args[0];
@@ -15,11 +20,11 @@ function printUsage() {
15
20
  }
16
21
 
17
22
  const commands = {
18
- ...require('./user').commands,
19
- ...require('./bundle').commands,
20
- ...require('./app').commands,
21
- ...require('./package').commands,
22
- ...require('./versions').commands,
23
+ ...userCommands,
24
+ ...bundleCommands,
25
+ ...appCommands,
26
+ ...packageCommands,
27
+ ...versionCommands,
23
28
  help: printUsage,
24
29
  };
25
30
 
package/src/package.ts CHANGED
@@ -52,7 +52,7 @@ export async function choosePackage(appId: string) {
52
52
  }
53
53
  }
54
54
 
55
- export const commands = {
55
+ export const packageCommands = {
56
56
  uploadIpa: async ({ args }: { args: string[] }) => {
57
57
  const fn = args[0];
58
58
  if (!fn || !fn.endsWith('.ipa')) {
package/src/user.ts CHANGED
@@ -7,7 +7,7 @@ function md5(str: string) {
7
7
  return crypto.createHash('md5').update(str).digest('hex');
8
8
  }
9
9
 
10
- export const commands = {
10
+ export const userCommands = {
11
11
  login: async ({ args }: { args: string[] }) => {
12
12
  const email = args[0] || (await question('email:'));
13
13
  const pwd = args[1] || (await question('password:', true));