diff --git a/packages/cli/scripts/printSuccessMessage.js b/packages/cli/scripts/printSuccessMessage.js index 41e541c55e..809a602c65 100644 --- a/packages/cli/scripts/printSuccessMessage.js +++ b/packages/cli/scripts/printSuccessMessage.js @@ -1,34 +1,36 @@ /* - * 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. - * - */ +* 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. +* +*/ -const installSuccessMessage = - "Zowe CLI has been successfully installed. " + +function getImperative() { + try { + return require("@zowe/imperative"); + } catch (err) { + if (err.code === "ERR_MODULE_NOT_FOUND" || err.code === "MODULE_NOT_FOUND") { + require("ts-node/register"); + return require(require("path").resolve(__dirname, "../../../../imperative/packages/utilities/src/TextUtils")); + } else { + throw err; + } + } +} + +function printSuccessMessage() { + const imperative = getImperative(); + + const installSuccessMessage = "Zowe CLI has been successfully installed. " + "You can safely ignore all non-plug-in related errors and warnings. " + "Please check above for any plug-in related issues."; -const Table = require("cli-table3"); -const table = new Table({ - chars: { - top: "═", - "top-left": "╔", - "top-right": "╗", - bottom: "═", - "bottom-left": "╚", - "bottom-right": "╝", - left: "║", - right: "║", - }, - colWidths: [require("yargs").terminalWidth() - 8], - style: { "padding-left": 0, "padding-right": 0, head: [], border: [] }, - wordWrap: true, -}); -table.push([installSuccessMessage]); -console.log("\n" + table.toString() + "\n"); + const table = imperative.TextUtils.getTable([[installSuccessMessage]], "yellow", undefined, false, true, true); + console.log("\n" + table + "\n"); +} + +printSuccessMessage(); \ No newline at end of file