GithubHelp home page GithubHelp logo

super-cache-money / make-runnable Goto Github PK

View Code? Open in Web Editor NEW
75.0 75.0 9.0 134 KB

Call a node.js module's exports directly from the command line, with arguments.

License: ISC License

JavaScript 100.00%

make-runnable's People

Contributors

briaker avatar dependabot[bot] avatar mrgrain avatar super-cache-money 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  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

make-runnable's Issues

Pass function arguments like command line arguments

Would be nice if we could pass function arguments like command line arguments.

Given the example in the documentation

module.exports = {
    addTogether: function(x,y){
        return x + y
    }, doSomethingWithObject: function(object){
        object.newKey = "easy AF";
        return object;
    }, simpleValue: 'also works'
};
require('make-runnable');

Would be good if it could be run like the following:
node your_file.js addTogether --x 1 --y 2

Uses something like https://www.npmjs.com/package/get-params to determine what the names of the arguments are.

Best effort would be fine, doesn't need to handle weird argument syntax, like comments, and default values, etc.

Code doesn't exit

When i run a JS function via make-runnable, the function does't exit.
After successful run, the output shows "--------make-runnable-output--------", and it the execution stops there.
The script doesn't exit to the Shell Prompt.
I have to do Ctrl+C to make it exit.

It would be nice if the program exits gracefully.

completion?

Would be awesome to provide a way to do tab completion.

TypeError: Cannot read property 'indexOf' of undefined /make-runnable/index.js:55:42

test.js

require('make-runnable');

module.exports = {
    addTogether: function(x,y){
        return x + y
    }, doSomethingWithObject: function(object){
        object.newKey = "easy AF";
        return object;
    }, simpleValue: 'also works'
};
Kevins-MBP:org-stream kevzettler$ node ./test.js addtogether 1 2
/Users/kevzettler/Dropbox (Personal)/code/org-stream/node_modules/make-runnable/index.js:55
      var egPropertyHasSpace = egProperty.indexOf(' ') > 0; //if example property
                                         ^

TypeError: Cannot read property 'indexOf' of undefined
    at Object.<anonymous> (/Users/kevzettler/Dropbox (Personal)/code/org-stream/node_modules/make-runnable/index.js:55:42)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/Users/kevzettler/Dropbox (Personal)/code/org-stream/test.js:1:63)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)

versions

Kevins-MBP:org-stream kevzettler$ node -v && npm ls make-runnable
v4.2.6
/Users/kevzettler/Dropbox (Personal)/code/org-stream
└── [email protected]

Add promise support

In the scenario the function returns a promise, it would be nice if make-runnable waited on the promise and then printed out the final resolved value.

I can submit a PR if this is okay!

Pretty print whole object, rather than truncating to [Object] ?

Hi, I want to test a function that returns an object, but it is only shallow printing the object.

ie given the following return object

{
   "customerAccountsRs": {
      "fullName": "Fred Single",
      "account": [
         {
            "sortCodeAcctNum": "400216-00001001"
         }
      ]
   }
}

make-runnable only prints

{
  customerAccountsRs: { fullName: 'Fred Single', account: [ [Object] ] }
}

Could you add this option? If not, if I made a PR, would you merge in? I notice #7 has languished for years, so not really up for putting in the effort if you are not gonna merge it

Remove unused console.log

I have been struggle 20 min to understand that the undefined in my console was related to make-runnable.

$ node build.js vulcanize
running func []
undefined
BUILD.JS: Everithing done!  
✨  Done in 23.70s.

I think could be good specify when the console.log is printed from the make-runnable script and maybe could be also good to add a flag like -v (verbose) to enable the logger within make-runnable

I can come back with a PR if you agree.

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.