4.1.2 • Published 5 months ago

js2yaml v4.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

js2yaml

This small utility allows you to create configuration files with Javascript and convert them to YAML files on the fly.

How does it work

To get started, you have to provide a configuration file (e.g. js2yaml.config.js). E.g. the following configuration converts Javascript to YAML for Magnolia CMS:

module.exports = [
  {
    watch: "../magnolia/light-modules/**/*.js",
    processor: {
      // Process incoming JSON (optional)
      json: (json) => {
        return json
      },
      // Process resulting YAML (optional)
      yaml: (yaml) => {
        return (
          "# This file has been auto-generated.\n" +
          yaml
            .replace(/"!content-type": /g, "!content-type:")
            .replace(/"!inherit": /g, "!inherit:")
            .replace(/!override:/g, ": !override")
        )
      },
      // Process resulting filename (optional)
      file: (file) => {
        return file
      },
    },
  },
]

Now you can start the file watching process via:

node index.js js2yaml.config.js
4.1.0

9 months ago

4.1.2

5 months ago

4.1.1

6 months ago

3.0.0

9 months ago

4.0.0

9 months ago

2.2.0

12 months ago

2.1.3

1 year ago

2.1.2

1 year ago

2.1.1

1 year ago

2.1.0

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago