Skip to content

Commit c75bd58

Browse files
Version Packages (#11)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 05df231 commit c75bd58

File tree

3 files changed

+102
-106
lines changed

3 files changed

+102
-106
lines changed

.changeset/plain-beers-win.md

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

CHANGELOG.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,106 @@
11
# @noxify/gitlab-ci-builder
22

3+
## 1.0.0
4+
5+
### Major Changes
6+
7+
- 05df231: Major Release: Improved Type Safety and GitLab CI Compatibility
8+
9+
This release brings significant improvements to type safety, extends resolution, and compatibility with complex GitLab CI configurations.
10+
11+
## Breaking Changes
12+
13+
### Architecture Refactoring
14+
15+
The internal architecture has been completely refactored for better type safety and reliability:
16+
- **Type System**: Job definitions now use explicit input/output types (`JobDefinitionInput`, `JobDefinitionNormalized`, `JobDefinitionOutput`) instead of a single `JobDefinition` type. This provides better IntelliSense support and catches errors at compile time.
17+
- **Extends Resolution**: Completely rewritten extends resolution with proper topological sorting, cycle detection, and merge strategies that match GitLab CI's behavior.
18+
- **State Management**: New internal `PipelineState` model for cleaner separation of concerns and better maintainability.
19+
20+
### What This Means for You
21+
22+
If you're using TypeScript, you may need to update type annotations that reference the old `JobDefinition` type. However, the **public API remains the same** - all existing code using `ConfigBuilder` should continue to work without changes.
23+
24+
## What's New
25+
26+
### Enhanced GitLab CI Compatibility
27+
- **Complex Script Support**: Full support for multiline scripts with shell operators, heredocs, and GitLab CI variables
28+
29+
```typescript
30+
config.job("release", {
31+
before_script: [
32+
"npm ci --cache .npm --prefer-offline",
33+
`{
34+
echo "@\${CI_PROJECT_ROOT_NAMESPACE}:registry=\${CI_API_V4_URL}/projects/\${CI_PROJECT_ID}/packages/npm/"
35+
echo "\${CI_API_V4_URL#https?}/projects/\${CI_PROJECT_ID}/packages/npm/:_authToken=\${CI_JOB_TOKEN}"
36+
} | tee -a .npmrc`,
37+
],
38+
})
39+
```
40+
41+
- **Array Syntax Normalization**: Single-element arrays in `extends` are now properly normalized to strings, matching GitLab CI's behavior
42+
43+
```yaml
44+
# Input YAML
45+
job:
46+
extends: [.base] # Single-element array
47+
48+
# Now correctly outputs
49+
job:
50+
extends: .base # Normalized to string
51+
```
52+
53+
- **Parallel Matrix Support**: Fixed schema to accept string, number, and array values for `parallel.matrix`, supporting all GitLab CI patterns
54+
```typescript
55+
config.job("test", {
56+
parallel: {
57+
matrix: [
58+
{ NODE_VERSION: "18" }, // String values ✓
59+
{ PARALLEL_COUNT: 3 }, // Number values ✓
60+
{ BROWSERS: ["chrome", "firefox"] }, // Array values ✓
61+
],
62+
},
63+
})
64+
```
65+
66+
### Import/Export Improvements
67+
- **Variable Preservation**: GitLab CI variables like `${CI_COMMIT_BRANCH}` are now correctly preserved during YAML import/export cycles
68+
- **Template Literal Escaping**: Fixed double-escaping bug in generated TypeScript code for multiline scripts
69+
70+
### Better Type Safety
71+
- **Explicit Types**: All pipeline components now have well-defined input and output types
72+
- **Union Type Handling**: Improved type guards for properties that can be strings or objects (like `environment`, `cache`, `needs`)
73+
- **Better IntelliSense**: More accurate autocomplete and type checking in your IDE
74+
75+
## Testing & Quality
76+
- **241 tests** covering all functionality
77+
- **86%+ test coverage** with comprehensive real-world use case tests
78+
- New test suites for:
79+
- Complex script handling with GitLab CI variables
80+
- Merge strategies and extends resolution
81+
- Pipeline state management
82+
- Real-world deployment scenarios
83+
84+
## Migration Guide
85+
86+
For most users, no changes are required. However, if you have TypeScript code that references internal types:
87+
88+
**Before:**
89+
90+
```typescript
91+
import type { JobDefinition } from "@noxify/gitlab-ci-builder"
92+
const job: JobDefinition = { ... }
93+
```
94+
95+
**After:**
96+
97+
```typescript
98+
import type { JobDefinitionInput } from "@noxify/gitlab-ci-builder"
99+
const job: JobDefinitionInput = { ... }
100+
```
101+
102+
The public API (`ConfigBuilder` methods, import/export functions) remains fully compatible with previous versions.
103+
3104
## 0.1.1
4105

5106
### Patch Changes

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@noxify/gitlab-ci-builder",
3-
"version": "0.1.1",
3+
"version": "1.0.0",
44
"description": "Create GitLab CI pipelines with TypeScript.",
55
"keywords": [
66
"gitlab",

0 commit comments

Comments
 (0)