@infrascan/cli 0.3.1 → 0.4.0

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.
Files changed (2) hide show
  1. package/dist/index.mjs +12 -11
  2. package/package.json +6 -5
package/dist/index.mjs CHANGED
@@ -12,6 +12,7 @@ import {
12
12
  CommandLineAction
13
13
  } from "@rushstack/ts-command-line";
14
14
  import buildFsConnector from "@infrascan/fs-connector";
15
+ import { serializeGraph } from "@infrascan/cytoscape-serializer";
15
16
  function readScanMetadata(outputPath) {
16
17
  const scanMetadata = readFileSync(
17
18
  join(resolve(outputPath), "metadata.json"),
@@ -48,21 +49,21 @@ var GraphCmd = class extends CommandLineAction {
48
49
  this._outputDirectory.value
49
50
  );
50
51
  const connector = buildFsConnector(this._outputDirectory.value);
52
+ let nServicesScanned = 0;
53
+ this.infrascanClient.registerPlugin({
54
+ event: "onServiceComplete",
55
+ id: "countServicesScanner",
56
+ handler: () => {
57
+ nServicesScanned += 1;
58
+ }
59
+ });
51
60
  const graphData = await this.infrascanClient.generateGraph(
52
61
  scanMetadata,
53
- connector
62
+ connector,
63
+ serializeGraph
54
64
  );
55
- const graphNodes = graphData.filter(
56
- (elem) => elem.group === "nodes"
57
- );
58
- const mappedServices = graphNodes.reduce((acc, node) => {
59
- if (node?.data?.service) {
60
- acc.add(node.data.service);
61
- }
62
- return acc;
63
- }, /* @__PURE__ */ new Set());
64
65
  console.log(
65
- `Graph Complete. Found resources in ${mappedServices.size} services.`
66
+ `Graph Complete. Found resources in ${nServicesScanned} services.`
66
67
  );
67
68
  return writeGraphOutput(this._outputDirectory.value, graphData);
68
69
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrascan/cli",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "Thin command line wrapper around the infrascan sdk",
5
5
  "main": "dist/index.mjs",
6
6
  "scripts": {
@@ -37,18 +37,19 @@
37
37
  "license": "MPL-2.0",
38
38
  "dependencies": {
39
39
  "@aws-sdk/credential-providers": "3.428.0",
40
- "@infrascan/aws": "^0.4.0",
40
+ "@infrascan/aws": "^0.4.1",
41
+ "@infrascan/cytoscape-serializer": "^0.2.0",
41
42
  "@infrascan/fs-connector": "^0.2.2",
42
- "@infrascan/sdk": "^0.3.1",
43
+ "@infrascan/sdk": "^0.4.0",
43
44
  "@rushstack/ts-command-line": "^4.15.2",
44
45
  "@smithy/shared-ini-file-loader": "^2.2.2",
45
46
  "minimatch": "^6.1.6"
46
47
  },
47
48
  "devDependencies": {
48
49
  "@aws-sdk/types": "3.428.0",
49
- "@infrascan/shared-types": "^0.2.2",
50
+ "@infrascan/shared-types": "^0.4.0",
50
51
  "@smithy/types": "^2.4.0",
51
52
  "ts-node": "^10.9.1",
52
53
  "typescript": "^5.1.3"
53
54
  }
54
- }
55
+ }