Skip to content

Commit

Permalink
Create lockfile for web help subpackage
Browse files Browse the repository at this point in the history
Signed-off-by: Timothy Johnson <timothy.johnson@broadcom.com>
  • Loading branch information
t1m0thyj committed Aug 9, 2024
1 parent d3ab253 commit 8b9a08e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions packages/imperative/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"files": [
"lib",
"web-help/dist",
"web-help/package*.json",
"web-diff"
],
"publishConfig": {
Expand Down
3 changes: 2 additions & 1 deletion packages/imperative/web-help/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"main": "index.js",
"scripts": {
"build": "tsc --build ./tsconfig.json",
"watch": "tsc --build ./tsconfig.json -w"
"watch": "tsc --build ./tsconfig.json -w",
"prepare": "node ../../../scripts/rewriteShrinkwrap.js package-lock.json"
},
"keywords": [],
"author": "",
Expand Down
10 changes: 5 additions & 5 deletions scripts/rewriteShrinkwrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const chalk = require("chalk");
const getLockfile = require("npm-lockfile/getLockfile");

const rootShrinkwrapFile = __dirname + "/../npm-shrinkwrap.json";
const cliShrinkwrapFile = __dirname + "/../packages/cli/npm-shrinkwrap.json";
const newShrinkwrapFile = process.cwd() + "/" + (process.argv[2] ?? "npm-shrinkwrap.json");

// Remove "file:" links from shrinkwrap
const shrinkwrap = JSON.parse(fs.readFileSync(rootShrinkwrapFile, "utf-8"));
Expand All @@ -23,11 +23,11 @@ for (const [k, v] of Object.entries(shrinkwrap.packages)) {
delete shrinkwrap.packages[k];
}
}
fs.writeFileSync(cliShrinkwrapFile, JSON.stringify(shrinkwrap, null, 2));
fs.writeFileSync(newShrinkwrapFile, JSON.stringify(shrinkwrap, null, 2));

// Build deduped shrinkwrap for @zowe/cli
// Build deduped shrinkwrap for subpackage (@zowe/cli or web-help)
const zoweRegistry = require("../lerna.json").command.publish.registry;
getLockfile(cliShrinkwrapFile, undefined, { "@zowe:registry": zoweRegistry })
.then((lockfile) => fs.writeFileSync(cliShrinkwrapFile, lockfile))
getLockfile(newShrinkwrapFile, undefined, { "@zowe:registry": zoweRegistry })
.then((lockfile) => fs.writeFileSync(newShrinkwrapFile, lockfile))
.then(() => console.log(chalk.green("Lockfile contents written!")))
.catch((err) => { console.error(err); process.exit(1); });

0 comments on commit 8b9a08e

Please sign in to comment.