Skip to content

Commit bd669ed

Browse files
committed
Improve architecture and design principles documentation
1 parent 7b23ef1 commit bd669ed

File tree

8 files changed

+188
-64
lines changed

8 files changed

+188
-64
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Overview
2+
3+
Understanding the architecture and design principles of ts-graphviz helps you utilize the library more effectively and contribute to its development.
4+
5+
This section provides insights into the foundational concepts, architectural decisions, and guiding principles that shape ts-graphviz.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Design Principles
2+
3+
**ts-graphviz** is built around several key concepts that make it modular, extensible, and easy to use:
4+
5+
1. **TypeScript-First Design & Type Definitions**
6+
7+
**ts-graphviz** is designed primarily with TypeScript in mind, offering strong typing and seamless integration with TypeScript projects. Comprehensive type definitions for DOT language elements enable type-safe interactions, enhancing development efficiency and reducing errors.
8+
9+
1. **Object-Oriented API**
10+
11+
The library provides an object-oriented API for creating and manipulating graph elements such as graphs, nodes, and edges. This approach makes working with complex graph structures intuitive and efficient, leveraging familiar programming paradigms.
12+
13+
1. **Modular Design**
14+
15+
**ts-graphviz** adopts a modular architecture, split into multiple packages, each serving a specific purpose. This modularity allows users to include only the functionality they need, improving maintainability, flexibility, and reducing unnecessary dependencies.
16+
17+
1. **AST Support**
18+
19+
The library includes support for Abstract Syntax Trees (AST) for processing the DOT language. This enables parsing and generating DOT language while preserving its structure, facilitating programmatic manipulation and transformation of graphs.
20+
21+
1. **Runtime Adapter**
22+
23+
To ensure compatibility across different runtime environments, **ts-graphviz** provides adapter functions for environments like Node.js and Deno. These adapters serve as a wrapper, enabling seamless execution of Graphviz commands regardless of the underlying platform.
24+
25+
1. **Extensibility**
26+
27+
Designed with extensibility in mind, **ts-graphviz** allows users to extend its functionality with custom implementations for specific use cases. This flexibility supports a wide range of applications and integration scenarios.
28+
29+
1. **Multi-Paradigm Support**
30+
31+
The library accommodates various programming paradigms, including Object-Oriented Programming, Declarative Programming, and Functional Programming. Users can choose the style that best suits their needs, making the library versatile and adaptable.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Package Architecture
2+
3+
**ts-graphviz** consists of several packages, each with a specific role:
4+
5+
- **`ts-graphviz`** (Main Package): Provides high-level APIs for creating and manipulating graphs, suitable for most users.
6+
7+
- **`@ts-graphviz/core`**: Contains core implementations of models and functions, used internally and available for advanced use.
8+
9+
- **`@ts-graphviz/common`**: Aggregates Graphviz domain knowledge, providing type definitions, constants, and utilities. Supports use cases like extending custom types and attributes.
10+
11+
- **`@ts-graphviz/ast`**: Offers tools for parsing, manipulating, and generating DOT language graphs at the AST level.
12+
13+
- **`@ts-graphviz/adapter`**: Executes Graphviz commands in various runtime environments (Node.js, Deno) and converts DOT strings to images.
14+
15+
- **`@ts-graphviz/react`**: Allows defining graphs using React's declarative UI paradigm, expressing DOT language models with JSX.
16+
17+
## Dependency Graph
18+
19+
The relationships between packages can be visualized as follows:
20+
21+
![Dependency Graph](./img/dependency-graph.svg)
22+
23+
This modular architecture ensures:
24+
25+
- **Maintainability**: Individual packages can be maintained and updated without affecting others.
26+
27+
- **Flexibility**: Users can select only the packages needed for their specific use cases.
28+
29+
- **Extensibility**: Facilitates the addition of new features or packages as the library evolves.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
2+
# Versioning Policy
3+
4+
## Overview
5+
6+
**ts-graphviz** follows [**Semantic Versioning 2.0**](https://semver.org/) to ensure consistency and predictability. This policy clarifies how we manage breaking changes, especially those related to runtime support, and what users can expect when using **ts-graphviz**.
7+
8+
## Semantic Versioning
9+
10+
Version numbers are formatted as **MAJOR.MINOR.PATCH**, with changes classified as follows:
11+
12+
- **MAJOR**: Introduces backward-incompatible changes.
13+
- **MINOR**: Adds functionality in a backward-compatible manner.
14+
- **PATCH**: Fixes bugs in a backward-compatible manner.
15+
16+
---
17+
18+
## Exceptions: TypeScript Version Updates
19+
20+
There are scenarios where **ts-graphviz** may deviate from strict Semantic Versioning:
21+
22+
- **TypeScript Definitions**: Breaking changes to TypeScript type definitions may occur between minor versions due to:
23+
- TypeScript introducing breaking changes in its own minor updates.
24+
- Adopting features available only in newer TypeScript versions, which may raise the minimum required TypeScript version.
25+
26+
:::tip
27+
For TypeScript projects, we recommend pinning the **ts-graphviz** minor version to control upgrade timing and compatibility testing.
28+
:::
29+
30+
---
31+
32+
## Information Sharing
33+
34+
We are committed to transparent communication regarding our versioning and support policies:
35+
36+
- **Documentation and Release Notes**: All changes to the versioning policy and support levels will be documented in our official documentation and detailed in release notes.
37+
- **Community Engagement**: Users are encouraged to subscribe to updates or follow our repositories to stay informed about the latest developments.
38+
39+
---
40+
41+
## Migration Support
42+
43+
To assist users in transitioning between versions, especially when breaking changes occur:
44+
45+
- **Migration Guides**: We provide comprehensive migration guides outlining steps to upgrade to new major versions.
46+
- **Code Examples**: Examples are included to demonstrate how to adapt code to accommodate changes.
47+
- **Support Channels**: Users can seek assistance through community forums, issue trackers, or other support channels if they encounter difficulties during migration.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Supported Environments
2+
3+
To provide clarity on the environments in which **ts-graphviz** operates, we have categorized support levels:
4+
5+
## Support Levels
6+
7+
### Tier 1: Full Support
8+
9+
- **Definition**: Environments that are fully supported, with comprehensive automated testing and maintenance.
10+
- **Environments**:
11+
- **Node.js**: All active Long-Term Support (LTS) versions.
12+
- **Details**:
13+
- We run automated tests on all LTS versions of Node.js.
14+
- Full compatibility and performance are ensured.
15+
- Critical issues are prioritized for fixes.
16+
17+
### Tier 2: Active Support
18+
19+
- **Definition**: Environments that receive active support with limited automated testing.
20+
- **Environments**:
21+
- **Deno**: Latest stable version.
22+
- **Node.js Current Release**: The latest Node.js release outside the LTS schedule.
23+
- **Details**:
24+
- Automated tests are conducted on the latest version of Deno to confirm functionality.
25+
- Compatibility is maintained, and issues are addressed.
26+
27+
### Tier 3: Community Support
28+
29+
- **Definition**: Environments that are not officially tested but are supported on a best-effort basis.
30+
- **Environments**:
31+
- **Modern Browsers**: Latest versions of major browsers, including:
32+
- Google Chrome
33+
- Mozilla Firefox
34+
- Microsoft Edge
35+
- Apple Safari
36+
- **Details**:
37+
- Installation methods are provided.
38+
- No automated testing is performed.
39+
- Issues reported by users will be addressed.
40+
- Targeting the latest versions ensures compatibility with modern web standards.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Security Policies
2+
3+
## Purpose and Importance
4+
5+
In today's software development landscape, **open-source software (OSS)** plays an indispensable role in building applications. According to the **Open Source Security Foundation (OpenSSF)**, **70% to 90%** of modern applications consist of OSS components, and the complexity of their dependencies is increasing daily.
6+
7+
### The Impact and Responsibility of ts-graphviz
8+
9+
**ts-graphviz** is a widely used library with over 2 million downloads per month, impacting a broad range of applications. Even users who do not directly interact with ts-graphviz are affected through software that depends on it.
10+
11+
> ![Dependency](https://imgs.xkcd.com/comics/dependency.png)
12+
>
13+
> *An illustration of software dependencies (Source: [xkcd.com/2347](https://xkcd.com/2347/))*
14+
15+
This illustration highlights how modern software relies on numerous underlying components.
16+
17+
**Ensuring the security of ts-graphviz is crucial because vulnerabilities can cascade through dependencies, potentially affecting countless applications.**
18+
19+
## Commitment to Security
20+
21+
ts-graphviz is committed to more than just providing secure source code. We implement **comprehensive security measures** that consider the **entire software supply chain**. This dedication ensures that users can confidently adopt ts-graphviz, knowing it contributes to building secure and reliable applications.
22+
23+
## Software Supply Chain Security
24+
25+
Recognizing that modern applications are heavily dependent on open-source software, we implement practices that safeguard against vulnerabilities throughout the dependency chain.
26+
27+
## Reporting Vulnerabilities
28+
29+
We encourage users and security researchers to report any vulnerabilities or security concerns. Prompt reporting allows us to address issues swiftly, maintaining the integrity and security of the library.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"label": "Architecture and Design Principles",
3+
"link": {
4+
"type": "generated-index"
5+
}
6+
}
7+

docs/ts-graphviz/12-architecture-and-design-principles/index.md

Lines changed: 0 additions & 64 deletions
This file was deleted.

0 commit comments

Comments
 (0)