@gatling.io/cli 3.11.5 → 3.11.6

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.11.5",
3
+ "version": "3.11.6",
4
4
  "license": "Apache-2.0",
5
5
  "bin": {
6
6
  "gatling": "target/index.js"
@@ -19,15 +19,16 @@
19
19
  "devDependencies": {
20
20
  "@types/archiver": "6.0.2",
21
21
  "@types/decompress": "4.2.7",
22
- "@types/node": "20.14.9",
22
+ "@types/node": "20.14.12",
23
23
  "@types/readline-sync": "1.4.8",
24
- "prettier": "3.3.2",
25
- "rimraf": "5.0.7",
26
- "typescript": "5.4.5"
24
+ "prettier": "3.3.3",
25
+ "rimraf": "6.0.1",
26
+ "typescript": "5.5.3"
27
27
  },
28
28
  "scripts": {
29
29
  "clean": "rimraf target",
30
30
  "format": "prettier --write '**/*.ts'",
31
+ "format-check": "prettier --check '**/*.ts'",
31
32
  "build": "tsc -p . && chmod +x ./target/index.js"
32
33
  }
33
34
  }
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.versions = void 0;
4
4
  exports.versions = {
5
5
  graalvm: {
6
- jdk: "22.0.1",
7
- js: "24.0.1"
6
+ jdk: "22.0.2",
7
+ js: "24.0.2"
8
8
  },
9
9
  coursier: "2.1.10",
10
10
  gatling: {
11
11
  core: "3.11.5",
12
- enterprisePluginCommons: "1.9.4",
13
- jsAdapter: "3.11.5"
12
+ enterprisePluginCommons: "1.9.6",
13
+ jsAdapter: "3.11.6"
14
14
  }
15
15
  };
@@ -39,17 +39,19 @@ const generateManifest = (simulationNames) => {
39
39
  const continuation = utf8Encoder.encode("\n ");
40
40
  const lines = [
41
41
  "Manifest-Version: 1.0",
42
- "Implementation-Title: gatling-javascript",
43
- `Implementation-Version: ${versions_1.versions.gatling.jsAdapter}`,
44
- "Implementation-Vendor: GatlingCorp",
45
42
  "Specification-Vendor: GatlingCorp",
46
43
  "Gatling-Context: js",
47
44
  `Gatling-Version: ${versions_1.versions.gatling.core}`,
48
- "Gatling-Packager: javascript",
45
+ "Gatling-Packager: js-cli",
49
46
  `Gatling-Packager-Version: ${versions_1.versions.gatling.jsAdapter}`,
50
47
  `Gatling-Simulations: ${simulationNames.join(",")}`,
51
48
  `Java-Version: ${versions_1.versions.graalvm.jdk.split(".")[0]}`
52
49
  ];
50
+ const pkg = getPackageNameAndVersion();
51
+ lines.push(`Implementation-Title: ${pkg.name}`);
52
+ if (pkg.version !== undefined) {
53
+ lines.push(`Implementation-Version: ${pkg.version}`);
54
+ }
53
55
  let totalLength = 0;
54
56
  const buffer = [];
55
57
  for (const line of lines) {
@@ -81,6 +83,30 @@ const generateManifest = (simulationNames) => {
81
83
  }
82
84
  return manifest;
83
85
  };
86
+ const getPackageNameAndVersion = () => {
87
+ // npm_package_* env vars are available when launching CLI with npx
88
+ let name = process.env.npm_package_name;
89
+ let version = process.env.npm_package_version;
90
+ // otherwise, try to read from package.json file
91
+ if (name === undefined || version === undefined) {
92
+ if (!fs_1.default.existsSync("package.json")) {
93
+ throw Error("package.json not found");
94
+ }
95
+ const pkg = JSON.parse(fs_1.default.readFileSync("package.json", "utf-8"));
96
+ if (name === undefined) {
97
+ if (typeof pkg.name === "string") {
98
+ name = pkg.name;
99
+ }
100
+ else {
101
+ throw Error("package.json does not contain a valid package name");
102
+ }
103
+ }
104
+ if (version === undefined && typeof pkg.version === "string") {
105
+ version = pkg.version;
106
+ }
107
+ }
108
+ return { name: name, version: version };
109
+ };
84
110
  const javaArgsFromPluginOptions = (options) => {
85
111
  const javaArgs = [];
86
112
  // Base
@@ -92,7 +118,7 @@ const javaArgsFromPluginOptions = (options) => {
92
118
  if (options.controlPlaneUrl !== undefined) {
93
119
  javaArgs.push(`-Dgatling.enterprise.controlPlaneUrl=${options.controlPlaneUrl}`);
94
120
  }
95
- javaArgs.push("-Dgatling.enterprise.buildTool=JS_CLI");
121
+ javaArgs.push("-Dgatling.enterprise.buildTool=js-cli");
96
122
  javaArgs.push(`-Dgatling.enterprise.pluginVersion=${versions_1.versions.gatling.jsAdapter}`);
97
123
  if (options.nonInteractive) {
98
124
  javaArgs.push(`-Dgatling.enterprise.batchMode=true`);
@@ -106,9 +132,7 @@ const javaArgsFromDeployOptions = (options) => {
106
132
  javaArgs.push(`-Dgatling.enterprise.packageDescriptorFilename=${options.packageDescriptorFilename}`);
107
133
  // Deployment info
108
134
  javaArgs.push(`-Dgatling.enterprise.packageFile=${options.packageFile}`);
109
- if (process.env.npm_package_name !== undefined) {
110
- javaArgs.push(`-Dgatling.enterprise.artifactId=${process.env.npm_package_name}`);
111
- }
135
+ javaArgs.push(`-Dgatling.enterprise.artifactId=${getPackageNameAndVersion().name}`);
112
136
  return javaArgs;
113
137
  };
114
138
  const enterpriseDeploy = async (options) => {