rhaiscript / playground

A Rhai scripting playground that runs Rhai scripts using WebAssembly in a web browser.
https://rhai.rs/playground
MIT License
20 stars 5 forks source link

Update to latest version #22

Closed schungx closed 1 year ago

schungx commented 1 year ago

@alvinhochun Latest version is now up to 1.12.0... good time to update the playground...

Beware there may be new Token variants...

alvinhochun commented 1 year ago

Would you like to submit a PR? 🙂

(I may get to it some time later, maybe in a few days...)

schungx commented 1 year ago

Would love to but I don't run a Linux machine (on Windows) so can't really build this thing to try out...

Maybe I can spawn a code spaces on Github...

If it is only a few days, then I suppose we can wait ;-)

alvinhochun commented 1 year ago

I actually run this on Windows 😄

schungx commented 1 year ago

I actually run this on Windows 😄

How did you do that? Did you run on WSL?

Or do I have to install some software packages? It complains rimraf is not found...

alvinhochun commented 1 year ago

It should work natively after installing the node.js modules (npm install). I haven't run it for quite some time though so it is possible some stuff may have become outdated?

schungx commented 1 year ago

It is giving me this:

> web-wasm@0.1.0 build
> rimraf dist pkg && webpack

🧐  Checking for wasm-pack...

ℹī¸  Installing wasm-pack

