@gatling.io/cli 3.13.104-M5 → 3.13.104-M7

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gatling.io/cli",
3
- "version": "3.13.104-M5",
3
+ "version": "3.13.104-M7",
4
4
  "license": "Apache-2.0",
5
5
  "homepage": "https://gatling.io",
6
6
  "repository": "github:gatling/gatling-js",
@@ -12,6 +12,6 @@ exports.versions = {
12
12
  gatling: {
13
13
  core: "3.13.1",
14
14
  enterprisePluginCommons: "1.11.0",
15
- jsAdapter: "3.13.104-M5"
15
+ jsAdapter: "3.13.104-M7"
16
16
  }
17
17
  };
@@ -1,43 +0,0 @@
1
- import * as esbuild from "esbuild";
2
- import esbuildPluginTsc from "esbuild-plugin-tsc";
3
-
4
- import { polyfill } from "./polyfill";
5
- import { SimulationFile } from "../simulations";
6
- import { logger } from "../log";
7
-
8
- export interface BundleOptions {
9
- sourcesFolder: string;
10
- bundleFile: string;
11
- postman?: string;
12
- typescript: boolean;
13
- simulations: SimulationFile[];
14
- }
15
-
16
- export const bundle = async (options: BundleOptions): Promise<void> => {
17
- logger.info(`Bundling a Gatling simulation with options:
18
- - sourcesFolder: ${options.sourcesFolder}
19
- - bundleFile: ${options.bundleFile}
20
- - typescript: ${options.typescript}`);
21
-
22
- const contents = options.simulations.map((s) => `export { default as "${s.name}" } from "./${s.path}";`).join("\n");
23
-
24
- const plugins = options.typescript ? [esbuildPluginTsc({ force: true })] : [];
25
- if (options.postman !== undefined) {
26
- plugins.push(polyfill());
27
- }
28
- await esbuild.build({
29
- stdin: {
30
- contents,
31
- resolveDir: options.sourcesFolder
32
- },
33
- outfile: options.bundleFile,
34
- platform: "neutral",
35
- mainFields: ["main", "module"],
36
- bundle: true,
37
- minify: false,
38
- sourcemap: true,
39
- format: "iife",
40
- globalName: "gatling",
41
- plugins
42
- });
43
- };
@@ -1,91 +0,0 @@
1
- import type { Plugin } from "esbuild";
2
- import { fileURLToPath, pathToFileURL } from "url";
3
- import { resolve, dirname } from "path";
4
-
5
- // This is largely inspired by https://github.com/cyco130/esbuild-plugin-polyfill-node
6
-
7
- export const polyfill = (): Plugin => ({
8
- name: "gatling-js-polyfill",
9
- setup: async (build) => {
10
- // modules
11
- const jspmResolved = await resolveImport(`@jspm/core/nodelibs/fs`);
12
- build.onResolve({ filter: polyfillsFilter }, async ({ path }) => {
13
- const [, , moduleName] = path.match(polyfillsFilter)!;
14
- const resolved = customPolyfills.find((name) => name === moduleName)
15
- ? resolve(dirname(__filename), `../../polyfills/${moduleName}.js`)
16
- : resolve(jspmResolved, `../../browser/${moduleName}.js`);
17
- return { path: resolved };
18
- });
19
-
20
- // Globals
21
- build.initialOptions.inject = build.initialOptions.inject || [];
22
- const injectGlobal = (name: string) =>
23
- (build.initialOptions.inject as string[]).push(resolve(dirname(__filename), `../../polyfills/${name}.js`));
24
- injectGlobal("global");
25
- }
26
- });
27
-
28
- const customPolyfills = ["crypto"];
29
-
30
- const jspmPolyfills = ["buffer", "path", "string_decoder"];
31
-
32
- // Other available jspm-core modules:
33
- // "_stream_duplex"
34
- // "_stream_passthrough"
35
- // "_stream_readable"
36
- // "_stream_transform"
37
- // "_stream_writable"
38
- // "assert"
39
- // "assert/strict"
40
- // "async_hooks"
41
- // "child_process"
42
- // "cluster"
43
- // "console"
44
- // "constants"
45
- // "crypto"
46
- // "dgram"
47
- // "diagnostics_channel"
48
- // "dns"
49
- // "domain"
50
- // "events"
51
- // "fs"
52
- // "fs/promises"
53
- // "http"
54
- // "http2"
55
- // "https"
56
- // "module"
57
- // "net"
58
- // "os"
59
- // "perf_hooks"
60
- // "process"
61
- // "punycode"
62
- // "querystring"
63
- // "readline"
64
- // "repl"
65
- // "stream"
66
- // "sys"
67
- // "timers"
68
- // "timers/promises"
69
- // "tls"
70
- // "tty"
71
- // "url"
72
- // "util"
73
- // "v8"
74
- // "vm"
75
- // "wasi"
76
- // "worker_threads"
77
- // "zlib"
78
-
79
- const polyfillsFilter = new RegExp(`^(node:)?(${jspmPolyfills.concat(customPolyfills).join("|")})$`);
80
-
81
- let importMetaResolve: (specifier: string, parent: string) => string;
82
-
83
- const importMetaUrl = pathToFileURL(__filename).href;
84
-
85
- const resolveImport = async (specifier: string) => {
86
- if (!importMetaResolve) {
87
- importMetaResolve = (await import("import-meta-resolve")).resolve;
88
- }
89
- const resolved = importMetaResolve(specifier, importMetaUrl);
90
- return fileURLToPath(resolved);
91
- };
@@ -1,34 +0,0 @@
1
- import { Command } from "commander";
2
-
3
- import {
4
- bundleFileOption,
5
- bundleFileOptionValue,
6
- postmanOption,
7
- postmanOptionValueWithDefaults,
8
- sourcesFolderOption,
9
- sourcesFolderOptionValue,
10
- typescriptOption,
11
- typescriptOptionValueWithDefaults
12
- } from "./options";
13
- import { findSimulations } from "../simulations";
14
- import { bundle } from "../bundle";
15
-
16
- export default (program: Command): void => {
17
- program
18
- .command("build")
19
- .description("Build Gatling simulations")
20
- .addOption(sourcesFolderOption)
21
- .addOption(bundleFileOption)
22
- .addOption(postmanOption)
23
- .addOption(typescriptOption)
24
- .action(async (options) => {
25
- const sourcesFolder: string = sourcesFolderOptionValue(options);
26
- const bundleFile = bundleFileOptionValue(options);
27
-
28
- const simulations = await findSimulations(sourcesFolder);
29
- const postman = postmanOptionValueWithDefaults(options);
30
- const typescript = typescriptOptionValueWithDefaults(options, simulations);
31
-
32
- await bundle({ sourcesFolder, bundleFile, postman, typescript, simulations });
33
- });
34
- };
@@ -1,97 +0,0 @@
1
- import { Command } from "commander";
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
- typescriptOption,
27
- typescriptOptionValueWithDefaults,
28
- apiUrlOption,
29
- apiUrlOptionValue,
30
- webAppUrlOption,
31
- webAppUrlOptionValue
32
- } from "./options";
33
- import { findSimulations } from "../simulations";
34
- import { resolveBundle } from "../dependencies";
35
- import { bundle } from "../bundle";
36
- import { enterpriseDeploy, enterprisePackage } from "../enterprise";
37
-
38
- export default (program: Command): void => {
39
- program
40
- .command("enterprise-deploy")
41
- .description("Deploy a package and configured simulations")
42
- .addOption(sourcesFolderOption)
43
- .addOption(resourcesFolderOption)
44
- .addOption(bundleFileOption)
45
- .addOption(resultsFolderOption)
46
- .addOption(postmanOption)
47
- .addOption(typescriptOption)
48
- .addOption(gatlingHomeOption)
49
- // Base
50
- .addOption(apiUrlOption)
51
- .addOption(webAppUrlOption)
52
- .addOption(apiTokenOption)
53
- // Plugin configuration
54
- .addOption(controlPlaneUrlOption)
55
- .addOption(nonInteractiveOption)
56
- // Descriptor file
57
- .addOption(packageDescriptorFilenameOption)
58
- // Deployment info
59
- .addOption(packageFileOption)
60
- .action(async (options) => {
61
- const sourcesFolder: string = sourcesFolderOptionValue(options);
62
-
63
- const simulations = await findSimulations(sourcesFolder);
64
- const postman = postmanOptionValueWithDefaults(options);
65
- const typescript = typescriptOptionValueWithDefaults(options, simulations);
66
-
67
- const resourcesFolder: string = resourcesFolderOptionValue(options);
68
- const bundleFile = bundleFileOptionValue(options);
69
- const resultsFolder: string = resultsFolderOptionValue(options);
70
- const gatlingHome = gatlingHomeOptionValueWithDefaults(options);
71
- const apiUrl = apiUrlOptionValue(options);
72
- const webAppUrl = webAppUrlOptionValue(options);
73
- const apiToken = apiTokenOptionValue(options);
74
- const controlPlaneUrl = controlPlaneUrlOptionValue(options);
75
- const nonInteractive = nonInteractiveOptionValue(options);
76
- const packageDescriptorFilename = packageDescriptorFilenameOptionValue(options);
77
- const packageFile = packageFileOptionValue(options);
78
-
79
- const { graalvmHome, jvmClasspath } = await resolveBundle({ gatlingHome });
80
- await bundle({ sourcesFolder, bundleFile, postman, typescript, simulations });
81
- await enterprisePackage({ bundleFile, resourcesFolder, packageFile, simulations });
82
- await enterpriseDeploy({
83
- graalvmHome,
84
- jvmClasspath,
85
- bundleFile,
86
- resourcesFolder,
87
- resultsFolder,
88
- apiUrl,
89
- webAppUrl,
90
- apiToken,
91
- controlPlaneUrl,
92
- nonInteractive,
93
- packageDescriptorFilename,
94
- packageFile
95
- });
96
- });
97
- };
@@ -1,45 +0,0 @@
1
- import { Command } from "commander";
2
-
3
- import {
4
- bundleFileOption,
5
- bundleFileOptionValue,
6
- packageFileOption,
7
- packageFileOptionValue,
8
- postmanOption,
9
- postmanOptionValueWithDefaults,
10
- resourcesFolderOption,
11
- resourcesFolderOptionValue,
12
- sourcesFolderOption,
13
- sourcesFolderOptionValue,
14
- typescriptOption,
15
- typescriptOptionValueWithDefaults
16
- } from "./options";
17
- import { findSimulations } from "../simulations";
18
- import { bundle } from "../bundle";
19
- import { enterprisePackage } from "../enterprise";
20
-
21
- export default (program: Command): void => {
22
- program
23
- .command("enterprise-package")
24
- .description("Build Gatling simulations and package them for Gatling Enterprise")
25
- .addOption(sourcesFolderOption)
26
- .addOption(resourcesFolderOption)
27
- .addOption(bundleFileOption)
28
- .addOption(packageFileOption)
29
- .addOption(postmanOption)
30
- .addOption(typescriptOption)
31
- .action(async (options) => {
32
- const sourcesFolder: string = sourcesFolderOptionValue(options);
33
- const resourcesFolder: string = resourcesFolderOptionValue(options);
34
- const bundleFile = bundleFileOptionValue(options);
35
- const packageFile = packageFileOptionValue(options);
36
-
37
- const simulations = await findSimulations(sourcesFolder);
38
- const postman = postmanOptionValueWithDefaults(options);
39
- const typescript = typescriptOptionValueWithDefaults(options, simulations);
40
-
41
- await bundle({ sourcesFolder, bundleFile, postman, typescript, simulations });
42
-
43
- await enterprisePackage({ bundleFile, resourcesFolder, packageFile, simulations });
44
- });
45
- };
@@ -1,122 +0,0 @@
1
- import { Command } from "commander";
2
-
3
- import {
4
- apiTokenOption,
5
- apiTokenOptionValue,
6
- bundleFileOption,
7
- bundleFileOptionValue,
8
- controlPlaneUrlOption,
9
- controlPlaneUrlOptionValue,
10
- enterpriseSimulationOption,
11
- enterpriseSimulationOptionValue,
12
- gatlingHomeOption,
13
- gatlingHomeOptionValueWithDefaults,
14
- nonInteractiveOption,
15
- nonInteractiveOptionValue,
16
- packageDescriptorFilenameOption,
17
- packageDescriptorFilenameOptionValue,
18
- packageFileOption,
19
- packageFileOptionValue,
20
- postmanOption,
21
- postmanOptionValueWithDefaults,
22
- resourcesFolderOption,
23
- resourcesFolderOptionValue,
24
- resultsFolderOption,
25
- resultsFolderOptionValue,
26
- runDescriptionOption,
27
- runDescriptionOptionValue,
28
- runTitleOption,
29
- runTitleOptionValue,
30
- sourcesFolderOption,
31
- sourcesFolderOptionValue,
32
- typescriptOption,
33
- typescriptOptionValueWithDefaults,
34
- apiUrlOption,
35
- apiUrlOptionValue,
36
- webAppUrlOption,
37
- webAppUrlOptionValue,
38
- waitForRunEndOption,
39
- waitForRunEndOptionValue
40
- } from "./options";
41
- import { findSimulations } from "../simulations";
42
- import { resolveBundle } from "../dependencies";
43
- import { bundle } from "../bundle";
44
- import { enterprisePackage, enterpriseStart } from "../enterprise";
45
-
46
- export default (program: Command): void => {
47
- program
48
- .command("enterprise-start")
49
- .description("Start a simulation deployed with `enterprise-deploy`")
50
- .addOption(sourcesFolderOption)
51
- .addOption(resourcesFolderOption)
52
- .addOption(bundleFileOption)
53
- .addOption(resultsFolderOption)
54
- .addOption(postmanOption)
55
- .addOption(typescriptOption)
56
- .addOption(gatlingHomeOption)
57
- // Base
58
- .addOption(apiUrlOption)
59
- .addOption(webAppUrlOption)
60
- .addOption(apiTokenOption)
61
- // Plugin configuration
62
- .addOption(controlPlaneUrlOption)
63
- .addOption(nonInteractiveOption)
64
- // Descriptor file
65
- .addOption(packageDescriptorFilenameOption)
66
- // Deployment info
67
- .addOption(packageFileOption)
68
- // Start
69
- .addOption(enterpriseSimulationOption)
70
- .addOption(runTitleOption)
71
- .addOption(runDescriptionOption)
72
- .addOption(waitForRunEndOption)
73
- .action(async (options) => {
74
- const sourcesFolder: string = sourcesFolderOptionValue(options);
75
-
76
- const simulations = await findSimulations(sourcesFolder);
77
- const postman = postmanOptionValueWithDefaults(options);
78
- const typescript = typescriptOptionValueWithDefaults(options, simulations);
79
-
80
- const resourcesFolder: string = resourcesFolderOptionValue(options);
81
- const bundleFile = bundleFileOptionValue(options);
82
- const resultsFolder: string = resultsFolderOptionValue(options);
83
- const gatlingHome = gatlingHomeOptionValueWithDefaults(options);
84
- const apiUrl = apiUrlOptionValue(options);
85
- const webAppUrl = webAppUrlOptionValue(options);
86
- const apiToken = apiTokenOptionValue(options);
87
- const controlPlaneUrl = controlPlaneUrlOptionValue(options);
88
- const nonInteractive = nonInteractiveOptionValue(options);
89
- const packageDescriptorFilename = packageDescriptorFilenameOptionValue(options);
90
- const packageFile = packageFileOptionValue(options);
91
- const enterpriseSimulation = enterpriseSimulationOptionValue(options);
92
- const runTitle = runTitleOptionValue(options);
93
- const runDescription = runDescriptionOptionValue(options);
94
- const waitForRunEnd = waitForRunEndOptionValue(options);
95
-
96
- if (nonInteractiveOptionValue(options) && enterpriseSimulation === undefined) {
97
- throw new Error(`No simulation specified when using non-interactive mode`);
98
- }
99
-
100
- const { graalvmHome, jvmClasspath } = await resolveBundle({ gatlingHome });
101
- await bundle({ sourcesFolder, bundleFile, postman, typescript, simulations });
102
- await enterprisePackage({ bundleFile, resourcesFolder, packageFile, simulations });
103
- await enterpriseStart({
104
- graalvmHome,
105
- jvmClasspath,
106
- bundleFile,
107
- resourcesFolder,
108
- resultsFolder,
109
- apiUrl,
110
- webAppUrl,
111
- apiToken,
112
- controlPlaneUrl,
113
- nonInteractive,
114
- packageDescriptorFilename,
115
- packageFile,
116
- enterpriseSimulation,
117
- runTitle,
118
- runDescription,
119
- waitForRunEnd
120
- });
121
- });
122
- };
@@ -1,25 +0,0 @@
1
- import { Command } from "commander";
2
-
3
- import registerInstallCommand from "./install";
4
- import registerBuildCommand from "./build";
5
- import registerRunOnlyCommand from "./runOnly";
6
- import registerRunCommand from "./run";
7
- import registerRecorderCommand from "./recorder";
8
- import registerEnterprisePackageCommand from "./enterprisePackage";
9
- import registerEnterpriseDeployCommand from "./enterpriseDeploy";
10
- import registerEnterpriseStartCommand from "./enterpriseStart";
11
- import { versions } from "../dependencies";
12
-
13
- export const program: Command = new Command()
14
- .name("gatling-js-cli")
15
- .version(versions.gatling.jsAdapter)
16
- .description("The Gatling Javascript run & packaging tool");
17
-
18
- registerInstallCommand(program);
19
- registerBuildCommand(program);
20
- registerRunOnlyCommand(program);
21
- registerRunCommand(program);
22
- registerRecorderCommand(program);
23
- registerEnterprisePackageCommand(program);
24
- registerEnterpriseDeployCommand(program);
25
- registerEnterpriseStartCommand(program);
@@ -1,22 +0,0 @@
1
- import { Command } from "commander";
2
-
3
- import { bundleFileArgument, gatlingHomeOption, gatlingHomeOptionValueWithDefaults } from "./options";
4
- import { installBundleFile, resolveBundle } from "../dependencies";
5
- import { logger } from "../log";
6
-
7
- export default (program: Command): void => {
8
- program
9
- .command("install")
10
- .description("Install all required components and dependencies for Gatling")
11
- .addOption(gatlingHomeOption)
12
- .addArgument(bundleFileArgument)
13
- .action(async (bundleFilePath: string | undefined, options) => {
14
- const gatlingHome = gatlingHomeOptionValueWithDefaults(options);
15
- const { graalvmHome, jvmClasspath } =
16
- bundleFilePath !== undefined
17
- ? await installBundleFile({ gatlingHome, bundleFilePath })
18
- : await resolveBundle({ gatlingHome });
19
- logger.info(`graalvmHome=${graalvmHome}`);
20
- logger.info(`jvmClasspath=${jvmClasspath}`);
21
- });
22
- };