diff --git a/package.json b/package.json index 0fb89020..9e07e4b9 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,8 @@ "private": true, "version": "4.0.8", "publishConfig": { - "registry": "https://zowe.jfrog.io/zowe/api/npm/npm-local-release/" + "registry": "https://zowe.jfrog.io/zowe/api/npm/npm-local-release/", + "scope": "@zowe" }, "repository": "https://github.com/zowe/cics-for-zowe-client", "workspaces": [ diff --git a/packages/cli/package.json b/packages/cli/package.json index 1b87a987..7d19dcd6 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -23,7 +23,8 @@ "lib" ], "publishConfig": { - "registry": "https://zowe.jfrog.io/zowe/api/npm/npm-local-release/" + "registry": "https://zowe.jfrog.io/zowe/api/npm/npm-local-release/", + "scope": "@zowe" }, "scripts": { "build": "tsc --pretty && npm run checkTestsCompile && npm run madge", @@ -62,4 +63,4 @@ "@zowe/cli": "~6.40.18", "@zowe/imperative": "~4.18.17" } -} +} \ No newline at end of file diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 86a79cad..7443a211 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -22,7 +22,8 @@ "lib" ], "publishConfig": { - "registry": "https://zowe.jfrog.io/zowe/api/npm/npm-local-release/" + "registry": "https://zowe.jfrog.io/zowe/api/npm/npm-local-release/", + "scope": "@zowe" }, "scripts": { "build": "tsc --pretty && npm run checkTestsCompile && npm run madge", @@ -48,4 +49,4 @@ "peerDependencies": { "@zowe/imperative": "~4.18.17" } -} +} \ No newline at end of file diff --git a/scripts/bundleTgz.js b/scripts/bundleTgz.js index 840679d6..8126d9cd 100644 --- a/scripts/bundleTgz.js +++ b/scripts/bundleTgz.js @@ -50,8 +50,8 @@ fsE.copyFileSync(pkgJsonFile, pkgJsonFile + ".bak"); try { // Install node_modules directly inside packages/cli execCmd("npm run preshrinkwrap"); - - execCmd(`${npmInstallCmd} ${path.relative(__dirname, "../dist/zowe-cics-for-zowe-sdk-" + tempPkgJson.version + ".tgz")}`); + const sdkTgzPath = path.relative(__dirname, "../dist/zowe-cics-for-zowe-sdk-" + tempPkgJson.version + ".tgz"); + execCmd(`${npmInstallCmd} ${sdkTgzPath}`); execCmd(npmInstallCmd); for (const zowePkgDir of fsE.readdirSync(path.join(cliPkgDir, "node_modules", "@zowe"))) { const srcDir = path.join("node_modules", "@zowe", zowePkgDir); diff --git a/scripts/rewriteShrinkwrap.js b/scripts/rewriteShrinkwrap.js index e5a4429b..e5de89c1 100644 --- a/scripts/rewriteShrinkwrap.js +++ b/scripts/rewriteShrinkwrap.js @@ -31,18 +31,19 @@ if (!fs.existsSync(rootShrinkwrapFile)) { // Remove "file:" links from shrinkwrap const shrinkwrap = JSON.parse(fs.readFileSync(rootShrinkwrapFile, "utf-8")); for (const [k, v] of Object.entries(shrinkwrap.packages)) { - if (v.link) { - delete shrinkwrap.packages[k]; - } + if (v.link) { + delete shrinkwrap.packages[k]; + } } fs.writeFileSync(cliShrinkwrapFile, JSON.stringify(shrinkwrap, null, 2)); // Build deduped shrinkwrap for @zowe/cics-for-zowe-cli const zoweRegistry = require(cliDir + "package.json").publishConfig.registry;; -getLockfile(cliShrinkwrapFile, undefined, { "@zowe:registry": zoweRegistry }) -.then((lockfile) => fs.writeFileSync(cliShrinkwrapFile, lockfile)) -.then(() => console.log(chalk.green("Lockfile contents written!"))) -.catch((err) => { +getLockfile(cliShrinkwrapFile, undefined, { "@zowe:registry": zoweRegistry }).then((lockfile) => { + fs.writeFileSync(cliShrinkwrapFile, lockfile); + console.log(chalk.green("Lockfile contents written!")); + monorepoShrinkwrap(); +}).catch((err) => { if (err.statusCode !== 404) { console.error(err); process.exit(1); @@ -51,31 +52,34 @@ getLockfile(cliShrinkwrapFile, undefined, { "@zowe:registry": zoweRegistry }) } }); -const pkgA = rootDir + "package.json"; -const pkgB = rootDir + "package.json_"; -try { - // Mimic non-workspaces monorepo - fs.renameSync(pkgA, pkgB); +function monorepoShrinkwrap() { + const pkgA = rootDir + "package.json"; + const pkgB = rootDir + "package.json_"; + try { + // Mimic non-workspaces monorepo + fs.renameSync(pkgA, pkgB); - cp.execSync("npm shrinkwrap", {cwd: cliDir}); + cp.execSync("npm shrinkwrap", { cwd: cliDir }); - const shrinkwrap = JSON.parse(fs.readFileSync(cliShrinkwrapFile, "utf-8")); - shrinkwrap.lockfileVersion = 2; - for (const [k, v] of Object.entries(shrinkwrap.packages)) { - if (v.link || v.extraneous || k === "../sdk") { + const shrinkwrap = JSON.parse(fs.readFileSync(cliShrinkwrapFile, "utf-8")); + shrinkwrap.lockfileVersion = 2; + for (const [k, v] of Object.entries(shrinkwrap.packages)) { + if (v.link || v.extraneous || k === "../sdk") { delete shrinkwrap.packages[k]; + } } - } - for (const [k, v] of Object.entries(shrinkwrap?.dependencies ?? [])) { - if (v.link || v.extraneous || k === "../sdk") { + for (const [k, v] of Object.entries(shrinkwrap?.dependencies ?? [])) { + if (v.link || v.extraneous || k === "../sdk") { delete shrinkwrap.dependencies[k]; + } } - } - fs.writeFileSync(cliShrinkwrapFile, JSON.stringify(shrinkwrap, null, 2)); + fs.writeFileSync(cliShrinkwrapFile, JSON.stringify(shrinkwrap, null, 2)); + console.log(chalk.green("Shrinkwrap contents written!")); - // cp.execSync(`sed -i 's#file:../sdk#${require(cliDir + "package.json").version}#g' npm-shrinkwrap.json`, {cwd: cliDir}); - // cp.execSync("npm i ../sdk --install-links --package-lock-only", {cwd: cliDir}); -} finally { - // revert back to workspaces monorepo - fs.renameSync(pkgB, pkgA); + // cp.execSync(`sed -i 's#file:../sdk#${require(cliDir + "package.json").version}#g' npm-shrinkwrap.json`, {cwd: cliDir}); + // cp.execSync("npm i ../sdk --install-links --package-lock-only", {cwd: cliDir}); + } finally { + // revert back to workspaces monorepo + fs.renameSync(pkgB, pkgA); + } } \ No newline at end of file