Skip to content

Commit a521f36

Browse files
committed
feat: add private flag to some options to skip tracking for them
1 parent 8abd9e3 commit a521f36

File tree

3 files changed

+29
-20
lines changed

3 files changed

+29
-20
lines changed

lib/common/declarations.d.ts

+4
Original file line numberDiff line numberDiff line change
@@ -1269,6 +1269,10 @@ interface IDashedOption {
12691269
* Type of the option. It can be string, boolean, Array, etc.
12701270
*/
12711271
type: string;
1272+
/**
1273+
* Should skip in tracking
1274+
*/
1275+
private?: boolean;
12721276
/**
12731277
* Shorthand option passed on the command line with `-` sign, for example `-v`
12741278
*/

lib/helpers/options-track-helper.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { TrackActionNames } from "../constants";
33

44
export class OptionsTracker {
55
public static PASSWORD_DETECTION_STRING = "password";
6-
public static PASSOWRD_REPLACE_VALUE = "private";
6+
public static PRIVATE_REPLACE_VALUE = "private";
77
public static PATH_REPLACE_VALUE = "_localpath";
88
public static SIZE_EXEEDED_REPLACE_VALUE = "sizeExceeded";
99

@@ -34,13 +34,16 @@ export class OptionsTracker {
3434
if (this.shouldSkipProperty(key, value, shorthands, optionsDefinitions)) {
3535
delete data[key];
3636
} else {
37-
if (key.toLowerCase().indexOf(OptionsTracker.PASSWORD_DETECTION_STRING) >= 0) {
38-
value = OptionsTracker.PASSOWRD_REPLACE_VALUE;
37+
if (options && optionsDefinitions[key] && optionsDefinitions[key].private) {
38+
value = OptionsTracker.PRIVATE_REPLACE_VALUE;
39+
} else if (key.toLowerCase().indexOf(OptionsTracker.PASSWORD_DETECTION_STRING) >= 0) {
40+
value = OptionsTracker.PRIVATE_REPLACE_VALUE;
3941
} else if (_.isString(value) && value !== path.basename(value)) {
4042
value = OptionsTracker.PATH_REPLACE_VALUE;
4143
} else if (_.isObject(value) && !_.isArray(value)) {
4244
value = this.sanitizeTrackObject(value);
4345
}
46+
4447
data[key] = value;
4548
}
4649
});

lib/options.ts

+19-17
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ export class Options {
1212
verbose: { type: OptionType.Boolean, alias: "v" },
1313
version: { type: OptionType.Boolean },
1414
help: { type: OptionType.Boolean, alias: "h" },
15-
profileDir: { type: OptionType.String },
15+
profileDir: { type: OptionType.String, private: true },
1616
analyticsClient: { type: OptionType.String },
17-
path: { type: OptionType.String, alias: "p" },
17+
path: { type: OptionType.String, alias: "p", private: true },
1818
// This will parse all non-hyphenated values as strings.
1919
_: { type: OptionType.String }
2020
};
@@ -47,14 +47,14 @@ export class Options {
4747
framework: { type: OptionType.String },
4848
frameworkVersion: { type: OptionType.String },
4949
forDevice: { type: OptionType.Boolean },
50-
provision: { type: OptionType.Object },
50+
provision: { type: OptionType.Object, private: true },
5151
client: { type: OptionType.Boolean, default: true },
5252
env: { type: OptionType.Object },
5353
production: { type: OptionType.Boolean },
5454
debugTransport: { type: OptionType.Boolean },
5555
keyStorePath: { type: OptionType.String },
5656
keyStorePassword: { type: OptionType.String, },
57-
keyStoreAlias: { type: OptionType.String },
57+
keyStoreAlias: { type: OptionType.String, private: true },
5858
keyStoreAliasPassword: { type: OptionType.String },
5959
ignoreScripts: { type: OptionType.Boolean },
6060
disableNpmInstall: { type: OptionType.Boolean },
@@ -75,46 +75,48 @@ export class Options {
7575
androidTypings: { type: OptionType.Boolean },
7676
bundle: { type: OptionType.String },
7777
all: { type: OptionType.Boolean },
78-
teamId: { type: OptionType.Object },
78+
teamId: { type: OptionType.Object, private: true },
7979
syncAllFiles: { type: OptionType.Boolean, default: false },
8080
chrome: { type: OptionType.Boolean },
8181
inspector: { type: OptionType.Boolean },
8282
clean: { type: OptionType.Boolean },
8383
watch: { type: OptionType.Boolean, default: true },
8484
background: { type: OptionType.String },
85-
username: { type: OptionType.String },
85+
username: { type: OptionType.String, private: true },
8686
pluginName: { type: OptionType.String },
8787
hmr: { type: OptionType.Boolean },
8888
collection: { type: OptionType.String, alias: "c" },
8989
json: { type: OptionType.Boolean },
90-
avd: { type: OptionType.String },
90+
avd: { type: OptionType.String, private: true },
91+
// check not used
9192
config: { type: OptionType.Array },
9293
insecure: { type: OptionType.Boolean, alias: "k" },
9394
debug: { type: OptionType.Boolean, alias: "d" },
9495
timeout: { type: OptionType.String },
95-
device: { type: OptionType.String },
96-
availableDevices: { type: OptionType.Boolean },
97-
appid: { type: OptionType.String },
98-
geny: { type: OptionType.String },
96+
device: { type: OptionType.String, private: true },
97+
availableDevices: { type: OptionType.Boolean, private: true },
98+
appid: { type: OptionType.String, private: true },
99+
geny: { type: OptionType.String, private: true },
99100
debugBrk: { type: OptionType.Boolean },
100101
debugPort: { type: OptionType.Number },
101102
start: { type: OptionType.Boolean },
102103
stop: { type: OptionType.Boolean },
103-
ddi: { type: OptionType.String }, // the path to developer disk image
104+
ddi: { type: OptionType.String, private: true }, // the path to developer disk image
104105
justlaunch: { type: OptionType.Boolean },
105-
file: { type: OptionType.String },
106+
file: { type: OptionType.String, private: true },
106107
force: { type: OptionType.Boolean, alias: "f" },
108+
// remove legacy
107109
companion: { type: OptionType.Boolean },
108110
emulator: { type: OptionType.Boolean },
109111
sdk: { type: OptionType.String },
110-
template: { type: OptionType.String },
111-
certificate: { type: OptionType.String },
112+
template: { type: OptionType.String, private: true },
113+
certificate: { type: OptionType.String, private: true },
112114
certificatePassword: { type: OptionType.String },
113115
release: { type: OptionType.Boolean, alias: "r" },
114-
var: { type: OptionType.Object },
116+
var: { type: OptionType.Object, private: true },
115117
default: { type: OptionType.Boolean },
116118
count: { type: OptionType.Number },
117-
analyticsLogFile: { type: OptionType.String },
119+
analyticsLogFile: { type: OptionType.String, private: true },
118120
hooks: { type: OptionType.Boolean, default: true },
119121
link: { type: OptionType.Boolean, default: false },
120122
aab: { type: OptionType.Boolean }

0 commit comments

Comments
 (0)