Skip to content

Commit

Permalink
Merge pull request #2423 from zowe/fix/import-of-dependency
Browse files Browse the repository at this point in the history
Add secrets-for-zowe-sdk dependency to ZE API
  • Loading branch information
zFernand0 authored Aug 21, 2023
2 parents 0669b68 + 87d4c10 commit fab1aa7
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 19 deletions.
1 change: 1 addition & 0 deletions packages/zowe-explorer-api/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
lib
results
scripts
1 change: 1 addition & 0 deletions packages/zowe-explorer-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"dependencies": {
"@types/vscode": "^1.53.2",
"@zowe/cli": "^7.18.0",
"@zowe/secrets-for-zowe-sdk": "7.18.1",
"handlebars": "^4.7.7",
"semver": "^7.5.3"
},
Expand Down
28 changes: 16 additions & 12 deletions packages/zowe-explorer-api/scripts/check-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,32 @@ const { resolve } = require("path");
const { exit } = require("process");

// Looks for the scoped @zowe folder & inner "cli" module folder in node_modules
const findCli = (folderToScan) => {
const resolvedModule = require.resolve("@zowe/cli", {
const findPackage = (folderToScan, nodePackage) => {
console.log(`[Zowe Explorer API] Checking for ${nodePackage} in node_modules...`);
const resolvedModule = require.resolve(nodePackage, {
paths: [folderToScan],
});

if (resolvedModule.includes(folderToScan)) {
console.log("[Zowe Explorer API] OK ✔ @zowe/cli was found in node_modules");
console.log(`[Zowe Explorer API] OK ✔ ${nodePackage} was found in node_modules`);
return 0;
}

console.error("[Zowe Explorer API] ERR ✘ @zowe/cli was not found in node_modules");
console.error(`[Zowe Explorer API] ERR ✘ ${nodePackage} was not found in node_modules`);
return 1;
};

console.log("[Zowe Explorer API] Checking for @zowe/cli in node_modules...");

let exitCode = 0;
if (__dirname.includes("packages") || __dirname.includes("scripts")) {
// Modify starting path to point to zowe-explorer-api folder
exitCode = findCli(resolve(__dirname, "../../../"));
} else {
exitCode = findCli(__dirname);
}
let nodePackages = ["@zowe/cli", "@zowe/secrets-for-zowe-sdk"];
nodePackages.forEach(element => {
if (exitCode === 0) {
if (__dirname.includes("packages") || __dirname.includes("scripts")) {
// Modify starting path to point to zowe-explorer-api folder
exitCode = findPackage(resolve(__dirname, "../../../"), element);
} else {
exitCode = findPackage(__dirname, element);
}
}
});

exit(exitCode);
13 changes: 8 additions & 5 deletions packages/zowe-explorer-api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,21 @@
*
*/

export * from "./globals/Gui";
export * from "./logger/IZoweLogger";
export * from "./profiles/UserSettings";
export * from "./profiles/ProfilesCache";
export * from "./profiles/ZoweExplorerApi";
export * from "./profiles/ZoweExplorerZosmfApi";
export * from "./logger/IZoweLogger";
export * from "./security/KeytarApi";
export * from "./security/KeytarCredentialManager";
export * from "./security/KeytarApi";
export * from "./security/KeytarCredentialManager";
export * from "./tree/ZoweExplorerTreeApi";
export * from "./tree/ZoweTreeNode";
export * from "./tree/IZoweTree";
export * from "./tree/IZoweTreeNode";
export * from "./utils";
export * from "./vscode/ZoweVsCodeExtension";
export * from "./vscode/ui";
export * from "./security/KeytarApi";
export * from "./security/KeytarCredentialManager";
export * from "./globals/Gui";
export * from "./utils";
export { imperative } from "@zowe/cli";
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
/**
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright Contributors to the Zowe Project.
*
*/

import { ExtensionContext } from "vscode";
import { AttributeView } from "../../../src/uss/AttributeView";
import { IZoweTree, IZoweUSSTreeNode, ZoweExplorerApi } from "@zowe/zowe-explorer-api";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"getChildren.error.invalidNode": "Invalid node",
"getChildren.error.response": "Retrieving response from ",
"getChildren.responses.error.response": "The response from Zowe CLI was not successful",
"getChildren.error.response": "Retrieving response from ",
"getChildren.responses.open": "Open",
"deleteUssPrompt.deleteCancelled": "Delete action was cancelled.",
"deleteUSSNode.error.node": "Unable to delete node: ",
Expand Down
2 changes: 1 addition & 1 deletion packages/zowe-explorer/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const config = {
plugins: [
new webpack.BannerPlugin(fs.readFileSync("../../scripts/LICENSE_HEADER", "utf-8")),
new CopyPlugin({
patterns: [{ from: "./node_modules/@zowe/secrets-for-zowe-sdk/prebuilds", to: "../../prebuilds/" }],
patterns: [{ from: "../../node_modules/@zowe/secrets-for-zowe-sdk/prebuilds", to: "../../prebuilds/" }],
}),
],
};
Expand Down

0 comments on commit fab1aa7

Please sign in to comment.