https://github.com/hyperweb-io/yamlize
https://github.com/hyperweb-io/yamlize
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/hyperweb-io/yamlize
- Owner: hyperweb-io
- License: mit
- Created: 2024-05-03T06:50:12.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-25T21:29:58.000Z (about 2 years ago)
- Last Synced: 2025-04-16T03:57:26.979Z (about 1 year ago)
- Language: TypeScript
- Size: 302 KB
- Stars: 1
- Watchers: 6
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# yamlize
`yamlize` is a powerful tool designed to simplify the creation of YAML files by allowing dynamic generation based on predefined templates and contextual data. This tool is especially useful in environments where configurations need to be adjusted frequently, such as in CI/CD workflows. It provides flexibility in integrating changes seamlessly and ensures configurations are up-to-date with minimal manual intervention.
## install
```sh
npm install yamlize
```
For CI/CD and easier usage, use [our CLI](https://github.com/cosmology-tech/yamlize/tree/main/packages/cli):
```sh
npm install @yamlize/cli
```
or for your own use:
```sh
npm install -g @yamlize/cli
```
## Table of contents
- [yamlize](#yamlize)
- [Install](#install)
- [Usage](#usage)
- [Developing](#developing)
- [Credits](#credits)
## Usage
`yamlize` helps you dynamically generate YAML configurations using predefined templates and context. Hereβs how to use it with example YAML templates and the corresponding JavaScript function call:
### Example
**meta.yaml** - This is your main workflow template.
```yaml
name: Build
on:
workflow_dispatch:
jobs:
build-artifacts:
- import-yaml: node/setup.yaml
- import-yaml: git/configure.yaml
- name: Install and Build π
run: |
yarn
```
**node/setup.yaml** - Sets up your Node.js environment.
```yaml
name: Setup Node.js π
uses: actions/setup-node@v4
with:
node-version: ${{yamlize.NODE_VERSION}}
cache: 'yarn'
```
**git/configure.yaml** - Configures Git with user information.
```yaml
name: Configure Git π
run: |
git config user.name "${{yamlize.git.USER_NAME}}"
git config user.email "${{yamlize.git.USER_EMAIL}}"
```
### Invoking Yamlize
Provide the `meta.yaml` template and your specific context to generate the complete YAML configuration.
```js
yamlize(metaYaml, outFile, {
git: {
USER_NAME: 'Cosmology',
USER_EMAIL: 'developers@cosmology.zone',
},
EMSCRIPTEN_VERSION: '3.1.59',
NODE_VERSION: '20.x'
});
```
### Output Example
Here's the generated YAML configuration reflecting the provided context.
```yaml
name: Build
on:
workflow_dispatch: null
jobs:
build-artifacts:
- name: Setup Node.js π
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: yarn
- name: Configure Git π
run: |
git config user.name "Cosmology"
git config user.email "developers@cosmology.zone"
- name: Install and Build π
run: |
yarn
```
## Developing
When first cloning the repo:
```
yarn
yarn build
```
## Related
Checkout these related projects:
* [@cosmology/telescope](https://github.com/cosmology-tech/telescope) Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules.
* [@cosmwasm/ts-codegen](https://github.com/CosmWasm/ts-codegen) Convert your CosmWasm smart contracts into dev-friendly TypeScript classes.
* [chain-registry](https://github.com/cosmology-tech/chain-registry) Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application.
* [cosmos-kit](https://github.com/cosmology-tech/cosmos-kit) Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface.
* [create-cosmos-app](https://github.com/cosmology-tech/create-cosmos-app) Set up a modern Cosmos app by running one command.
* [interchain-ui](https://github.com/cosmology-tech/interchain-ui) The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit.
* [starship](https://github.com/cosmology-tech/starship) Unified Testing and Development for the Interchain.
## Credits
π Built by Cosmology βΒ if you like our tools, please consider delegating to [our validator βοΈ](https://cosmology.zone/validator)
## Disclaimer
AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED βAS ISβ, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.