@kustodian/loader 1.0.0 → 1.0.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/README.md +59 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# @kustodian/loader
|
|
2
|
+
|
|
3
|
+
YAML file loading and validation utilities for Kustodian projects. This package provides type-safe functions to load, parse, and validate Kustodian configuration files including projects, clusters, templates, and node profiles.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun add @kustodian/loader
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## API Overview
|
|
12
|
+
|
|
13
|
+
### YAML Utilities
|
|
14
|
+
|
|
15
|
+
- `parse_yaml<T>(content)` - Parse a YAML string into a typed object
|
|
16
|
+
- `parse_multi_yaml<T>(content)` - Parse multi-document YAML (separated by `---`)
|
|
17
|
+
- `stringify_yaml<T>(data)` - Convert an object to a YAML string
|
|
18
|
+
|
|
19
|
+
### File Operations
|
|
20
|
+
|
|
21
|
+
- `file_exists(path)` - Check if a file exists
|
|
22
|
+
- `is_directory(path)` - Check if a path is a directory
|
|
23
|
+
- `read_file(path)` - Read file contents as string
|
|
24
|
+
- `write_file(path, content)` - Write content to file (creates directories as needed)
|
|
25
|
+
- `read_yaml_file<T>(path)` - Read and parse a YAML file
|
|
26
|
+
- `read_multi_yaml_file<T>(path)` - Read and parse a multi-document YAML file
|
|
27
|
+
- `write_yaml_file<T>(path, data)` - Write an object as YAML to file
|
|
28
|
+
- `list_files(dir, extension?)` - List files in directory with optional extension filter
|
|
29
|
+
- `list_directories(dir)` - List subdirectories in a directory
|
|
30
|
+
|
|
31
|
+
### Project Loading
|
|
32
|
+
|
|
33
|
+
- `find_project_root(startPath)` - Find project root by locating `kustodian.yaml`
|
|
34
|
+
- `load_project(projectRoot)` - Load a complete Kustodian project with all resources
|
|
35
|
+
- `load_template(templateDir)` - Load a single template
|
|
36
|
+
- `load_all_templates(projectRoot)` - Load all templates from `templates/` directory
|
|
37
|
+
- `load_cluster(clusterDir)` - Load a single cluster with its nodes
|
|
38
|
+
- `load_all_clusters(projectRoot)` - Load all clusters from `clusters/` directory
|
|
39
|
+
- `load_cluster_nodes(clusterDir, paths?)` - Load node definitions from files or directories
|
|
40
|
+
|
|
41
|
+
### Profile Loading
|
|
42
|
+
|
|
43
|
+
- `load_all_profiles(projectRoot)` - Load all node profiles from `profiles/` directory
|
|
44
|
+
- `get_profile(profiles, name)` - Get a profile by name from a profiles map
|
|
45
|
+
|
|
46
|
+
### Constants
|
|
47
|
+
|
|
48
|
+
- `StandardFiles` - Standard file names (`template.yaml`, `cluster.yaml`, `nodes.yaml`, `kustodian.yaml`)
|
|
49
|
+
- `StandardDirs` - Standard directory names (`templates`, `clusters`, `nodes`, `profiles`)
|
|
50
|
+
|
|
51
|
+
All functions return `ResultType<T, KustodianErrorType>` for type-safe error handling.
|
|
52
|
+
|
|
53
|
+
## License
|
|
54
|
+
|
|
55
|
+
MIT
|
|
56
|
+
|
|
57
|
+
## Repository
|
|
58
|
+
|
|
59
|
+
[https://github.com/lucasilverentand/kustodian](https://github.com/lucasilverentand/kustodian)
|