mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[REF] extras: improve code
This commit is contained in:
@@ -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:
|
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
@@ -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>
|
||||||
|
|||||||
+24
-10
@@ -3,18 +3,32 @@ 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()
|
||||||
|
|
||||||
thread.start_new_thread(start_server,())
|
|
||||||
url = 'http://127.0.0.1:3600/extras'
|
|
||||||
webbrowser.open_new(url)
|
|
||||||
|
|
||||||
while True:
|
if __name__ == "__main__":
|
||||||
try:
|
thread.start_new_thread(start_server, ())
|
||||||
time.sleep(1)
|
url = 'http://{0}:{1}/extras'.format(HOST, PORT)
|
||||||
except KeyboardInterrupt:
|
webbrowser.open_new(url)
|
||||||
sys.exit(0)
|
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
time.sleep(1)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
sys.exit(0)
|
||||||
|
|||||||
+1
-1
@@ -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": {
|
||||||
|
|||||||
Reference in New Issue
Block a user