super-cache-money / make-runnable Goto Github PK
View Code? Open in Web Editor NEWCall a node.js module's exports directly from the command line, with arguments.
License: ISC License
Call a node.js module's exports directly from the command line, with arguments.
License: ISC License
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.
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.
at printError(...node_modules\make-runnable\engine.js:36:5)
I suggest to use
if (options.printErrorOutput) {
Can you add an option to change or hide the --------make-runnable-output--------
and --------make-runnable-errors--------
headers?
Would be awesome to provide a way to do tab completion.
I'm trying to use make-runnable to insert rows into my database, and I'm using my db config file which uses ES6 imports.
How can I get make-runnable to work with imports instead of require?
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]
Is it possible to pass both an object as well as multiple primitives to a function ?
Something like,
node your_file.js doSomethingWithObject --jsonObj '{"key1": "value1", "key2": "value2"}' --primitive1 abc --primitive2 def
Is there any chance to make this package compatible for ESModule?
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!
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
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.