@ws-tools/grapher 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@ws-tools/grapher",
3
+ "entries": [
4
+ {
5
+ "date": "Wed, 17 May 2023 01:25:39 GMT",
6
+ "tag": "@ws-tools/grapher_v0.1.1",
7
+ "version": "0.1.1",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "elcraig@microsoft.com",
12
+ "package": "@ws-tools/grapher",
13
+ "commit": "a14af9fe6d1081712a1f84483a38185fc7603cc8",
14
+ "comment": "Add `bin` and prevent importing the package"
15
+ },
16
+ {
17
+ "author": "kchau@microsoft.com",
18
+ "package": "@ws-tools/grapher",
19
+ "commit": "9311481fb7acc75402900473a38bd6dcc169014d",
20
+ "comment": "adding a deps graph tool"
21
+ },
22
+ {
23
+ "author": "beachball",
24
+ "package": "@ws-tools/grapher",
25
+ "comment": "Bump workspace-tools to v0.34.6",
26
+ "commit": "1ae1a23fe0402f213d6ef2c5fad221a9bacab185"
27
+ }
28
+ ]
29
+ }
30
+ }
31
+ ]
32
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,15 @@
1
+ # Change Log - @ws-tools/grapher
2
+
3
+ This log was last generated on Wed, 17 May 2023 01:25:39 GMT and should not be manually modified.
4
+
5
+ <!-- Start content -->
6
+
7
+ ## 0.1.1
8
+
9
+ Wed, 17 May 2023 01:25:39 GMT
10
+
11
+ ### Patches
12
+
13
+ - Add `bin` and prevent importing the package (elcraig@microsoft.com)
14
+ - adding a deps graph tool (kchau@microsoft.com)
15
+ - Bump workspace-tools to v0.34.6
package/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # @ws-tools/grapher
2
+
3
+ ## Generates a list of dependents and dependencies (internal to the workspace) for a package or packages
4
+
5
+ For one package
6
+
7
+ ```
8
+ npx @ws-tools/grapher --scope foo
9
+ ```
10
+
11
+ For multiple packages:
12
+
13
+ ```
14
+ npx @ws-tools/grapher --scope foo --scope bar
15
+ ```
package/bin/grapher.js ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require("../lib/index");
@@ -0,0 +1,5 @@
1
+ interface DepsCommandOptions {
2
+ scope?: string[];
3
+ }
4
+ export declare function depsCommand(options: DepsCommandOptions): void;
5
+ export {};
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.depsCommand = void 0;
4
+ const workspace_tools_1 = require("workspace-tools");
5
+ function depsCommand(options) {
6
+ var _a, _b;
7
+ const root = (0, workspace_tools_1.getWorkspaceRoot)(process.cwd());
8
+ if (!root) {
9
+ throw new Error("Could not find workspace root");
10
+ }
11
+ const packageInfos = (0, workspace_tools_1.getPackageInfos)(root);
12
+ const dependents = (0, workspace_tools_1.getTransitiveDependents)((_a = options.scope) !== null && _a !== void 0 ? _a : [], packageInfos);
13
+ console.log("Dependent Packages:");
14
+ console.log(dependents
15
+ .sort()
16
+ .map((d) => ` - ${d}`)
17
+ .join("\n"));
18
+ console.log("");
19
+ const dependencies = (0, workspace_tools_1.getTransitiveDependencies)((_b = options.scope) !== null && _b !== void 0 ? _b : [], packageInfos);
20
+ console.log("Dependencies of Package:");
21
+ console.log(dependencies
22
+ .sort()
23
+ .map((d) => ` - ${d}`)
24
+ .join("\n"));
25
+ }
26
+ exports.depsCommand = depsCommand;
27
+ //# sourceMappingURL=depsCommand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"depsCommand.js","sourceRoot":"","sources":["../../src/commands/depsCommand.ts"],"names":[],"mappings":";;;AAAA,qDAAwH;AAMxH,SAAgB,WAAW,CAAC,OAA2B;;IACrD,MAAM,IAAI,GAAG,IAAA,kCAAgB,EAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAE7C,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;KAClD;IAED,MAAM,YAAY,GAAG,IAAA,iCAAe,EAAC,IAAI,CAAC,CAAC;IAE3C,MAAM,UAAU,GAAG,IAAA,yCAAuB,EAAC,MAAA,OAAO,CAAC,KAAK,mCAAI,EAAE,EAAE,YAAY,CAAC,CAAC;IAC9E,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;IACnC,OAAO,CAAC,GAAG,CACT,UAAU;SACP,IAAI,EAAE;SACN,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;SACtB,IAAI,CAAC,IAAI,CAAC,CACd,CAAC;IAEF,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAEhB,MAAM,YAAY,GAAG,IAAA,2CAAyB,EAAC,MAAA,OAAO,CAAC,KAAK,mCAAI,EAAE,EAAE,YAAY,CAAC,CAAC;IAClF,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;IACxC,OAAO,CAAC,GAAG,CACT,YAAY;SACT,IAAI,EAAE;SACN,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;SACtB,IAAI,CAAC,IAAI,CAAC,CACd,CAAC;AACJ,CAAC;AA5BD,kCA4BC"}
package/lib/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {};
package/lib/index.js ADDED
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const commander_1 = __importDefault(require("commander"));
7
+ const depsCommand_1 = require("./commands/depsCommand");
8
+ async function main() {
9
+ try {
10
+ const program = new commander_1.default.Command();
11
+ program.version(require("../package.json").version);
12
+ program
13
+ .command("deps")
14
+ .description("Generate a list of dependencies and dependents for a package")
15
+ .option("--scope <package...>", "Package names, give multiple names by have multiple --scope flags")
16
+ .action(depsCommand_1.depsCommand);
17
+ program.parse(process.argv);
18
+ }
19
+ catch (e) {
20
+ if (e instanceof Error) {
21
+ console.error(e.stack);
22
+ }
23
+ else {
24
+ console.error(String(e));
25
+ }
26
+ process.exit(1);
27
+ }
28
+ }
29
+ main();
30
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,0DAAkC;AAClC,wDAAqD;AAErD,KAAK,UAAU,IAAI;IACjB,IAAI;QACF,MAAM,OAAO,GAAG,IAAI,mBAAS,CAAC,OAAO,EAAE,CAAC;QACxC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,CAAC;QACpD,OAAO;aACJ,OAAO,CAAC,MAAM,CAAC;aACf,WAAW,CAAC,8DAA8D,CAAC;aAC3E,MAAM,CAAC,sBAAsB,EAAE,mEAAmE,CAAC;aACnG,MAAM,CAAC,yBAAW,CAAC,CAAC;QAEvB,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;KAC7B;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,CAAC,YAAY,KAAK,EAAE;YACtB,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;SACxB;aAAM;YACL,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;SAC1B;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;AACH,CAAC;AAED,IAAI,EAAE,CAAC"}
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@ws-tools/grapher",
3
+ "version": "0.1.1",
4
+ "license": "MIT",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/microsoft/workspace-tools"
8
+ },
9
+ "bin": {
10
+ "grapher": "./bin/grapher.js"
11
+ },
12
+ "exports": null,
13
+ "files": [
14
+ "lib/!(__*)",
15
+ "lib/!(__*)/**/*"
16
+ ],
17
+ "scripts": {
18
+ "build": "tsc",
19
+ "start": "tsc -w --preserveWatchOutput",
20
+ "test": "jest"
21
+ },
22
+ "dependencies": {
23
+ "commander": "^10.0.1",
24
+ "workspace-tools": "^0.34.6"
25
+ },
26
+ "devDependencies": {
27
+ "@types/node": "^16.0.0",
28
+ "lodash": "4.17.21",
29
+ "workspace-tools-scripts": "*"
30
+ }
31
+ }