circuit-json-to-connectivity-map 0.0.1 → 0.0.2
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/LICENSE +21 -0
- package/README.md +63 -4
- package/package.json +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 tscircuit Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Circuit JSON to Connectivity Map
|
|
2
|
+
|
|
3
|
+
This project provides utilities to generate connectivity maps from circuit JSON data. It's designed to work with the `@tscircuit/soup` library and offers functionality to find connected networks and create source port connectivity maps.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Find connected networks from a list of connections
|
|
8
|
+
- Generate source port connectivity maps from circuit JSON data
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
2
11
|
|
|
3
12
|
To install dependencies:
|
|
4
13
|
|
|
@@ -6,10 +15,60 @@ To install dependencies:
|
|
|
6
15
|
bun install
|
|
7
16
|
```
|
|
8
17
|
|
|
9
|
-
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
### Finding Connected Networks
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import { findConnectedNetworks } from "circuit-json-to-connectivity-map"
|
|
24
|
+
|
|
25
|
+
const connections = [
|
|
26
|
+
["A", "B"],
|
|
27
|
+
["B", "C"],
|
|
28
|
+
["D", "E"],
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
const result = findConnectedNetworks(connections)
|
|
32
|
+
console.log(result)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Generating Source Port Connectivity Map
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { getSoupPortConnectivityMapFromCircuitJson } from "circuit-json-to-connectivity-map"
|
|
39
|
+
import type { AnySoupElement } from "@tscircuit/soup"
|
|
40
|
+
|
|
41
|
+
const circuitJson: AnySoupElement[] = [
|
|
42
|
+
// Your circuit JSON data here
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
const connectivityMap = getSoupPortConnectivityMapFromCircuitJson(circuitJson)
|
|
46
|
+
console.log(connectivityMap)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Running Tests
|
|
50
|
+
|
|
51
|
+
To run the tests:
|
|
10
52
|
|
|
11
53
|
```bash
|
|
12
|
-
bun
|
|
54
|
+
bun test
|
|
13
55
|
```
|
|
14
56
|
|
|
15
|
-
|
|
57
|
+
## Development
|
|
58
|
+
|
|
59
|
+
This project uses [Bun](https://bun.sh) as its JavaScript runtime. Bun is a fast all-in-one JavaScript runtime.
|
|
60
|
+
|
|
61
|
+
To start development:
|
|
62
|
+
|
|
63
|
+
1. Clone the repository
|
|
64
|
+
2. Run `bun install` to install dependencies
|
|
65
|
+
3. Make your changes
|
|
66
|
+
4. Run `bun test` to ensure all tests pass
|
|
67
|
+
|
|
68
|
+
## Contributing
|
|
69
|
+
|
|
70
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
71
|
+
|
|
72
|
+
## License
|
|
73
|
+
|
|
74
|
+
[MIT License](LICENSE)
|