Skip to content

Commit

Permalink
re-enable final install-related script
Browse files Browse the repository at this point in the history
Signed-off-by: zFernand0 <[email protected]>
  • Loading branch information
zFernand0 committed Sep 11, 2023
1 parent d4fec32 commit bb59c6a
Show file tree
Hide file tree
Showing 10 changed files with 112 additions and 471 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,7 @@ imperative_debug.log
# Licenses in package folders (managed with build scripts)
packages/*/LICENSE
zowex/

# Browserified bundles and compiled JS for web help
packages/imperative/web-help/dist/css/bundle*
packages/imperative/web-help/dist/js/
18 changes: 10 additions & 8 deletions gulp/DevelopmentTasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
*/

import { IGulpError, ITaskFunction } from "./GulpHelpers";
import { Constants } from "../packages/cli/src/Constants";
import { SpawnSyncReturns } from "child_process";
import * as util from "util";
import { DefaultHelpGenerator, Imperative, ImperativeConfig } from "../packages/imperative/src";

import { CliConstants } from "../packages/cli/src/CliConstants";

// "npx" command allows us to issue CLIs from node_modules dependencies
// without globally installing.
const npx = "npx" + (require("os").platform() === "win32" ? ".cmd" : ""); // platform dependent extension for npx command
Expand Down Expand Up @@ -130,7 +131,7 @@ const doc: ITaskFunction = async () => {
clearRequire.all(); // in case the code has changed, reload any code

let totalCommands = 0;
let markdownContent = "# " + Constants.DISPLAY_NAME + " Help\n\n";
let markdownContent = "# " + CliConstants.DISPLAY_NAME + " Help\n\n";
markdownContent += "\n" + loadedDefinitions.description + "\n\n";

markdownContent += "{{tableOfContents}}\n\n";
Expand Down Expand Up @@ -187,7 +188,7 @@ const doc: ITaskFunction = async () => {

const helpGen = new DefaultHelpGenerator({
produceMarkdown: true,
rootCommandName: Constants.BINARY_NAME + oldCommandName
rootCommandName: CliConstants.BINARY_NAME + oldCommandName
} as any, {
commandDefinition: child,
fullCommandTree: definition
Expand Down Expand Up @@ -262,7 +263,7 @@ const buildImperative: ITaskFunction = (done) => {
buildImperative.description = "Build the project and generate documentation";

const watchImperative: ITaskFunction = (done) => {
gulp.watch("packages/**", gulp.series("lint"));
gulp.watch("packages/imperative/src/**", gulp.series("lint"));
const watchProcess = childProcess.spawn("node", [tscExecutable, "--watch"], {stdio: "inherit"});
watchProcess.on("error", (error: Error) => {
fancylog(error);
Expand All @@ -277,13 +278,14 @@ watchImperative.description = "Continuously build the project as you edit the so
"generate documentation, use the 'build' task before attempting to merge with the master branch";


const imperativeDirectory = __dirname + "/../packages/imperative/";
const buildAllClis: ITaskFunction = async () => {
const cliDirs: string[] = getDirectories(__dirname + "/../__tests__/__integration__/");
const cliDirs: string[] = getDirectories(imperativeDirectory + "__tests__/__integration__/");
cliDirs.forEach((dir) => {
// Build them all
fancylog(`Build "${dir}" cli...`);
const buildResponse = childProcess.spawnSync((process.platform === "win32") ? "npm.cmd" : "npm", ["run", "build"],
{cwd: __dirname + `/../__tests__/__integration__/${dir}/`});
{cwd: imperativeDirectory + `__tests__/__integration__/${dir}/`});
if (buildResponse.stdout && buildResponse.stdout.toString().length > 0) {
fancylog(`***BUILD "${dir}" stdout:\n${buildResponse.stdout.toString()}`);
}
Expand All @@ -305,12 +307,12 @@ function getDirectories(path: string) {
}

const installAllCliDependencies: ITaskFunction = async () => {
const cliDirs: string[] = getDirectories(__dirname + "/../__tests__/__integration__/");
const cliDirs: string[] = getDirectories(imperativeDirectory + "__tests__/__integration__/");
cliDirs.forEach((dir) => {
// Perform an NPM install
fancylog(`Executing "npm install" for "${dir}" cli to obtain dependencies...`);
const installResponse = childProcess.spawnSync((process.platform === "win32") ? "npm.cmd" : "npm", ["install"],
{cwd: __dirname + `/../__tests__/__integration__/${dir}/`});
{cwd: imperativeDirectory + `__tests__/__integration__/${dir}/`});
if (installResponse.stdout && installResponse.stdout.toString().length > 0) {
fancylog(`***INSTALL "${dir}" stdout:\n${installResponse.stdout.toString()}`);
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"typedoc": "typedoc",
"typedoc:packages": "lerna run --parallel typedoc",
"audit:public": "npm audit --registry https://registry.npmjs.org/",
"bundle:webHelp": "echo 'gulp bundleWebHelp'",
"bundle:webHelp": "gulp bundleWebHelp",
"prepare": "husky install && npm run bundle:webHelp"
},
"dependencies": {
Expand Down
92 changes: 92 additions & 0 deletions packages/cli/src/CliConstants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*
* 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.
*
*/

/**
* Class to contain CLI constants
* @export
* @class CliConstants
*/
export class CliConstants {

/**
* Custom log location to prevent logging to default folder based on the package name
* @static
* @memberof CliConstants
*/
public static readonly LOG_LOCATION = "zowe/logs/zowe.log";

/**
* Display name
* @static
* @memberof CliConstants
*/
public static readonly DISPLAY_NAME = "Zowe CLI";

/**
* Binary executable name
* @static
* @memberof CliConstants
*/
public static readonly BINARY_NAME = "zowe";

/**
*
* Documentation link for the CLI
* @static
* @memberof CliConstants
*/
public static readonly DOCUMENTATION_LINK = "https://docs.zowe.org";

/**
*
* Support link for zowe
* @static
* @memberof CliConstants
*/
public static readonly SUPPORT_LINK = "https://www.zowe.org";

/**
* Description of product
* @static
* @memberof CliConstants
*/
public static readonly DESCRIPTION =
`Welcome to ${CliConstants.DISPLAY_NAME}!
${CliConstants.DISPLAY_NAME} is a command line interface (CLI) that provides a simple and streamlined way to interact with IBM z/OS.
For additional ${CliConstants.DISPLAY_NAME} documentation, visit ${CliConstants.DOCUMENTATION_LINK}
For ${CliConstants.DISPLAY_NAME} support, visit ${CliConstants.SUPPORT_LINK}
`;

/**
* Home environment variable
* @static
* @memberof CliConstants
*/
public static readonly HOME_ENV_KEY = "ZOWE_CLI_HOME";


/**
* Prefix for environmental variable settings used by Imperative
* @static
* @memberof CliConstants
*/
public static readonly ENV_PREFIX = "ZOWE";

/**
* Home directory
* @static
* @memberof CliConstants
*/
public static readonly HOME_DIR = "~/.zowe";
}
78 changes: 2 additions & 76 deletions packages/cli/src/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,89 +9,15 @@
*
*/

import { CliConstants } from "./CliConstants";
import { ICommandOptionDefinition, ICommandExampleDefinition, SessConstants } from "@zowe/imperative";

/**
* Class to contain constants
* @export
* @class Constants
*/
export class Constants {

/**
* Custom log location to prevent logging to default folder based on the package name
* @static
* @memberof Constants
*/
public static readonly LOG_LOCATION = "zowe/logs/zowe.log";

/**
* Display name
* @static
* @memberof Constants
*/
public static readonly DISPLAY_NAME = "Zowe CLI";

/**
* Binary executable name
* @static
* @memberof Constants
*/
public static readonly BINARY_NAME = "zowe";

/**
*
* Documentation link for the CLI
* @static
* @memberof Constants
*/
public static readonly DOCUMENTATION_LINK = "https://docs.zowe.org";

/**
*
* Support link for zowe
* @static
* @memberof Constants
*/
public static readonly SUPPORT_LINK = "https://www.zowe.org";

/**
* Description of product
* @static
* @memberof Constants
*/
public static readonly DESCRIPTION =
`Welcome to ${Constants.DISPLAY_NAME}!
${Constants.DISPLAY_NAME} is a command line interface (CLI) that provides a simple and streamlined way to interact with IBM z/OS.
For additional ${Constants.DISPLAY_NAME} documentation, visit ${Constants.DOCUMENTATION_LINK}
For ${Constants.DISPLAY_NAME} support, visit ${Constants.SUPPORT_LINK}
`;

/**
* Home environment variable
* @static
* @memberof Constants
*/
public static readonly HOME_ENV_KEY = "ZOWE_CLI_HOME";


/**
* Prefix for environmental variable settings used by Imperative
* @static
* @memberof Constants
*/
public static readonly ENV_PREFIX = "ZOWE";


/**
* Home directory
* @static
* @memberof Constants
*/
public static readonly HOME_DIR = "~/.zowe";
export class Constants extends CliConstants {

public static BASE_CONNECTION_OPTION_GROUP = "Base Connection Options";

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*
*/

export * as imperative from "@zowe/imperative";
export { Constants } from "./Constants";
export * from "./Utils";
export * from "@zowe/core-for-zowe-sdk";
Expand All @@ -20,4 +21,3 @@ export * from "@zowe/zos-tso-for-zowe-sdk";
export * from "@zowe/zos-uss-for-zowe-sdk";
export * from "@zowe/zos-workflows-for-zowe-sdk";
export * from "@zowe/zosmf-for-zowe-sdk";
export * as imperative from "@zowe/imperative";
2 changes: 1 addition & 1 deletion packages/imperative/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"build": "npm run build:packages && npm run build:webHelp",
"build:packages": "tsc --pretty",
"watch": "gulp watchImperative",
"postbuild": "echo 'gulp build:install-all-cli-dependencies && gulp build:all-clis'"
"postbuild": "gulp build:install-all-cli-dependencies && gulp build:all-clis"
},
"dependencies": {
"@types/yargs": "13.0.4",
Expand Down
1 change: 1 addition & 0 deletions packages/imperative/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"composite": true,
"outDir": "./lib"
},
"include": [
Expand Down
Loading

0 comments on commit bb59c6a

Please sign in to comment.