Skip to content

Commit 22acced

Browse files
committed
refactor: for suggest review
1 parent 3161b87 commit 22acced

File tree

5 files changed

+21
-20
lines changed

5 files changed

+21
-20
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -360,9 +360,9 @@ npx code-push release --binary-version 1.0.0 --app-version 1.0.1 \
360360
--mandatory true
361361

362362
# Expo project
363-
npx code-push release --type expo --binary-version 1.0.0 --app-version 1.0.1 --platform ios
363+
npx code-push release --framework expo --binary-version 1.0.0 --app-version 1.0.1 --platform ios
364364
```
365-
- `--type`: Project type (react-native (default) | expo)
365+
- `--framework`(`-f`) : Framework type (expo)
366366
- `--binary-version`: The version of the binary app that the CodePush update is targeting.
367367
- `--app-version`: The version of the CodePush update itself.
368368

@@ -394,12 +394,13 @@ Create a CodePush bundle file.
394394
npx code-push bundle --platform android --entry-file index.js
395395

396396
# Expo project
397-
npx code-push bundle --type expo --platform android --entry-file index.js
397+
npx code-push bundle --framework expo --platform android --entry-file index.js
398398
```
399-
- `--type`: Project type (react-native (default) | expo)
399+
- `--framework`(`-f`): Framework type (expo)
400400

401401
By default, the bundle file is created in the `/build/bundleOutput` directory.
402402

403-
>[!NOTE] For Expo projects, the CLI uses `expo export:embed` command for bundling instead of React Native's bundle command.
403+
> [!NOTE]
404+
> For Expo projects, the CLI uses `expo export:embed` command for bundling instead of React Native's bundle command.
404405
405406
(The file name represents a hash value of the bundle content.)

cli/commands/bundleCommand/bundleCodePush.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const { makeCodePushBundle } = require('../../functions/makeCodePushBundle');
88
const { ROOT_OUTPUT_DIR, ENTRY_FILE } = require('../../constant');
99

