chrisguttandin / dynamo-converters

A collection of converter functions to get good old JavaScript key/value objects into a DynamoDB friendly schema and back again.
MIT License
24 stars 3 forks source link

Add CLI tool #81

Open jrschumacher opened 2 years ago

jrschumacher commented 2 years ago

Add a CLI option so you can install globally and use without building an application

./bin/dynamo-converters d2i "{\"hello\": \"world\"}"
./bin/dynamo-converters i2d "{\"hello\":{\"S\":\"world\"}}"
jrschumacher commented 2 years ago

@chrisguttandin I couldn't get the pre-commit hook working because grunt depends on too many global installed tools and it wasn't clear how to install the chain without trial and error.

chrisguttandin commented 2 years ago

Hi @jrschumacher, thanks a lot for your contribution.

Since the biggest part of your changes is adding a new file (cli.js) which consumes the public API of dynamo-converters I wonder if it would be cleaner to create a separate package for that. Something like dynamo-converters-cli. Does that make sense?

By the way, I honestly never thought about using dynamo-converters from the command line. I'm curious (and hope you can publicly talk about it) what's your use case?

jrschumacher commented 2 years ago

Sorry I dropped the ball on this one. The use case I was working with was analyzing a bunch of Dynamo objects and needing to derive some schema from them for a migration to an RDBMS.

Yes you could also create a new CLI project, but I personally prefer keeping the CLI within the same tool chain for easier maintenance.

As a casual contributor it's easier to implement a new feature in the supply chain if the CLI and base library are in the same project.

chrisguttandin commented 2 years ago

Yeah, I see where you're coming from. I guess what I really wanted to say is that I don't have the bandwidth to also maintain a CLI for this package. 😔

What if we close this PR for now but add a note to the README which points to this PR and mentions that those who are interested in a CLI version could copy/paste your implementation and express their interest here? Does that sound like a good solution?