Skip to content

Commit

Permalink
version v1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
bengarrett committed Jan 30, 2021
1 parent 960c13c commit f660107
Show file tree
Hide file tree
Showing 22 changed files with 1,637 additions and 1,331 deletions.
147 changes: 126 additions & 21 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,133 @@
// .eslintrc.js
/*
* ESLint configuration.
*
* This config was last revised for ESLint v7
*
* Rules: https://eslint.org/docs/rules/
*/
module.exports = {
env: {
// Browser global variables.
browser: true,
es6: true
// Es2017 JS syntax
es2017: true,
},
extends: ['plugin:prettier/recommended'],
plugins: ['prettier'],
rules: {
'no-console': ['off'],
'prettier/prettier': ['error'],
quotes: ['error', 'backtick'],
/*
* Prettier must be the last item in extends.
* It uses the npm package eslint-config-prettier.
* https://github.com/prettier/eslint-config-prettier
*
* No other plugins or addons are required, instead in VSCode,
* simply enable the Prettier and ESLint extensions.
*/
extends: [`eslint:recommended`, `prettier`],
// global variables
globals: {
module: `readonly`,
BrowserFS: `readonly`,
DOSee: `readonly`,
DoseeLoader: `readonly`,
Emulator: `readonly`,
FileSaver: `readonly`,
FS: `readonly`,
Module: true,
},
parserOptions: {
ecmaVersion: 2016,
ecmaVersion: 2017,
},
globals: {
BrowserFS: true,
DOSee: true,
DoseeLoader: true,
Emulator: true,
ES6Promise: true,
FileSaver: true,
FS: true,
Module: true,
Promise: true
}
}
rules: {
"no-unused-vars": [`error`, { vars: `local` }],
// Possible errors
"no-template-curly-in-string": `error`,
"no-unreachable-loop": `error`,
//"no-unsafe-optional-chaining": `error`,
// Best practices
"array-callback-return": `error`,
"block-scoped-var": `error`,
//"consistent-return": `error`,
"default-case": `error`,
"default-case-last": `error`,
eqeqeq: [`error`, `smart`],
//"no-alert": `error`,
"no-else-return": `error`,
"no-empty-function": [`error`],
"no-eval": `error`,
"no-extend-native": `error`,
"no-extra-bind": `error`,
"no-extra-label": `error`,
"no-floating-decimal": `error`,
"no-implicit-coercion": `error`,
"no-implicit-globals": `error`,
"no-implied-eval": `error`,
"no-invalid-this": `error`,
"no-iterator": `error`,
"no-labels": `error`,
"no-lone-blocks": `error`,
"no-loop-func": `error`,
"no-magic-numbers": [
`error`,
{ ignore: [0, 1, 2], ignoreArrayIndexes: true },
],
"no-multi-spaces": `error`,
"no-multi-str": `error`,
"no-new": `error`,
"no-new-func": `error`,
"no-new-wrappers": `error`,
//"no-nonoctal-decimal-escape": `error`,
"no-octal": `error`,
"no-octal-escape": `error`,
"no-param-reassign": `error`,
"no-proto": `error`,
"no-return-assign": `error`,
"no-return-await": `error`,
"no-script-url": `error`,
"no-self-compare": `error`,
"no-sequences": `error`,
"no-throw-literal": `error`,
"no-unmodified-loop-condition": `error`,
"no-useless-call": `error`,
"no-useless-concat": `error`,
"no-useless-return": `error`,
"no-void": `error`,
"no-warning-comments": `error`,
"prefer-promise-reject-errors": `error`,
"require-await": `error`,
"vars-on-top": `error`,
yoda: [`error`, `never`],
// Strict mode
strict: `error`,
// Variables
//"init-declarations": [`error`, `never`, { ignoreForLoopInit: true }],
"no-label-var": `error`,
"no-shadow": `error`,
"no-undef-init": `error`,
"no-undefined": `error`,
//"no-use-before-define": `error`,
// Stylistic issues
camelcase: `error`,
"new-cap": `error`,
"no-array-constructor": `error`,
"no-inline-comments": `error`,
"no-lonely-if": `error`,
"no-multi-assign": `error`,
"no-negated-condition": `error`,
"no-nested-ternary": `error`,
"no-new-object": `error`,
"no-tabs": [`error`, { allowIndentationTabs: true }],
quotes: [`error`, `backtick`],
"unicode-bom": [`error`, `never`],
// ES2015
"no-confusing-arrow": `error`,
"no-duplicate-imports": `error`,
"no-useless-computed-key": `error`,
"no-useless-constructor": `error`,
"no-var": `error`,
"object-shorthand": `error`,
"prefer-const": `error`,
"prefer-rest-params": `error`,
"prefer-spread": `error`,
"prefer-template": `error`,
"symbol-description": `error`,
"template-curly-spacing": `error`,
},
};
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ yarn.lock