1010
/**
11-
* @param type {string} 'react-native' | 'expo'
11+
* @param framework {string|undefined} 'expo'
1212
* @param platform {string} 'ios' | 'android'
1313
* @param outputRootPath {string}
1414
* @param entryFile {string}
@@ -17,7 +17,7 @@ const { ROOT_OUTPUT_DIR, ENTRY_FILE } = require('../../constant');
1717
* @return {Promise<string>} CodePush bundle file name (equals to packageHash)
1818
*/
1919
async function bundleCodePush(
20-
type = 'react-native',
20+
framework,
2121
platform = 'ios',
2222
outputRootPath = ROOT_OUTPUT_DIR,
2323
entryFile = ENTRY_FILE,
@@ -35,16 +35,16 @@ async function bundleCodePush(
3535

3636
prepareToBundleJS({ deleteDirs: [outputRootPath, getReactTempDir()], makeDir: OUTPUT_CONTENT_PATH });
3737

38-
if (type === 'react-native') {
39-
runReactNativeBundleCommand(
38+
if (framework === 'expo') {
39+
runExpoBundleCommand(
4040
_jsBundleName,
4141
OUTPUT_CONTENT_PATH,
4242
platform,
4343
SOURCEMAP_OUTPUT,
4444
entryFile,
4545
);
46-
} else if (type === 'expo') {
47-
runExpoBundleCommand(
46+
} else {
47+
runReactNativeBundleCommand(
4848
_jsBundleName,
4949
OUTPUT_CONTENT_PATH,
5050
platform,

cli/commands/bundleCommand/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ const { OUTPUT_BUNDLE_DIR, ROOT_OUTPUT_DIR, ENTRY_FILE } = require('../../consta
44

55
program.command('bundle')
66
.description('Creates a CodePush bundle file (assumes Hermes is enabled).')
7-
.addOption(new Option('-t, --type <type>', 'project type (react-native | expo)').choices(['react-native', 'expo']).default('react-native'))
7+
.addOption(new Option('-f, --framework <type>', 'framework type (expo)').choices(['expo']))
88
.addOption(new Option('-p, --platform <type>', 'platform').choices(['ios', 'android']).default('ios'))
99
.option('-o, --output-path <string>', 'path to output root directory', ROOT_OUTPUT_DIR)
1010
.option('-e, --entry-file <string>', 'path to JS/TS entry file', ENTRY_FILE)
1111
.option('-b, --bundle-name <string>', 'bundle file name (default-ios: "main.jsbundle" / default-android: "index.android.bundle")')
1212
.option('--output-bundle-dir <string>', 'name of directory containing the bundle file created by the "bundle" command', OUTPUT_BUNDLE_DIR)
1313
/**
1414
* @param {Object} options
15-
* @param {string} options.type
15+
* @param {string} options.framework
1616
* @param {string} options.platform
1717
* @param {string} options.outputPath
1818
* @param {string} options.entryFile
@@ -22,7 +22,7 @@ program.command('bundle')
2222
*/
2323
.action((options) => {
2424
bundleCodePush(
25-
options.type,
25+
options.framework,
2626
options.platform,
2727
options.outputPath,
2828
options.entryFile,

cli/commands/releaseCommand/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ program.command('release')
77
.description('Deploys a new CodePush update for a target binary app.\nAfter creating the CodePush bundle, it uploads the file and updates the ReleaseHistory information.\n`bundleUploader`, `getReleaseHistory`, and `setReleaseHistory` functions should be implemented in the config file.')
88
.requiredOption('-b, --binary-version <string>', '(Required) The target binary version')
99
.requiredOption('-v, --app-version <string>', '(Required) The app version to be released. It must be greater than the binary version.')
10-
.addOption(new Option('-t, --type <type>', 'project type (react-native | expo)').choices(['react-native', 'expo']).default('react-native'))
10+
.addOption(new Option('-f, --framework <type>', 'framework type (expo)').choices(['expo']))
1111
.addOption(new Option('-p, --platform <type>', 'platform').choices(['ios', 'android']).default('ios'))
1212
.option('-i, --identifier <string>', 'reserved characters to distinguish the release.')
1313
.option('-c, --config <path>', 'set config file name (JS/TS)', CONFIG_FILE_NAME)
@@ -23,7 +23,7 @@ program.command('release')
2323
* @param {Object} options
2424
* @param {string} options.binaryVersion
2525
* @param {string} options.appVersion
26-
* @param {string} options.type
26+
* @param {string} options.framework
2727
* @param {string} options.platform
2828
* @param {string} options.identifier
2929
* @param {string} options.config
@@ -46,7 +46,7 @@ program.command('release')
4646
config.setReleaseHistory,
4747
options.binaryVersion,
4848
options.appVersion,
49-
options.type,
49+
options.framework,
5050
options.platform,
5151
options.identifier,
5252
options.outputPath,

cli/commands/releaseCommand/release.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const { addToReleaseHistory } = require("./addToReleaseHistory");
2525
* ): Promise<void>}
2626
* @param binaryVersion {string}
2727
* @param appVersion {string}
28-
* @param type {string} 'react-native' | 'expo'
28+
* @param framework {string|undefined} 'expo'
2929
* @param platform {"ios" | "android"}
3030
* @param identifier {string?}
3131
* @param outputPath {string}
@@ -44,7 +44,7 @@ async function release(
4444
setReleaseHistory,
4545
binaryVersion,
4646
appVersion,
47-
type = 'react-native',
47+
framework,
4848
platform,
4949
identifier,
5050
outputPath,
@@ -58,7 +58,7 @@ async function release(
5858
) {
5959
const bundleFileName = skipBundle
6060
? readBundleFileNameFrom(bundleDirectory)
61-
: await bundleCodePush(type, platform, outputPath, entryFile, jsBundleName, bundleDirectory);
61+
: await bundleCodePush(framework, platform, outputPath, entryFile, jsBundleName, bundleDirectory);
6262
const bundleFilePath = `${bundleDirectory}/${bundleFileName}`;
6363

6464
const downloadUrl = await (async () => {

0 commit comments

Comments
 (0)