appium 2.0.0-beta.30 → 2.0.0-beta.33

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 (36) hide show
  1. package/build/lib/appium.d.ts +1 -1
  2. package/build/lib/appium.d.ts.map +1 -1
  3. package/build/lib/appium.js +5 -2
  4. package/build/lib/cli/parser.d.ts +3 -2
  5. package/build/lib/cli/parser.d.ts.map +1 -1
  6. package/build/lib/cli/parser.js +1 -1
  7. package/build/lib/config.d.ts +5 -4
  8. package/build/lib/config.d.ts.map +1 -1
  9. package/build/lib/config.js +1 -1
  10. package/build/lib/extension/manifest.d.ts.map +1 -1
  11. package/build/lib/extension/manifest.js +1 -1
  12. package/build/lib/main.d.ts +13 -10
  13. package/build/lib/main.d.ts.map +1 -1
  14. package/build/lib/main.js +57 -50
  15. package/build/tsconfig.tsbuildinfo +1 -1
  16. package/build/types/appium-manifest.d.ts +40 -0
  17. package/build/types/appium-manifest.d.ts.map +1 -0
  18. package/build/types/cli.d.ts +112 -0
  19. package/build/types/cli.d.ts.map +1 -0
  20. package/build/types/extension.d.ts +43 -0
  21. package/build/types/extension.d.ts.map +1 -0
  22. package/build/types/external-manifest.d.ts +47 -0
  23. package/build/types/external-manifest.d.ts.map +1 -0
  24. package/build/types/index.d.ts +15 -0
  25. package/build/types/index.d.ts.map +1 -0
  26. package/lib/appium.js +7 -3
  27. package/lib/cli/parser.js +2 -1
  28. package/lib/config.js +6 -5
  29. package/lib/extension/manifest.js +0 -2
  30. package/lib/main.js +78 -63
  31. package/package.json +18 -12
  32. package/types/{appium-manifest.d.ts → appium-manifest.ts} +1 -1
  33. package/types/{cli.d.ts → cli.ts} +48 -29
  34. package/types/{extension.d.ts → extension.ts} +4 -4
  35. package/types/{external-manifest.d.ts → external-manifest.ts} +2 -2
  36. package/types/{index.d.ts → index.ts} +7 -0
@@ -1,5 +1,5 @@
1
- import { DriverOpts } from '@appium/types';
2
- import {
1
+ import {ServerArgs} from '@appium/types';
2
+ import type {
3
3
  DRIVER_TYPE as DRIVER_SUBCOMMAND,
4
4
  EXT_SUBCOMMAND_INSTALL,
5
5
  EXT_SUBCOMMAND_LIST,
@@ -10,17 +10,21 @@ import {
10
10
  SERVER_SUBCOMMAND,
11
11
  } from '../lib/constants';
12
12
 
13
+ export type ServerSubcommand = typeof SERVER_SUBCOMMAND;
14
+ export type DriverSubcommand = typeof DRIVER_SUBCOMMAND;
15
+ export type PluginSubcommand = typeof PLUGIN_SUBCOMMAND;
16
+
13
17
  /**
14
18
  * Possible subcommands for the `appium` CLI.
15
19
  */
16
- type CliSubcommand =
17
- | typeof SERVER_SUBCOMMAND
18
- | typeof DRIVER_SUBCOMMAND
19
- | typeof PLUGIN_SUBCOMMAND;
20
+ export type CliSubcommand =
21
+ | ServerSubcommand
22
+ | DriverSubcommand
23
+ | PluginSubcommand;
20
24
 
21
25
  /**
22
- * Possible subcommands of {@link DRIVER_SUBCOMMAND} or
23
- * {@link PLUGIN_SUBCOMMAND}.
26
+ * Possible subcommands of {@linkcode DriverSubcommand} or
27
+ * {@linkcode PluginSubcommand}.
24
28
  */
25
29
  export type CliExtensionSubcommand =
26
30
  | typeof EXT_SUBCOMMAND_INSTALL
@@ -33,7 +37,12 @@ export type CliExtensionSubcommand =
33
37
  * Random stuff that may appear in the parsed args which has no equivalent in a
34
38
  * config file.
35
39
  */
36
- interface MoreArgs {
40
+ export interface MoreArgs {
41
+ /**
42
+ * Possible subcommands. If empty, defaults to {@linkcode ServerSubcommand}.
43
+ */
44
+ subcommand?: CliSubcommand;
45
+
37
46
  /**
38
47
  * Path to config file, if any. Does not make sense for this to be allowed in a config file!
39
48
  */
@@ -53,7 +62,7 @@ interface MoreArgs {
53
62
  /**
54
63
  * These arguments are _not_ supported by the CLI, but only via programmatic usage / tests.
55
64
  */
56
- interface ProgrammaticArgs {
65
+ export interface ProgrammaticArgs {
57
66
  /**
58
67
  * If `true`, throw on error instead of exit.
59
68
  */
@@ -85,9 +94,9 @@ interface ProgrammaticArgs {
85
94
  }
86
95
 
87
96
  /**
88
- * These are args that Appium assigns while parsing the args.
97
+ * These are args which the user will specify if using an extension command
89
98
  */
90
- interface InternalArgs {
99
+ export interface ExtArgs extends WithExtSubcommand {
91
100
  /**
92
101
  * Subcommands of `driver` subcommand
93
102
  */
@@ -97,32 +106,42 @@ interface InternalArgs {
97
106
  * Subcommands of `plugin` subcommand
98
107
  */
99
108
  pluginCommand?: CliExtensionSubcommand;
109
+ }
100
110
 
101
- /**
102
- * Possible subcommands
103
- */
104
- subcommand: CliSubcommand;
111
+ /**
112
+ * Args having the `server` subcommand
113
+ */
114
+ export interface WithServerSubcommand {
115
+ subcommand?: ServerSubcommand;
105
116
  }
106
117
 
107
118
  /**
108
- * The same as {@link ParsedArgs} but with a nullable `subcommand`.
109
- * This is _not_ the same as `Partial<ParsedArgs>`.
119
+ * Args having the `driver` or `plugin` subcommand
110
120
  */
111
- export type PartialArgs = DriverOpts &
112
- MoreArgs &
113
- ProgrammaticArgs &
114
- Partial<InternalArgs>;
121
+ export interface WithExtSubcommand {
122
+ subcommand: DriverSubcommand | PluginSubcommand;
123
+ }
115
124
 
116
125
  /**
117
- * The Appium configuration as a flattened object, parsed via CLI args _and_ any
118
- * CLI args unsupported by the config file.
119
- * @todo Does not make any assumptions about property names derived from
120
- * extensions.
126
+ * Some generic bits of arguments; should not be used outside this declaration
121
127
  */
122
- export type ParsedArgs = DriverOpts &
123
- MoreArgs &
128
+ type CommonArgs<SArgs, T = WithServerSubcommand> = MoreArgs &
124
129
  ProgrammaticArgs &
125
- InternalArgs;
130
+ (T extends WithServerSubcommand
131
+ ? SArgs
132
+ : T extends WithExtSubcommand
133
+ ? ExtArgs
134
+ : never);
135
+
136
+ /**
137
+ * Fully-parsed arguments, containing defaults, computed args, and config file values.
138
+ */
139
+ export type ParsedArgs<T = WithServerSubcommand> = CommonArgs<ServerArgs, T>;
140
+
141
+ /**
142
+ * Partial arguments, as supplied by a user. _May_ have defaults applied; _may_ contain config values; _may_ contain computed args.
143
+ */
144
+ export type Args<T = WithServerSubcommand> = CommonArgs<Partial<ServerArgs>, T>;
126
145
 
127
146
  /**
128
147
  * Shown by `appium --build-info`
@@ -1,4 +1,4 @@
1
- import { BaseDriverBase } from '@appium/base-driver/lib/basedriver/driver';
1
+ import type { BaseDriverBase } from '@appium/base-driver/lib/basedriver/driver';
2
2
  import { Class, Driver, ExternalDriver } from '@appium/types';
3
3
  import { DriverType, ExtensionType, PluginType } from '.';
4
4
 
@@ -8,7 +8,7 @@ export type DriverClass = BaseDriverBase<ExternalDriver,
8
8
  /**
9
9
  * Additional static props for external driver classes
10
10
  */
11
- interface ExternalDriverStatic {
11
+ export interface ExternalDriverStatic {
12
12
  driverName: string;
13
13
  }
14
14
 
@@ -20,7 +20,7 @@ export type PluginClass = Class<PluginProto, ExternalPluginStatic>;
20
20
  /**
21
21
  * Static props for plugin classes
22
22
  */
23
- interface ExternalPluginStatic {
23
+ export interface ExternalPluginStatic {
24
24
  pluginName: string;
25
25
  }
26
26
 
@@ -28,7 +28,7 @@ interface ExternalPluginStatic {
28
28
  * A plugin must have this shape.
29
29
  * @todo Use base plugin instead of this
30
30
  */
31
- interface PluginProto {
31
+ export interface PluginProto {
32
32
  /**
33
33
  * I'm not sure why `plugin.name` is required, but it is.
34
34
  */
@@ -2,8 +2,8 @@
2
2
  * These types describe information about external extensions and the contents of their `package.json` files
3
3
  */
4
4
 
5
- import { SchemaObject } from 'ajv';
6
- import { PackageJson, SetRequired } from 'type-fest';
5
+ import type { SchemaObject } from 'ajv';
6
+ import type { PackageJson, SetRequired } from 'type-fest';
7
7
  import { DriverType, ExtensionType, PluginType } from './index';
8
8
 
9
9
  /**
@@ -5,3 +5,10 @@ export * from './cli';
5
5
  export type DriverType = 'driver';
6
6
  export type PluginType = 'plugin';
7
7
  export type ExtensionType = DriverType | PluginType;
8
+
9
+ /**
10
+ * Known environment variables concerning Appium
11
+ */
12
+ export interface AppiumEnv extends NodeJS.ProcessEnv {
13
+ APPIUM_HOME?: string;
14
+ }