|
1 | 1 | import { Command } from "commander";
|
2 | 2 |
|
3 |
| -import { |
4 |
| - apiTokenOption, |
5 |
| - apiTokenOptionValue, |
6 |
| - bundleFileOption, |
7 |
| - bundleFileOptionValue, |
8 |
| - controlPlaneUrlOption, |
9 |
| - controlPlaneUrlOptionValue, |
10 |
| - gatlingHomeOption, |
11 |
| - gatlingHomeOptionValueWithDefaults, |
12 |
| - nonInteractiveOption, |
13 |
| - nonInteractiveOptionValue, |
14 |
| - packageDescriptorFilenameOption, |
15 |
| - packageDescriptorFilenameOptionValue, |
16 |
| - packageFileOption, |
17 |
| - packageFileOptionValue, |
18 |
| - postmanOption, |
19 |
| - postmanOptionValueWithDefaults, |
20 |
| - resourcesFolderOption, |
21 |
| - resourcesFolderOptionValue, |
22 |
| - resultsFolderOption, |
23 |
| - resultsFolderOptionValue, |
24 |
| - sourcesFolderOption, |
25 |
| - sourcesFolderOptionValue, |
26 |
| - trustStoreOption, |
27 |
| - trustStoreOptionValue, |
28 |
| - trustStorePasswordOption, |
29 |
| - trustStorePasswordOptionValue, |
30 |
| - typescriptOption, |
31 |
| - typescriptOptionValueWithDefaults, |
32 |
| - apiUrlOption, |
33 |
| - apiUrlOptionValue, |
34 |
| - webAppUrlOption, |
35 |
| - webAppUrlOptionValue |
36 |
| -} from "./options"; |
| 3 | +import { ResolvedOptions } from "./resolveOptions"; |
37 | 4 | import { findSimulations } from "../simulations";
|
38 | 5 | import { resolveBundle } from "../dependencies";
|
39 | 6 | import { bundle } from "../bundle";
|
40 | 7 | import { enterpriseDeploy, enterprisePackage } from "../enterprise";
|
41 | 8 |
|
42 |
| -export default (program: Command): void => { |
| 9 | +export default (opts: ResolvedOptions, program: Command): void => { |
43 | 10 | program
|
44 | 11 | .command("enterprise-deploy")
|
45 | 12 | .description("Deploy a package and configured simulations")
|
46 |
| - .addOption(sourcesFolderOption) |
47 |
| - .addOption(resourcesFolderOption) |
48 |
| - .addOption(bundleFileOption) |
49 |
| - .addOption(resultsFolderOption) |
50 |
| - .addOption(postmanOption) |
51 |
| - .addOption(typescriptOption) |
52 |
| - .addOption(gatlingHomeOption) |
| 13 | + .addOption(opts.sourcesFolderOption) |
| 14 | + .addOption(opts.resourcesFolderOption) |
| 15 | + .addOption(opts.bundleFileOption) |
| 16 | + .addOption(opts.resultsFolderOption) |
| 17 | + .addOption(opts.postmanOption) |
| 18 | + .addOption(opts.typescriptOption) |
| 19 | + .addOption(opts.gatlingHomeOption) |
53 | 20 | // Base
|
54 |
| - .addOption(apiUrlOption) |
55 |
| - .addOption(webAppUrlOption) |
56 |
| - .addOption(apiTokenOption) |
| 21 | + .addOption(opts.apiUrlOption) |
| 22 | + .addOption(opts.webAppUrlOption) |
| 23 | + .addOption(opts.apiTokenOption) |
57 | 24 | // Plugin configuration
|
58 |
| - .addOption(controlPlaneUrlOption) |
59 |
| - .addOption(trustStoreOption) |
60 |
| - .addOption(trustStorePasswordOption) |
61 |
| - .addOption(nonInteractiveOption) |
| 25 | + .addOption(opts.controlPlaneUrlOption) |
| 26 | + .addOption(opts.trustStoreOption) |
| 27 | + .addOption(opts.trustStorePasswordOption) |
| 28 | + .addOption(opts.nonInteractiveOption) |
62 | 29 | // Descriptor file
|
63 |
| - .addOption(packageDescriptorFilenameOption) |
| 30 | + .addOption(opts.packageDescriptorFilenameOption) |
64 | 31 | // Deployment info
|
65 |
| - .addOption(packageFileOption) |
| 32 | + .addOption(opts.packageFileOption) |
66 | 33 | .action(async (options) => {
|
67 |
| - const sourcesFolder: string = sourcesFolderOptionValue(options); |
| 34 | + const sourcesFolder: string = opts.sourcesFolderOptionValue(options); |
68 | 35 |
|
69 | 36 | const simulations = await findSimulations(sourcesFolder);
|
70 |
| - const postman = postmanOptionValueWithDefaults(options); |
71 |
| - const typescript = typescriptOptionValueWithDefaults(options, simulations); |
| 37 | + const postman = opts.postmanOptionValueWithDefaults(options); |
| 38 | + const typescript = opts.typescriptOptionValueWithDefaults(options, simulations); |
72 | 39 |
|
73 |
| - const resourcesFolder: string = resourcesFolderOptionValue(options); |
74 |
| - const bundleFile = bundleFileOptionValue(options); |
75 |
| - const resultsFolder: string = resultsFolderOptionValue(options); |
76 |
| - const gatlingHome = gatlingHomeOptionValueWithDefaults(options); |
77 |
| - const apiUrl = apiUrlOptionValue(options); |
78 |
| - const webAppUrl = webAppUrlOptionValue(options); |
79 |
| - const apiToken = apiTokenOptionValue(options); |
80 |
| - const controlPlaneUrl = controlPlaneUrlOptionValue(options); |
81 |
| - const trustStore = trustStoreOptionValue(options); |
82 |
| - const trustStorePassword = trustStorePasswordOptionValue(options); |
83 |
| - const nonInteractive = nonInteractiveOptionValue(options); |
84 |
| - const packageDescriptorFilename = packageDescriptorFilenameOptionValue(options); |
85 |
| - const packageFile = packageFileOptionValue(options); |
| 40 | + const resourcesFolder = opts.resourcesFolderOptionValue(options); |
| 41 | + const bundleFile = opts.bundleFileOptionValue(options); |
| 42 | + const resultsFolder = opts.resultsFolderOptionValue(options); |
| 43 | + const gatlingHome = opts.gatlingHomeOptionValueWithDefaults(options); |
| 44 | + const apiUrl = opts.apiUrlOptionValue(options); |
| 45 | + const webAppUrl = opts.webAppUrlOptionValue(options); |
| 46 | + const apiToken = opts.apiTokenOptionValue(options); |
| 47 | + const controlPlaneUrl = opts.controlPlaneUrlOptionValue(options); |
| 48 | + const trustStore = opts.trustStoreOptionValue(options); |
| 49 | + const trustStorePassword = opts.trustStorePasswordOptionValue(options); |
| 50 | + const nonInteractive = opts.nonInteractiveOptionValue(options); |
| 51 | + const packageDescriptorFilename = opts.packageDescriptorFilenameOptionValue(options); |
| 52 | + const packageFile = opts.packageFileOptionValue(options); |
86 | 53 |
|
87 | 54 | const { graalvmHome, jvmClasspath } = await resolveBundle({ gatlingHome });
|
88 | 55 | await bundle({ sourcesFolder, bundleFile, postman, typescript, simulations });
|
|
0 commit comments