Răsfoiți Sursa

Update server npm run command

Lutz Roeder 4 ani în urmă
părinte
comite
0e61ffb7f8
2 a modificat fișierele cu 14 adăugiri și 1 ștergeri
  1. 1 1
      package.json
  2. 13 0
      publish/server.js

+ 1 - 1
package.json

@@ -14,7 +14,7 @@
     "scripts": {
         "postinstall": "electron-builder install-app-deps",
         "start": "[ -d node_modules ] || npm install && npx electron .",
-        "server": "python setup.py --quiet build && python -c 'import sys, os; sys.path.insert(0, os.path.join(\"dist\", \"lib\")); import netron; netron.main()' $@"
+        "server": "node ./publish/server.js"
     },
     "dependencies": {
         "electron-updater": "4.3.9"

+ 13 - 0
publish/server.js

@@ -0,0 +1,13 @@
+
+const child_process = require('child_process');
+const path = require('path');
+
+const options = { stdio: 'inherit' };
+
+child_process.spawnSync('python', [ 'setup.py', '--quiet', 'build' ], options);
+
+options.env = Object.assign({}, process.env);
+options.env.PYTHONPATH = path.join('dist', 'lib');
+
+const args = [ '-c', 'import netron; netron.main()' ].concat(process.argv.slice(2));
+child_process.spawnSync('python', args, options);