How to use the yaml.default.stringify function in yaml

To help you get started, we’ve selected a few yaml examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github back4app / antframework / packages / ant / lib / config / Config.js View on Github external
`Could not load config ${this._path}`,
              e
            );
          }
        }
        this._config = new yaml.Document();
        this._config.contents = new Map();
        fs.writeFileSync(this._path, this._config.toString());
        logger.log(`Configuration file successfully written at: ${this._path}`);
      } else {
        throw new AntError(`Could not load config at "${this._path}".`);
      }
    } else {
      // Stringifies the configuration at "params" and then parses it to
      // generate our YAML document tree.
      this._config = yaml.parseDocument(yaml.stringify(params));
    }
  }
github lmammino / loige.co / import.js View on Github external
const oldHeaderLocation = join(src, post.attributes.header_img.replace(/^\/content\//, ''))
      const newHeaderLocation = join(postDestDir, basename(post.attributes.header_img))
      filesToCopy.push({ src: oldHeaderLocation, dest: newHeaderLocation })
      post.attributes.header_img = `./${basename(post.attributes.header_img)}`
    }

    // finds and replaces references to other assets in the post body
    post.body = post.body.replace(findResourcesRegex, (...args) => {
      const oldImageLocation = join(src, args[2])
      const newImageLocation = join(postDestDir, basename(args[2]))
      filesToCopy.push({ src: oldImageLocation, dest: newImageLocation })

      return `](./${basename(args[2])}`
    })

    post.content = `---\n${YAML.stringify(post.attributes)}---\n${post.body}`

    posts.push(post)
  })