react-native-update-cli 2.10.1 → 2.11.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.
Files changed (82) hide show
  1. package/README.md +47 -497
  2. package/README.zh-CN.md +52 -500
  3. package/cli.json +2 -16
  4. package/lib/api.js +1 -1
  5. package/lib/app.d.ts +1 -1
  6. package/lib/app.js +42 -45
  7. package/lib/bin.d.ts +2 -0
  8. package/lib/bin.js +70 -0
  9. package/lib/bundle-runner.d.ts +1 -0
  10. package/lib/bundle-runner.js +46 -10
  11. package/lib/exports.d.ts +2 -9
  12. package/lib/exports.js +0 -31
  13. package/lib/index.d.ts +1 -5
  14. package/lib/index.js +12 -128
  15. package/lib/locales/en.d.ts +1 -0
  16. package/lib/locales/en.js +1 -0
  17. package/lib/locales/zh.d.ts +1 -0
  18. package/lib/locales/zh.js +1 -0
  19. package/lib/package.d.ts +1 -2
  20. package/lib/package.js +50 -10
  21. package/lib/provider.d.ts +1 -4
  22. package/lib/provider.js +6 -25
  23. package/lib/types.d.ts +0 -37
  24. package/lib/user.d.ts +1 -1
  25. package/lib/user.js +1 -1
  26. package/lib/utils/app-info-parser/aab.js +46 -5
  27. package/lib/utils/app-info-parser/resource-finder.js +5 -5
  28. package/lib/utils/app-info-parser/utils.js +3 -2
  29. package/lib/utils/check-lockfile.js +1 -1
  30. package/lib/utils/dep-versions.js +2 -2
  31. package/lib/utils/http-helper.js +2 -2
  32. package/lib/utils/index.d.ts +0 -1
  33. package/lib/utils/index.js +0 -13
  34. package/lib/utils/plugin-config.js +42 -6
  35. package/lib/versions.d.ts +1 -0
  36. package/lib/versions.js +19 -16
  37. package/package.json +8 -10
  38. package/src/api.ts +1 -1
  39. package/src/app.ts +40 -40
  40. package/src/bin.ts +86 -0
  41. package/src/bundle-runner.ts +70 -12
  42. package/src/exports.ts +1 -12
  43. package/src/index.ts +1 -159
  44. package/src/locales/en.ts +1 -0
  45. package/src/locales/zh.ts +1 -0
  46. package/src/package.ts +6 -10
  47. package/src/provider.ts +10 -29
  48. package/src/types.ts +0 -54
  49. package/src/user.ts +1 -1
  50. package/src/utils/app-info-parser/aab.ts +2 -2
  51. package/src/utils/app-info-parser/resource-finder.ts +5 -5
  52. package/src/utils/app-info-parser/utils.ts +2 -2
  53. package/src/utils/check-lockfile.ts +1 -1
  54. package/src/utils/dep-versions.ts +2 -2
  55. package/src/utils/http-helper.ts +2 -2
  56. package/src/utils/index.ts +1 -12
  57. package/src/utils/plugin-config.ts +1 -1
  58. package/src/versions.ts +25 -17
  59. package/lib/module-manager.d.ts +0 -20
  60. package/lib/module-manager.js +0 -118
  61. package/lib/modules/app-module.d.ts +0 -2
  62. package/lib/modules/app-module.js +0 -263
  63. package/lib/modules/bundle-module.d.ts +0 -2
  64. package/lib/modules/bundle-module.js +0 -187
  65. package/lib/modules/index.d.ts +0 -6
  66. package/lib/modules/index.js +0 -42
  67. package/lib/modules/package-module.d.ts +0 -2
  68. package/lib/modules/package-module.js +0 -16
  69. package/lib/modules/user-module.d.ts +0 -2
  70. package/lib/modules/user-module.js +0 -413
  71. package/lib/modules/version-module.d.ts +0 -2
  72. package/lib/modules/version-module.js +0 -16
  73. package/lib/workflow-runner.d.ts +0 -2
  74. package/lib/workflow-runner.js +0 -25
  75. package/src/module-manager.ts +0 -145
  76. package/src/modules/app-module.ts +0 -277
  77. package/src/modules/bundle-module.ts +0 -212
  78. package/src/modules/index.ts +0 -19
  79. package/src/modules/package-module.ts +0 -10
  80. package/src/modules/user-module.ts +0 -465
  81. package/src/modules/version-module.ts +0 -8
  82. package/src/workflow-runner.ts +0 -24
package/src/app.ts CHANGED
@@ -11,8 +11,6 @@ interface AppSummary {
11
11
  platform: Platform;
12
12
  }
13
13
 
14
- const validPlatforms = ['ios', 'android', 'harmony'] as const;
15
-
16
14
  export async function getPlatform(platform?: string) {
17
15
  return assertPlatform(
18
16
  platform || (await question(t('platformQuestion'))),
@@ -20,7 +18,7 @@ export async function getPlatform(platform?: string) {
20
18
  }
21
19
 
22
20
  export function assertPlatform(platform: string): Platform {
23
- if (!validPlatforms.includes(platform as Platform)) {
21
+ if (platform !== 'ios' && platform !== 'android' && platform !== 'harmony') {
24
22
  throw new Error(t('unsupportedPlatform', { platform }));
25
23
  }
26
24
  return platform as Platform;
@@ -121,40 +119,42 @@ async function selectApp({
121
119
  );
122
120
  }
123
121
 
124
- export const appCommands = {
125
- createApp: async ({
126
- options,
127
- }: {
128
- options: { name: string; downloadUrl: string; platform?: Platform | '' };
129
- }) => {
130
- const name = options.name || (await question(t('appNameQuestion')));
131
- const { downloadUrl } = options;
132
- const platform = await getPlatform(options.platform);
133
- const { id } = await post('/app/create', { name, platform, downloadUrl });
134
- console.log(t('createAppSuccess', { id }));
135
- await selectApp({
136
- args: [String(id)],
137
- options: { platform },
138
- });
139
- },
140
- deleteApp: async ({
141
- args,
142
- options,
143
- }: {
144
- args: string[];
145
- options: { platform: Platform };
146
- }) => {
147
- const { platform } = options;
148
- const id = args[0] || (await chooseApp(platform)).id;
149
- if (!id) {
150
- console.log(t('cancelled'));
151
- }
152
- await doDelete(`/app/${id}`);
153
- console.log(t('operationSuccess'));
154
- },
155
- apps: async ({ options }: { options: { platform?: Platform | '' } }) => {
156
- const { platform = '' } = options;
157
- await listApp(platform);
158
- },
159
- selectApp,
160
- };
122
+ export function getAppCommands() {
123
+ return {
124
+ createApp: async ({
125
+ options,
126
+ }: {
127
+ options: { name: string; downloadUrl: string; platform?: Platform | '' };
128
+ }) => {
129
+ const name = options.name || (await question(t('appNameQuestion')));
130
+ const { downloadUrl } = options;
131
+ const platform = await getPlatform(options.platform);
132
+ const { id } = await post('/app/create', { name, platform, downloadUrl });
133
+ console.log(t('createAppSuccess', { id }));
134
+ await selectApp({
135
+ args: [String(id)],
136
+ options: { platform },
137
+ });
138
+ },
139
+ deleteApp: async ({
140
+ args,
141
+ options,
142
+ }: {
143
+ args: string[];
144
+ options: { platform: Platform };
145
+ }) => {
146
+ const { platform } = options;
147
+ const id = args[0] || (await chooseApp(platform)).id;
148
+ if (!id) {
149
+ console.log(t('cancelled'));
150
+ }
151
+ await doDelete(`/app/${id}`);
152
+ console.log(t('operationSuccess'));
153
+ },
154
+ apps: async ({ options }: { options: { platform?: Platform | '' } }) => {
155
+ const { platform = '' } = options;
156
+ await listApp(platform);
157
+ },
158
+ selectApp,
159
+ };
160
+ }
package/src/bin.ts ADDED
@@ -0,0 +1,86 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { loadSession } from './api';
4
+ import { getAppCommands } from './app';
5
+ import { bundleCommands } from './bundle';
6
+ import { diffCommands } from './diff';
7
+ import { installCommands } from './install';
8
+ import { packageCommands } from './package';
9
+ import { userCommands } from './user';
10
+ import { printVersionCommand } from './utils';
11
+ import { t } from './utils/i18n';
12
+ import { versionCommands } from './versions';
13
+
14
+ type CliCommandHandler = (argv: any) => Promise<unknown> | unknown;
15
+
16
+ interface CliArgv {
17
+ command: string;
18
+ args: string[];
19
+ options: Record<string, any>;
20
+ }
21
+
22
+ function printUsage(exitCode = 1) {
23
+ console.log('React Native Update CLI');
24
+ console.log('');
25
+ console.log('Commands:');
26
+ for (const name of Object.keys(commandHandlers)) {
27
+ console.log(` ${name}`);
28
+ }
29
+
30
+ console.log('');
31
+ console.log('Special commands:');
32
+ console.log(' list: List all available commands');
33
+ console.log(' help: Show this help message');
34
+
35
+ console.log('');
36
+ console.log(
37
+ 'Visit `https://github.com/reactnativecn/react-native-update` for document.',
38
+ );
39
+ process.exit(exitCode);
40
+ }
41
+
42
+ const commandHandlers: Record<string, CliCommandHandler> = {
43
+ ...userCommands,
44
+ ...bundleCommands,
45
+ ...diffCommands,
46
+ ...getAppCommands(),
47
+ ...packageCommands,
48
+ ...versionCommands,
49
+ ...installCommands,
50
+ help: printUsage,
51
+ };
52
+
53
+ async function run() {
54
+ await printVersionCommand();
55
+ if (process.argv.indexOf('-v') >= 0 || process.argv[2] === 'version') {
56
+ process.exit();
57
+ }
58
+
59
+ const argv: CliArgv = require('cli-arguments').parse(require('../cli.json'));
60
+ global.NO_INTERACTIVE = argv.options['no-interactive'];
61
+ global.USE_ACC_OSS = argv.options.acc;
62
+
63
+ try {
64
+ await loadSession();
65
+
66
+ if (argv.command === 'help') {
67
+ printUsage(0);
68
+ } else if (argv.command === 'list') {
69
+ printUsage(0);
70
+ } else if (commandHandlers[argv.command]) {
71
+ const handler = commandHandlers[argv.command];
72
+ await handler(argv);
73
+ } else {
74
+ throw new Error(`Unknown command: ${argv.command}`);
75
+ }
76
+ } catch (err: any) {
77
+ if (err.status === 401) {
78
+ console.log(t('loginFirst'));
79
+ return;
80
+ }
81
+ console.error(err.stack);
82
+ process.exit(-1);
83
+ }
84
+ }
85
+
86
+ run();
@@ -331,6 +331,75 @@ function getHermesOSBin() {
331
331
  if (os.platform() === 'linux') return 'linux64-bin';
332
332
  }
333
333
 
334
+ function getHermesExecutableName() {
335
+ return os.platform() === 'win32' ? 'hermesc.exe' : 'hermesc';
336
+ }
337
+
338
+ function dirnameOfPackage(
339
+ packageJsonPath: string,
340
+ projectRoot = process.cwd(),
341
+ ) {
342
+ return path.dirname(
343
+ require.resolve(packageJsonPath, {
344
+ paths: [projectRoot],
345
+ }),
346
+ );
347
+ }
348
+
349
+ export function resolveHermesCommand(projectRoot = process.cwd()): string {
350
+ const osBin = getHermesOSBin();
351
+ if (!osBin) {
352
+ throw new Error(`Unsupported platform for Hermes: ${os.platform()}`);
353
+ }
354
+
355
+ const executableName = getHermesExecutableName();
356
+ const candidates: string[] = [];
357
+
358
+ try {
359
+ const rnDir = dirnameOfPackage('react-native/package.json', projectRoot);
360
+ candidates.push(path.join(rnDir, 'sdks', 'hermesc', osBin, executableName));
361
+ } catch {
362
+ // react-native is required for normal RN projects; keep looking so the
363
+ // final error can include all candidates we were able to infer.
364
+ }
365
+
366
+ try {
367
+ const hermesCompilerDir = dirnameOfPackage(
368
+ 'hermes-compiler/package.json',
369
+ projectRoot,
370
+ );
371
+ candidates.push(
372
+ path.join(hermesCompilerDir, 'hermesc', osBin, executableName),
373
+ );
374
+ } catch {
375
+ // RN 0.85+ uses hermes-compiler, older projects may still use other paths.
376
+ }
377
+
378
+ try {
379
+ const hermesEngineDir = dirnameOfPackage(
380
+ 'hermes-engine/package.json',
381
+ projectRoot,
382
+ );
383
+ candidates.push(
384
+ path.join(hermesEngineDir, osBin, executableName),
385
+ path.join(hermesEngineDir, 'hermesc', osBin, executableName),
386
+ );
387
+ } catch {
388
+ // RN 0.70-era projects commonly used hermes-engine; optional for newer RN.
389
+ }
390
+
391
+ const hermesCommand = candidates.find((candidate) =>
392
+ fs.existsSync(candidate),
393
+ );
394
+ if (hermesCommand) {
395
+ return hermesCommand;
396
+ }
397
+
398
+ throw new Error(
399
+ `Cannot find hermesc. Tried:\n${candidates.map((candidate) => `- ${candidate}`).join('\n')}`,
400
+ );
401
+ }
402
+
334
403
  async function checkGradleConfig(): Promise<GradleConfig> {
335
404
  let enableHermes = false;
336
405
  let crunchPngs: boolean | undefined;
@@ -365,18 +434,7 @@ async function compileHermesByteCode(
365
434
  shouldCleanSourcemap: boolean,
366
435
  ) {
367
436
  console.log(t('hermesEnabledCompiling'));
368
- const rnDir = path.dirname(
369
- require.resolve('react-native', {
370
- paths: [process.cwd()],
371
- }),
372
- );
373
- let hermesPath = path.join(rnDir, `/sdks/hermesc/${getHermesOSBin()}`);
374
-
375
- if (!fs.existsSync(hermesPath)) {
376
- hermesPath = `node_modules/hermes-engine/${getHermesOSBin()}`;
377
- }
378
-
379
- const hermesCommand = `${hermesPath}/hermesc`;
437
+ const hermesCommand = resolveHermesCommand();
380
438
 
381
439
  const args = [
382
440
  '-emit-binary',
package/src/exports.ts CHANGED
@@ -1,28 +1,17 @@
1
1
  export { getSession, loadSession } from './api';
2
2
  export { getPlatform, getSelectedApp } from './app';
3
3
  export { diffCommands } from './diff';
4
- export { moduleManager } from './module-manager';
5
- export { builtinModules } from './modules';
6
- export { appModule } from './modules/app-module';
7
- export { bundleModule } from './modules/bundle-module';
8
- export { packageModule } from './modules/package-module';
9
- export { userModule } from './modules/user-module';
10
- export { versionModule } from './modules/version-module';
11
4
  export { CLIProviderImpl } from './provider';
12
5
  export type {
13
6
  BundleOptions,
14
- CLIModule,
15
7
  CLIProvider,
16
8
  CommandContext,
17
- CommandDefinition,
18
9
  CommandResult,
19
- CustomWorkflow,
20
10
  Package,
21
11
  Platform,
22
12
  PublishOptions,
23
13
  Session,
24
14
  UploadOptions,
25
15
  Version,
26
- WorkflowStep,
27
16
  } from './types';
28
- export { question, saveToLocal } from './utils';
17
+ export { question } from './utils';
package/src/index.ts CHANGED
@@ -1,159 +1 @@
1
- #!/usr/bin/env node
2
-
3
- import { loadSession } from './api';
4
- import { appCommands } from './app';
5
- import { bundleCommands } from './bundle';
6
- import { diffCommands } from './diff';
7
- import { installCommands } from './install';
8
- import { moduleManager } from './module-manager';
9
- import { builtinModules } from './modules';
10
- import { packageCommands } from './package';
11
- import type { CommandContext } from './types';
12
- import { userCommands } from './user';
13
- import { printVersionCommand } from './utils';
14
- import { t } from './utils/i18n';
15
- import { versionCommands } from './versions';
16
-
17
- type LegacyCommandHandler = (argv: any) => Promise<unknown> | unknown;
18
-
19
- interface CliArgv {
20
- command: string;
21
- args: string[];
22
- options: Record<string, any>;
23
- }
24
-
25
- function registerBuiltinModules() {
26
- for (const module of builtinModules) {
27
- try {
28
- moduleManager.registerModule(module);
29
- } catch (error) {
30
- console.error(`Failed to register module ${module.name}:`, error);
31
- }
32
- }
33
- }
34
-
35
- function printUsage() {
36
- console.log('React Native Update CLI');
37
- console.log('');
38
- console.log('Traditional commands:');
39
- for (const name of Object.keys(legacyCommands)) {
40
- console.log(` ${name}: Legacy command`);
41
- }
42
-
43
- console.log('');
44
- console.log('Modular commands:');
45
- const commands = moduleManager.listCommands();
46
- for (const command of commands) {
47
- console.log(
48
- ` ${command.name}: ${command.description || 'No description'}`,
49
- );
50
- }
51
-
52
- console.log('');
53
- console.log('Available workflows:');
54
- const workflows = moduleManager.listWorkflows();
55
- for (const workflow of workflows) {
56
- console.log(
57
- ` ${workflow.name}: ${workflow.description || 'No description'}`,
58
- );
59
- }
60
-
61
- console.log('');
62
- console.log('Special commands:');
63
- console.log(' list: List all available commands and workflows');
64
- console.log(' workflow <name>: Execute a specific workflow');
65
- console.log(' help: Show this help message');
66
-
67
- console.log('');
68
- console.log(
69
- 'Visit `https://github.com/reactnativecn/react-native-update` for document.',
70
- );
71
- process.exit(1);
72
- }
73
-
74
- const legacyCommands: Record<string, LegacyCommandHandler> = {
75
- ...userCommands,
76
- ...bundleCommands,
77
- ...diffCommands,
78
- ...appCommands,
79
- ...packageCommands,
80
- ...versionCommands,
81
- ...installCommands,
82
- help: printUsage,
83
- };
84
-
85
- async function run() {
86
- await printVersionCommand();
87
- if (process.argv.indexOf('-v') >= 0 || process.argv[2] === 'version') {
88
- process.exit();
89
- }
90
-
91
- // Register builtin modules for modular functionality
92
- registerBuiltinModules();
93
-
94
- const argv: CliArgv = require('cli-arguments').parse(require('../cli.json'));
95
- global.NO_INTERACTIVE = argv.options['no-interactive'];
96
- global.USE_ACC_OSS = argv.options.acc;
97
-
98
- const context: CommandContext = {
99
- args: argv.args || [],
100
- options: argv.options || {},
101
- };
102
-
103
- try {
104
- await loadSession();
105
- context.session = require('./api').getSession();
106
-
107
- // Handle special modular commands first
108
- if (argv.command === 'help') {
109
- printUsage();
110
- } else if (argv.command === 'list') {
111
- moduleManager.listAll();
112
- } else if (argv.command === 'workflow') {
113
- const workflowName = argv.args[0];
114
- if (!workflowName) {
115
- console.error('Workflow name is required');
116
- process.exit(1);
117
- }
118
- const result = await moduleManager.executeWorkflow(workflowName, context);
119
- if (!result.success) {
120
- console.error('Workflow execution failed:', result.error);
121
- process.exit(1);
122
- }
123
- console.log('Workflow completed successfully:', result.data);
124
- }
125
- // Try legacy commands first for backward compatibility
126
- else if (legacyCommands[argv.command]) {
127
- const legacyHandler = legacyCommands[argv.command];
128
- await legacyHandler(argv);
129
- }
130
- // Fall back to modular commands
131
- else {
132
- const result = await moduleManager.executeCommand(argv.command, context);
133
- if (!result.success) {
134
- console.error('Command execution failed:', result.error);
135
- process.exit(1);
136
- }
137
- console.log('Command completed successfully:', result.data);
138
- }
139
- } catch (err: any) {
140
- if (err.status === 401) {
141
- console.log(t('loginFirst'));
142
- return;
143
- }
144
- console.error(err.stack);
145
- process.exit(-1);
146
- }
147
- }
148
-
149
- export { CLIProviderImpl } from './provider';
150
- export type {
151
- CLIModule,
152
- CLIProvider,
153
- CommandDefinition,
154
- CustomWorkflow,
155
- WorkflowStep,
156
- } from './types';
157
- export { moduleManager };
158
-
159
- run();
1
+ export * from './exports';
package/src/locales/en.ts CHANGED
@@ -96,6 +96,7 @@ This can reduce the risk of inconsistent dependencies and supply chain attacks.
96
96
  packageIdRequired: 'Please provide packageId or packageVersion parameter',
97
97
  packageUploadSuccess:
98
98
  'Successfully uploaded new hot update package (id: {{id}})',
99
+ depsChangeWarningTitle: 'Dependency changes detected',
99
100
  depsChangeSummary:
100
101
  'Dependency changes: added {{added}}, removed {{removed}}, changed {{changed}}.',
101
102
  depsChangeTargetPackage:
package/src/locales/zh.ts CHANGED
@@ -89,6 +89,7 @@ export default {
89
89
  operationSuccess: '操作成功',
90
90
  packageIdRequired: '请提供 packageId 或 packageVersion 参数',
91
91
  packageUploadSuccess: '已成功上传新热更包(id: {{id}})',
92
+ depsChangeWarningTitle: '检测到依赖变化',
92
93
  depsChangeSummary:
93
94
  '依赖变化:新增 {{added}} 项,移除 {{removed}} 项,版本变更 {{changed}} 项。',
94
95
  depsChangeTargetPackage: '目标原生包:{{packageName}} (id: {{packageId}})',
package/src/package.ts CHANGED
@@ -1,4 +1,4 @@
1
- import fs from 'fs-extra';
1
+ import * as fs from 'fs-extra';
2
2
  import os from 'os';
3
3
  import path from 'path';
4
4
  import Table from 'tty-table';
@@ -11,7 +11,6 @@ import {
11
11
  getAppInfo,
12
12
  getIpaInfo,
13
13
  question,
14
- saveToLocal,
15
14
  } from './utils';
16
15
  import { AabParser } from './utils/app-info-parser/aab';
17
16
  import { depVersions } from './utils/dep-versions';
@@ -59,7 +58,7 @@ function ensureFileByExt(
59
58
  extension: NativeUploadConfig['extension'] | '.aab',
60
59
  usageKey: string,
61
60
  ): string {
62
- if (!filePath || !filePath.endsWith(extension)) {
61
+ if (!filePath?.endsWith(extension)) {
63
62
  throw new Error(t(usageKey));
64
63
  }
65
64
  return filePath;
@@ -129,7 +128,6 @@ async function uploadNativePackage(
129
128
  deps: depVersions,
130
129
  commit: await getCommitInfo(),
131
130
  });
132
- saveToLocal(filePath, `${appId}/package/${id}${config.extension}`);
133
131
  console.log(
134
132
  t(config.successKey, {
135
133
  id,
@@ -274,28 +272,28 @@ export const packageCommands = {
274
272
  },
275
273
  parseApp: async ({ args }: { args: string[] }) => {
276
274
  const fn = args[0];
277
- if (!fn || !fn.endsWith('.app')) {
275
+ if (!fn?.endsWith('.app')) {
278
276
  throw new Error(t('usageParseApp'));
279
277
  }
280
278
  console.log(await getAppInfo(fn));
281
279
  },
282
280
  parseIpa: async ({ args }: { args: string[] }) => {
283
281
  const fn = args[0];
284
- if (!fn || !fn.endsWith('.ipa')) {
282
+ if (!fn?.endsWith('.ipa')) {
285
283
  throw new Error(t('usageParseIpa'));
286
284
  }
287
285
  console.log(await getIpaInfo(fn));
288
286
  },
289
287
  parseApk: async ({ args }: { args: string[] }) => {
290
288
  const fn = args[0];
291
- if (!fn || !fn.endsWith('.apk')) {
289
+ if (!fn?.endsWith('.apk')) {
292
290
  throw new Error(t('usageParseApk'));
293
291
  }
294
292
  console.log(await getApkInfo(fn));
295
293
  },
296
294
  parseAab: async ({ args }: { args: string[] }) => {
297
295
  const fn = args[0];
298
- if (!fn || !fn.endsWith('.aab')) {
296
+ if (!fn?.endsWith('.aab')) {
299
297
  throw new Error(t('usageParseAab'));
300
298
  }
301
299
  console.log(await getAabInfo(fn));
@@ -333,10 +331,8 @@ export const packageCommands = {
333
331
  await listPackage(String(appId));
334
332
  },
335
333
  deletePackage: async ({
336
- args,
337
334
  options,
338
335
  }: {
339
- args: string[];
340
336
  options: {
341
337
  appId?: string;
342
338
  packageId?: string;
package/src/provider.ts CHANGED
@@ -5,7 +5,6 @@ import type {
5
5
  CLIProvider,
6
6
  CommandContext,
7
7
  CommandResult,
8
- CustomWorkflow,
9
8
  Platform,
10
9
  PublishOptions,
11
10
  Session,
@@ -13,10 +12,11 @@ import type {
13
12
  Version,
14
13
  } from './types';
15
14
  import { runAsCommandResult } from './utils/command-result';
16
- import { runWorkflow } from './workflow-runner';
15
+
16
+ const DEFAULT_BUNDLE_OUTPUT =
17
+ '$' + '{tempDir}/output/$' + '{platform}.$' + '{time}.ppk';
17
18
 
18
19
  export class CLIProviderImpl implements CLIProvider {
19
- private workflows: Map<string, CustomWorkflow> = new Map();
20
20
  private session?: Session;
21
21
  private sessionInitPromise?: Promise<void>;
22
22
 
@@ -83,7 +83,7 @@ export class CLIProviderImpl implements CLIProvider {
83
83
  platform: options.platform,
84
84
  bundleName: options.bundleName || 'index.bundlejs',
85
85
  entryFile: options.entryFile || 'index.js',
86
- output: options.output || '${tempDir}/output/${platform}.${time}.ppk',
86
+ output: options.output || DEFAULT_BUNDLE_OUTPUT,
87
87
  sourcemap: options.sourcemap || false,
88
88
  taro: options.taro || false,
89
89
  expo: options.expo || false,
@@ -171,8 +171,10 @@ export class CLIProviderImpl implements CLIProvider {
171
171
  return this.runMessageCommand(
172
172
  async () => {
173
173
  const resolvedPlatform = await this.getPlatform(platform);
174
- const { appCommands } = await import('./app');
175
- await appCommands.apps({ options: { platform: resolvedPlatform } });
174
+ const { getAppCommands } = await import('./app');
175
+ await getAppCommands().apps({
176
+ options: { platform: resolvedPlatform },
177
+ });
176
178
  },
177
179
  'Unknown error listing apps',
178
180
  'Apps listed successfully',
@@ -182,8 +184,8 @@ export class CLIProviderImpl implements CLIProvider {
182
184
  async createApp(name: string, platform: Platform): Promise<CommandResult> {
183
185
  return this.runMessageCommand(
184
186
  async () => {
185
- const { appCommands } = await import('./app');
186
- await appCommands.createApp({
187
+ const { getAppCommands } = await import('./app');
188
+ await getAppCommands().createApp({
187
189
  options: {
188
190
  name,
189
191
  platform,
@@ -238,27 +240,6 @@ export class CLIProviderImpl implements CLIProvider {
238
240
  return this.session;
239
241
  }
240
242
 
241
- registerWorkflow(workflow: CustomWorkflow): void {
242
- this.workflows.set(workflow.name, workflow);
243
- }
244
-
245
- async executeWorkflow(
246
- workflowName: string,
247
- context: CommandContext,
248
- ): Promise<CommandResult> {
249
- return this.runDataCommand(async () => {
250
- const workflow = this.workflows.get(workflowName);
251
- if (!workflow) {
252
- throw new Error(`Workflow '${workflowName}' not found`);
253
- }
254
- const result = await runWorkflow(workflowName, workflow, context);
255
- return {
256
- message: `Workflow '${workflowName}' completed successfully`,
257
- result,
258
- };
259
- }, `Workflow '${workflowName}' failed`);
260
- }
261
-
262
243
  async listPackages(appId?: string): Promise<CommandResult> {
263
244
  return this.runDataCommand(async () => {
264
245
  const { listPackage } = await import('./package');