Skip to content

Commit

Permalink
refactor: Change project structure; update README
Browse files Browse the repository at this point in the history
  • Loading branch information
deziev committed Oct 28, 2019
1 parent 7d7f4b2 commit ea2f80d
Show file tree
Hide file tree
Showing 26 changed files with 179 additions and 167 deletions.
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ First we modify our minimal example to load in custom commands found in "js/comm

```html
...
<script src="js/filesystem.js"></script>
<script src="js/commands.js"></script>
<script src="js/filesystem.js"></script>
<script src="js/customCommands.js"></script>
...
```

Expand Down Expand Up @@ -158,6 +158,18 @@ To see a full example including loading in system commands and the nicer boot me

See the [Contributing Guide](CONTRIBUTING.md). Pull requests for existing issues are welcome. For other or major changes, please open an issue first to discuss what you would like to change.

### For developer

```
npm install
npm run build
```

To start `webpack` in watch mode run:
```
npm run build-dev
```

## Authors

* **Sherri Wheeler** - *Author & Maintainer* - [SyntaxSeed](https://github.com/SyntaxSeed)
Expand Down
4 changes: 0 additions & 4 deletions src/filesystem.js

This file was deleted.

6 changes: 3 additions & 3 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ <h1><a href="https://github.com/syntaxseed/terminalfaker">Terminal Faker Demo</a
</p>
</div>
<!-- Global variables -->
<script src="filesystem.js"></script>
<script src="customCommands.js"></script>
<script src="js/filesystem.js"></script>
<script src="js/customCommands.js"></script>
<!-- Minified build -->
<script src="bundle.min.js"></script>
<script src="js/bundle.min.js"></script>
</body>
</html>
190 changes: 95 additions & 95 deletions src/bundle.min.js → src/js/bundle.min.js

Large diffs are not rendered by default.

File renamed without changes.
65 changes: 4 additions & 61 deletions src/js/filesystem.js
Original file line number Diff line number Diff line change
@@ -1,61 +1,4 @@
// TODO - Refactor the initial filesystem state to read from a JSON file and then do this conversion.

// Here we create initial file system structure. Changes are saved to LocalStorage.
// System is reset to this on 'reboot' command.

import { FileSystem } from './components/fs/FileSystem';
import { FsDir } from './components/fs/FsDir';
import { FsFile } from './components/fs/FsFile';

export const initialFilesystem = new FileSystem();

initialFilesystem
.add(new FsDir('.tmp-dir'), [])

initialFilesystem
.add(new FsFile('.hidden', 'There is a hidden file.'), []);

initialFilesystem
.add(new FsDir('docs'), [])

initialFilesystem
.get(['docs'])
.add(new FsFile('moretodo.txt', 'A, B, C.'))

initialFilesystem
.get(['docs'])
.add(new FsFile('ok.txt', 'I am ok.'))

initialFilesystem
.get(['docs'])
.add(new FsFile(
'shoplist.txt',
`-Apples\n-Bananas\n-Cookies`
)
);

initialFilesystem
.get(['docs'])
.add(new FsDir('private'))

initialFilesystem
.get(['docs', 'private'])
.add(new FsFile('secret.txt', 'PxNmGkl6M+jDP4AYAKZET18SEnWD5qw5LIP9174lONWslF144K9VHFIk1JA='))

initialFilesystem
.get(['docs', 'private'])
.add(new FsDir('opt'))

initialFilesystem
.get(['docs'])
.add(new FsDir('tmp'))

initialFilesystem
.add(new FsDir('more'), [])
.add(new FsFile('moretodo.txt', `Don't forget this other stuff.`))

initialFilesystem
.add(new FsDir('stuff'), [])

initialFilesystem
.add(new FsFile('cool.txt', 'There is a hidden command in this terminal called \'secret\'.'), []);
const myFileSystem = {
file1: 'f1',
dir1: 'dir'
};
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
61 changes: 61 additions & 0 deletions src/main/filesystem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// TODO - Refactor the initial filesystem state to read from a JSON file and then do this conversion.

// Here we create initial file system structure. Changes are saved to LocalStorage.
// System is reset to this on 'reboot' command.

import { FileSystem } from './components/fs/FileSystem';
import { FsDir } from './components/fs/FsDir';
import { FsFile } from './components/fs/FsFile';

export const initialFilesystem = new FileSystem();

initialFilesystem
.add(new FsDir('.tmp-dir'), [])

initialFilesystem
.add(new FsFile('.hidden', 'There is a hidden file.'), []);

initialFilesystem
.add(new FsDir('docs'), [])

initialFilesystem
.get(['docs'])
.add(new FsFile('moretodo.txt', 'A, B, C.'))

initialFilesystem
.get(['docs'])
.add(new FsFile('ok.txt', 'I am ok.'))

initialFilesystem
.get(['docs'])
.add(new FsFile(
'shoplist.txt',
`-Apples\n-Bananas\n-Cookies`
)
);

initialFilesystem
.get(['docs'])
.add(new FsDir('private'))

initialFilesystem
.get(['docs', 'private'])
.add(new FsFile('secret.txt', 'PxNmGkl6M+jDP4AYAKZET18SEnWD5qw5LIP9174lONWslF144K9VHFIk1JA='))

initialFilesystem
.get(['docs', 'private'])
.add(new FsDir('opt'))

initialFilesystem
.get(['docs'])
.add(new FsDir('tmp'))

initialFilesystem
.add(new FsDir('more'), [])
.add(new FsFile('moretodo.txt', `Don't forget this other stuff.`))

initialFilesystem
.add(new FsDir('stuff'), [])

initialFilesystem
.add(new FsFile('cool.txt', 'There is a hidden command in this terminal called \'secret\'.'), []);
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const path = require('path');

module.exports = {
entry: './src/js/index.js',
entry: './src/main/index.js',
mode: 'development',
output: {
filename: 'bundle.min.js',
path: path.resolve(__dirname, 'src'),
path: path.resolve(__dirname, 'src/js'),
},
};

0 comments on commit ea2f80d

Please sign in to comment.