-
-
Notifications
You must be signed in to change notification settings - Fork 22
Fs refactor #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fs refactor #13
Conversation
Remade 'cd' command with usage of new FileSystem class Add 'la' flag support ot 'ls' command Add path resolver which creates absolute path from current location and relative path, passed as params syntaxseed#11
To check how new commands work just rebuild bundle or uncomment scripts in index.html. Note that |
So, the idea behind the Filesystem's initial state being defined as it was, is that anyone using this application can easily customize their own intial state of it. Can this be tweaked to read the initial state from a json file? Other than that, this looks cool! |
Other than wanting the initial state in a json file, this is really great. Going to merge this in before other PRs so we can all use this format. |
Yeah, that's easily could be done by adding toPlain/restore methods in FileSystem class. Can you create new issue for fs state restoring |
Pulled this down and had a look.
A few concerns:
|
Honestly, I did not tested other commands :D
Im not familiar with frontend development, so had no idea bout that. Moreover that browser module system bugs me out. That make hard to write clean, readable code
Will fix that |
@syntaxseed I think I finished with improvements and your suggestions on this PR |
Awesome... A small note before I pull this down... Filename allowed chars should be: Directory name allowed chars: (If you support 'hidden' directories, you can allow dots in directory names too!) I saw this in your changes: if (!newFileName.match(/[A-z]+/)) {
throw new CmdValidationError('touch', `${path}: Invalid file name.`);
} PS - This project originated as a way for me to practise my Javascript skills... so appologies that it will take me some time to go over and fully grok your PR. But I'm very excited about your refactor I think it's a big improvement. :) |
@deziev ... does your refactor allow 'hidden' directories? If so, we can allow dots in directory names too. :) |
oh, missed that one) yes, new For me this project is great chance to better understand how linux terminal works, so im interested in further development. also past few years I was working with nodejs so feel free to ask for help) |
Looked this over and it looks great. I made some tiny changes... but my minifier isn't working meaning something in your PR isn't ES 2015 compatible. Also the touch command only works from the root now. |
oh, everything in my PR in es6, arrow functions, literals, let - const, Set - Map etc. Its not a good idea to use es5 in 2019)) |
@deziev true I think it'll be a good idea to refactor this repo to ES6. Also @syntaxseed can we migrate to Node as it'll allow us to leverage tools like ES6 and Webpack to automate the minifying process and making the code cleaner and more obvious to read. |
Ok. Let's talk about this. I don't have any experience with Node... and the original idea was to create something that could be easily just dropped into another website. If we go the ES6 route, I will need to transpile and minify a bundle that can be provided for people who don't want to bother with that. We can keep the custom commands (commands.js) and the initial filesystem state (filesystem.js) in a ES5 ready to use state, and we can write all the internal stuff in ES6 and then transpile it to a minified bundle for deployment. Can anyone point me to the easiest way to get started with this for a Linux dev environment? I'm a PHP dev so I don't have npm or any JS transpilers installed. But I agree that this sounds like the best route. Willing to learn how it works! Is this something I can accomplish with Babel alone? Or do I need to install npm and Node? |
I noticed I already have Node/NPM installed. Upgraded both to the latest:
I am in the process of going through a Babel CLI tutorial. |
This PR has been merged. But it has introduced a few issues:
I will create separate issues for these. Thanks for your contribution @deziev! |
This PR contains refactoring of file system related stuff. New features will simplify fs management.
Also adds new error handling method and command Error class - watch terminal.js runCommand method;
#1
#11