# Hide dependencies
build
pub

# Packs
*.tgz
Expand Down
35 changes: 30 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# DOSee Dockerfile to load an nginx server
# DOSee Dockerfile to load an nginx webhost server

# Instructions to build and run:
#
# docker build --tag dosee:latest .
# docker run --name dosee_app --interactive --publish 8086:80 dosee:latest
#
# or in short form
# Or in short form:
# docker build -t dosee .
# docker run --name dosee_app -i -p 8086:80 dosee
#
Expand All @@ -16,6 +16,31 @@

# nginx stable is used due to its less frequent updates
# alpine is a tiny linux distribution
FROM nginx:stable-alpine
LABEL net.dosee.description="DOSee an MS-DOS emulator for the web"
COPY src/ /usr/share/nginx/html/
FROM nginx:stable-alpine AS dosee
LABEL net.dosee.description="DOSee - A MS-DOS emulator for the web"

COPY src/ /home/nginx/src
COPY package.json workbox-config.js /home/nginx/

# install dependencies and build the site
RUN mkdir -p /home/nginx/src
WORKDIR /home/nginx/
RUN apk add --update nodejs npm && \
npm install --global yarn && \
yarn && \
cp -r /home/nginx/build/* /usr/share/nginx/html/

WORKDIR /usr/share/nginx/html/

# cleanup to reduce the image from 250M down to 56M.
RUN rm -R /home/nginx && \
yarn cache clean && \
npm -g uninstall yarn && \
npm cache clean --force && \
apk del nodejs npm && \
du -hs /

# optional cleanup

# serve internally over HTTP port 80
EXPOSE 80
12 changes: 9 additions & 3 deletions docs/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@

## Changes and updates

### v1.5.0
### v1.60

- Fixed broken stop button.
- Code refactor to be ES2017 and ESlint compliant.
- Updated Workbox to v6.
- Fixed the broken Dockerfile and dropped docker-compose.yml.

### v1.50

- Added experimental _WASM_ WebAssembly DOSBox port support.
- Fixed malformed, tiny canvas rendering on high DPR devices such as Retina laptops.
Expand All @@ -11,8 +18,7 @@
- Added _DOSee_ and _DOSBox_ prefixes to console logging.
- `dosee:width:height` now applies to splash screen.
- Dropped `aspectRatio` API call as it wasn't used.
- Updated `http-server` to fix `yarn run serve` connection failures on some browsers.
- Changed the behaviour of DOSee.exit() to better handle eventlisteners.
- Migrated to Workbox v5.

### v1.40

Expand Down
107 changes: 45 additions & 62 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,108 +11,91 @@

## An MS-DOS emulator for the web.

DOSee is a front-end for an [MS-DOS](https://en.wikipedia.org/wiki/MS-DOS) emulation ecosystem to use on the web.
DOSee is a front-end for an [MS-DOS](https://en.wikipedia.org/wiki/MS-DOS) emulation ecosystem to use on the web. The text-based MS-DOS was the dominant personal computer platform for much of the 1980s. Up until the mid-1990s before being superseded by Microsoft Windows. Emulating this platform allows tens of thousands of games, demos and applications from this era to run on a web browser both online or offline as a desktop web-app!

The text-based MS-DOS was the dominant personal computer platform for much of the 1980s up until the mid-1990s before being superseded by Microsoft Windows. Emulating this platform allows the running of tens of thousands of games, demos and applications from this era to run on a web browser both online or offline as a desktop web-app!
DOSee is only a user interface and installation process for an incredible emulation ecosystem. Many remarkable people created it over many years. DOSee itself is a fork of [The Emularity](https://github.com/db48x/emularity) project started by the Internet Archive. [EM-DOSBox](https://github.com/dreamlayers/em-dosbox/), the core of this emulation, is a JavaScript port of [DOSBox](https://www.dosbox.com), the world's most popular MS-DOS emulator.

**[Try it online at dosee.link](https://dosee.link)**

DOSee is an interface and installation process for an incredible emulation ecosystem created by many amazing people over the years.

The application itself is a fork of [The Emularity](https://github.com/db48x/emularity) project created by the Internet Archive. [EM-DOSBox](https://github.com/dreamlayers/em-dosbox/), the core of this emulation, is a JavaScript port of [DOSBox](https://www.dosbox.com), the world's most popular MS-DOS emulator.

![DOSee preview](/src/images/preview.png)
![DOSee preview](../src/images/preview.png)

### What's new

[Changes and updates are in CHANGES.md](CHANGES.md).
[Updates are in CHANGES](CHANGES.md)

### Requirements

- A web browser that supports JavaScript ES6 (ECMAScript 2015),
current Firefox, Chrome, Edge or Safari are good.
- A web browser that supports JavaScript ES6 (ECMAScript 2015).<br>
Current Firefox, Chrome, Edge, Brave or Safari will work fine.
- A physical keyboard, as MS-DOS is a text-based operating system.
- [Node.js](https://nodejs.org), with [yarn](https://yarnpkg.com/) or [npm](https://www.npmjs.com/get-npm) and [npx](https://www.npmjs.com/package/npx).
- [Node.js](https://nodejs.org) with [yarn](https://yarnpkg.com) or [npm](https://www.npmjs.com).

_DOSee requires an HTTP server, it can not run using the `file:///` browser protocol._
**DOSee runs over an HTTP server**, and it can not function using the `file:///` browser protocol.

### Instructions, **download and build**
### Instructions, _download, build and serve_

DOSee requires building before it is ready to serve to a web browser.

#### Clone DOSee.
DOSee requires a build before it can serve to a web browser.

```bash
# clone DOSee
git clone https://github.com/bengarrett/DOSee.git
```

#### Install the dependencies and build DOSee.

`npm` is the included package manager for node.js that [is available for all major platforms](https://nodejs.org/en/download/). `yarn` [is an alternative](https://yarnpkg.com/), easier package manager for node.js.

```bash
cd DOSee
yarn # npm install
```

#### Future updates.

Any updates to the files in `src/` require an install command to apply the changes.

```bash
yarn run install # npm run install
```

### Serve, **yarn**

Serve the `build` directory over port _8086_.
# install dependencies & build
yarn # npm install

```bash
# serve dosee over port 8086
yarn run serve # npm run serve
```

Point a web browser to http://localhost:8086

### Serve, **Docker Compose**
### Editing the JS or HTML

Run the DOSee container.
If you edit the source files in `src/` you will need to clear the application storage and unregister the service workers.

```bash
docker-compose up
```
- In Chrome/Edge bring up the browser Dev Tools in using <kbd>Ctrl</kbd> <kbd>Shift</kbd> <kbd>J</kbd>.<br>
Select the Application and Storage tab.<br>
Check the Application Unregister service workers checkbox.<br>
Press the Clear site data button.

Point a web browser to http://localhost:8086

### Serve, **Docker**

Build DOSee using the included Dockerfile.
- In Firefox bring up the browser Developer Tools in using <kbd>Ctrl</kbd> <kbd>Shift</kbd> <kbd>I</kbd>.<br>
Select the Application and Service Workers tab.<br>
Press the Unregister button.

```bash
docker build -t dosee .
# re-build
yarn # npm run install
```

Run the DOSee image as a container.
### Docker container instructions

```bash
# clone DOSee
git clone https://github.com/bengarrett/DOSee.git
cd DOSee

# build
docker build -t dosee .

# serve dosee over port 8086, press Ctrl-C to exit
docker run --name dosee_app -i -p 8086:80 dosee

# cleanup and remove
docker container rm dosee_app
docker image rm dosee
```

Point a web browser to http://localhost:8086

```bash
docker stop dosee_app # to stop the container
```

### Usage, hosting and troubleshooting.
### Usage & customisations

[Can be found in USAGE.md](USAGE.md).
[Is in USAGE](USAGE.md)

### Licenses
### License

1. DOSee is under GPL-3.0.
2. Em-DOSBox located in `src/emulator` is under GPL-2.0.
3. `src/disk_drives` and `src/dos_programs` contain non-free software binaries that are there for convenience.
1. DOSee is under a GPL-3.0 license.
2. Em-DOSBox located in `src/emulator` is under GPL-2.0 license.
3. `src/disk_drives` and `src/dos_programs` contain non-free software binaries for your convenience.

### Similar projects

- [js-dos](https://github.com/caiiiycuk/js-dos) - _The best API for running dos programs in the browser._
- [js-dos](https://github.com/caiiiycuk/js-dos) _The best API for running dos programs in a browser_
Loading

0 comments on commit f660107

Please sign in to comment.