princejwesley / mancy Goto Github PK
View Code? Open in Web Editor NEW>_ Electron based NodeJS REPL :see_no_evil:
Home Page: http://mancy-re.pl
License: MIT License
>_ Electron based NodeJS REPL :see_no_evil:
Home Page: http://mancy-re.pl
License: MIT License
I assumed async/await works in Mancy after reading the wiki. But I'm having some problems with it.
I'm new to async/await, so I'm probably at fault here somehow.
I tried to get the following example into Mancy:
async function getValues() {
return [1,2,3,4];
}
From this primer: http://code.tutsplus.com/tutorials/a-primer-on-es7-async-functions--cms-22367
I get this error:
SyntaxError: Unexpected token function
I also tried the following alternatives which yield the same error:
getValues = async function () { return [1,2,3,4]; }
var getValues = async function () { return [1,2,3,4]; }
I also tried this alternative:
let getValues = async function () { return [1,2,3,4]; }
Which gave this error:
SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
Any ideas what's wrong here?
Mancy has no icon. So there is a generic (and ugly) icon at my taskbar. I use Arch Linux.
This should be easy to fix. A stackoverflow related question.
When you click on prompt (">"), it only changes its orientation. Tooltip says "expand command", should it work like minimize/maximize buttom?
The value in the async/await pattern is that it allows us to work with async values like we would sync values vs. nesting callback or then blocks. Given that, thanks for adding this sugar to Mancy. However, these await statements return promise objects vs. the resolved values, so we still need to call then on them to access the resolved value.
let request = require('request-promise');
let todos = await request('http://jsonplaceholder.typicode.com/todos');
console.log(todos);
// Promise {}
// [[PromiseStatus]]: fulfilled
// [[PromiseValue]]:
// '[
// {
// "userId": 1,
// "id": 1,
// "title": "delectus aut autem",
// "completed": false
// }
// ...
// ]'
todos.then(res => console.log(res));
// '[
// {
// "userId": 1,
// "id": 1,
// "title": "delectus aut autem",
// "completed": false
// }
// ...
// ]'
Which ends up looking the same as a vanilla promise:
let todos = request('http://jsonplaceholder.typicode.com/todos');
todos.then(res => console.log(res));
// '[
// {
// "userId": 1,
// "id": 1,
// "title": "delectus aut autem",
// "completed": false
// }
// ...
// ]'
When I test this in my own environment using Babel and babel-preset-stage-0, it works, so I'm nor sure what the problem is...
As long as Mancy community is growing, I suggest to create a chat room. With Gitter is very easy and it's well integrated with GitHub.
In nodej.s REPL or bash we can use `Control + L' to clear the screen. I think it's missing from mancy :).
Not sure if this is a fixable issue but currently it takes a very long time to require external node modules.
Hi @princejwesley. I tried to use smth like let b = {x: [1,2,3,4,5]};
but for this one doesn't work a chart view. For let b = {x: [1,2,3,4,5], y: [4,5,6,7,8]};
it's working correctly. Also I have another question about a prompt symbol. How can I change this one?
Mancy 2.0 is here! And it's really nice but I'm thinking of Mancy 3.0 from right now. I think the next big thing should be plugins support (like Atom pacakages). There could be the following types of plugins:
Part of Mancy itself could be coded as plugins. I'm sure many contributors would create plugins for Mancy, other people do for Atom.
What do you think about?
Thank you for Mancy! It's great!
This looks amazing, I look forward to using it more, but one of the basic features I'm not able to get working.
Whenever I tried to to require
a module, I always get Error: Cannot find module 'module-name'
.
It does work when I run from master locally, so it's possible this has already been addressed.
I know you can expand "Object" item and the expand "proto" item and then you have constructor name. But I think it would be useful look constructor name at first glance.
Example:
class A {}
a = new A();
now you get:
> Object {}
I think it would be better something like this:
> Object (A) {}
Thank you.
I like to implement a toString
function for each my custom types, to be used to debug print the contents.
Does Mancy support, or are there any plans to support, implicit use of toString
when outputting objects on the console?
After upgrading to 2.1.0 on Windows 7 Pro, the REPL GUI does not appear when I start Mancy. I have repeatedly removed and re-downloaded Mancy to no effect. I have also deleted %appdata%\mancy to no effect. If I delete the 2.1.0 installation and run the 2.0.1 build, the GUI starts up.
Is it technically feasible to use an external Node.js executable with Mancy?
I ask because Electron comes with Node.js 4.1.1, and I'm using Node.js 5.1.0 with my own projects. It gets a bit confusing trying to remember which syntax is available in which Node.js version.
Is this something that you'd accept a PR for?
Clarification:
Hi!
First, thanks for this great project. I'm learning Javascript (ES6) and React and it's the nicest repl I've found.
I think there's a problem with the evaluation:
function buzz(n) {
if (n%15 === 0) return 'FizzBuzz';
if (n%5 === 0) return 'Buzz';
if (n%3 === 0) return 'Fizz';
return n;
}
buzz(3)
'Fizz'
buzz(2)
undefined <<<< it should return 2
I tested it on Firefox's console and it works fine.
Hello. I'm intrigued by this project. I just installed it and played around a bit. I see that it has some nice features that you can't get from a regular node repl, but it's not immediately clear to me what I would use this tool for on day-to-day basis.
How are you using it?
This issue is apparent on Macs.
Once Mancy is running, clicking the Mancy icon in the dockbar invokes a new instance of Mancy.
It may be engineered to behave this way but I feel users will find this confusing and disconcerting, I certainly did.
I'm running Mancy v2.1.0 on OSX El Capitan. Using the release build of Mancy.
I'd like to do two things, specifically:
I've done this in my fork, but in doing so, I noticed the themes are somewhat tightly coupled.
My suggestion is:
~/Library/Application Support/Mancy
). May also need a place to put .ttf
file(s) or other binary data.thanks. Great work!
It would be nice if you could show transpiled/compiled code.
For example, if you are using LiveScript and type:
console.log \hello
you could show the generated (and evaluated) JavaScript code:
console.log("hello");
This feature would be easy to implement and it's very useful to debug. You could apply this feature to all languages and transpiler: Babel, CoffeeScript, TypeScript, LiveScript...
When you type '9', Mancy "autofill" another '9' character. I think it's a issue related to shift keycode and parentheses. When you type "(" or "(quotes), no autofill at all.
First up. Mancy is awesome. I'm really loving it.
I'd like to have a startup script that loads all my most common modules and helper functions when I start Mancy.
Is it possible to do this already? Or are there any plans to implement this?
It's kind of a pain to evaluate short variables quickly since the autocomplete gets in the way. For example, I can't quickly type n
and then hit enter, since it autocompletes to new
. Considering that this is a REPL and you'd expect people to want to hit enter pretty often to evaluate things, doing autocomplete feels wrong to me.
Hi @princejwesley When I try install npm dependencies I got this error:
npm ERR! Cloning into bare repository 'C:\Users\user\AppData\Roaming\npm-cache\_git-remotes\git-ssh-git-github-com-princejwesley-font-manager-git-3684d2cffffd1f08ab15a7fa0f01449f'...
npm ERR! Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
I seem to be getting a syntax error SyntaxError: missing ) after argument list
with the following code:
Promise.resolve('finished').then(function(result){
console.log(result)
}
)
But if I put the closing bracket and parenthesis on the same line, there's no error:
Promise.resolve('finished').then(function(result){
console.log(result)
})
I'm running Mancy v2.1.0 on OSX 10.11.1.
(thanks for making Mancy btw, it's great)
Console (right panel) is light even using dark theme. It should be dark using dark theme.
Thank you.
I can find no way to execute const usesRest = (first, ...rest) => console.log(first, rest)
in Mancy.
Pressing ENTER
behaves like SHIFT+ENTER
(adds blank lines).
I looked for documentation on what features were supported (#13), but couldn't find any. I assume rest parameters are not supported because the line is evaluated if I replace ...rest
with rest
.
There should be some feedback to the user. Either execute the code and throw a SyntaxError
, or indicate that the code can't/won't be executed and list the reason.
There is a npm package for creating windows installers out of electron projects IIRC. Would be really nice to have an installer.
[Babel transform: enabled]
Input:
async function x() { return 100 }
await x()
Output:
SyntaxError: Unexpected token function
Expected output:
100
However if you code only this line:
async function x() { return 100 }
you get no error (right) and x() returns a promise (right).
Then, if you code this line:
await x()
you get another promise (!) and it should return 100.
Hi @princejwesley. How can I include some library like a lodash to repl?
Multiline code (shift+enter) is evaluated multiple times (as many as lines).
Example:
1+1;
2+2;
2
1+1;
2+2;
4
I think is not necessary Mancy show 1+1 result, only last line (2+2 = 4) that is the global result form entire input code,
Support for recalling old command execution. It would be better if the commands are stored in a file so that they can applied between sessions. Props for implementing Ctrl+R for searching through History.
I noticed that Mancy already has Auto async wrapper and Promise output tracking.
Would it be possibly to add an synchronous wrapper for promises?
Or does something like this already exist in Mancy?
Example...
The following code pulls json data from a REST API. Data-forge returns a promise that resolves when the async operation has completed:
dataForge.from(http("some/rest/api")
.as(json())
.then(function (dataFrame)) {
// ... do stuff with the data frame ...
});
In Mancy I'd like this to behave like it was synchronous:
var dataFrame = dataForge.from(http(...)).as(json());
Is it possible for Mancy to wrap promises automatically and then resolve them to their values?
Since this is just electron, can't you just run this in broswer?
using ubuntu 14.10
Downloaded from github (not npm)
Tested in similar virtual machines and the problem persisted
I think it would be helpful to see, at a glance, what language features are supported in the REPL. Maybe as an added feature have the ability to toggle available features.
I like what n_ is doing. Though this module likely is too specific to simply make a user preference, it'd be really swell if Mancy allowed you to wrap its REPL with a custom one.
Would this be possible? Is this something you'd be interested in supporting?
Great work. ๐
If you click, for example, a minimize buttom, you lose focus on prompt line. So you have to click on prompt line to write again. I think prompt line should be focus all the time or mostly. Click an empty space of main panel, should focus prompt line. Maybe keypress event too.
These are only suggestions. I hope they help you. Mancy is great!
Hello! Love the project. Just one issue I had so far:
Running npm install
then npm run package
does not initiate the application.
I had to run gulp start
or npm start
.
@princejwesley I cannot rebuild Mancy on windows. I have errors about mime module.
It think error outp should be collapsed by default.
Example (wrong) input:
1+++
Now you get this output:
ReferenceError: Invalid left-hand side expression in postfix operation
at exports.createScript (vm.js:24:10)
at REPLServer.defaultEval (repl.js:137:25)
at bound (domain.js:250:14)
at REPLServer.runBound [as eval] (domain.js:263:12)
at REPLServer.<anonymous> (repl.js:393:12)
at emitOne (events.js:77:13)
at REPLServer.emit (events.js:169:7)
at REPLServer.Interface._onLine (readline.js:210:10)
It would be nicer this way:
> ReferenceError: Invalid left-hand side expression in postfix operation
click on ( >) to view error details
There is no Date viewer.
Example: new Date()
Using the traditional node REPL from the terminal on Mac OS X, I don't have to require
core node modules. For example:
> os
{ hostname: [Function: getHostname],
loadavg: [Function: getLoadAvg],
uptime: [Function: getUptime],
freemem: [Function: getFreeMem],
totalmem: [Function: getTotalMem],
cpus: [Function: getCPUs],
type: [Function: getOSType],
release: [Function: getOSRelease],
networkInterfaces: [Function: getInterfaceAddresses],
homedir: [Function: getHomeDirectory],
arch: [Function],
platform: [Function],
tmpdir: [Function],
tmpDir: [Function],
getNetworkInterfaces: [Function: deprecated],
EOL: '\n',
endianness: [Function] }
But in Mancy that'll throw a ReferenceError. I've always liked that ability in the terminal because it allows for quickly iterating on something, which is what I use REPLs for. Mancy is cool, nice work ๐
Code you type has no syntax highlight until you press enter. I think that if you use codemirror or ace instead highlight.js, you would get live syntax highlight (and maybe another interesting features).
Thank you again.
Hi!
I'm thinking about create a Node REPL based on Electron and I've found Mancy! Great job! Very very nice!
I don't know yet how Mancy eval/run input code but I've tried this code
while(true){}
and Mancy hangs completely (Node CLI REPL hangs too). But it would be nice if you could stop/cancel the last execution (infinite loop in this case) and continue working with Mancy. I think Mancy would need to execute input code at another process (child). Parent process (global data) and child process (execution) would have to communicate in order to share global data. So you could kill child process if it hangs and continue working whith Mancy and your current session (global data).
Thank you for Mancy! Go on!
Requiring external module babel-core/register
Using gulpfile ~/JS/Mancy/gulpfile.babel.js
Starting 'user-env'...
Finished 'user-env' after 160 ฮผs
Starting 'start'...
Starting 'build'...
Starting 'clean'...
Finished 'clean' after 224 ms
Starting 'copy'...
Finished 'copy' after 859 ms
Starting 'sass'...
Starting 'react'...
Finished 'sass' after 2.62 s
Finished 'react' after 4.87 s
Finished 'build' after 6.14 s
Starting 'run'...
[5779:1012/214101:ERROR:browser_main_loop.cc(189)] Running without the SUID sandbox! See https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment for more information on developing with the sandbox on.Crash dump id: 9a459779-ccf5-4546-95d3-95e5d0b49ef1
Finished 'run' after 9.8 s
Finished 'start' after 16 s
It would be nice if you could install Mancy this way:
npm i mancy -g
Other electron based applicacions (like iron-node) work this way.
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.