Просмотр исходного кода

Add npm run server -- <args> shortcut

Lutz Roeder 7 лет назад
Родитель
Сommit
81fedddfd1
3 измененных файлов с 6 добавлено и 15 удалено
  1. 3 5
      DEVELOPMENT.md
  2. 0 9
      netron
  3. 3 1
      package.json

+ 3 - 5
DEVELOPMENT.md

@@ -8,7 +8,7 @@ To start the Electron app, install [Node.js](https://nodejs.org) and run:
 
 ```bash
 npm install
-npm start
+npx electron .
 ```
 
 To debug the Electron app use [Visual Studio Code](https://code.visualstudio.com) and install the [Debugger for Chrome](https://marketplace.visualstudio.com/items?itemName=msjsdiag.debugger-for-chrome) extension. Open the `./Netron` root folder and press `F5`. To attach the debugger to a rendering window select the `Debug` tab and `Debug Renderer Process` before launching.
@@ -25,8 +25,6 @@ To build and launch the Python server run:
 
 ```bash
 npm install
-python ./setup.py build
-PYTHONPATH=${source}/build/python/lib python -c "import netron; netron.main()"
+python setup.py build
+PYTHONPATH=build/python/lib python -c "import netron; netron.main()"
 ```
-
-The same can be accomplished by running the `./netron` script in the enlistment root folder.

+ 0 - 9
netron

@@ -1,9 +0,0 @@
-#!/bin/bash
-# Build and start Netron as a Python web server from local directory
-source=$(dirname ${0})
-pushd ${source} > /dev/null
-[ -d node_modules ] || npm install
-rm -rf ./build/python
-python ./setup.py --quiet build
-popd > /dev/null
-PYTHONPATH=${source}/build/python/lib python -c "import netron; netron.main()" $@

+ 3 - 1
package.json

@@ -11,7 +11,9 @@
     "repository": "lutzroeder/netron",
     "main": "src/app.js",
     "scripts": {
-        "start": "npx electron ."
+        "install": "",
+        "start": "[ -d node_modules ] || npm install && npx electron .",
+        "server": "[ -d node_modules ] || npm install && rm -rf build/python && python setup.py --quiet build && PYTHONPATH=build/python/lib python -c 'import netron; netron.main()' $@"
     },
     "dependencies": {
         "d3": "latest",