@vsirotin/ts-stop 0.5.1 → 0.5.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/README.md +2 -130
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,116 +6,17 @@ DEvelopment in progress.
|
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
9
|
-
### From NPM
|
|
9
|
+
### From NPM
|
|
10
10
|
```bash
|
|
11
11
|
npm install @vsirotin/ts-stop
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
### Local Installation for Another Project
|
|
15
14
|
|
|
16
|
-
If you want to use this package in another project without publishing to NPM:
|
|
17
|
-
|
|
18
|
-
#### Step 1: Build and Pack the Library
|
|
19
|
-
```bash
|
|
20
|
-
# In the ts-stop directory
|
|
21
|
-
cd /path/to/StOP/ts/ts-stop
|
|
22
|
-
npm run build
|
|
23
|
-
npm pack
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
This creates a file `vsirotin-ts-stop-<version>.tgz` in the ts-stop directory.
|
|
27
|
-
|
|
28
|
-
#### Step 2: Install in Your Project
|
|
29
|
-
|
|
30
|
-
Choose one of these methods:
|
|
31
|
-
|
|
32
|
-
**Method 1: Install from Tarball (Recommended)**
|
|
33
|
-
```bash
|
|
34
|
-
# In your project directory
|
|
35
|
-
npm install /Users/viktorsirotin/VSCodeProjects/StOP/ts/ts-stop/vsirotin-ts-stop-0.0.1.tgz
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
**Method 2: Install from Directory**
|
|
39
|
-
```bash
|
|
40
|
-
# In your project directory
|
|
41
|
-
npm install /path/to/StOP/ts/ts-stop
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
**Method 3: Add to package.json**
|
|
45
|
-
```json
|
|
46
|
-
{
|
|
47
|
-
"dependencies": {
|
|
48
|
-
"@vsirotin/ts-stop": "file:/path/to/StOP/ts/ts-stop"
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
```
|
|
52
|
-
Then run `npm install`.
|
|
53
|
-
|
|
54
|
-
#### Step 3: Update After Changes
|
|
55
|
-
|
|
56
|
-
When you make changes to the ts-stop library:
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
# In the ts-stop directory
|
|
60
|
-
npm run build
|
|
61
|
-
npm pack
|
|
62
|
-
|
|
63
|
-
# In your project directory
|
|
64
|
-
npm install /path/to/StOP/ts/ts-stop/vsirotin-ts-stop-0.0.1.tgz --force
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
Or if using Method 2 or 3:
|
|
68
|
-
```bash
|
|
69
|
-
# In your project directory
|
|
70
|
-
npm install --force
|
|
71
|
-
```
|
|
72
15
|
|
|
73
16
|
## Usage
|
|
74
17
|
|
|
75
|
-
|
|
76
|
-
import { FiniteStateMachine, DefaultState } from '@vsirotin/ts-stop';
|
|
77
|
-
|
|
78
|
-
// Example: Simple State Machine
|
|
79
|
-
const states = [/* your states */];
|
|
80
|
-
const signals = [/* your signals */];
|
|
81
|
-
const transitions = [/* your transitions */];
|
|
82
|
-
const startState = states[0];
|
|
18
|
+
See documentation on https://github.com/vsirotin/StOP/blob/4d8c2d42601e35453c08a74a7eda75ddc1725e4e/README.md
|
|
83
19
|
|
|
84
|
-
const machine = new FiniteStateMachine(
|
|
85
|
-
states,
|
|
86
|
-
signals,
|
|
87
|
-
transitions,
|
|
88
|
-
startState
|
|
89
|
-
);
|
|
90
|
-
|
|
91
|
-
// Process signals
|
|
92
|
-
machine.processSignal(someSignal);
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
## Development
|
|
96
|
-
|
|
97
|
-
### Build
|
|
98
|
-
```bash
|
|
99
|
-
npm run build # Build both CommonJS and ESM versions
|
|
100
|
-
npm run build:cjs # Build CommonJS version only
|
|
101
|
-
npm run build:esm # Build ESM version only
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
### Test
|
|
105
|
-
```bash
|
|
106
|
-
npm test # Run tests
|
|
107
|
-
npm run test:coverage # Run tests with coverage
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
### Clean
|
|
111
|
-
```bash
|
|
112
|
-
npm run clean # Remove build artifacts
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
### Package
|
|
116
|
-
```bash
|
|
117
|
-
npm run pack # Build and create tarball for distribution
|
|
118
|
-
```
|
|
119
20
|
|
|
120
21
|
## Package Structure
|
|
121
22
|
|
|
@@ -138,35 +39,6 @@ The package includes:
|
|
|
138
39
|
- **TypeScript declarations** (`.d.ts`) for type checking
|
|
139
40
|
- **Source maps** for debugging
|
|
140
41
|
|
|
141
|
-
## Using the Package Locally
|
|
142
|
-
|
|
143
|
-
To use this package in another project without publishing to NPM:
|
|
144
|
-
|
|
145
|
-
### Method 1: Direct Installation
|
|
146
|
-
```bash
|
|
147
|
-
# From your target project directory
|
|
148
|
-
npm install /path/to/StOP/ts/ts-stop
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
### Method 2: Using the Packed Tarball
|
|
152
|
-
```bash
|
|
153
|
-
# In ts-stop directory
|
|
154
|
-
npm run pack
|
|
155
|
-
|
|
156
|
-
# In your target project directory
|
|
157
|
-
npm install /path/to/StOP/ts/ts-stop/vsirotin-ts-stop-0.0.1.tgz
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
### Method 3: Using package.json
|
|
161
|
-
In your target project's `package.json`:
|
|
162
|
-
```json
|
|
163
|
-
{
|
|
164
|
-
"dependencies": {
|
|
165
|
-
"@vsirotin/ts-stop": "file:../StOP/ts/ts-stop"
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
```
|
|
169
|
-
Then run `npm install`.
|
|
170
42
|
|
|
171
43
|
## License
|
|
172
44
|
|