samualtnorman / hackmud-script-manager

Script manager for game hackmud, with minification, TypeScript support, and player script type definition generation.
https://www.npmjs.com/package/hackmud-script-manager
MIT License
11 stars 4 forks source link

--no-minify Drastically changes the output of the script #191

Open Mallchad opened 4 months ago

Mallchad commented 4 months ago

Hello, would it be possible to have --no-minify not mess with the contents of the script? We have some scripts that need the content in a very particualry format because of processing and --no-minify still does alot of unwanted minification but we would still like to use hackmud-script-manager

This is the outputs we get. original

function(ctx, args) {
    var out
    return #fs.akira.spellbender().script(ctx, args, #fs.scripts.quine())
    //$ -- begin --
    //$module.exports = (ctx, args) => {
    //$  $d('Dark magic is cool!')
    //$  out = "Dark magic is not cool"
    //$  #hs.accts.balance({})
    //$  return out
    //$}
    //$ -- end --
}
function(ctx, args) {
  return #fs.akira.spellbender().script(
    ctx,
    args,
    "function(ctx, args) {\n    var out\n    return #fs.akira.spellbender\().script(ctx, args, #fs.scripts.quine\())\n    /\/$ -- begin --\n    /\/$module.exports = (ctx, args) => {\n    /\/$  $d('Dark magic is cool!')\n    /\/$  out = \"Dark magic is not cool\"\n    /\/$  #hs.accts.balance\({})\n    /\/$  return out\n    /\/$}\n    /\/$ -- end --\n}\n"
  )
}
samualtnorman commented 4 months ago

if you don't want to use HSM, don't use HSM. making --no-minify not mess with the script at all is not possible. I don't understand why you need --no-minify to use akira.spellbounder, the script you gave above should work even with minification

Mallchad commented 4 months ago

I wanted to use HSM because manually syncing files to all users in a directory is tedious and the HackMUD directory is a little mess for my liking to put source control in it directly anyway

It might work but for debuggability and convenience in general I would really just like it to not tamper when not-minifying I'm not sure why it wouldn't be possible, I'm asking for a file copy operation, essentially. This is in Javascript not typescript

samualtnorman commented 4 months ago

okay but why do you need to use --no-minify? even if I added an option that just did a file copy, you don't gain anything over just using HSM with minification

Mallchad commented 4 months ago

So my main reasoning is when I'm debugging errors from in-game I then need to find and go over the issue in my code- when the code is reshifted around the errors correspond to a place in the code that's not relevant to the code I'm reading.

Then my code will upload given as written and the errors will correspond to the code I'm reading. Hope that makes sense

samualtnorman commented 4 months ago

Hope that makes sense

not really, can you provide an example?