Skip to content

Commit

Permalink
First
Browse files Browse the repository at this point in the history
  • Loading branch information
o0101 committed Nov 3, 2020
0 parents commit 2915a42
Show file tree
Hide file tree
Showing 9 changed files with 161 additions and 0 deletions.
24 changes: 24 additions & 0 deletions README.md
@@ -0,0 +1,24 @@
# Grader.JS

Grader.JS, or just **Grader**, is a tool to help you build cross-platform desktop apps in JavaScript, HTML and CSS, without the bloat of Electron.

# Get Started

Use npm to create a new Grader app like so:

```sh
mkdir my-app
cd my-app
# make it git
git init
# make it grader
npm i graderjs
```

And the [Grader.JS tool](https://github.com/c9fe/graderjs) will automatically populate your repo.

Then, read the [getting started guide](https://github.com/c9fe/grader-base/blob/master/README.md) or see below for an API reference.

# API reference


11 changes: 11 additions & 0 deletions notes/caveats.md
@@ -0,0 +1,11 @@
# Flags

## Localstorage and multiple windows

If you want localstorage you need to pick persistent session storage. If you do this, you can only have one app window.

If you want to open multiple app windows, they are all temporary and transient and you cannot rely on local storage.

### Why

This is the case because, Chrome, running with more than one window, and each window having RDP on different ports cannot share the same user data directory. In order to run multiple windows, each window/chrome needs to have its own user data directory. So if you want multiple windows, we need to create them transiently and delete them. If you want persistent localstorage (but hey you can use filesystem since you have node), you must accept one window only.
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions package.json
@@ -0,0 +1,33 @@
{
"name": "graderjs",
"version": "2.1.0",
"description": "Tool to copy the Grader.JS base repo into the current directory",
"scripts": {
"postinstall": "bash ./scripts/bring_grader.sh"
},
"repository": {
"type": "git",
"url": "git+https://github.com/c9fe/graderjs.git"
},
"keywords": [
"devtools",
"node",
"hybrid",
"desktop",
"template",
"electron",
"sciter",
"gradebr",
"cross-platform apps",
"chromium",
"chrome"
],
"author": "@dosy",
"license": "AGPL-3.0",
"bugs": {
"url": "https://github.com/c9fe/graderjs/issues"
},
"homepage": "https://github.com/c9fe/graderjs#readme",
"dependencies": {},
"devDependencies": {}
}
9 changes: 9 additions & 0 deletions scripts/bring_grader.sh
@@ -0,0 +1,9 @@
#!/bin/bash

echo "Making it Grader-ified..."

git clone https://github.com/c9fe/grader-base.git
cp -r grader-base/* .

npm i

29 changes: 29 additions & 0 deletions work/achievements
@@ -0,0 +1,29 @@
- verify window control buttons work
- add a build step that zips up our website / app directory
- add the website zip into the nexe build
- write the server.js and website zip to a temp directory
- unzip the website zip
- start the server
- refactor to have app as a launch process for a fatter server. app closes quickly, leaving no trace of console.
- test this on windows and linux (ubuntu vnc)
- clean up code and remove most of it
- Decide how to handle config, names, folders of different apps
- perf: try keeping the chrome profile dir (per app), and experiment with cache dir as temp or persistent. Also try opening chrome earlier and using DevTools if needed as fallback to make it load the UI
- global $HOME/.grader directory for all grader apps, installs and configs
- handle picking a random port that's available
- work out how to delete the session directories on windows
- make it into a great API and clean the code
- ensure all sessions are correctly accounted for (seems at least 1 window will not be saved in old session log, need to work out why)
- create API bridge plumbing!
- remove bugs about adding binding/related code twice
- work out that trying make window controls top bar available (for systems that don't use them, like ubuntu) is actually an error because ubuntu does provide them, and trying to provide on ourselves (using app region drag) doesn't work. But be grateful that I got all the plumbing for the API bridge done! YAY
- implement way to pass back info from service side to UI side (promise resolver account)
- allow setting initial position and size (and get screen size by opening headless chrome window and evaluating screen.width, everytime. We can also use this headless vanguard to provide us other useful properties.)
- improve way to get screen coorindates (faster and less waste, let's try to keep these two browsers using the same session directories)
- get rid of console window opening on browser exit / shutdown process
- implement addHandlers, server and keepConsoleOpen settings (as well as other sketched and unimplemented settings)
- add download_chrome script to pull it in if system doesn't have it
- this can be an npm repo
- call a function {install} and depending on win, nix or osx download the right installer and run it
- multiple windows handling
- fix bug where service doesnt' close after last UI closed (because 'headless' still there)
5 changes: 5 additions & 0 deletions work/future
@@ -0,0 +1,5 @@
Icons
- add ability to create dmg and add icon, add ability to create windows icon, and mac icon.

differentiate from pkg and nexe via:
- support .node imports (binaries natives)
29 changes: 29 additions & 0 deletions work/release.notes
@@ -0,0 +1,29 @@
I think it's easier to make it like a create-app or a template repo.

Because ...

To have these apps an author needs 2 parts:

1) Grader API and code
2) Build their code into a binary

And 2 requires

3) Correct structure of their code

There could be a post install script, that sets up 3.

And also copies all the required build scripts.

And also sets up their config.

This is an option.

--- but


I think at the start, it's easier just to make it a template repository.




16 changes: 16 additions & 0 deletions work/todo
@@ -0,0 +1,16 @@
Priority
- put archivist in this framework.
- improve API based on what I learned from porting and
- write documentation about how to use grader to build cross-platform apps

Lesser
- implement apiInUI flag
- improve progress . metrics (no clearline just add 1 dot on each turn using stdout.write)
- add sessionIds to old-sessions on every exit path from the app (even before UI launched for example)
- fix it so we ALWAYS (no matter what) delete old sessions
- add security checks on origin for API proxy





0 comments on commit 2915a42

Please sign in to comment.