[REF] extras: improve code

This commit is contained in:
Géry Debongnie
2019-05-03 11:14:34 +02:00
parent e060130655
commit 10ab97e3c6
4 changed files with 34 additions and 20 deletions
+8 -8
View File
@@ -64,14 +64,14 @@ If you want to use a simple `<script>` tag, the last release can be downloaded h
Some npm scripts are available:
| Command | Description |
| -------------------- | -------------------------------------------------- |
| `npm install` | install every dependency required for this project |
| `npm run build` | build a bundle of _owl_ in the _/dist/_ folder |
| `npm run minify` | minify the prebuilt owl.js file |
| `npm run test` | run all tests |
| `npm run test:watch` | run all tests, and keep a watcher |
| `npm run extras` | build extras applications, start a static server |
| Command | Description |
| -------------------- | ------------------------------------------------------------------------------- |
| `npm install` | install every dependency required for this project |
| `npm run build` | build a bundle of _owl_ in the _/dist/_ folder |
| `npm run minify` | minify the prebuilt owl.js file |
| `npm run test` | run all tests |
| `npm run test:watch` | run all tests, and keep a watcher |
| `npm run extras` | build extras applications, start a static server (see [here](extras/readme.md)) |
## Documentation
+1 -1
View File
@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Misc Benchmarks</title>
<title>OWL Extras</title>
</head>
<body>
<h1>🦉 OWL Extra Stuff 🦉</h1>
+24 -10
View File
@@ -3,18 +3,32 @@ import thread
import webbrowser
import time
import BaseHTTPServer, SimpleHTTPServer
import BaseHTTPServer
import SimpleHTTPServer
HOST = '127.0.0.1'
PORT = 8000
class OWLHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def do_GET(self):
if self.path == '/extras/owl.js':
self.path = '/dist/owl.js'
return SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self)
def start_server():
httpd = BaseHTTPServer.HTTPServer(('127.0.0.1', 3600), SimpleHTTPServer.SimpleHTTPRequestHandler)
httpd = BaseHTTPServer.HTTPServer((HOST, PORT), OWLHandler)
httpd.serve_forever()
thread.start_new_thread(start_server,())
url = 'http://127.0.0.1:3600/extras'
webbrowser.open_new(url)
while True:
try:
time.sleep(1)
except KeyboardInterrupt:
sys.exit(0)
if __name__ == "__main__":
thread.start_new_thread(start_server, ())
url = 'http://{0}:{1}/extras'.format(HOST, PORT)
webbrowser.open_new(url)
while True:
try:
time.sleep(1)
except KeyboardInterrupt:
sys.exit(0)
+1 -1
View File
@@ -13,7 +13,7 @@
"dev": "npm-run-all --parallel \"build:* -- --watch\"",
"test": "jest",
"test:watch": "jest --watch",
"preextras": "npm run build && cp dist/owl.js extras/",
"preextras": "npm run build",
"extras": "python extras/server.py"
},
"repository": {