PseudocodeEditor / editor

The codemirror 6 editor for CIE spec Pseudocode
https://editor.pseudonaja.app
21 stars 2 forks source link

Container #29

Closed fcarsana closed 9 months ago

fcarsana commented 9 months ago

Can you provide a guide on running PseudocodeEditor in a cotanier, please? I would like to run my own editor just to not be stucked in the execution queue. Thank you.

Coding-Cactus commented 9 months ago

For the websocket server (https://github.com/PseudocodeEditor/eval):

  1. Clone the repo
  2. Install the dependencies $ poetry install
  3. Run the server $ python3 main.py

For the editor (https://github.com/PseudocodeEditor/editor):

  1. Clone the repo
  2. Edit the url in codemirror6/editor/run/websocket.js to the url of your websocket server
  3. Install the dependencies $ npm install
  4. Bundle the files $ npx rollup -c
  5. Run the webserver $ node index.js

If you want to run these specifically in a Docker container, I would recommend looking up a general Docker guide.

fcarsana commented 9 months ago

I'm receiving the following error trying to bundle the files:

$ npx rollup -c (node:72361) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension. (Use node --trace-warnings ... to show where the warning was created) [!] RollupError: Node tried to load your configuration file as CommonJS even though it is likely an ES module. To resolve this, change the extension of your configuration to ".mjs", set "type": "module" in your package.json file or pass the "--bundleConfigAsCjs" flag.

Original error: Cannot use import statement outside a module https://rollupjs.org/command-line-interface/#bundleconfigascjs /editor/rollup.config.js:1 import typescript from "rollup-plugin-ts"; ^^^^^^

SyntaxError: Cannot use import statement outside a module at internalCompileFunction (node:internal/vm:77:18) at wrapSafe (node:internal/modules/cjs/loader:1288:20) at Module._compile (node:internal/modules/cjs/loader:1340:27) at Module._extensions..js (node:internal/modules/cjs/loader:1435:10) at Module.load (node:internal/modules/cjs/loader:1207:32) at Module._load (node:internal/modules/cjs/loader:1023:12) at cjsLoader (node:internal/modules/esm/translators:345:17) at ModuleWrap. (node:internal/modules/esm/translators:294:7) at ModuleJob.run (node:internal/modules/esm/module_job:218:25) at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)

Coding-Cactus commented 9 months ago

What version of node and npm are you using?

fcarsana commented 9 months ago

$ npm --version 10.2.3 $ node --version v20.10.0

Coding-Cactus commented 9 months ago

Ah, I forgot to say to import the packages. Run npm install.

fcarsana commented 9 months ago

I think it's working: thank you!

$ npx rollup -c Browserslist: caniuse-lite is outdated. Please run: npx browserslist@latest --update-db Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating

codemirror6/editor/editor.js → dist/editor.bundle.js... (!) Circular dependency codemirror6/editor/extensions/themes.js -> codemirror6/editor/extensions/extensions.js -> codemirror6/editor/extensions/shortcuts.js -> codemirror6/editor/files/delete.js -> codemirror6/editor/extensions/themes.js created dist/editor.bundle.js in 1.5s

$ node server.js Server listening on PORT 8080

Coding-Cactus commented 9 months ago

Just to let you know @fcarsana, https://editor.pseudonaja.app now runs entirely client side, so there is no longer any waiting in the queue.