Skip to content

Commit

Permalink
fix: sourcemapOutput be coverd
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan committed Jun 23, 2020
1 parent 02ec693 commit 1e53f8c
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 5 deletions.
7 changes: 7 additions & 0 deletions README-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ code-push release-react <appName> <platform>
[--plistFile <plistFile>]
[--plistFilePrefix <plistFilePrefix>]
[--sourcemapOutput <sourcemapOutput>]
[--sourcemapOutputDir <sourcemapOutputDir>]
[--targetBinaryVersion <targetBinaryVersion>]
[--rollout <rolloutPercentage>]
[--privateKeyPath <pathToPrivateKey>]
Expand Down Expand Up @@ -489,6 +490,12 @@ code-push release-react MyApp ios

*注意:参数可以配置成`--sourcemapOutput``-s`*

#### Sourcemap output dir 参数

指明生成的JS bundle 的sourcemap写入的文件夹路径。如果指定了`--sourcemapOutput``sourcemap-output-dir`参数将被忽略。

*注意:参数可以配置成`--sourcemapOutputDir`

### 发布更新 (Cordova)

```shell
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ code-push release-react <appName> <platform>
[--plistFile <plistFile>]
[--plistFilePrefix <plistFilePrefix>]
[--sourcemapOutput <sourcemapOutput>]
[--sourcemapOutputDir <sourcemapOutputDir>]
[--targetBinaryVersion <targetBinaryVersion>]
[--rollout <rolloutPercentage>]
[--privateKeyPath <pathToPrivateKey>]
Expand Down Expand Up @@ -575,6 +576,12 @@ This specifies the relative path to where the generated JS bundle's sourcemap fi

*NOTE: This parameter can be set using either --sourcemapOutput or -s*

#### Sourcemap output dir parameter

Specify the folder path where the sourcemap of the generated JS bundle is written. If `--sourcemapOutput` is specified, the `sourcemap-output-dir` parameter will be ignored.

*NOTE: This parameter can be set using either --sourcemapOutputDir

#### Output directory parameter

This specifies the relative path to where the assets, JS bundle and sourcemap files should be written. If left unspecified, the assets, JS bundle and sourcemap will be copied to the `/tmp/CodePush` folder.
Expand Down
1 change: 1 addition & 0 deletions src/definitions/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ export interface IReleaseReactCommand extends IReleaseBaseCommand {
plistFile?: string;
plistFilePrefix?: string;
sourcemapOutput?: string;
sourcemapOutputDir?: string;
outputDir?: string;
config?: string;
}
Expand Down
12 changes: 7 additions & 5 deletions src/script/command-executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1867,11 +1867,13 @@ export var releaseReact = (
? (Q(command.appStoreVersion) as any)
: getReactNativeProjectAppVersion(command, projectName);

if (command.outputDir) {
command.sourcemapOutput = path.join(
releaseCommand.package,
bundleName + ".map"
);
if (command.sourcemapOutputDir && command.sourcemapOutput) {
log('\n"sourcemap-output-dir" argument will be ignored as "sourcemap-output" argument is provided.\n');
}

if ((command.outputDir || command.sourcemapOutputDir) && !command.sourcemapOutput) {
const sourcemapDir = command.sourcemapOutputDir || releaseCommand.package;
command.sourcemapOutput = path.join(sourcemapDir, bundleName + ".map");
}

return appVersionPromise;
Expand Down
9 changes: 9 additions & 0 deletions src/script/command-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1282,6 +1282,13 @@ var argv = yargs
"Path to where the sourcemap for the resulting bundle should be written. If omitted, a sourcemap will not be generated.",
type: "string",
})
.option("sourcemapOutputDir", {
default: null,
demand: false,
description:
'Path to folder where the sourcemap for the resulting bundle should be written. Name of sourcemap file will be generated automatically. This argument will be ignored if "sourcemap-output" argument is provided. If omitted, a sourcemap will not be generated.',
type: "string",
})
.option("targetBinaryVersion", {
alias: "t",
default: null,
Expand Down Expand Up @@ -1817,6 +1824,8 @@ function createCommand(): cli.ICommand {
releaseReactCommand.privateKeyPath = argv["privateKeyPath"];
releaseReactCommand.sourcemapOutput =
argv["sourcemapOutput"];
releaseReactCommand.sourcemapOutputDir =
argv["sourcemapOutputDir"];
releaseReactCommand.outputDir = argv["outputDir"];
releaseReactCommand.config = argv["config"];
}
Expand Down

0 comments on commit 1e53f8c

Please sign in to comment.