Skip to content

Commit

Permalink
use ts-node to import texstUtils
Browse files Browse the repository at this point in the history
Signed-off-by: zFernand0 <[email protected]>
  • Loading branch information
zFernand0 committed Sep 8, 2023
1 parent 137245e commit d4fec32
Showing 1 changed file with 31 additions and 29 deletions.
60 changes: 31 additions & 29 deletions packages/cli/scripts/printSuccessMessage.js
Original file line number Diff line number Diff line change
@@ -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();

0 comments on commit d4fec32

Please sign in to comment.