diff --git a/__tests__/__packages__/cli-test-utils/CHANGELOG.md b/__tests__/__packages__/cli-test-utils/CHANGELOG.md index 2218f50dfa..7a9c969370 100644 --- a/__tests__/__packages__/cli-test-utils/CHANGELOG.md +++ b/__tests__/__packages__/cli-test-utils/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to the Zowe CLI test utils package will be documented in this file. -## Recent Changes +## `8.7.1` - BugFix: Improved the error message shown on MacOS when `runCliScript` method fails to run script that is missing shebang line. [#2314](https://github.com/zowe/zowe-cli/pull/2314) diff --git a/__tests__/__packages__/cli-test-utils/package.json b/__tests__/__packages__/cli-test-utils/package.json index 5a40c21885..377845bbe9 100644 --- a/__tests__/__packages__/cli-test-utils/package.json +++ b/__tests__/__packages__/cli-test-utils/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/cli-test-utils", - "version": "8.7.0", + "version": "8.7.1", "description": "Test utilities package for Zowe CLI plug-ins", "author": "Zowe", "license": "EPL-2.0", @@ -43,7 +43,7 @@ "devDependencies": { "@types/js-yaml": "^4.0.9", "@types/uuid": "^10.0.0", - "@zowe/imperative": "8.7.0" + "@zowe/imperative": "8.7.1" }, "peerDependencies": { "@zowe/imperative": "^8.0.0" diff --git a/__tests__/__packages__/cli-test-utils/src/TestUtils.ts b/__tests__/__packages__/cli-test-utils/src/TestUtils.ts index 90cb8be95a..961f7fb2c2 100644 --- a/__tests__/__packages__/cli-test-utils/src/TestUtils.ts +++ b/__tests__/__packages__/cli-test-utils/src/TestUtils.ts @@ -61,6 +61,7 @@ export function runCliScript(scriptPath: string, testEnvironment: ITestEnvironme env: childEnv, encoding: "buffer" }); + // eslint-disable-next-line @typescript-eslint/no-magic-numbers if (process.platform === "darwin" && (response.error as ExecFileException)?.errno === -8) { throw new Error(`The script file ${path.basename(scriptPath)} failed to execute. Check that it starts with a shebang line.`); } diff --git a/__tests__/__packages__/cli-test-utils/src/environment/TestEnvironment.ts b/__tests__/__packages__/cli-test-utils/src/environment/TestEnvironment.ts index 2ebefad416..39efdcbd67 100644 --- a/__tests__/__packages__/cli-test-utils/src/environment/TestEnvironment.ts +++ b/__tests__/__packages__/cli-test-utils/src/environment/TestEnvironment.ts @@ -114,7 +114,7 @@ export class TestEnvironment { public static createUniqueTestDataDir(testName: string): string { const app = uuidv4() + "_" + testName + "/"; const path = nodePath.resolve(TEST_RESULT_DATA_DIR + "/" + app); - IO.mkdirp(path); + IO.createDirSync(path); return path; } diff --git a/lerna.json b/lerna.json index 7f74212cf8..3f16794e20 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "8.7.0", + "version": "8.7.1", "command": { "publish": { "ignoreChanges": [ diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 43a462220f..21b2fee8fa 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -52,7 +52,7 @@ }, "__tests__/__packages__/cli-test-utils": { "name": "@zowe/cli-test-utils", - "version": "8.7.0", + "version": "8.7.1", "license": "EPL-2.0", "dependencies": { "find-up": "^5.0.0", @@ -63,7 +63,7 @@ "devDependencies": { "@types/js-yaml": "^4.0.9", "@types/uuid": "^10.0.0", - "@zowe/imperative": "8.7.0" + "@zowe/imperative": "8.7.1" }, "peerDependencies": { "@zowe/imperative": "^8.0.0" @@ -16267,21 +16267,21 @@ }, "packages/cli": { "name": "@zowe/cli", - "version": "8.7.0", + "version": "8.7.1", "hasInstallScript": true, "license": "EPL-2.0", "dependencies": { - "@zowe/core-for-zowe-sdk": "8.7.0", - "@zowe/imperative": "8.7.0", - "@zowe/provisioning-for-zowe-sdk": "8.7.0", - "@zowe/zos-console-for-zowe-sdk": "8.7.0", - "@zowe/zos-files-for-zowe-sdk": "8.7.0", - "@zowe/zos-jobs-for-zowe-sdk": "8.7.0", - "@zowe/zos-logs-for-zowe-sdk": "8.7.0", - "@zowe/zos-tso-for-zowe-sdk": "8.7.0", - "@zowe/zos-uss-for-zowe-sdk": "8.7.0", - "@zowe/zos-workflows-for-zowe-sdk": "8.7.0", - "@zowe/zosmf-for-zowe-sdk": "8.7.0", + "@zowe/core-for-zowe-sdk": "8.7.1", + "@zowe/imperative": "8.7.1", + "@zowe/provisioning-for-zowe-sdk": "8.7.1", + "@zowe/zos-console-for-zowe-sdk": "8.7.1", + "@zowe/zos-files-for-zowe-sdk": "8.7.1", + "@zowe/zos-jobs-for-zowe-sdk": "8.7.1", + "@zowe/zos-logs-for-zowe-sdk": "8.7.1", + "@zowe/zos-tso-for-zowe-sdk": "8.7.1", + "@zowe/zos-uss-for-zowe-sdk": "8.7.1", + "@zowe/zos-workflows-for-zowe-sdk": "8.7.1", + "@zowe/zosmf-for-zowe-sdk": "8.7.1", "find-process": "1.4.7", "lodash": "4.17.21", "minimatch": "9.0.5", @@ -16294,7 +16294,7 @@ "@types/diff": "^5.0.9", "@types/lodash": "^4.17.6", "@types/tar": "^6.1.11", - "@zowe/cli-test-utils": "8.7.0", + "@zowe/cli-test-utils": "8.7.1", "comment-json": "^4.2.3", "strip-ansi": "^6.0.1", "which": "^4.0.0" @@ -16350,15 +16350,15 @@ }, "packages/core": { "name": "@zowe/core-for-zowe-sdk", - "version": "8.7.0", + "version": "8.7.1", "license": "EPL-2.0", "dependencies": { "comment-json": "~4.2.3", "string-width": "^4.2.3" }, "devDependencies": { - "@zowe/cli-test-utils": "8.7.0", - "@zowe/imperative": "8.7.0" + "@zowe/cli-test-utils": "8.7.1", + "@zowe/imperative": "8.7.1" }, "engines": { "node": ">=18.12.0" @@ -16369,7 +16369,7 @@ }, "packages/imperative": { "name": "@zowe/imperative", - "version": "8.7.0", + "version": "8.7.1", "license": "EPL-2.0", "dependencies": { "@types/yargs": "^17.0.32", @@ -16563,16 +16563,16 @@ }, "packages/provisioning": { "name": "@zowe/provisioning-for-zowe-sdk", - "version": "8.7.0", + "version": "8.7.1", "license": "EPL-2.0", "dependencies": { "js-yaml": "^4.1.0" }, "devDependencies": { "@types/js-yaml": "^4.0.9", - "@zowe/cli-test-utils": "8.7.0", - "@zowe/core-for-zowe-sdk": "8.7.0", - "@zowe/imperative": "8.7.0" + "@zowe/cli-test-utils": "8.7.1", + "@zowe/core-for-zowe-sdk": "8.7.1", + "@zowe/imperative": "8.7.1" }, "engines": { "node": ">=18.12.0" @@ -16597,15 +16597,15 @@ }, "packages/workflows": { "name": "@zowe/zos-workflows-for-zowe-sdk", - "version": "8.7.0", + "version": "8.7.1", "license": "EPL-2.0", "dependencies": { - "@zowe/zos-files-for-zowe-sdk": "8.7.0" + "@zowe/zos-files-for-zowe-sdk": "8.7.1" }, "devDependencies": { - "@zowe/cli-test-utils": "8.7.0", - "@zowe/core-for-zowe-sdk": "8.7.0", - "@zowe/imperative": "8.7.0" + "@zowe/cli-test-utils": "8.7.1", + "@zowe/core-for-zowe-sdk": "8.7.1", + "@zowe/imperative": "8.7.1" }, "engines": { "node": ">=18.12.0" @@ -16617,12 +16617,12 @@ }, "packages/zosconsole": { "name": "@zowe/zos-console-for-zowe-sdk", - "version": "8.7.0", + "version": "8.7.1", "license": "EPL-2.0", "devDependencies": { - "@zowe/cli-test-utils": "8.7.0", - "@zowe/core-for-zowe-sdk": "8.7.0", - "@zowe/imperative": "8.7.0" + "@zowe/cli-test-utils": "8.7.1", + "@zowe/core-for-zowe-sdk": "8.7.1", + "@zowe/imperative": "8.7.1" }, "engines": { "node": ">=18.12.0" @@ -16634,17 +16634,17 @@ }, "packages/zosfiles": { "name": "@zowe/zos-files-for-zowe-sdk", - "version": "8.7.0", + "version": "8.7.1", "license": "EPL-2.0", "dependencies": { "lodash": "^4.17.21", "minimatch": "^9.0.5" }, "devDependencies": { - "@zowe/cli-test-utils": "8.7.0", - "@zowe/core-for-zowe-sdk": "8.7.0", - "@zowe/imperative": "8.7.0", - "@zowe/zos-uss-for-zowe-sdk": "8.7.0" + "@zowe/cli-test-utils": "8.7.1", + "@zowe/core-for-zowe-sdk": "8.7.1", + "@zowe/imperative": "8.7.1", + "@zowe/zos-uss-for-zowe-sdk": "8.7.1" }, "engines": { "node": ">=18.12.0" @@ -16676,15 +16676,15 @@ }, "packages/zosjobs": { "name": "@zowe/zos-jobs-for-zowe-sdk", - "version": "8.7.0", + "version": "8.7.1", "license": "EPL-2.0", "dependencies": { - "@zowe/zos-files-for-zowe-sdk": "8.7.0" + "@zowe/zos-files-for-zowe-sdk": "8.7.1" }, "devDependencies": { - "@zowe/cli-test-utils": "8.7.0", - "@zowe/core-for-zowe-sdk": "8.7.0", - "@zowe/imperative": "8.7.0" + "@zowe/cli-test-utils": "8.7.1", + "@zowe/core-for-zowe-sdk": "8.7.1", + "@zowe/imperative": "8.7.1" }, "engines": { "node": ">=18.12.0" @@ -16696,12 +16696,12 @@ }, "packages/zoslogs": { "name": "@zowe/zos-logs-for-zowe-sdk", - "version": "8.7.0", + "version": "8.7.1", "license": "EPL-2.0", "devDependencies": { - "@zowe/cli-test-utils": "8.7.0", - "@zowe/core-for-zowe-sdk": "8.7.0", - "@zowe/imperative": "8.7.0" + "@zowe/cli-test-utils": "8.7.1", + "@zowe/core-for-zowe-sdk": "8.7.1", + "@zowe/imperative": "8.7.1" }, "engines": { "node": ">=18.12.0" @@ -16713,12 +16713,12 @@ }, "packages/zosmf": { "name": "@zowe/zosmf-for-zowe-sdk", - "version": "8.7.0", + "version": "8.7.1", "license": "EPL-2.0", "devDependencies": { - "@zowe/cli-test-utils": "8.7.0", - "@zowe/core-for-zowe-sdk": "8.7.0", - "@zowe/imperative": "8.7.0" + "@zowe/cli-test-utils": "8.7.1", + "@zowe/core-for-zowe-sdk": "8.7.1", + "@zowe/imperative": "8.7.1" }, "engines": { "node": ">=18.12.0" @@ -16730,15 +16730,15 @@ }, "packages/zostso": { "name": "@zowe/zos-tso-for-zowe-sdk", - "version": "8.7.0", + "version": "8.7.1", "license": "EPL-2.0", "dependencies": { - "@zowe/zosmf-for-zowe-sdk": "8.7.0" + "@zowe/zosmf-for-zowe-sdk": "8.7.1" }, "devDependencies": { - "@zowe/cli-test-utils": "8.7.0", - "@zowe/core-for-zowe-sdk": "8.7.0", - "@zowe/imperative": "8.7.0" + "@zowe/cli-test-utils": "8.7.1", + "@zowe/core-for-zowe-sdk": "8.7.1", + "@zowe/imperative": "8.7.1" }, "engines": { "node": ">=18.12.0" @@ -16750,15 +16750,15 @@ }, "packages/zosuss": { "name": "@zowe/zos-uss-for-zowe-sdk", - "version": "8.7.0", + "version": "8.7.1", "license": "EPL-2.0", "dependencies": { "ssh2": "^1.15.0" }, "devDependencies": { "@types/ssh2": "^1.11.19", - "@zowe/cli-test-utils": "8.7.0", - "@zowe/imperative": "8.7.0" + "@zowe/cli-test-utils": "8.7.1", + "@zowe/imperative": "8.7.1" }, "engines": { "node": ">=18.12.0" diff --git a/packages/cli/__tests__/auth/__system__/__scripts__/auth_login_apiml_show_token.sh b/packages/cli/__tests__/auth/__system__/__scripts__/auth_login_apiml_show_token.sh index bb1c005b18..5b29388f39 100755 --- a/packages/cli/__tests__/auth/__system__/__scripts__/auth_login_apiml_show_token.sh +++ b/packages/cli/__tests__/auth/__system__/__scripts__/auth_login_apiml_show_token.sh @@ -1,3 +1,4 @@ +#!/bin/bash set -e HOST=$1 diff --git a/packages/cli/__tests__/auth/__system__/__scripts__/auth_login_apiml_show_token_rfj.sh b/packages/cli/__tests__/auth/__system__/__scripts__/auth_login_apiml_show_token_rfj.sh index e45ddbe86b..0039cbfc6f 100755 --- a/packages/cli/__tests__/auth/__system__/__scripts__/auth_login_apiml_show_token_rfj.sh +++ b/packages/cli/__tests__/auth/__system__/__scripts__/auth_login_apiml_show_token_rfj.sh @@ -1,3 +1,4 @@ +#!/bin/bash set -e HOST=$1 diff --git a/packages/cli/__tests__/auth/__system__/__scripts__/auth_logout_apiml_show_token.sh b/packages/cli/__tests__/auth/__system__/__scripts__/auth_logout_apiml_show_token.sh index 0f6490c87a..8340fef941 100755 --- a/packages/cli/__tests__/auth/__system__/__scripts__/auth_logout_apiml_show_token.sh +++ b/packages/cli/__tests__/auth/__system__/__scripts__/auth_logout_apiml_show_token.sh @@ -1,3 +1,4 @@ +#!/bin/bash set -e HOST=$1 diff --git a/packages/cli/__tests__/zosjobs/__system__/download/cli.zos-jobs.download.output.system.test.ts b/packages/cli/__tests__/zosjobs/__system__/download/cli.zos-jobs.download.output.system.test.ts index c646971f07..d1be44eee1 100644 --- a/packages/cli/__tests__/zosjobs/__system__/download/cli.zos-jobs.download.output.system.test.ts +++ b/packages/cli/__tests__/zosjobs/__system__/download/cli.zos-jobs.download.output.system.test.ts @@ -14,8 +14,6 @@ import { ITestEnvironment } from "../../../../../../__tests__/__src__/environmen import { runCliScript } from "@zowe/cli-test-utils"; import { ITestPropertiesSchema } from "../../../../../../__tests__/__src__/properties/ITestPropertiesSchema"; import * as fs from "fs"; -import { Session } from "@zowe/imperative"; -import { GetJobs } from "@zowe/zos-jobs-for-zowe-sdk"; // Test Environment populated in the beforeAll(); let TEST_ENVIRONMENT: ITestEnvironment; @@ -49,14 +47,14 @@ describe("zos-jobs download output command", () => { it("should download a job and wait for it to reach output status", async () => { const response = runCliScript(__dirname + "/__scripts__/download-output/download_job_wait_for_output.sh", TEST_ENVIRONMENT, [IEFBR14_JCL]); - expect(response.stderr.toString()).toBe(""); - expect(response.status).toBe(0); + expect(response.stderr.toString()).toBe(""); + expect(response.status).toBe(0); }); it("should download a job and wait for it to reach active status", async () => { const response = runCliScript(__dirname + "/__scripts__/download-output/download_job_wait_for_active.sh", TEST_ENVIRONMENT, [IEFBR14_JCL]); - expect(response.stderr.toString()).toBe(""); - expect(response.status).toBe(0); + expect(response.stderr.toString()).toBe(""); + expect(response.status).toBe(0); }); }); describe("output", () => { diff --git a/packages/cli/package.json b/packages/cli/package.json index 02199be485..78fa7595eb 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/cli", - "version": "8.7.0", + "version": "8.7.1", "zoweVersion": "v3.0.0", "description": "Zowe CLI is a command line interface (CLI) that provides a simple and streamlined way to interact with IBM z/OS.", "author": "Zowe", @@ -58,17 +58,17 @@ "preshrinkwrap": "node ../../scripts/rewriteShrinkwrap.js" }, "dependencies": { - "@zowe/core-for-zowe-sdk": "8.7.0", - "@zowe/imperative": "8.7.0", - "@zowe/provisioning-for-zowe-sdk": "8.7.0", - "@zowe/zos-console-for-zowe-sdk": "8.7.0", - "@zowe/zos-files-for-zowe-sdk": "8.7.0", - "@zowe/zos-jobs-for-zowe-sdk": "8.7.0", - "@zowe/zos-logs-for-zowe-sdk": "8.7.0", - "@zowe/zos-tso-for-zowe-sdk": "8.7.0", - "@zowe/zos-uss-for-zowe-sdk": "8.7.0", - "@zowe/zos-workflows-for-zowe-sdk": "8.7.0", - "@zowe/zosmf-for-zowe-sdk": "8.7.0", + "@zowe/core-for-zowe-sdk": "8.7.1", + "@zowe/imperative": "8.7.1", + "@zowe/provisioning-for-zowe-sdk": "8.7.1", + "@zowe/zos-console-for-zowe-sdk": "8.7.1", + "@zowe/zos-files-for-zowe-sdk": "8.7.1", + "@zowe/zos-jobs-for-zowe-sdk": "8.7.1", + "@zowe/zos-logs-for-zowe-sdk": "8.7.1", + "@zowe/zos-tso-for-zowe-sdk": "8.7.1", + "@zowe/zos-uss-for-zowe-sdk": "8.7.1", + "@zowe/zos-workflows-for-zowe-sdk": "8.7.1", + "@zowe/zosmf-for-zowe-sdk": "8.7.1", "find-process": "1.4.7", "lodash": "4.17.21", "minimatch": "9.0.5", @@ -78,7 +78,7 @@ "@types/diff": "^5.0.9", "@types/lodash": "^4.17.6", "@types/tar": "^6.1.11", - "@zowe/cli-test-utils": "8.7.0", + "@zowe/cli-test-utils": "8.7.1", "comment-json": "^4.2.3", "strip-ansi": "^6.0.1", "which": "^4.0.0" diff --git a/packages/cli/src/daemon/DaemonUtil.ts b/packages/cli/src/daemon/DaemonUtil.ts index 9809cc46e7..fe54adaa06 100644 --- a/packages/cli/src/daemon/DaemonUtil.ts +++ b/packages/cli/src/daemon/DaemonUtil.ts @@ -37,7 +37,7 @@ export class DaemonUtil { } if (!IO.existsSync(daemonDir)) { try { - IO.mkdirp(daemonDir); + IO.createDirSync(daemonDir); const ownerReadWriteTraverse = 0o700; fs.chmodSync(daemonDir, ownerReadWriteTraverse); } catch(err) { diff --git a/packages/core/package.json b/packages/core/package.json index ff642b9554..14d9284023 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/core-for-zowe-sdk", - "version": "8.7.0", + "version": "8.7.1", "description": "Core libraries shared by Zowe SDK packages", "author": "Zowe", "license": "EPL-2.0", @@ -49,8 +49,8 @@ "string-width": "^4.2.3" }, "devDependencies": { - "@zowe/cli-test-utils": "8.7.0", - "@zowe/imperative": "8.7.0" + "@zowe/cli-test-utils": "8.7.1", + "@zowe/imperative": "8.7.1" }, "peerDependencies": { "@zowe/imperative": "^8.0.0" diff --git a/packages/imperative/CHANGELOG.md b/packages/imperative/CHANGELOG.md index 1e97c1fb58..d42d1c5454 100644 --- a/packages/imperative/CHANGELOG.md +++ b/packages/imperative/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to the Imperative package will be documented in this file. +## `8.7.1` + +- BugFix: Deprecated `IO` functions `createDirsSync` and `mkdirp` due to code duplication. Please use `createDirSync` instead. [#2352](https://github.com/zowe/zowe-cli/pull/2352) + ## `8.7.0` - Enhancement: Added optional `proxy` object to ISession interface for extenders to pass a ProxyVariables object that would override the environment variables if in place. [#2330](https://github.com/zowe/zowe-cli/pull/2330) diff --git a/packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/convert-profiles/cli.imperative-test-cli.config.convert-profiles.integration.subtest.ts b/packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/convert-profiles/cli.imperative-test-cli.config.convert-profiles.integration.subtest.ts index 8025b02006..2d222e1ad5 100644 --- a/packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/convert-profiles/cli.imperative-test-cli.config.convert-profiles.integration.subtest.ts +++ b/packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/convert-profiles/cli.imperative-test-cli.config.convert-profiles.integration.subtest.ts @@ -46,7 +46,7 @@ describe("imperative-test-cli config convert-profiles", () => { if (fs.existsSync(configJsonPath)) { fs.unlinkSync(configJsonPath); } - fsExtra.removeSync(TEST_ENVIRONMENT.workingDir + "/profiles-old"); + fs.rmSync(TEST_ENVIRONMENT.workingDir + "/profiles-old", {recursive: true, force: true}); }); it("should display the help", () => { diff --git a/packages/imperative/__tests__/__src__/environment/SetupTestEnvironment.ts b/packages/imperative/__tests__/__src__/environment/SetupTestEnvironment.ts index 2f65efca32..d28432513f 100644 --- a/packages/imperative/__tests__/__src__/environment/SetupTestEnvironment.ts +++ b/packages/imperative/__tests__/__src__/environment/SetupTestEnvironment.ts @@ -13,7 +13,7 @@ import { ISetupEnvironmentParms } from "./doc/parms/ISetupEnvironmentParms"; import { ImperativeExpect } from "../../../src"; import * as nodePath from "path"; import { TEST_RESULT_DATA_DIR } from "../TestConstants"; -import { mkdirpSync } from "fs-extra"; +import { mkdirSync } from "fs"; import { ITestEnvironment } from "./doc/response/ITestEnvironment"; import { v4 as uuidv4 } from "uuid"; @@ -80,7 +80,7 @@ export class SetupTestEnvironment { public static createUniqueTestDataDir(testName: string): string { const app = uuidv4() + "_" + testName + "/"; const path = nodePath.resolve(TEST_RESULT_DATA_DIR + "/" + app); - mkdirpSync(path); + mkdirSync(path, {recursive: true}); return path; } } diff --git a/packages/imperative/__tests__/src/TestUtil.ts b/packages/imperative/__tests__/src/TestUtil.ts index 1f2693f558..1e74262900 100644 --- a/packages/imperative/__tests__/src/TestUtil.ts +++ b/packages/imperative/__tests__/src/TestUtil.ts @@ -24,7 +24,6 @@ import { ICommandResponse } from "../../src/cmd"; import { ICompareParms } from "./doc/ICompareParms"; import { TestLogger } from "./TestLogger"; import * as nodePath from "path"; -import { mkdirpSync } from "fs-extra"; import * as fs from "fs"; import { randomBytes } from "crypto"; import * as os from "os"; @@ -410,7 +409,7 @@ export function compareJsonObjects(actual: any, expected: any, parms?: ICompareP export function createUniqueTestDataDir(append = ""): string { const app = uuidv4() + "/" + append + "/"; const path = nodePath.resolve(TEST_RESULT_DIR + "/data/" + app); - mkdirpSync(path); + fs.mkdirSync(path, {recursive: true}); return path; } diff --git a/packages/imperative/__tests__/src/packages/imperative/__integration__/PluginManagementFacility.integration.subtest.ts b/packages/imperative/__tests__/src/packages/imperative/__integration__/PluginManagementFacility.integration.subtest.ts index f3d91af151..04c3a59205 100644 --- a/packages/imperative/__tests__/src/packages/imperative/__integration__/PluginManagementFacility.integration.subtest.ts +++ b/packages/imperative/__tests__/src/packages/imperative/__integration__/PluginManagementFacility.integration.subtest.ts @@ -33,7 +33,7 @@ describe("Plugin Management Facility", () => { * expect to see them. */ const namespaceDirPath = join(testCliNodeModulePath, "@zowe"); - IO.mkdirp(namespaceDirPath); + IO.createDirSync(namespaceDirPath); const testCliImpSymLink = join(namespaceDirPath, "imperative"); IO.createSymlinkToDir(testCliImpSymLink, impLibDir); }); @@ -42,7 +42,7 @@ describe("Plugin Management Facility", () => { T.rimraf(home); // Some test may still need this directory to exists in order to spawn zowe commands in that location // (e.g. node --require ts-node/register config init) - IO.mkdirp(home); + IO.createDirSync(home); }); afterAll(() => { diff --git a/packages/imperative/package.json b/packages/imperative/package.json index be8a6d11cc..5313526dbf 100644 --- a/packages/imperative/package.json +++ b/packages/imperative/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/imperative", - "version": "8.7.0", + "version": "8.7.1", "description": "framework for building configurable CLIs", "author": "Zowe", "license": "EPL-2.0", diff --git a/packages/imperative/src/cmd/__tests__/help/WebHelpGenerator.unit.test.ts b/packages/imperative/src/cmd/__tests__/help/WebHelpGenerator.unit.test.ts index 814a3298c2..41b6910825 100644 --- a/packages/imperative/src/cmd/__tests__/help/WebHelpGenerator.unit.test.ts +++ b/packages/imperative/src/cmd/__tests__/help/WebHelpGenerator.unit.test.ts @@ -118,7 +118,7 @@ describe("WebHelpGenerator", () => { */ const webHelpDocsDirNm = webHelpDirNm + "/docs"; if (!existsSync(webHelpDocsDirNm)) { - IO.mkdirp(webHelpDocsDirNm); + IO.createDirSync(webHelpDocsDirNm); } const webHelpGen = new WebHelpGenerator( diff --git a/packages/imperative/src/cmd/__tests__/help/WebHelpManager.unit.test.ts b/packages/imperative/src/cmd/__tests__/help/WebHelpManager.unit.test.ts index 8ab28c75fa..30b0af9ce2 100644 --- a/packages/imperative/src/cmd/__tests__/help/WebHelpManager.unit.test.ts +++ b/packages/imperative/src/cmd/__tests__/help/WebHelpManager.unit.test.ts @@ -103,7 +103,7 @@ describe("WebHelpManager", () => { // ensure that the plugins directory exists instPluginsFileNm = path.join(mockCliHome, "plugins"); if (!fs.existsSync(instPluginsFileNm)) { - IO.mkdirp(instPluginsFileNm); + IO.createDirSync(instPluginsFileNm); } // add the plugins file name to the directory, and create an empty object @@ -118,7 +118,7 @@ describe("WebHelpManager", () => { */ const webHelpDocsDirNm = webHelpDirNm + "/docs"; if (!fs.existsSync(webHelpDocsDirNm)) { - IO.mkdirp(webHelpDocsDirNm); + IO.createDirSync(webHelpDocsDirNm); } }); diff --git a/packages/imperative/src/config/__tests__/ConvertV1Profiles.unit.test.ts b/packages/imperative/src/config/__tests__/ConvertV1Profiles.unit.test.ts index a842f4e953..7b672387ae 100644 --- a/packages/imperative/src/config/__tests__/ConvertV1Profiles.unit.test.ts +++ b/packages/imperative/src/config/__tests__/ConvertV1Profiles.unit.test.ts @@ -12,7 +12,6 @@ jest.mock("jsonfile"); import * as fs from "fs"; -import * as fsExtra from "fs-extra"; import * as jsonfile from "jsonfile"; import { CredentialManagerFactory } from "../.."; import { ConvertV1Profiles } from "../"; @@ -834,7 +833,7 @@ describe("ConvertV1Profiles tests", () => { beforeAll(() => { ConvertV1Profiles["oldProfilesDir"] = oldProfileDir; existsSyncSpy = jest.spyOn(fs, "existsSync"); - removeSyncSpy = jest.spyOn(fsExtra, "removeSync"); + removeSyncSpy = jest.spyOn(fs, "rmSync"); }); beforeEach(() => { @@ -907,7 +906,7 @@ describe("ConvertV1Profiles tests", () => { existsSyncSpy.mockReturnValue(true); // pretend that remove crashed - const removeError = "fsExtra.removeSync threw a horrible error"; + const removeError = "fs.rmSync threw a horrible error"; removeSyncSpy.mockImplementation(() => { throw new Error(removeError); }); diff --git a/packages/imperative/src/config/src/ConvertV1Profiles.ts b/packages/imperative/src/config/src/ConvertV1Profiles.ts index 7fcc7e1bd5..deddb1438d 100644 --- a/packages/imperative/src/config/src/ConvertV1Profiles.ts +++ b/packages/imperative/src/config/src/ConvertV1Profiles.ts @@ -12,7 +12,6 @@ import * as fs from "fs"; import * as path from "path"; import { readFileSync } from "jsonfile"; -import { removeSync } from "fs-extra"; import stripAnsi = require("strip-ansi"); import { V1ProfileRead, ProfilesConstants, ProfileUtils } from "../../profiles"; import { Config } from "./Config"; @@ -446,7 +445,7 @@ export class ConvertV1Profiles { // Delete the profiles directory try { if (fs.existsSync(ConvertV1Profiles.oldProfilesDir)) { - removeSync(ConvertV1Profiles.oldProfilesDir); + fs.rmSync(ConvertV1Profiles.oldProfilesDir, {recursive: true}); ConvertV1Profiles.addToConvertMsgs( ConvertMsgFmt.REPORT_LINE | ConvertMsgFmt.PARAGRAPH, `Deleted the old profiles directory ${ConvertV1Profiles.oldProfilesDir}.` diff --git a/packages/imperative/src/imperative/__tests__/plugins/PluginManagementFacility.unit.test.ts b/packages/imperative/src/imperative/__tests__/plugins/PluginManagementFacility.unit.test.ts index 35dd35707e..90db06ae8d 100644 --- a/packages/imperative/src/imperative/__tests__/plugins/PluginManagementFacility.unit.test.ts +++ b/packages/imperative/src/imperative/__tests__/plugins/PluginManagementFacility.unit.test.ts @@ -44,7 +44,7 @@ describe("Plugin Management Facility", () => { existsSync: jest.spyOn(fs, "existsSync"), writeFileSync: jest.spyOn(jsonfile, "writeFileSync"), readFileSync: jest.spyOn(jsonfile, "readFileSync"), - mkdirp: jest.spyOn(IO, "mkdirp") + mkdirp: jest.spyOn(IO, "createDirSync") }; /* Put a base CLI config into ImperativeConfig. It is required by infrastructure diff --git a/packages/imperative/src/imperative/src/plugins/PluginManagementFacility.ts b/packages/imperative/src/imperative/src/plugins/PluginManagementFacility.ts index bb152f156b..bfba9258ae 100644 --- a/packages/imperative/src/imperative/src/plugins/PluginManagementFacility.ts +++ b/packages/imperative/src/imperative/src/plugins/PluginManagementFacility.ts @@ -228,7 +228,7 @@ export class PluginManagementFacility { if (!existsSync(this.pmfConst.PLUGIN_JSON)) { if (!existsSync(this.pmfConst.PMF_ROOT)) { this.impLogger.debug("Creating PMF_ROOT directory"); - IO.mkdirp(this.pmfConst.PMF_ROOT); + IO.createDirSync(this.pmfConst.PMF_ROOT); } this.impLogger.debug("Creating PLUGIN_JSON file"); diff --git a/packages/imperative/src/io/__tests__/IO.unit.test.ts b/packages/imperative/src/io/__tests__/IO.unit.test.ts index 717ba989ea..d2cf071737 100644 --- a/packages/imperative/src/io/__tests__/IO.unit.test.ts +++ b/packages/imperative/src/io/__tests__/IO.unit.test.ts @@ -119,20 +119,10 @@ describe("IO tests", () => { expect(fnFm).toHaveBeenCalled(); }); - it("should not create a dir if file exists", () => { - existsSyncSpy = jest.spyOn(fs, "existsSync").mockReturnValue(true); - const fnFm = jest.mocked(fs.mkdirSync); - fnFm.mockImplementation(((file: fs.PathLike) => { - return; // do nothing but pretend to write - }) as any); - IO.createDirSync("pretend/already/exists"); - expect(existsSyncSpy).toHaveBeenCalled(); - expect(fnFm).not.toHaveBeenCalled(); - }); - it("should get an error for no input on createDirsSync", () => { let error; try { + // eslint-disable-next-line deprecation/deprecation IO.createDirsSync(" "); } catch (thrownError) { error = thrownError; @@ -152,44 +142,9 @@ describe("IO tests", () => { }); const willBeADir = ["pretend", "to", "create"]; const dir = willBeADir.join(path.posix.sep); + // eslint-disable-next-line deprecation/deprecation IO.createDirsSync(dir); - expect(fnFm).toHaveBeenCalledTimes(willBeADir.length); - }); - - it("should not create several dirs if dirs already exist", () => { - existsSyncSpy = jest.spyOn(fs, "existsSync").mockReturnValue(true); - const fnFm = jest.mocked(fs.mkdirSync); - fnFm.mockImplementation(((file: fs.PathLike) => { - return; // do nothing but pretend to write - }) as any); - const fnPr = jest.mocked(path.resolve); - fnPr.mockImplementation((...pathSegments: any[]) => { - return pathSegments[0]; - }); - const willBeADir = ["pretend", "to", "create"]; - const dir = willBeADir.join(path.posix.sep); - IO.createDirsSync(dir); - expect(fnFm).not.toHaveBeenCalled(); - }); - - it("should only create dirs that do not exist", () => { - // pretend that only one of our directories exist - const willBeADir = ["pretend", "to", "create"]; - existsSyncSpy = jest.spyOn(fs, "existsSync") - .mockReturnValue(false) - .mockReturnValueOnce(true); - - const fnFm = jest.mocked(fs.mkdirSync); - fnFm.mockImplementation(((file: fs.PathLike) => { - return; // do nothing but pretend to write - }) as any); - const fnPr = jest.mocked(path.resolve); - fnPr.mockImplementation((...pathSegments: any[]) => { - return pathSegments[0]; - }); - const dir = willBeADir.join(path.posix.sep); - IO.createDirsSync(dir); - expect(fnFm).toHaveBeenCalledTimes(willBeADir.length - 1); + expect(fnFm).toHaveBeenCalledTimes(1); }); it("should create several dirs if dirs do not exist from input file", () => { @@ -211,55 +166,7 @@ describe("IO tests", () => { const willBeADir = ["pretend", "to", "create", "test.txt"]; const dir = willBeADir.join(path.posix.sep); IO.createDirsSyncFromFilePath(dir); - expect(fnFm).toHaveBeenCalledTimes(willBeADir.length - 1); - }); - - it("should not create several dirs if dirs already exist from input file", () => { - existsSyncSpy = jest.spyOn(fs, "existsSync").mockReturnValue(true); - const fnFm = jest.mocked(fs.mkdirSync); - fnFm.mockImplementation(((file: fs.PathLike) => { - return; // do nothing but pretend to write - }) as any); - const fnPr = jest.mocked(path.resolve); - fnPr.mockImplementation((...pathSegments: any[]) => { - return pathSegments[0]; - }); - const fnPd = jest.mocked(path.dirname); - fnPd.mockImplementation(((...pathSegments: any[]) => { - const toDir: string[] = pathSegments[0].split(path.posix.sep); - toDir.pop(); - return toDir.join(path.posix.sep); - }) as any); - const willBeADir = ["pretend", "to", "create", "test.txt"]; - const dir = willBeADir.join(path.posix.sep); - IO.createDirsSyncFromFilePath(dir); - expect(fnFm).not.toHaveBeenCalled(); - }); - - it("should only create dirs that do not exist from input file", () => { - // pretend that only one of our three directories exist - const willBeADir = ["pretend", "to", "create", "test.txt"]; - existsSyncSpy = jest.spyOn(fs, "existsSync") - .mockReturnValue(false) - .mockReturnValueOnce(true); - - const fnFm = jest.mocked(fs.mkdirSync); - fnFm.mockImplementation(((file: fs.PathLike) => { - return; // do nothing but pretend to write - }) as any); - const fnPr = jest.mocked(path.resolve); - fnPr.mockImplementation((...pathSegments: any[]) => { - return pathSegments[0]; - }); - const fnPd = jest.mocked(path.dirname); - fnPd.mockImplementation(((...pathSegments: any[]) => { - const toDir: string[] = pathSegments[0].split(path.posix.sep); - toDir.pop(); - return toDir.join(path.posix.sep); - }) as any); - const dir = willBeADir.join(path.posix.sep); - IO.createDirsSyncFromFilePath(dir); - expect(fnFm).toHaveBeenCalledTimes(willBeADir.length - 2); + expect(fnFm).toHaveBeenCalledTimes(1); }); it("processNewLines should replace LF line endings with CRLF on Windows", () => { @@ -279,6 +186,7 @@ describe("IO tests", () => { it("should get an error for no input on mkdirp", () => { let error; try { + // eslint-disable-next-line deprecation/deprecation IO.mkdirp(" "); } catch (thrownError) { error = thrownError; diff --git a/packages/imperative/src/io/src/IO.ts b/packages/imperative/src/io/src/IO.ts index 8159c7bb0a..6c23611f3c 100644 --- a/packages/imperative/src/io/src/IO.ts +++ b/packages/imperative/src/io/src/IO.ts @@ -18,7 +18,6 @@ import { ImperativeExpect } from "../../expect"; // use complete path to ExecUtils to avoid circular dependency that results from utilities/index import { ExecUtils } from "../../utilities/src/ExecUtils"; import { Readable, Writable } from "stream"; -import { mkdirpSync } from "fs-extra"; /** * This class will handle common sequences of node I/O and issue messages / @@ -109,7 +108,7 @@ export class IO { } /** - * Create a directory if it does not yet exist synchronously. + * Create a directory and all subdirectories if they do not yet exist synchronously. * @static * @param {string} dir - directory to create * @return {undefined} @@ -117,9 +116,7 @@ export class IO { */ public static createDirSync(dir: string) { ImperativeExpect.toBeDefinedAndNonBlank(dir, "dir"); - if (!IO.existsSync(dir)) { - fs.mkdirSync(dir); - } + fs.mkdirSync(dir, {recursive: true}); } /** @@ -129,19 +126,10 @@ export class IO { * @static * @param {string} dir - directory to create all sub directories for * @memberof IO + * @deprecated Please use IO.createDirSync */ public static createDirsSync(dir: string) { - ImperativeExpect.toBeDefinedAndNonBlank(dir, "dir"); - // we're splitting on a specific separator character, so replace \ with / - // before splitting - const dirs = path.resolve(dir).replace(/\\/g, path.posix.sep).split(path.posix.sep); - - let createDir: string = ""; - for (const crDir of dirs) { - - createDir += crDir + path.posix.sep; - IO.createDirSync(createDir); - } + IO.createDirSync(dir); } /** @@ -155,7 +143,7 @@ export class IO { */ public static createDirsSyncFromFilePath(filePath: string) { ImperativeExpect.toBeDefinedAndNonBlank(filePath, "filePath"); - IO.createDirsSync(path.dirname(filePath)); + IO.createDirSync(path.dirname(filePath)); } /** @@ -198,14 +186,15 @@ export class IO { } /** - * Uses the fs-extra package to create a directory (and all subdirectories) + * Create a directory and all subdirectories if they do not yet exist synchronously. * @static * @param {string} dir - the directory (do not include a file name) * @memberof IO + * @deprecated Please use IO.createDirSync */ public static mkdirp(dir: string) { ImperativeExpect.toBeDefinedAndNonBlank(dir, "dir"); - mkdirpSync(dir); + IO.createDirSync(dir); } /** diff --git a/packages/imperative/src/operations/src/Operation.ts b/packages/imperative/src/operations/src/Operation.ts index 5f66df8652..3e3179137b 100644 --- a/packages/imperative/src/operations/src/Operation.ts +++ b/packages/imperative/src/operations/src/Operation.ts @@ -13,7 +13,6 @@ import { IOperationResult } from "./doc/IOperationResult"; import { TaskStage } from "./TaskStage"; import * as fs from "fs"; -import { removeSync } from "fs-extra"; import { TextUtils } from "../../utilities"; import { ITaskWithStatus } from "./doc/ITaskWithStatus"; import { TaskProgress } from "./TaskProgress"; @@ -475,11 +474,7 @@ export abstract class Operation implements ITaskWithStatus { for (let x = 0; x < order.length; x++) { this.log.info("Cleaning file: " + this.fileToUndo[x]); try { - if (fs.statSync(order[x]).isDirectory()) { - removeSync(order[x]); - } else { - fs.unlinkSync(order[x]); - } + fs.rmSync(order[x], {recursive: true, force: true}); } catch (error) { this.log.error("An error occurred deleting: " + order[x]); this.log.error("Message: " + error.message); diff --git a/packages/imperative/src/rest/__tests__/client/AbstractRestClient.unit.test.ts b/packages/imperative/src/rest/__tests__/client/AbstractRestClient.unit.test.ts index e5d7a047ea..fcd7669552 100644 --- a/packages/imperative/src/rest/__tests__/client/AbstractRestClient.unit.test.ts +++ b/packages/imperative/src/rest/__tests__/client/AbstractRestClient.unit.test.ts @@ -1517,7 +1517,7 @@ describe("AbstractRestClient tests", () => { const result = privateRestClient.buildOptions(resource, request, reqHeaders); expect(Object.keys(result)).toContain('agent'); expect(headerSpy).toHaveBeenCalledWith([{'Proxy-Authorization': restSession.ISession.proxy.proxy_authorization}]); - }) + }); }); }); }); diff --git a/packages/imperative/src/rest/__tests__/client/ProxySettings.unit.test.ts b/packages/imperative/src/rest/__tests__/client/ProxySettings.unit.test.ts index e6b47f4d86..952b9e298f 100644 --- a/packages/imperative/src/rest/__tests__/client/ProxySettings.unit.test.ts +++ b/packages/imperative/src/rest/__tests__/client/ProxySettings.unit.test.ts @@ -41,7 +41,7 @@ describe("Proxy tests", () => { const expected = { proxyUrl: passedUrl, protocol: HTTPS_PROTOCOL - } + }; beforeEach(() => { jest.clearAllMocks(); diff --git a/packages/imperative/src/rest/src/client/AbstractRestClient.ts b/packages/imperative/src/rest/src/client/AbstractRestClient.ts index 3d337bf125..0acdc37eed 100644 --- a/packages/imperative/src/rest/src/client/AbstractRestClient.ts +++ b/packages/imperative/src/rest/src/client/AbstractRestClient.ts @@ -476,9 +476,9 @@ export abstract class AbstractRestClient { this.mLogger.info(`Proxy setting "${proxyUrl.href}" will not be used as hostname was found listed under "no_proxy" setting.`); } else { this.mLogger.info(`Using the following proxy setting for the request: ${proxyUrl.href}`); - if (this.session.ISession?.proxy?.proxy_authorization) { + if (this.session.ISession.proxy?.proxy_authorization) { reqHeaders.push({ 'Proxy-Authorization': this.session.ISession.proxy.proxy_authorization}); - } + } options.agent = ProxySettings.getProxyAgent(this.session.ISession); } } diff --git a/packages/imperative/src/utilities/__tests__/diff/WebDiffGenerator.unit.test.ts b/packages/imperative/src/utilities/__tests__/diff/WebDiffGenerator.unit.test.ts index 0b32138381..d8f4330f66 100644 --- a/packages/imperative/src/utilities/__tests__/diff/WebDiffGenerator.unit.test.ts +++ b/packages/imperative/src/utilities/__tests__/diff/WebDiffGenerator.unit.test.ts @@ -26,7 +26,7 @@ describe("WebDiffGenerator", () => { beforeAll(async () => { // checking if fakewebdiffdir exists or not if (!fs.existsSync(webDiffDir)) { - IO.mkdirp(webDiffDir); + IO.createDirSync(webDiffDir); } }); afterAll(async () => { diff --git a/packages/provisioning/package.json b/packages/provisioning/package.json index e2e2125a0a..d583006ee5 100644 --- a/packages/provisioning/package.json +++ b/packages/provisioning/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/provisioning-for-zowe-sdk", - "version": "8.7.0", + "version": "8.7.1", "description": "Zowe SDK to interact with the z/OS provisioning APIs", "author": "Zowe", "license": "EPL-2.0", @@ -49,9 +49,9 @@ }, "devDependencies": { "@types/js-yaml": "^4.0.9", - "@zowe/cli-test-utils": "8.7.0", - "@zowe/core-for-zowe-sdk": "8.7.0", - "@zowe/imperative": "8.7.0" + "@zowe/cli-test-utils": "8.7.1", + "@zowe/core-for-zowe-sdk": "8.7.1", + "@zowe/imperative": "8.7.1" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0", diff --git a/packages/workflows/package.json b/packages/workflows/package.json index 55acc8c231..bbc9793180 100644 --- a/packages/workflows/package.json +++ b/packages/workflows/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zos-workflows-for-zowe-sdk", - "version": "8.7.0", + "version": "8.7.1", "description": "Zowe SDK to interact with the z/OS workflows APIs", "author": "Zowe", "license": "EPL-2.0", @@ -45,12 +45,12 @@ "prepack": "node ../../scripts/prepareLicenses.js" }, "dependencies": { - "@zowe/zos-files-for-zowe-sdk": "8.7.0" + "@zowe/zos-files-for-zowe-sdk": "8.7.1" }, "devDependencies": { - "@zowe/cli-test-utils": "8.7.0", - "@zowe/core-for-zowe-sdk": "8.7.0", - "@zowe/imperative": "8.7.0" + "@zowe/cli-test-utils": "8.7.1", + "@zowe/core-for-zowe-sdk": "8.7.1", + "@zowe/imperative": "8.7.1" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0", diff --git a/packages/zosconsole/package.json b/packages/zosconsole/package.json index eed0982d91..0a2e6a243a 100644 --- a/packages/zosconsole/package.json +++ b/packages/zosconsole/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zos-console-for-zowe-sdk", - "version": "8.7.0", + "version": "8.7.1", "description": "Zowe SDK to interact with the z/OS console", "author": "Zowe", "license": "EPL-2.0", @@ -45,9 +45,9 @@ "prepack": "node ../../scripts/prepareLicenses.js" }, "devDependencies": { - "@zowe/cli-test-utils": "8.7.0", - "@zowe/core-for-zowe-sdk": "8.7.0", - "@zowe/imperative": "8.7.0" + "@zowe/cli-test-utils": "8.7.1", + "@zowe/core-for-zowe-sdk": "8.7.1", + "@zowe/imperative": "8.7.1" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0", diff --git a/packages/zosfiles/package.json b/packages/zosfiles/package.json index c11755fa64..cedba685a8 100644 --- a/packages/zosfiles/package.json +++ b/packages/zosfiles/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zos-files-for-zowe-sdk", - "version": "8.7.0", + "version": "8.7.1", "description": "Zowe SDK to interact with files and data sets on z/OS", "author": "Zowe", "license": "EPL-2.0", @@ -50,10 +50,10 @@ "minimatch": "^9.0.5" }, "devDependencies": { - "@zowe/cli-test-utils": "8.7.0", - "@zowe/core-for-zowe-sdk": "8.7.0", - "@zowe/imperative": "8.7.0", - "@zowe/zos-uss-for-zowe-sdk": "8.7.0" + "@zowe/cli-test-utils": "8.7.1", + "@zowe/core-for-zowe-sdk": "8.7.1", + "@zowe/imperative": "8.7.1", + "@zowe/zos-uss-for-zowe-sdk": "8.7.1" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0", diff --git a/packages/zosfiles/src/methods/upload/Upload.ts b/packages/zosfiles/src/methods/upload/Upload.ts index b4d17b937a..e22d380712 100644 --- a/packages/zosfiles/src/methods/upload/Upload.ts +++ b/packages/zosfiles/src/methods/upload/Upload.ts @@ -876,8 +876,9 @@ export class Upload { } } else if(options.filesMap?.fileNames.indexOf(path.basename(localPath)) > -1) { tempOptions.binary = options.filesMap.binary; + + // Reset encoding to undefined if binary is true to avoid file tagging issues - //Reset encoding to undefined if binary is true to avoid file tagging issues if(tempOptions.binary) tempOptions.encoding = undefined; } diff --git a/packages/zosjobs/CHANGELOG.md b/packages/zosjobs/CHANGELOG.md index fc986d2800..46c4209895 100644 --- a/packages/zosjobs/CHANGELOG.md +++ b/packages/zosjobs/CHANGELOG.md @@ -2,10 +2,15 @@ All notable changes to the Zowe z/OS jobs SDK package will be documented in this file. +## `8.7.1` + +- BugFix: Fixed an error where the Delete Jobs API response was not returned if the `modifyVersion` parameter was not specified, even though it was available. [#2352](https://github.com/zowe/zowe-cli/pull/2352) + ## `8.7.0` - Enhancement: Added waitForOutput & waitForActive as optional parameters to download on zosjobs. [#2326] (https://github.com/zowe/zowe-cli/pull/2326). ## `8.5.0` + - Enhancement: Added execData to IJob return data from GetJobs.getJob [#2320](https://github.com/zowe/zowe-cli/pull/2320) ## `8.1.1` diff --git a/packages/zosjobs/__tests__/__system__/DeleteJobs.system.test.ts b/packages/zosjobs/__tests__/__system__/DeleteJobs.system.test.ts index 8dcb1c8b58..6bbffdc7fc 100644 --- a/packages/zosjobs/__tests__/__system__/DeleteJobs.system.test.ts +++ b/packages/zosjobs/__tests__/__system__/DeleteJobs.system.test.ts @@ -51,7 +51,12 @@ describe("DeleteJobs System tests", () => { const job = await SubmitJobs.submitJclNotifyCommon(REAL_SESSION, {jcl: iefbr14JCL}); expect(job.retcode).toEqual("CC 0000"); const response = await DeleteJobs.deleteJob(REAL_SESSION, job.jobname, job.jobid); - expect(response).toBeUndefined(); + expect(response.message).toEqual("Request was successful."); + expect(response.jobname).toEqual(job.jobname); + expect(response.jobid).toEqual(job.jobid); + expect(response["job-correlator"]).toEqual(job["job-correlator"]); + expect(response.owner).toEqual(job.owner); + expect(response.status).toEqual("0"); } }, LONG_TIMEOUT); @@ -62,7 +67,12 @@ describe("DeleteJobs System tests", () => { const job = await SubmitJobs.submitJclNotifyCommon(REAL_SESSION, {jcl: iefbr14JCL}); expect(job.retcode).toEqual("CC 0000"); const response = await DeleteJobs.deleteJobForJob(REAL_SESSION, job); - expect(response).toBeUndefined(); + expect(response.message).toEqual("Request was successful."); + expect(response.jobname).toEqual(job.jobname); + expect(response.jobid).toEqual(job.jobid); + expect(response["job-correlator"]).toEqual(job["job-correlator"]); + expect(response.owner).toEqual(job.owner); + expect(response.status).toEqual("0"); } }, LONG_TIMEOUT); @@ -73,7 +83,12 @@ describe("DeleteJobs System tests", () => { const job = await SubmitJobs.submitJclNotifyCommon(REAL_SESSION, {jcl: iefbr14JCL}); expect(job.retcode).toEqual("CC 0000"); const response = await DeleteJobs.deleteJobCommon(REAL_SESSION, {jobname: job.jobname, jobid: job.jobid}); - expect(response).toBeUndefined(); + expect(response.message).toEqual("Request was successful."); + expect(response.jobname).toEqual(job.jobname); + expect(response.jobid).toEqual(job.jobid); + expect(response["job-correlator"]).toEqual(job["job-correlator"]); + expect(response.owner).toEqual(job.owner); + expect(response.status).toEqual("0"); } }, LONG_TIMEOUT); @@ -166,21 +181,36 @@ describe("DeleteJobs System tests - Encoded", () => { const job = await SubmitJobs.submitJclNotifyCommon(REAL_SESSION, {jcl: iefbr14JCL}); expect(job.retcode).toEqual("CC 0000"); const response = await DeleteJobs.deleteJob(REAL_SESSION, job.jobname, job.jobid); - expect(response).toBeUndefined(); + expect(response.message).toEqual("Request was successful."); + expect(response.jobname).toEqual(job.jobname); + expect(response.jobid).toEqual(job.jobid); + expect(response["job-correlator"]).toEqual(job["job-correlator"]); + expect(response.owner).toEqual(job.owner); + expect(response.status).toEqual("0"); }, LONG_TIMEOUT); it("should be able to delete a job using deleteJobForJob", async () => { const job = await SubmitJobs.submitJclNotifyCommon(REAL_SESSION, {jcl: iefbr14JCL}); expect(job.retcode).toEqual("CC 0000"); const response = await DeleteJobs.deleteJobForJob(REAL_SESSION, job); - expect(response).toBeUndefined(); + expect(response.message).toEqual("Request was successful."); + expect(response.jobname).toEqual(job.jobname); + expect(response.jobid).toEqual(job.jobid); + expect(response["job-correlator"]).toEqual(job["job-correlator"]); + expect(response.owner).toEqual(job.owner); + expect(response.status).toEqual("0"); }, LONG_TIMEOUT); it("should be able to delete a job using deleteJobCommon", async () => { const job = await SubmitJobs.submitJclNotifyCommon(REAL_SESSION, {jcl: iefbr14JCL}); expect(job.retcode).toEqual("CC 0000"); const response = await DeleteJobs.deleteJobCommon(REAL_SESSION, {jobname: job.jobname, jobid: job.jobid}); - expect(response).toBeUndefined(); + expect(response.message).toEqual("Request was successful."); + expect(response.jobname).toEqual(job.jobname); + expect(response.jobid).toEqual(job.jobid); + expect(response["job-correlator"]).toEqual(job["job-correlator"]); + expect(response.owner).toEqual(job.owner); + expect(response.status).toEqual("0"); }, LONG_TIMEOUT); it("should be able to delete a job using deleteJobCommon (job modify version 2.0 - synchronous)", async () => { diff --git a/packages/zosjobs/__tests__/__unit__/DeleteJobs.unit.test.ts b/packages/zosjobs/__tests__/__unit__/DeleteJobs.unit.test.ts index d6bf063145..1e218e910d 100644 --- a/packages/zosjobs/__tests__/__unit__/DeleteJobs.unit.test.ts +++ b/packages/zosjobs/__tests__/__unit__/DeleteJobs.unit.test.ts @@ -51,7 +51,7 @@ describe("Delete Jobs unit tests", () => { describe("Positive tests", () => { it("should allow users to call deleteJob with correct parameters", async () => { - ZosmfRestClient.deleteExpectJSON = jest.fn(returnDeleteJobsDataAsync); + ZosmfRestClient.deleteExpectJSON = jest.fn().mockReturnValue(CancelJobsData.SAMPLE_JOB_FEEDBACK_GOOD); let caughtError; let response; try { @@ -60,11 +60,11 @@ describe("Delete Jobs unit tests", () => { caughtError = error; } expect(caughtError).toBeUndefined(); - expect(response).toEqual(CancelJobsData.SAMPLE_JOB_FEEDBACK_ASYNC); + expect(response).toEqual(CancelJobsData.SAMPLE_JOB_FEEDBACK_GOOD); }); it("should allow users to call deleteJobForJob with correct parameters", async () => { - ZosmfRestClient.deleteExpectJSON = jest.fn(returnDeleteJobsDataAsync); + ZosmfRestClient.deleteExpectJSON = jest.fn().mockReturnValue(CancelJobsData.SAMPLE_JOB_FEEDBACK_GOOD); let caughtError; let response; try { @@ -73,7 +73,7 @@ describe("Delete Jobs unit tests", () => { caughtError = error; } expect(caughtError).toBeUndefined(); - expect(response).toEqual(CancelJobsData.SAMPLE_JOB_FEEDBACK_ASYNC); + expect(response).toEqual(CancelJobsData.SAMPLE_JOB_FEEDBACK_GOOD); }); it("should allow users to call deleteJobForJob with correct parameters (with modify version 1_0)", async () => { @@ -104,7 +104,7 @@ describe("Delete Jobs unit tests", () => { }); it("should allow users to call deleteJobCommon with correct parameters", async () => { - ZosmfRestClient.deleteExpectJSON = jest.fn(returnDeleteJobsDataAsync); + ZosmfRestClient.deleteExpectJSON = jest.fn().mockReturnValue(CancelJobsData.SAMPLE_JOB_FEEDBACK_GOOD); let caughtError; let response; try { @@ -113,7 +113,7 @@ describe("Delete Jobs unit tests", () => { caughtError = error; } expect(caughtError).toBeUndefined(); - expect(response).toEqual(CancelJobsData.SAMPLE_JOB_FEEDBACK_ASYNC); + expect(response).toEqual(CancelJobsData.SAMPLE_JOB_FEEDBACK_GOOD); }); it("should allow users to call deleteJobCommon with correct parameters (with modify version 1_0)", async () => { diff --git a/packages/zosjobs/package.json b/packages/zosjobs/package.json index 16dd093f24..49b39a09ac 100644 --- a/packages/zosjobs/package.json +++ b/packages/zosjobs/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zos-jobs-for-zowe-sdk", - "version": "8.7.0", + "version": "8.7.1", "description": "Zowe SDK to interact with jobs on z/OS", "author": "Zowe", "license": "EPL-2.0", @@ -46,12 +46,12 @@ "prepack": "node ../../scripts/prepareLicenses.js" }, "dependencies": { - "@zowe/zos-files-for-zowe-sdk": "8.7.0" + "@zowe/zos-files-for-zowe-sdk": "8.7.1" }, "devDependencies": { - "@zowe/cli-test-utils": "8.7.0", - "@zowe/core-for-zowe-sdk": "8.7.0", - "@zowe/imperative": "8.7.0" + "@zowe/cli-test-utils": "8.7.1", + "@zowe/core-for-zowe-sdk": "8.7.1", + "@zowe/imperative": "8.7.1" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0", diff --git a/packages/zosjobs/src/DeleteJobs.ts b/packages/zosjobs/src/DeleteJobs.ts index 15030304e0..1676e4beca 100644 --- a/packages/zosjobs/src/DeleteJobs.ts +++ b/packages/zosjobs/src/DeleteJobs.ts @@ -79,12 +79,14 @@ export class DeleteJobs { const parameters: string = path.posix.sep + encodeURIComponent(parms.jobname) + path.posix.sep + encodeURIComponent(parms.jobid); const responseJson = await ZosmfRestClient.deleteExpectJSON(session, JobsConstants.RESOURCE + parameters, headers); - if (parms.modifyVersion === "2.0") { + if (parms.modifyVersion === "1.0") { + return undefined; + } else { const responseFeedback = responseJson as IJobFeedback; // Turns out status is a number, but we cannot introduce breaking changes. responseFeedback.status = responseFeedback.status.toString(); return responseFeedback; - } else { return undefined; } + } } diff --git a/packages/zoslogs/package.json b/packages/zoslogs/package.json index af415af4c1..8886027889 100644 --- a/packages/zoslogs/package.json +++ b/packages/zoslogs/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zos-logs-for-zowe-sdk", - "version": "8.7.0", + "version": "8.7.1", "description": "Zowe SDK to interact with the z/OS logs", "author": "Zowe", "license": "EPL-2.0", @@ -45,9 +45,9 @@ "prepack": "node ../../scripts/prepareLicenses.js" }, "devDependencies": { - "@zowe/cli-test-utils": "8.7.0", - "@zowe/core-for-zowe-sdk": "8.7.0", - "@zowe/imperative": "8.7.0" + "@zowe/cli-test-utils": "8.7.1", + "@zowe/core-for-zowe-sdk": "8.7.1", + "@zowe/imperative": "8.7.1" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0", diff --git a/packages/zosmf/package.json b/packages/zosmf/package.json index b90cae3280..6b5fa01985 100644 --- a/packages/zosmf/package.json +++ b/packages/zosmf/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zosmf-for-zowe-sdk", - "version": "8.7.0", + "version": "8.7.1", "description": "Zowe SDK to interact with the z/OS Management Facility", "author": "Zowe", "license": "EPL-2.0", @@ -44,9 +44,9 @@ "prepack": "node ../../scripts/prepareLicenses.js" }, "devDependencies": { - "@zowe/cli-test-utils": "8.7.0", - "@zowe/core-for-zowe-sdk": "8.7.0", - "@zowe/imperative": "8.7.0" + "@zowe/cli-test-utils": "8.7.1", + "@zowe/core-for-zowe-sdk": "8.7.1", + "@zowe/imperative": "8.7.1" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0", diff --git a/packages/zostso/package.json b/packages/zostso/package.json index 6d7d9bd28a..12c06a0376 100644 --- a/packages/zostso/package.json +++ b/packages/zostso/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zos-tso-for-zowe-sdk", - "version": "8.7.0", + "version": "8.7.1", "description": "Zowe SDK to interact with TSO on z/OS", "author": "Zowe", "license": "EPL-2.0", @@ -45,12 +45,12 @@ "prepack": "node ../../scripts/prepareLicenses.js" }, "dependencies": { - "@zowe/zosmf-for-zowe-sdk": "8.7.0" + "@zowe/zosmf-for-zowe-sdk": "8.7.1" }, "devDependencies": { - "@zowe/cli-test-utils": "8.7.0", - "@zowe/core-for-zowe-sdk": "8.7.0", - "@zowe/imperative": "8.7.0" + "@zowe/cli-test-utils": "8.7.1", + "@zowe/core-for-zowe-sdk": "8.7.1", + "@zowe/imperative": "8.7.1" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0", diff --git a/packages/zosuss/package.json b/packages/zosuss/package.json index 138b419c9b..e424bd8ac6 100644 --- a/packages/zosuss/package.json +++ b/packages/zosuss/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zos-uss-for-zowe-sdk", - "version": "8.7.0", + "version": "8.7.1", "description": "Zowe SDK to interact with USS on z/OS", "author": "Zowe", "license": "EPL-2.0", @@ -49,8 +49,8 @@ }, "devDependencies": { "@types/ssh2": "^1.11.19", - "@zowe/cli-test-utils": "8.7.0", - "@zowe/imperative": "8.7.0" + "@zowe/cli-test-utils": "8.7.1", + "@zowe/imperative": "8.7.1" }, "peerDependencies": { "@zowe/imperative": "^8.0.0" diff --git a/scripts/bundleCliTgz.js b/scripts/bundleCliTgz.js index ab06e9c232..8abcf43cba 100644 --- a/scripts/bundleCliTgz.js +++ b/scripts/bundleCliTgz.js @@ -10,7 +10,7 @@ */ const childProcess = require("child_process"); -const fs = require("fs-extra"); +const fs = require("fs"); const path = require("path"); // Workaround for https://github.com/npm/cli/issues/3466 @@ -18,7 +18,7 @@ process.chdir(__dirname + "/.."); const cliPkgDir = path.join(process.cwd(), "packages", "cli"); const pkgJsonFile = path.join(cliPkgDir, "package.json"); const execCmd = (cmd) => childProcess.execSync(cmd, { cwd: cliPkgDir, stdio: "inherit" }); -fs.mkdirpSync("dist"); +fs.mkdirSync("dist", {recursive: true}); fs.renameSync(path.join(cliPkgDir, "node_modules"), path.join(cliPkgDir, "node_modules_old")); fs.copyFileSync(pkgJsonFile, pkgJsonFile + ".bak");