Code Monkey home page Code Monkey logo

yaml-include's Introduction

Howdy! ๐Ÿ‘‹

At some point, I'll think of something clever and/or useful to put here. For now, it's just here to say hello.

And, here's a Mastodon link. The rel="me" thing is annoying, but I get it.

<a rel="me" href="https://masto.ai/@claylo">:eyeroll:</a>

yaml-include's People

Contributors

claylo avatar greenkeeper[bot] avatar riccardougolini avatar yasuhiroki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

yaml-include's Issues

lists/arrays are converted to indexed object when included

// main.yaml
colors: !!inc/file colors.yaml

// colors.yaml
[red, yellow, green]

Currently this returns something that looks like this:

{colors: {0: "red", 1: "yellow", 2: "green"}}

but I would expect to get something like this:

{colors: ["red","yellow","green"]}

This seems like a bug, correct?
naltatis

inc/file inconsistent about base path

I have a directory structure like the following (example demonstrating my actual setup):

config/
-- development.yml
-- production.yml
-- databases.yml
-- assetHosts.yml
tests/
-- test.js

and I want to assign the objects loaded from databases.yml and assetHosts.yml to top-level keys in each of development.yml and production.yml like so:

databases: !! inc/file development.yml
assetHosts: !! inc/file assetHosts.yml

Then I load these files in both webpack from the root of the project, and running unit tests from the tests directory (ie. cd tests && mocha **/*.test.js).

Expected

It would find the files located in its own directory and parse them.

Actual

Webpack reports a file not found error trying to load databases.yml. So I change the directory to be relative to where I'm running webpack from (ie. inc/file config/databases.yml). This works for webpack, but then mocha reports an error when running tests because it can't find config/databases.yml.

Explanation

Since lib/file.js uses process.cwd() as its base, the actual path to the file is dependent on how I run js-yaml. This results in the path behavior being very unpredictable.

Referencing included aliases result in unidentified alias

Consider this file structure:

# in include1.yml
props:
  - &key
    key: value
# in main.yml
name: main

include1: !!inc/file include1.yml

properties:
  - *key

It will throw a YAMLException with: unidentified alias "key", because the key isn't even included.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.