@infrascan/fs-connector 0.2.2 → 0.3.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.
@@ -0,0 +1,26 @@
1
+ import { Connector } from '@infrascan/shared-types';
2
+
3
+ /**
4
+ * Config for the file system resolver.
5
+ */
6
+ type FsResolverConfig = {
7
+ /**
8
+ * Pretty print state when writing to the fs.
9
+ */
10
+ prettyPrint?: boolean;
11
+ /**
12
+ * Force creation of the target directory. Note: this will enable recursive creation.
13
+ */
14
+ createTargetDirectory?: boolean;
15
+ };
16
+ declare const DEFAULT_CONFIG: Required<FsResolverConfig>;
17
+ /**
18
+ * Connector to store state in the local file system
19
+ * @param {string} basePath Directory to store Infrascan scan and graph state in
20
+ * @param {FsResolverConfig} config Configuration for the FS Connector
21
+ * @returns {Connector} Infrascan Connector
22
+ * @throws {Error} Errors from readDir, and readFile calls.
23
+ */
24
+ declare function buildFsConnector(basePath: string, config?: FsResolverConfig): Connector;
25
+
26
+ export { DEFAULT_CONFIG, type FsResolverConfig, buildFsConnector as default };
@@ -0,0 +1,26 @@
1
+ import { Connector } from '@infrascan/shared-types';
2
+
3
+ /**
4
+ * Config for the file system resolver.
5
+ */
6
+ type FsResolverConfig = {
7
+ /**
8
+ * Pretty print state when writing to the fs.
9
+ */
10
+ prettyPrint?: boolean;
11
+ /**
12
+ * Force creation of the target directory. Note: this will enable recursive creation.
13
+ */
14
+ createTargetDirectory?: boolean;
15
+ };
16
+ declare const DEFAULT_CONFIG: Required<FsResolverConfig>;
17
+ /**
18
+ * Connector to store state in the local file system
19
+ * @param {string} basePath Directory to store Infrascan scan and graph state in
20
+ * @param {FsResolverConfig} config Configuration for the FS Connector
21
+ * @returns {Connector} Infrascan Connector
22
+ * @throws {Error} Errors from readDir, and readFile calls.
23
+ */
24
+ declare function buildFsConnector(basePath: string, config?: FsResolverConfig): Connector;
25
+
26
+ export { DEFAULT_CONFIG, type FsResolverConfig, buildFsConnector as default };
package/dist/index.js CHANGED
@@ -17,13 +17,13 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // index.ts
21
- var fs_connector_exports = {};
22
- __export(fs_connector_exports, {
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
23
  DEFAULT_CONFIG: () => DEFAULT_CONFIG,
24
24
  default: () => buildFsConnector
25
25
  });
26
- module.exports = __toCommonJS(fs_connector_exports);
26
+ module.exports = __toCommonJS(index_exports);
27
27
  var import_fs = require("fs");
28
28
  var import_promises = require("fs/promises");
29
29
  var import_path = require("path");
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- // index.ts
1
+ // src/index.ts
2
2
  import { existsSync } from "fs";
3
3
  import { mkdir, readFile, readdir, writeFile } from "fs/promises";
4
4
  import { join, resolve } from "path";
package/package.json CHANGED
@@ -1,39 +1,26 @@
1
1
  {
2
2
  "name": "@infrascan/fs-connector",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "description": "Connector for the Infrascan SDK to read and write state to the local filesystem",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
7
7
  "types": "dist/index.d.ts",
8
+ "source": "src/index.ts",
8
9
  "exports": {
9
10
  ".": {
10
11
  "require": "./dist/index.js",
11
- "import": "./dist/index.mjs",
12
- "types": "./dist/index.d.ts"
12
+ "import": "./dist/index.mjs"
13
13
  }
14
14
  },
15
15
  "files": [
16
16
  "dist"
17
17
  ],
18
18
  "scripts": {
19
- "build": "rm -rf dist ; tsup",
20
- "prepublish": "rm -rf dist ; tsup",
19
+ "build": "rm -rf dist ; tsup --config internal/tsconfig/tsup.json",
20
+ "prepublish": "rm -rf dist ; tsup --config internal/tsconfig/tsup.json",
21
21
  "lint": "tsc --noEmit ; eslint .",
22
22
  "clean": "rm -rf dist node_modules"
23
23
  },
24
- "tsup": {
25
- "clean": true,
26
- "cjsInterop": true,
27
- "splitting": false,
28
- "entry": [
29
- "index.ts"
30
- ],
31
- "format": [
32
- "esm",
33
- "cjs"
34
- ],
35
- "target": "node18"
36
- },
37
24
  "keywords": [
38
25
  "AWS",
39
26
  "Infrastructure Diagram",
@@ -44,7 +31,7 @@
44
31
  "author": "Liam Farrelly <liam@l3f7.dev> (https://whoisli.am/)",
45
32
  "license": "MPL-2.0",
46
33
  "devDependencies": {
47
- "@infrascan/shared-types": "^0.2.2",
34
+ "@infrascan/shared-types": "^0.6.0",
48
35
  "eslint-config-custom": "*",
49
36
  "tsconfig": "*",
50
37
  "typescript": "^5.1.6"