@unispechq/unispec-core 0.1.0 → 0.1.1
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/.github/workflows/npm-publish.yml +74 -74
- package/.windsurfrules +138 -138
- package/README.md +223 -223
- package/package.json +28 -28
- package/scripts/release.js +51 -51
- package/src/converters/index.ts +120 -120
- package/src/diff/index.ts +235 -235
- package/src/index.ts +6 -6
- package/src/loader/index.ts +25 -25
- package/src/normalizer/index.ts +156 -156
- package/src/types/index.ts +67 -67
- package/src/validator/index.ts +61 -61
- package/tests/converters.test.mjs +126 -126
- package/tests/diff.test.mjs +240 -240
- package/tests/loader-validator.test.mjs +19 -19
- package/tests/normalizer.test.mjs +115 -115
- package/tsconfig.json +15 -15
- package/dist/converters/index.d.ts +0 -13
- package/dist/converters/index.js +0 -89
- package/dist/diff/index.d.ts +0 -21
- package/dist/diff/index.js +0 -195
- package/dist/index.d.ts +0 -6
- package/dist/index.js +0 -6
- package/dist/loader/index.d.ts +0 -13
- package/dist/loader/index.js +0 -19
- package/dist/normalizer/index.d.ts +0 -11
- package/dist/normalizer/index.js +0 -116
- package/dist/types/index.d.ts +0 -57
- package/dist/types/index.js +0 -1
- package/dist/validator/index.d.ts +0 -7
- package/dist/validator/index.js +0 -47
package/README.md
CHANGED
|
@@ -1,223 +1,223 @@
|
|
|
1
|
-
# UniSpec Core Platform
|
|
2
|
-
**The official UniSpec Core Engine package — parser, validator, normalizer, diff engine, and converters for the UniSpec format**
|
|
3
|
-
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
## 🚀 Overview
|
|
7
|
-
|
|
8
|
-
**UniSpec Core Engine** is the central runtime package of the UniSpec ecosystem.
|
|
9
|
-
It implements the mechanics of the **UniSpec Format**: loading, JSON Schema validation, normalization, diffing, and conversion to other formats.
|
|
10
|
-
|
|
11
|
-
This repository contains **only the Core Engine**, which is consumed by other UniSpec platform components (CLI, Registry, Portal, adapters, SDKs) that live in separate repositories.
|
|
12
|
-
|
|
13
|
-
Core Engine capabilities:
|
|
14
|
-
|
|
15
|
-
- 🧠 **Core Engine** — parser, validator, normalizer, diff engine, converters
|
|
16
|
-
- 🔄 **Format conversion** — UniSpec → OpenAPI, UniSpec → GraphQL SDL, UniSpec → WebSocket channel models
|
|
17
|
-
- 🧩 **Shared types and utilities** — types and helper functions used by the CLI, adapters, Registry, and Portal
|
|
18
|
-
|
|
19
|
-
UniSpec is designed to unify documentation for:
|
|
20
|
-
|
|
21
|
-
- REST
|
|
22
|
-
- GraphQL
|
|
23
|
-
- WebSocket
|
|
24
|
-
- Event-driven APIs (future)
|
|
25
|
-
- Multi-service architectures
|
|
26
|
-
|
|
27
|
-
---
|
|
28
|
-
|
|
29
|
-
## 📦 Repository Structure
|
|
30
|
-
|
|
31
|
-
```pgsql
|
|
32
|
-
unispec-core/
|
|
33
|
-
├─ src/
|
|
34
|
-
│ ├─ loader/ # File loading (YAML/JSON → JS object)
|
|
35
|
-
│ ├─ validator/ # JSON Schema validation
|
|
36
|
-
│ ├─ normalizer/ # UniSpec structure normalization
|
|
37
|
-
│ ├─ diff/ # Comparison of two UniSpec documents
|
|
38
|
-
│ ├─ converters/ # OpenAPI, GraphQL SDL, WS, etc.
|
|
39
|
-
│ ├─ types/ # UniSpec types/interfaces
|
|
40
|
-
│ ├─ utils/ # Small helpers
|
|
41
|
-
│ └─ index.ts # Public API
|
|
42
|
-
├─ tests/ # Unit tests
|
|
43
|
-
├─ package.json
|
|
44
|
-
└─ README.md
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
---
|
|
48
|
-
|
|
49
|
-
## 🧠 Core Concepts
|
|
50
|
-
|
|
51
|
-
### 📐 1. UniSpec Format
|
|
52
|
-
Defined in a separate repository: **`unispec-spec`**.
|
|
53
|
-
UniSpec Core Engine *implements* this format but does **not** define it.
|
|
54
|
-
|
|
55
|
-
### 🧱 2. Core Engine
|
|
56
|
-
Located in this repository, under the `src/` directory.
|
|
57
|
-
|
|
58
|
-
Core Engine provides:
|
|
59
|
-
|
|
60
|
-
- YAML/JSON loader
|
|
61
|
-
- JSON Schema validator
|
|
62
|
-
– Normalizer → canonical UniSpec output (REST paths/methods, GraphQL operations, WebSocket channels/messages)
|
|
63
|
-
– Diff engine (with basic breaking / non-breaking classification for REST, GraphQL and WebSocket)
|
|
64
|
-
– Converters:
|
|
65
|
-
- UniSpec → OpenAPI (REST-centric)
|
|
66
|
-
- UniSpec → GraphQL SDL
|
|
67
|
-
- UniSpec → WebSocket channel models for dashboards
|
|
68
|
-
|
|
69
|
-
This is the foundation used by:
|
|
70
|
-
|
|
71
|
-
- the CLI (in a separate repository/package)
|
|
72
|
-
- framework adapters
|
|
73
|
-
- Registry and Portal (as separate UniSpec platform services)
|
|
74
|
-
|
|
75
|
-
### 🌉 3. Protocol Coverage in Core
|
|
76
|
-
|
|
77
|
-
At the level of the Core Engine, protocol support is intentionally minimal but deterministic:
|
|
78
|
-
|
|
79
|
-
- **REST**
|
|
80
|
-
- Treated as a general OpenAPI-like structure defined by UniSpec JSON Schemas.
|
|
81
|
-
- Normalizer orders `paths` and HTTP methods for stable diffs.
|
|
82
|
-
- Diff engine annotates path/operation additions and removals with breaking/non-breaking severity.
|
|
83
|
-
- Converter exposes REST as an OpenAPI 3.1 document while preserving the original UniSpec under `x-unispec`.
|
|
84
|
-
|
|
85
|
-
- **GraphQL**
|
|
86
|
-
- Typed protocol with `schema` (SDL) and `operations` (queries/mutations/subscriptions).
|
|
87
|
-
- Normalizer orders operation names within each bucket.
|
|
88
|
-
- Diff engine annotates operation additions/removals as non-breaking/breaking.
|
|
89
|
-
- Converter either passes through user-provided SDL or generates a minimal, deterministic SDL shell.
|
|
90
|
-
|
|
91
|
-
- **WebSocket**
|
|
92
|
-
- Typed protocol with channels and messages, plus extensions.
|
|
93
|
-
- Normalizer orders channels by name and messages by `name` within each channel.
|
|
94
|
-
- Diff engine annotates channel/message additions/removals as non-breaking/breaking changes.
|
|
95
|
-
- Converter produces a dashboard-friendly model with service metadata, a normalized channel list and the raw protocol.
|
|
96
|
-
|
|
97
|
-
### 💻 4. CLI (separate platform component)
|
|
98
|
-
The CLI uses UniSpec Core Engine for validation, conversion, and working with UniSpec specifications.
|
|
99
|
-
|
|
100
|
-
Example UniSpec CLI commands:
|
|
101
|
-
|
|
102
|
-
```pgsql
|
|
103
|
-
unispec validate
|
|
104
|
-
unispec push
|
|
105
|
-
unispec dev
|
|
106
|
-
unispec open
|
|
107
|
-
unispec diff
|
|
108
|
-
unispec convert
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
### 🗂 5. Registry API (separate service)
|
|
113
|
-
Stores UniSpec specs from multiple services and uses Core Engine for validation, normalization, and change analysis.
|
|
114
|
-
Effectively acts as the "system of record" for all APIs in the company.
|
|
115
|
-
|
|
116
|
-
### 🌐 6. Portal Web + API (separate service)
|
|
117
|
-
API documentation portal built on top of UniSpec and Core Engine:
|
|
118
|
-
|
|
119
|
-
- service catalog
|
|
120
|
-
- API endpoints
|
|
121
|
-
- schemas
|
|
122
|
-
- interactive playgrounds
|
|
123
|
-
- version comparison
|
|
124
|
-
|
|
125
|
-
---
|
|
126
|
-
|
|
127
|
-
## 🛒 Use Cases
|
|
128
|
-
|
|
129
|
-
### 🟦 Monolith mode (Swagger-like)
|
|
130
|
-
A backend service includes an adapter →
|
|
131
|
-
`/unispec.json` + `/docs` are served automatically.
|
|
132
|
-
|
|
133
|
-
### 🟧 Microservice mode
|
|
134
|
-
Each service pushes its UniSpec into Registry →
|
|
135
|
-
Portal Web assembles your entire company's API landscape.
|
|
136
|
-
|
|
137
|
-
### 🟩 Enterprise mode
|
|
138
|
-
Includes:
|
|
139
|
-
|
|
140
|
-
- SSO / permissions
|
|
141
|
-
- RBAC
|
|
142
|
-
- auditing
|
|
143
|
-
- topology map
|
|
144
|
-
- advanced analytics
|
|
145
|
-
|
|
146
|
-
(Handled via private repos.)
|
|
147
|
-
|
|
148
|
-
---
|
|
149
|
-
|
|
150
|
-
## 🏁 Getting Started
|
|
151
|
-
|
|
152
|
-
### 1. Clone the repo
|
|
153
|
-
|
|
154
|
-
```pgsql
|
|
155
|
-
git clone https://github.com/unispec/unispec-core.git
|
|
156
|
-
cd unispec-core
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
### 2. Install dependencies
|
|
160
|
-
|
|
161
|
-
```pgsql
|
|
162
|
-
pnpm install
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
### 3. Build all packages
|
|
166
|
-
|
|
167
|
-
```pgsql
|
|
168
|
-
pnpm build
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
### 4. Run locally (dev mode)
|
|
172
|
-
|
|
173
|
-
---
|
|
174
|
-
|
|
175
|
-
## 🤝 Contributing
|
|
176
|
-
|
|
177
|
-
Contributions are welcome!
|
|
178
|
-
Before contributing, please review:
|
|
179
|
-
|
|
180
|
-
- `docs/development.md`
|
|
181
|
-
- `.windsurfrules`
|
|
182
|
-
|
|
183
|
-
All core changes must comply with:
|
|
184
|
-
|
|
185
|
-
- the UniSpec format from `unispec-spec`
|
|
186
|
-
- compatibility rules
|
|
187
|
-
- test coverage
|
|
188
|
-
- platform architecture
|
|
189
|
-
|
|
190
|
-
---
|
|
191
|
-
|
|
192
|
-
## Related Repositories
|
|
193
|
-
|
|
194
|
-
| Repository | Purpose |
|
|
195
|
-
|------------------------|---------|
|
|
196
|
-
| `unispec-spec` | UniSpec format definition (schemas, examples) |
|
|
197
|
-
| `unispec-core` | **This repo** — UniSpec Core Engine implementation |
|
|
198
|
-
| `unispec-docs` | Documentation site |
|
|
199
|
-
| `unispec-js-adapters` | Framework integrations (Express/Nest/Fastify) built on top of Core Engine |
|
|
200
|
-
| `unispec-infra` | Helm charts, Docker, Terraform for deploying the UniSpec platform |
|
|
201
|
-
|
|
202
|
-
---
|
|
203
|
-
|
|
204
|
-
## License
|
|
205
|
-
|
|
206
|
-
UniSpec Core Engine is open-source and free to use under the MIT License.
|
|
207
|
-
|
|
208
|
-
---
|
|
209
|
-
|
|
210
|
-
## 🔥 Summary
|
|
211
|
-
|
|
212
|
-
`unispec-core` is the **heart of the UniSpec ecosystem** at the code level.
|
|
213
|
-
It provides the Core Engine used to:
|
|
214
|
-
|
|
215
|
-
- validate
|
|
216
|
-
- normalize
|
|
217
|
-
- diff
|
|
218
|
-
- convert
|
|
219
|
-
- and integrate
|
|
220
|
-
|
|
221
|
-
API specifications in the UniSpec format.
|
|
222
|
-
|
|
223
|
-
If you're building tools, adapters, or platform services that rely on UniSpec → **this is where the engine lives.**
|
|
1
|
+
# UniSpec Core Platform
|
|
2
|
+
**The official UniSpec Core Engine package — parser, validator, normalizer, diff engine, and converters for the UniSpec format**
|
|
3
|
+
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## 🚀 Overview
|
|
7
|
+
|
|
8
|
+
**UniSpec Core Engine** is the central runtime package of the UniSpec ecosystem.
|
|
9
|
+
It implements the mechanics of the **UniSpec Format**: loading, JSON Schema validation, normalization, diffing, and conversion to other formats.
|
|
10
|
+
|
|
11
|
+
This repository contains **only the Core Engine**, which is consumed by other UniSpec platform components (CLI, Registry, Portal, adapters, SDKs) that live in separate repositories.
|
|
12
|
+
|
|
13
|
+
Core Engine capabilities:
|
|
14
|
+
|
|
15
|
+
- 🧠 **Core Engine** — parser, validator, normalizer, diff engine, converters
|
|
16
|
+
- 🔄 **Format conversion** — UniSpec → OpenAPI, UniSpec → GraphQL SDL, UniSpec → WebSocket channel models
|
|
17
|
+
- 🧩 **Shared types and utilities** — types and helper functions used by the CLI, adapters, Registry, and Portal
|
|
18
|
+
|
|
19
|
+
UniSpec is designed to unify documentation for:
|
|
20
|
+
|
|
21
|
+
- REST
|
|
22
|
+
- GraphQL
|
|
23
|
+
- WebSocket
|
|
24
|
+
- Event-driven APIs (future)
|
|
25
|
+
- Multi-service architectures
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 📦 Repository Structure
|
|
30
|
+
|
|
31
|
+
```pgsql
|
|
32
|
+
unispec-core/
|
|
33
|
+
├─ src/
|
|
34
|
+
│ ├─ loader/ # File loading (YAML/JSON → JS object)
|
|
35
|
+
│ ├─ validator/ # JSON Schema validation
|
|
36
|
+
│ ├─ normalizer/ # UniSpec structure normalization
|
|
37
|
+
│ ├─ diff/ # Comparison of two UniSpec documents
|
|
38
|
+
│ ├─ converters/ # OpenAPI, GraphQL SDL, WS, etc.
|
|
39
|
+
│ ├─ types/ # UniSpec types/interfaces
|
|
40
|
+
│ ├─ utils/ # Small helpers
|
|
41
|
+
│ └─ index.ts # Public API
|
|
42
|
+
├─ tests/ # Unit tests
|
|
43
|
+
├─ package.json
|
|
44
|
+
└─ README.md
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 🧠 Core Concepts
|
|
50
|
+
|
|
51
|
+
### 📐 1. UniSpec Format
|
|
52
|
+
Defined in a separate repository: **`unispec-spec`**.
|
|
53
|
+
UniSpec Core Engine *implements* this format but does **not** define it.
|
|
54
|
+
|
|
55
|
+
### 🧱 2. Core Engine
|
|
56
|
+
Located in this repository, under the `src/` directory.
|
|
57
|
+
|
|
58
|
+
Core Engine provides:
|
|
59
|
+
|
|
60
|
+
- YAML/JSON loader
|
|
61
|
+
- JSON Schema validator
|
|
62
|
+
– Normalizer → canonical UniSpec output (REST paths/methods, GraphQL operations, WebSocket channels/messages)
|
|
63
|
+
– Diff engine (with basic breaking / non-breaking classification for REST, GraphQL and WebSocket)
|
|
64
|
+
– Converters:
|
|
65
|
+
- UniSpec → OpenAPI (REST-centric)
|
|
66
|
+
- UniSpec → GraphQL SDL
|
|
67
|
+
- UniSpec → WebSocket channel models for dashboards
|
|
68
|
+
|
|
69
|
+
This is the foundation used by:
|
|
70
|
+
|
|
71
|
+
- the CLI (in a separate repository/package)
|
|
72
|
+
- framework adapters
|
|
73
|
+
- Registry and Portal (as separate UniSpec platform services)
|
|
74
|
+
|
|
75
|
+
### 🌉 3. Protocol Coverage in Core
|
|
76
|
+
|
|
77
|
+
At the level of the Core Engine, protocol support is intentionally minimal but deterministic:
|
|
78
|
+
|
|
79
|
+
- **REST**
|
|
80
|
+
- Treated as a general OpenAPI-like structure defined by UniSpec JSON Schemas.
|
|
81
|
+
- Normalizer orders `paths` and HTTP methods for stable diffs.
|
|
82
|
+
- Diff engine annotates path/operation additions and removals with breaking/non-breaking severity.
|
|
83
|
+
- Converter exposes REST as an OpenAPI 3.1 document while preserving the original UniSpec under `x-unispec`.
|
|
84
|
+
|
|
85
|
+
- **GraphQL**
|
|
86
|
+
- Typed protocol with `schema` (SDL) and `operations` (queries/mutations/subscriptions).
|
|
87
|
+
- Normalizer orders operation names within each bucket.
|
|
88
|
+
- Diff engine annotates operation additions/removals as non-breaking/breaking.
|
|
89
|
+
- Converter either passes through user-provided SDL or generates a minimal, deterministic SDL shell.
|
|
90
|
+
|
|
91
|
+
- **WebSocket**
|
|
92
|
+
- Typed protocol with channels and messages, plus extensions.
|
|
93
|
+
- Normalizer orders channels by name and messages by `name` within each channel.
|
|
94
|
+
- Diff engine annotates channel/message additions/removals as non-breaking/breaking changes.
|
|
95
|
+
- Converter produces a dashboard-friendly model with service metadata, a normalized channel list and the raw protocol.
|
|
96
|
+
|
|
97
|
+
### 💻 4. CLI (separate platform component)
|
|
98
|
+
The CLI uses UniSpec Core Engine for validation, conversion, and working with UniSpec specifications.
|
|
99
|
+
|
|
100
|
+
Example UniSpec CLI commands:
|
|
101
|
+
|
|
102
|
+
```pgsql
|
|
103
|
+
unispec validate
|
|
104
|
+
unispec push
|
|
105
|
+
unispec dev
|
|
106
|
+
unispec open
|
|
107
|
+
unispec diff
|
|
108
|
+
unispec convert
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
### 🗂 5. Registry API (separate service)
|
|
113
|
+
Stores UniSpec specs from multiple services and uses Core Engine for validation, normalization, and change analysis.
|
|
114
|
+
Effectively acts as the "system of record" for all APIs in the company.
|
|
115
|
+
|
|
116
|
+
### 🌐 6. Portal Web + API (separate service)
|
|
117
|
+
API documentation portal built on top of UniSpec and Core Engine:
|
|
118
|
+
|
|
119
|
+
- service catalog
|
|
120
|
+
- API endpoints
|
|
121
|
+
- schemas
|
|
122
|
+
- interactive playgrounds
|
|
123
|
+
- version comparison
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## 🛒 Use Cases
|
|
128
|
+
|
|
129
|
+
### 🟦 Monolith mode (Swagger-like)
|
|
130
|
+
A backend service includes an adapter →
|
|
131
|
+
`/unispec.json` + `/docs` are served automatically.
|
|
132
|
+
|
|
133
|
+
### 🟧 Microservice mode
|
|
134
|
+
Each service pushes its UniSpec into Registry →
|
|
135
|
+
Portal Web assembles your entire company's API landscape.
|
|
136
|
+
|
|
137
|
+
### 🟩 Enterprise mode
|
|
138
|
+
Includes:
|
|
139
|
+
|
|
140
|
+
- SSO / permissions
|
|
141
|
+
- RBAC
|
|
142
|
+
- auditing
|
|
143
|
+
- topology map
|
|
144
|
+
- advanced analytics
|
|
145
|
+
|
|
146
|
+
(Handled via private repos.)
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## 🏁 Getting Started
|
|
151
|
+
|
|
152
|
+
### 1. Clone the repo
|
|
153
|
+
|
|
154
|
+
```pgsql
|
|
155
|
+
git clone https://github.com/unispec/unispec-core.git
|
|
156
|
+
cd unispec-core
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### 2. Install dependencies
|
|
160
|
+
|
|
161
|
+
```pgsql
|
|
162
|
+
pnpm install
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### 3. Build all packages
|
|
166
|
+
|
|
167
|
+
```pgsql
|
|
168
|
+
pnpm build
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### 4. Run locally (dev mode)
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## 🤝 Contributing
|
|
176
|
+
|
|
177
|
+
Contributions are welcome!
|
|
178
|
+
Before contributing, please review:
|
|
179
|
+
|
|
180
|
+
- `docs/development.md`
|
|
181
|
+
- `.windsurfrules`
|
|
182
|
+
|
|
183
|
+
All core changes must comply with:
|
|
184
|
+
|
|
185
|
+
- the UniSpec format from `unispec-spec`
|
|
186
|
+
- compatibility rules
|
|
187
|
+
- test coverage
|
|
188
|
+
- platform architecture
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Related Repositories
|
|
193
|
+
|
|
194
|
+
| Repository | Purpose |
|
|
195
|
+
|------------------------|---------|
|
|
196
|
+
| `unispec-spec` | UniSpec format definition (schemas, examples) |
|
|
197
|
+
| `unispec-core` | **This repo** — UniSpec Core Engine implementation |
|
|
198
|
+
| `unispec-docs` | Documentation site |
|
|
199
|
+
| `unispec-js-adapters` | Framework integrations (Express/Nest/Fastify) built on top of Core Engine |
|
|
200
|
+
| `unispec-infra` | Helm charts, Docker, Terraform for deploying the UniSpec platform |
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## License
|
|
205
|
+
|
|
206
|
+
UniSpec Core Engine is open-source and free to use under the MIT License.
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## 🔥 Summary
|
|
211
|
+
|
|
212
|
+
`unispec-core` is the **heart of the UniSpec ecosystem** at the code level.
|
|
213
|
+
It provides the Core Engine used to:
|
|
214
|
+
|
|
215
|
+
- validate
|
|
216
|
+
- normalize
|
|
217
|
+
- diff
|
|
218
|
+
- convert
|
|
219
|
+
- and integrate
|
|
220
|
+
|
|
221
|
+
API specifications in the UniSpec format.
|
|
222
|
+
|
|
223
|
+
If you're building tools, adapters, or platform services that rely on UniSpec → **this is where the engine lives.**
|
package/package.json
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@unispechq/unispec-core",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Central UniSpec Core Engine providing parsing, validation, normalization, diffing, and conversion of UniSpec specs.",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"main": "dist/index.cjs",
|
|
8
|
-
"module": "dist/index.js",
|
|
9
|
-
"types": "dist/index.d.ts",
|
|
10
|
-
"scripts": {
|
|
11
|
-
"build": "tsc -p tsconfig.json",
|
|
12
|
-
"test": "npm run build && node --test tests/*.test.mjs",
|
|
13
|
-
"release:patch": "node scripts/release.js patch",
|
|
14
|
-
"release:minor": "node scripts/release.js minor",
|
|
15
|
-
"release:major": "node scripts/release.js major"
|
|
16
|
-
},
|
|
17
|
-
"dependencies": {
|
|
18
|
-
"@unispechq/unispec-schema": "^0.2.1",
|
|
19
|
-
"ajv": "^8.12.0"
|
|
20
|
-
},
|
|
21
|
-
"devDependencies": {
|
|
22
|
-
"@types/node": "^24.10.1",
|
|
23
|
-
"typescript": "^5.0.0"
|
|
24
|
-
},
|
|
25
|
-
"publishConfig": {
|
|
26
|
-
"access": "public"
|
|
27
|
-
}
|
|
28
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@unispechq/unispec-core",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Central UniSpec Core Engine providing parsing, validation, normalization, diffing, and conversion of UniSpec specs.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/index.cjs",
|
|
8
|
+
"module": "dist/index.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc -p tsconfig.json",
|
|
12
|
+
"test": "npm run build && node --test tests/*.test.mjs",
|
|
13
|
+
"release:patch": "node scripts/release.js patch",
|
|
14
|
+
"release:minor": "node scripts/release.js minor",
|
|
15
|
+
"release:major": "node scripts/release.js major"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@unispechq/unispec-schema": "^0.2.1",
|
|
19
|
+
"ajv": "^8.12.0"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/node": "^24.10.1",
|
|
23
|
+
"typescript": "^5.0.0"
|
|
24
|
+
},
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
}
|
|
28
|
+
}
|
package/scripts/release.js
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { execSync } from 'node:child_process';
|
|
4
|
-
import { readFileSync, writeFileSync } from 'node:fs';
|
|
5
|
-
import { join } from 'node:path';
|
|
6
|
-
|
|
7
|
-
const bumpType = process.argv[2];
|
|
8
|
-
|
|
9
|
-
if (!['patch', 'minor', 'major'].includes(bumpType)) {
|
|
10
|
-
console.error('Usage: npm run release:<patch|minor|major>');
|
|
11
|
-
process.exit(1);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const root = process.cwd();
|
|
15
|
-
const pkgPath = join(root, 'package.json');
|
|
16
|
-
|
|
17
|
-
const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
|
|
18
|
-
|
|
19
|
-
function bumpVersion(version, type) {
|
|
20
|
-
const [major, minor, patch] = version.split('.').map(Number);
|
|
21
|
-
|
|
22
|
-
if (type === 'patch') return `${major}.${minor}.${patch + 1}`;
|
|
23
|
-
if (type === 'minor') return `${major}.${minor + 1}.0`;
|
|
24
|
-
if (type === 'major') return `${major + 1}.0.0`;
|
|
25
|
-
|
|
26
|
-
throw new Error(`Unsupported bump type: ${type}`);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const oldVersion = pkg.version;
|
|
30
|
-
if (!oldVersion) {
|
|
31
|
-
console.error('package.json has no version field');
|
|
32
|
-
process.exit(1);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const newVersion = bumpVersion(oldVersion, bumpType);
|
|
36
|
-
pkg.version = newVersion;
|
|
37
|
-
|
|
38
|
-
writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n', 'utf8');
|
|
39
|
-
|
|
40
|
-
const currentBranch = execSync('git rev-parse --abbrev-ref HEAD').toString().trim();
|
|
41
|
-
|
|
42
|
-
execSync('git add package.json', { stdio: 'inherit' });
|
|
43
|
-
execSync(`git commit -m "chore: release unispec-core v${newVersion}"`, { stdio: 'inherit' });
|
|
44
|
-
|
|
45
|
-
const tagName = `unispec-core-v${newVersion}`;
|
|
46
|
-
execSync(`git tag ${tagName}`, { stdio: 'inherit' });
|
|
47
|
-
|
|
48
|
-
execSync(`git push origin ${currentBranch}`, { stdio: 'inherit' });
|
|
49
|
-
execSync(`git push origin ${tagName}`, { stdio: 'inherit' });
|
|
50
|
-
|
|
51
|
-
console.log(`\nPushed ${currentBranch} and tag ${tagName} to origin.`);
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { execSync } from 'node:child_process';
|
|
4
|
+
import { readFileSync, writeFileSync } from 'node:fs';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
|
|
7
|
+
const bumpType = process.argv[2];
|
|
8
|
+
|
|
9
|
+
if (!['patch', 'minor', 'major'].includes(bumpType)) {
|
|
10
|
+
console.error('Usage: npm run release:<patch|minor|major>');
|
|
11
|
+
process.exit(1);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const root = process.cwd();
|
|
15
|
+
const pkgPath = join(root, 'package.json');
|
|
16
|
+
|
|
17
|
+
const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
|
|
18
|
+
|
|
19
|
+
function bumpVersion(version, type) {
|
|
20
|
+
const [major, minor, patch] = version.split('.').map(Number);
|
|
21
|
+
|
|
22
|
+
if (type === 'patch') return `${major}.${minor}.${patch + 1}`;
|
|
23
|
+
if (type === 'minor') return `${major}.${minor + 1}.0`;
|
|
24
|
+
if (type === 'major') return `${major + 1}.0.0`;
|
|
25
|
+
|
|
26
|
+
throw new Error(`Unsupported bump type: ${type}`);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const oldVersion = pkg.version;
|
|
30
|
+
if (!oldVersion) {
|
|
31
|
+
console.error('package.json has no version field');
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const newVersion = bumpVersion(oldVersion, bumpType);
|
|
36
|
+
pkg.version = newVersion;
|
|
37
|
+
|
|
38
|
+
writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n', 'utf8');
|
|
39
|
+
|
|
40
|
+
const currentBranch = execSync('git rev-parse --abbrev-ref HEAD').toString().trim();
|
|
41
|
+
|
|
42
|
+
execSync('git add package.json', { stdio: 'inherit' });
|
|
43
|
+
execSync(`git commit -m "chore: release unispec-core v${newVersion}"`, { stdio: 'inherit' });
|
|
44
|
+
|
|
45
|
+
const tagName = `unispec-core-v${newVersion}`;
|
|
46
|
+
execSync(`git tag ${tagName}`, { stdio: 'inherit' });
|
|
47
|
+
|
|
48
|
+
execSync(`git push origin ${currentBranch}`, { stdio: 'inherit' });
|
|
49
|
+
execSync(`git push origin ${tagName}`, { stdio: 'inherit' });
|
|
50
|
+
|
|
51
|
+
console.log(`\nPushed ${currentBranch} and tag ${tagName} to origin.`);
|