Error: spawn npm ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
    at onErrorNT (node:internal/child_process:478:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

Seems like a problem with webpack...

alvinhochun commented 1 year ago

Looks like it is failing to run npm. Is your nodejs install available on PATH?

schungx commented 1 year ago

Hhhmmm.... npm seems to be running fine AFAIK...

OK, I'll add C:\Program Files\nodejs to PATH and see...

EDIT: Nope. Same error.

I read on the net that I need to map something to node.cmd or something?

alvinhochun commented 1 year ago

Hmm, no idea. I have C:\Program Files\nodejs\npm.cmd, though my node.js is v12.18.1, which is quite old.

fabriziosestito commented 1 year ago

I updated the playground in my fork, you can check it here: https://fabriziosestito.github.io/playground/dev/

schungx commented 1 year ago

Well, I pushed a couple of commits to fix certain things, and now seems to have mucked up the CI...

I'll just leave it as is, so somebody more knowledgeable can fix it!

In the future, I promise I'm touching nothin'...

alvinhochun commented 1 year ago

Yeah if you bumped some of the node.js packages they may be too new for node.js 12.

https://github.com/rhaiscript/playground/blob/7d6bd91a2c897457d22b27047e3fbe61cbcc8be4/.github/workflows/dist.yml#L24-L27

fabriziosestito commented 1 year ago

@alvinhochun running npm audit fix seems to fix CI. I added the fix in #23.

schungx commented 1 year ago

What is the procedure to move it from dev into stable?

fabriziosestito commented 1 year ago

Manually run this action should do the trick https://github.com/rhaiscript/playground/actions/workflows/publish_stable_from_dev.yml

schungx commented 1 year ago

OK, let me try...

schungx commented 5 months ago

Trying to compile to the latest Rhai version, but keeps getting this error:


> web-wasm@0.1.0 build
> rimraf dist pkg && webpack

🧐  Checking for wasm-pack...

✅  wasm-pack is installed at C:\Git\rhai-playground\node_modules\.bin\wasm-pack.CMD. 

ℹī¸  Compiling your crate in release mode...

✅  Your crate has been correctly compiled

Hash: 1442ec626bf1afa03ebe
Version: webpack 4.47.0
Time: 15746ms
Built at: 02/01/2024 1:47:07 PM
 97 assets
Entrypoint index = index.js
  [0] ./pkg/index.js 22.3 KiB {0} [built]
  [1] ./js/wasm_loader.js + 1 modules 962 bytes {0} [built]
      | ./js/wasm_loader.js 876 bytes [built]
      | ./pkg/index_bg.wasm 81 bytes [built]
  [2] (webpack)/buildin/global.js 472 bytes {0} [built]
  [3] ./js/index.js 1.27 KiB {0} [built]
  [4] (webpack)/buildin/harmony-module.js 573 bytes {0} [built]
  [6] ./js/init.js + 26 modules 55.1 KiB {2} [built]
      | ./js/init.js 681 bytes [built]
      | ./js/playground.vue 665 bytes [built]
      | ./js/playground.vue?vue&type=template&id=edbf0ef0&scoped=true 283 bytes [built]
      | ./js/playground.vue?vue&type=script&lang=js 424 bytes [built]
      | ./node_modules/@open-wc/webpack-import-meta-loader/webpack-import-meta-loader.js!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--4!./node_modules/vue-loader/lib??vue-loader-options!./js/playground.vue?vue&type=template&id=edbf0ef0&scoped=true 19.6 KiB [built]
      | ./node_modules/@open-wc/webpack-import-meta-loader/webpack-import-meta-loader.js!./node_modules/vue-loader/lib??vue-loader-options!./js/playground.vue?vue&type=script&lang=js 12.3 KiB [built]
      | ./js/playground-runner.js 4.65 KiB [built]
      |     + 20 hidden modules
 [17] ./node_modules/style-loader/dist/cjs.js!./node_modules/css-loader/dist/cjs.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/vue-loader/lib??vue-loader-options!./js/playground.vue?vue&type=style&index=0&id=edbf0ef0&prod&scoped=true&lang=css 703 bytes {2} [built]
 [18] ./node_modules/style-loader/dist/cjs.js!./node_modules/css-loader/dist/cjs.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/vue-loader/lib??vue-loader-options!./js/playground.vue?vue&type=style&index=1&id=edbf0ef0&prod&lang=css 691 bytes {2} [built]
 [39] ./example-scripts lazy nonrecursive ./node_modules/raw-loader/dist/cjs.js \.rhai$ 160 bytes {2} [built]
 [41] ./js/playground.vue?vue&type=style&index=0&id=edbf0ef0&prod&scoped=true&lang=css 293 bytes {2} [built]
 [43] ./js/playground.vue?vue&type=style&index=1&id=edbf0ef0&prod&lang=css 281 bytes {2} [built]
[210] ./node_modules/buefy/dist/esm/dropdown.js + 2 modules 18 KiB {1} [built]
      |    3 modules
[211] ./node_modules/buefy/dist/esm/select.js + 2 modules 7.89 KiB {1} [built]
      |    3 modules
[212] ./node_modules/buefy/dist/esm/field.js + 1 modules 8.43 KiB {1} [built]
      |    2 modules
[213] ./node_modules/buefy/dist/esm/tooltip.js + 1 modules 2.52 KiB {1} [built]
      |    2 modules
    + 245 hidden modules

ERROR in index.js from Terser
Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:68:19)
    at Object.createHash (node:crypto:138:10)
    at C:\Git\rhai-playground\node_modules\terser-webpack-plugin\dist\index.js:217:37
    at Array.forEach (<anonymous>)
    at TerserPlugin.optimizeFn (C:\Git\rhai-playground\node_modules\terser-webpack-plugin\dist\index.js:160:259)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Git\rhai-playground\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:7:1)
    at AsyncSeriesHook.lazyCompileHook (C:\Git\rhai-playground\node_modules\tapable\lib\Hook.js:154:20)
    at C:\Git\rhai-playground\node_modules\webpack\lib\Compilation.js:1409:36
    at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Git\rhai-playground\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (C:\Git\rhai-playground\node_modules\tapable\lib\Hook.js:154:20)
    at C:\Git\rhai-playground\node_modules\webpack\lib\Compilation.js:1405:32
    at eval (eval at create (C:\Git\rhai-playground\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:12:1)
    at C:\Git\rhai-playground\node_modules\git-revision-webpack-plugin\lib\build-file.js:12:9
    at C:\Git\rhai-playground\node_modules\git-revision-webpack-plugin\lib\helpers\run-git-command.js:22:7
    at ChildProcess.exithandler (node:child_process:414:7)
    at ChildProcess.emit (node:events:514:28)
    at maybeClose (node:internal/child_process:1105:16)
    at ChildProcess._handle.onexit (node:internal/child_process:305:5)

... one Terser error for each JS file omitted...

Child worker:
     2 assets
    Entrypoint main = b1edef6286f5d7c275aa.worker.js
    [0] ./pkg/index.js 22.3 KiB {0} [built]
    [1] (webpack)/buildin/harmony-module.js 573 bytes {0} [built]
    [2] (webpack)/buildin/global.js 472 bytes {0} [built]
    [3] ./node_modules/workerize-loader/dist/rpc-worker-loader.js!./node_modules/@open-wc/webpack-import-meta-loader/webpack-import-meta-loader.js!./js/worker.js + 2 modules 2.67 KiB {0} [built]
        | ./node_modules/workerize-loader/dist/rpc-worker-loader.js!./node_modules/@open-wc/webpack-import-meta-loader/webpack-import-meta-loader.js!./js/worker.js 1.73 KiB [built]
        | ./js/wasm_loader.js 876 bytes [built]
        | ./pkg/index_bg.wasm 81 bytes [built]

    ERROR in b1edef6286f5d7c275aa.worker.js from Terser
    Error: error:0308010C:digital envelope routines::unsupported
        at new Hash (node:internal/crypto/hash:68:19)
        at Object.createHash (node:crypto:138:10)
        at C:\Git\rhai-playground\node_modules\terser-webpack-plugin\dist\index.js:217:37
        at Array.forEach (<anonymous>)
        at TerserPlugin.optimizeFn (C:\Git\rhai-playground\node_modules\terser-webpack-plugin\dist\index.js:160:259)
        at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Git\rhai-playground\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:7:1)
        at AsyncSeriesHook.lazyCompileHook (C:\Git\rhai-playground\node_modules\tapable\lib\Hook.js:154:20)
        at C:\Git\rhai-playground\node_modules\webpack\lib\Compilation.js:1409:36
        at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Git\rhai-playground\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:6:1)
        at AsyncSeriesHook.lazyCompileHook (C:\Git\rhai-playground\node_modules\tapable\lib\Hook.js:154:20)
        at C:\Git\rhai-playground\node_modules\webpack\lib\Compilation.js:1405:32
        at eval (eval at create (C:\Git\rhai-playground\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:12:1)
        at C:\Git\rhai-playground\node_modules\git-revision-webpack-plugin\lib\build-file.js:12:9
        at C:\Git\rhai-playground\node_modules\git-revision-webpack-plugin\lib\helpers\run-git-command.js:22:7
        at ChildProcess.exithandler (node:child_process:414:7)
        at ChildProcess.emit (node:events:514:28)
        at maybeClose (node:internal/child_process:1105:16)
        at ChildProcess._handle.onexit (node:internal/child_process:305:5)
schungx commented 5 months ago

OK, this post shows how to fix this (essentially a Node version problem):

https://sebhastian.com/error-0308010c-digital-envelope-routines-unsupported/