Skip to content

Commit

Permalink
fix wasmoon not working
Browse files Browse the repository at this point in the history
  • Loading branch information
CapsAdmin committed Jul 29, 2024
1 parent 5fd402f commit c6f81a2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
3 changes: 2 additions & 1 deletion language_server/playground/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build_output.lua
node_modules
*.bundle.*
yarn.lock
yarn.lock
public/glue.wasm
12 changes: 12 additions & 0 deletions language_server/playground/build.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const { execSync } = require("child_process")
const fs = require("fs")
const path = require("path")
const { finished } = require("stream/promises")
const { Readable } = require("stream")

const getAllFiles = function (dirPath, arrayOfFiles) {
files = fs.readdirSync(dirPath)
Expand Down Expand Up @@ -33,6 +35,16 @@ for (let path of getAllFiles("../../test/nattlua/analyzer/")) {
}

fs.writeFileSync("src/random.json", JSON.stringify(tests))
;(async () => {
const res = await fetch("https://unpkg.com/[email protected]/dist/glue.wasm")
fs.unlink("public/glue.wasm", (err) => {
if (err) {
console.error(err)
}
})
const fileStream = fs.createWriteStream("public/glue.wasm", { flags: "wx" })
await finished(Readable.fromWeb(res.body).pipe(fileStream))
})()

execSync("cd ../../ && luajit nattlua.lua build fast")

Expand Down
3 changes: 2 additions & 1 deletion language_server/playground/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ git remote add origin [email protected]:CapsAdmin/NattLua.git
git checkout -b gh-pages
git add --all
git commit -m "Deploy"
git push -f origin gh-pages
git push -f origin gh-pages
rm -rf .git
3 changes: 2 additions & 1 deletion language_server/playground/src/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
random.json
random.json
public/glue.wasm

0 comments on commit c6f81a2

Please sign in to comment.