[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
+2 -2
View File
@@ -65,13 +65,13 @@ If you want to use a simple `<script>` tag, the last release can be downloaded h
Some npm scripts are available: Some npm scripts are available:
| Command | Description | | Command | Description |
| -------------------- | -------------------------------------------------- | | -------------------- | ------------------------------------------------------------------------------- |
| `npm install` | install every dependency required for this project | | `npm install` | install every dependency required for this project |
| `npm run build` | build a bundle of _owl_ in the _/dist/_ folder | | `npm run build` | build a bundle of _owl_ in the _/dist/_ folder |
| `npm run minify` | minify the prebuilt owl.js file | | `npm run minify` | minify the prebuilt owl.js file |
| `npm run test` | run all tests | | `npm run test` | run all tests |
| `npm run test:watch` | run all tests, and keep a watcher | | `npm run test:watch` | run all tests, and keep a watcher |
| `npm run extras` | build extras applications, start a static server | | `npm run extras` | build extras applications, start a static server (see [here](extras/readme.md)) |
## Documentation ## Documentation
+1 -1
View File
@@ -2,7 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Misc Benchmarks</title> <title>OWL Extras</title>
</head> </head>
<body> <body>
<h1>🦉 OWL Extra Stuff 🦉</h1> <h1>🦉 OWL Extra Stuff 🦉</h1>
+17 -3
View File
@@ -3,14 +3,28 @@ import thread
import webbrowser import webbrowser
import time 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(): def start_server():
httpd = BaseHTTPServer.HTTPServer(('127.0.0.1', 3600), SimpleHTTPServer.SimpleHTTPRequestHandler) httpd = BaseHTTPServer.HTTPServer((HOST, PORT), OWLHandler)
httpd.serve_forever() httpd.serve_forever()
if __name__ == "__main__":
thread.start_new_thread(start_server, ()) thread.start_new_thread(start_server, ())
url = 'http://127.0.0.1:3600/extras' url = 'http://{0}:{1}/extras'.format(HOST, PORT)
webbrowser.open_new(url) webbrowser.open_new(url)
while True: while True:
+1 -1
View File
@@ -13,7 +13,7 @@
"dev": "npm-run-all --parallel \"build:* -- --watch\"", "dev": "npm-run-all --parallel \"build:* -- --watch\"",
"test": "jest", "test": "jest",
"test:watch": "jest --watch", "test:watch": "jest --watch",
"preextras": "npm run build && cp dist/owl.js extras/", "preextras": "npm run build",
"extras": "python extras/server.py" "extras": "python extras/server.py"
}, },
"repository": { "repository": {