New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

js2yaml

Package Overview
Dependencies
Maintainers
0
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js2yaml

Create configurations with the power of Javascript and convert it to YAML.

  • 4.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
30
increased by328.57%
Maintainers
0
Weekly downloads
 
Created
Source

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

Keywords

FAQs

Package last updated on 01 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc