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:
|
||||
|
||||
| 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
@@ -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
@@ -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
@@ -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": {
|
||||
|
||||
Reference in New Issue
Block a user