diff --git a/.github/release.config.js b/.github/release.config.js index 330f16f8..8dae224a 100644 --- a/.github/release.config.js +++ b/.github/release.config.js @@ -6,6 +6,7 @@ module.exports = { level: "minor", devDependencies: { "@zowe/imperative": "zowe-v2-lts", + "@zowe/secrets-for-zowe-sdk": "zowe-v2-lts", "@zowe/zowe-explorer-api": "zowe-v2-lts", } }, @@ -15,6 +16,7 @@ module.exports = { level: "patch", devDependencies: { "@zowe/imperative": "zowe-v1-lts", + "@zowe/secrets-for-zowe-sdk": "zowe-v2-lts", "@zowe/zowe-explorer-api": "zowe-v1-lts", } }, @@ -25,6 +27,7 @@ module.exports = { prerelease: true, devDependencies: { "@zowe/imperative": "next", + "@zowe/secrets-for-zowe-sdk": "next", "@zowe/zowe-explorer-api": "next", } } diff --git a/.vscode/launch.json b/.vscode/launch.json index b8dc3b3e..ba2e6078 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -6,16 +6,16 @@ "version": "0.2.0", "configurations": [ { - "name": "Run Kubernetes Secrets Extension for Zowe", + "name": "Run CICS Extension for Zowe", "type": "extensionHost", "request": "launch", "runtimeExecutable": "${execPath}", "args": [ - "--extensionDevelopmentPath=${workspaceFolder}/packages/vscode", + "--extensionDevelopmentPath=${workspaceFolder}/packages/vsce", "--verbose" ], - "outFiles": ["${workspaceFolder}/packages/vscode/dist/**/*.js"], - "preLaunchTask": "build dev watch", + "outFiles": ["${workspaceFolder}/packages/vsce/dist/**/*.js"], + "preLaunchTask": "npm run watch", "smartStep": true, "skipFiles": ["/**"], "enableTurboSourcemaps": true, diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 8b93f7eb..6a37e620 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -4,15 +4,15 @@ "version": "2.0.0", "tasks": [ { - "label": "build dev watch", + "label": "npm run watch", "group": "build", "isBackground": true, "type": "shell", "options": { - "cwd": "${workspaceFolder}/packages/vscode" + "cwd": "${workspaceFolder}/packages/vsce" }, "command": "npm", - "args": ["run", "dev"], + "args": ["run", "watch"], "problemMatcher": { "owner": "typescript", "source": "ts", diff --git a/package-lock.json b/package-lock.json index dc9e0600..b7923da9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,6 +20,7 @@ "@typescript-eslint/parser": "^5.57.1", "@zowe/cli-test-utils": "^7.13.0", "@zowe/imperative": "^5.22.0", + "@zowe/secrets-for-zowe-sdk": "^7.18.6", "@zowe/zowe-explorer-api": "^2.14.0", "chalk": "^4.1.2", "eslint": "^8.37.0", @@ -7485,7 +7486,8 @@ }, "node_modules/@zowe/imperative": { "version": "5.22.0", - "license": "EPL-2.0", + "resolved": "https://registry.npmjs.org/@zowe/imperative/-/imperative-5.22.0.tgz", + "integrity": "sha512-XSTlHuaKtI2FsWYSQWNIx2rR739Zv8pkjvvxBDesyiCYXOpo4u/1RxkeAE/FKfw5UgVKR6yq7izLeeOpPjj3IA==", "dependencies": { "@types/yargs": "13.0.4", "chalk": "2.4.2", @@ -7675,8 +7677,9 @@ }, "node_modules/@zowe/secrets-for-zowe-sdk": { "version": "7.18.6", + "resolved": "https://zowe.jfrog.io/zowe/api/npm/npm-release/@zowe/secrets-for-zowe-sdk/-/@zowe/secrets-for-zowe-sdk-7.18.6.tgz", + "integrity": "sha512-3ElVUd5VYWUxVjXRCeM/jmXh9u1rnWtxobQEpgEZ2iNt+PTt3QajIxUH9MxriELVCp7u39AeAG4lfxs3wnrGzA==", "hasInstallScript": true, - "license": "EPL-2.0", "engines": { "node": ">= 14" } @@ -7762,7 +7765,8 @@ }, "node_modules/@zowe/zowe-explorer-api": { "version": "2.14.0", - "license": "EPL-2.0", + "resolved": "https://registry.npmjs.org/@zowe/zowe-explorer-api/-/zowe-explorer-api-2.14.0.tgz", + "integrity": "sha512-T1rMwpWu41ZbWvvaAvuf2W2q0bjmAa010N/9sRwtK/kZPAcI4J6i9o1aizQ5bc7CqzaJAynEZIut02KH8iKvFA==", "dependencies": { "@types/vscode": "^1.53.2", "@zowe/cli": "7.22.0", @@ -8716,6 +8720,8 @@ }, "node_modules/chokidar": { "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", "dev": true, "funding": [ { @@ -8723,7 +8729,6 @@ "url": "https://paulmillr.com/funding/" } ], - "license": "MIT", "dependencies": { "anymatch": "~3.1.2", "braces": "~3.0.2", @@ -11035,6 +11040,20 @@ "version": "1.0.0", "license": "ISC" }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, "node_modules/function-bind": { "version": "1.1.1", "dev": true, diff --git a/package.json b/package.json index c903ff58..e5f72d2e 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "private": true, "scripts": { "build": "turbo build", + "watch": "turbo watch", "package": "turbo package", "test": "npm run test --workspaces", "test:system": "npm run test:system --workspaces", diff --git a/packages/cli/package.json b/packages/cli/package.json index 0edd587c..b5865618 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -36,7 +36,9 @@ "lint": "eslint \"src/**/*.ts\" \"**/__tests__/**/*.ts\"", "lint:src": "eslint \"src/**/*.ts\" --ignore-pattern \"**/__tests__/**/*.ts\"", "lint:tests": "eslint \"**/__tests__/**/*.ts\"", - "package": "node ../../scripts/bundleTgz.js", + "prepack": "node ../../scripts/bundleTgz.js", + "postpack": "node ../../scripts/bundleTgz.js post", + "package": "npm pack --pack-destination=../../dist", "test": "npm run test:unit && npm run test:system", "test:system": "jest --config system.jest_config.ts", "test:unit": "jest --config unit.jest_config.ts", @@ -53,7 +55,7 @@ "peerDependencies": { "@zowe/imperative": "^5.0.0" }, - "bundleDependencies": [ + "bundledDependencies": [ "@zowe/cics-for-zowe-sdk" ] } diff --git a/packages/vsce/.gitignore b/packages/vsce/.gitignore index de4e8f87..74795a23 100644 --- a/packages/vsce/.gitignore +++ b/packages/vsce/.gitignore @@ -4,4 +4,5 @@ lib/ .history/ logs/ .vscode-test/ -results/ \ No newline at end of file +results/ +prebuilds/ \ No newline at end of file diff --git a/packages/vsce/.vscodeignore b/packages/vsce/.vscodeignore index db8c41b8..e4b8f875 100644 --- a/packages/vsce/.vscodeignore +++ b/packages/vsce/.vscodeignore @@ -6,6 +6,7 @@ # Allowlist what we need !dist/extension.* +!prebuilds/* # !out/src/nls.metadata*.json !resources/**/*.png !resources/**/*.svg diff --git a/packages/vsce/package.json b/packages/vsce/package.json index e893498a..7889c316 100644 --- a/packages/vsce/package.json +++ b/packages/vsce/package.json @@ -871,18 +871,19 @@ } }, "scripts": { - "vscode:prepublish": "npm run tsupDep -- add && tsup && npm run tsupDep", + "vscode:prepublish": "npm run getPrebuilds && npm run tsupDep -- add && tsup && npm run tsupDep", "build": "tsup && npm run checkTestsCompile && npm run madge", "checkTestsCompile": "echo \"Checking that test source compiles...\" && tsc --project __tests__/test-tsconfig.json --noEmit ", "madge": "echo 'Nothing to check'", "lint": "eslint src --ext ts", "prebuild": "npm run clean && echo Using TypeScript && tsc --version && echo Using TSUP && tsup --version", "clean": "rimraf lib && rimraf dist", - "watch": "tsc -watch -p ./", + "watch": "tsup --watch", "test:system": "echo 'Please run the system tests via VSCode UI' && exit 0", "test:unit": "jest --config unit.jest_config.ts --no-coverage", "test": "npm run test:unit", "tsupDep": "node ./scripts/tsup-deps.js", + "getPrebuilds": "node ./scripts/getSecretsPrebuilds.js", "package": "vsce package --dependencies --allow-star-activation && node ../../scripts/mv-pack.js cics-extension-for-zowe vsix" }, "devDependencies": { @@ -896,4 +897,4 @@ "https": "~1.0.0", "xml-js": "~1.6.11" } -} +} \ No newline at end of file diff --git a/packages/vsce/scripts/getSecretsPrebuilds.js b/packages/vsce/scripts/getSecretsPrebuilds.js new file mode 100644 index 00000000..271b3e5c --- /dev/null +++ b/packages/vsce/scripts/getSecretsPrebuilds.js @@ -0,0 +1,15 @@ +/* +* 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 fsE = require("fs-extra"); +const path = require("path"); +const secretsPkgDir = path.resolve(require.resolve("@zowe/secrets-for-zowe-sdk"), "..", ".."); +fsE.copySync(path.join(secretsPkgDir, "prebuilds"), path.resolve(__dirname, "..", "prebuilds")); \ No newline at end of file diff --git a/packages/vsce/src/utils/profileUtils.ts b/packages/vsce/src/utils/profileUtils.ts index 2ac01a05..31d7da3a 100644 --- a/packages/vsce/src/utils/profileUtils.ts +++ b/packages/vsce/src/utils/profileUtils.ts @@ -13,6 +13,7 @@ import { ZoweVsCodeExtension, imperative } from "@zowe/zowe-explorer-api"; import { join } from "path"; import { CICSTree } from "../trees/CICSTree"; import { window } from "vscode"; +import { ProfileManagement } from "./profileManagement"; export function missingSessionParameters(profileProfile: any): (string | undefined)[] { const params = ["host", "port", "user", "password", "rejectUnauthorized", "protocol"]; @@ -38,10 +39,10 @@ export async function promptCredentials(sessionName: string, rePrompt?: boolean) // }); // await mProfileInfo.readProfilesFromDisk(); // ProfilesCache.createConfigInstance(mProfileInfo); - const promptInfo = await ZoweVsCodeExtension.promptCredentials({ + const promptInfo = await ZoweVsCodeExtension.updateCredentials({ sessionName, rePrompt, - }); + }, ProfileManagement.getExplorerApis()); if (!promptInfo) { window.showInformationMessage("Input credentials operation Cancelled"); } diff --git a/scripts/bundleTgz.js b/scripts/bundleTgz.js index b5b39d7a..840679d6 100644 --- a/scripts/bundleTgz.js +++ b/scripts/bundleTgz.js @@ -14,22 +14,45 @@ const fsE = require("fs-extra"); const fs = require("fs"); const path = require("path"); +const isPost = process.argv[2] === "post"; + // Workaround for https://github.com/npm/cli/issues/3466 const rootDir = path.join(__dirname, ".."); process.chdir(rootDir); const cliPkgDir = path.join(process.cwd(), "packages", "cli"); const pkgJsonFile = path.join(cliPkgDir, "package.json"); +const tempPkgJson = JSON.parse(fsE.readFileSync(pkgJsonFile, "utf-8")); +const npmInstallCmd = "npm install --ignore-scripts --workspaces=false"; const execCmd = (cmd) => childProcess.execSync(cmd, { cwd: cliPkgDir, stdio: "inherit" }); fsE.mkdirpSync("dist"); -if(fs.existsSync(path.join(cliPkgDir, "node_modules"))) { + +const cleanUp = () => { + fsE.rmSync(path.join(cliPkgDir, "node_modules"), { recursive: true, force: true }); + if (fs.existsSync(path.join(cliPkgDir, "node_modules_old"))) { + fsE.renameSync(path.join(cliPkgDir, "node_modules_old"), path.join(cliPkgDir, "node_modules")); + } + if (fs.existsSync(pkgJsonFile + ".bak")) { + fsE.renameSync(pkgJsonFile + ".bak", pkgJsonFile); + } + fs.rmSync(path.join(cliPkgDir, "npm-shrinkwrap.json"), { force: true }); + fs.rmSync(path.join(rootDir, "npm-shrinkwrap.json"), { force: true }); +} + +if (isPost) { + cleanUp(); + return; +} + +if (fs.existsSync(path.join(cliPkgDir, "node_modules"))) { fsE.renameSync(path.join(cliPkgDir, "node_modules"), path.join(cliPkgDir, "node_modules_old")); } fsE.copyFileSync(pkgJsonFile, pkgJsonFile + ".bak"); - try { // Install node_modules directly inside packages/cli execCmd("npm run preshrinkwrap"); - execCmd("npm install --ignore-scripts --workspaces=false --force"); + + execCmd(`${npmInstallCmd} ${path.relative(__dirname, "../dist/zowe-cics-for-zowe-sdk-" + tempPkgJson.version + ".tgz")}`); + execCmd(npmInstallCmd); for (const zowePkgDir of fsE.readdirSync(path.join(cliPkgDir, "node_modules", "@zowe"))) { const srcDir = path.join("node_modules", "@zowe", zowePkgDir); const destDir = path.join(cliPkgDir, srcDir); @@ -44,13 +67,9 @@ try { ...Object.keys(pkgJson.optionalDependencies ?? {}) ]; fsE.writeFileSync(pkgJsonFile, JSON.stringify(pkgJson, null, 2)); - execCmd("npm pack --pack-destination=../../dist"); -} finally { - fsE.rmSync(path.join(cliPkgDir, "node_modules"), { recursive: true, force: true }); - if(fs.existsSync(path.join(cliPkgDir, "node_modules_old"))) { - fsE.renameSync(path.join(cliPkgDir, "node_modules_old"), path.join(cliPkgDir, "node_modules")); - } - fs.rmSync(path.join(cliPkgDir, "npm-shrinkwrap.json"), { force: true }); - fs.rmSync(path.join(rootDir, "npm-shrinkwrap.json"), { force: true }); - fsE.renameSync(pkgJsonFile + ".bak", pkgJsonFile); + + // execCmd("npm pack --pack-destination=../../dist"); +} catch (err) { + cleanUp(); + throw err; } diff --git a/scripts/getSecretsPrebuilds.mjs b/scripts/getSecretsPrebuilds.mjs new file mode 100644 index 00000000..3d7fdaa1 --- /dev/null +++ b/scripts/getSecretsPrebuilds.mjs @@ -0,0 +1,15 @@ +/* +* 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 { copySync } from "fs-extra"; +import { join, resolve } from "path"; +const secretsPkgDir = resolve(require.resolve("@zowe/secrets-for-zowe-sdk"), "..", ".."); +copySync(join(secretsPkgDir, "prebuilds"), resolve(__dirname, "..", "prebuilds")); \ No newline at end of file diff --git a/turbo.json b/turbo.json index 61d30029..98a31baa 100644 --- a/turbo.json +++ b/turbo.json @@ -5,7 +5,7 @@ "dependsOn": ["^build"], "outputs": ["dist/**", "lib/**"] }, - "dev": { + "watch": { "dependsOn": ["build"] }, "test": {