scala-js / vite-plugin-scalajs

Vite plugin for integration of Scala.js
Apache License 2.0
51 stars 10 forks source link

Detect old sbt version; plus some maintenance #18

Closed raquo closed 1 year ago

raquo commented 1 year ago

Primarily this is a fix for #17. I tested on MacOS, with sbt 1.6.1, 1.3.3, 1.2.0 and 0.13.18 downloaded from https://www.scala-sbt.org/download.html, and it's working as intended, detecting the error in 1.2.0 and 0.13.18 and printing instructions to fix it:


> laminar-demo@0.1.0 dev
> vite

[info] welcome to sbt 1.9.7 (Eclipse Adoptium Java 17.0.8.1)
[info] loading settings for project global-plugins from build.sbt,idea.sbt ...
[info] loading global plugins from /Users/raquo/.sbt/1.0/plugins
[info] loading settings for project root from build.sbt,metals.sbt,plugins.sbt ...
[info] loading project definition from /Users/raquo/code/scala/demo/project
[info] loading settings for project root from build.sbt ...
[info] set current project to Laminar Demo (in build file:/Users/raquo/code/scala/demo/)
[error] Expected symbol
[error] Not a valid command: --
[error] Expected 'debug'
[error] Expected 'info'
[error] Expected 'warn'
[error] Expected 'error'
[error] Expected 'addPluginSbtFile'
[error] --batch
[error]   ^
error when starting dev server:
Error: sbt invocation for Scala.js compilation failed with exit code 1.
Cause: Your sbt launcher script version is too old (<1.3.3).
Fix: Re-install the latest version of sbt launcher script from https://www.scala-sbt.org/
    at ChildProcess.<anonymous> (file:///Users/raquo/code/js/vite-plugin-scalajs/dist/index.js:29:24)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:1091:16)
    at Socket.<anonymous> (node:internal/child_process:449:11)
    at Socket.emit (node:events:513:28)
    at Pipe.<anonymous> (node:net:313:12)

I ran it on my laminar-demo project, everything seems fine. Tests pass.

Let me know if you want the error reworded or something.

I also made the following rather trivial changes in separate commits, but let me know if you want separate PRs for them.


Added common IDE and OS files to .gitignore.


Ran npm audit fix because it was reporting vulnerabilities in transient dependencies. It just updated some versions in package-lock.json, I skimmed through the changes, and I don't see anything controversial in there.

# npm audit report

get-func-name  <2.0.1
Severity: high
Chaijs/get-func-name vulnerable to ReDoS - https://github.com/advisories/GHSA-4q6p-r6v2-jvc5
fix available via `npm audit fix`
node_modules/get-func-name

postcss  <8.4.31
Severity: moderate
PostCSS line return parsing error - https://github.com/advisories/GHSA-7fh5-64p2-3v2j
fix available via `npm audit fix`
node_modules/postcss

vite  4.1.0 - 4.1.4
Severity: high
Vite Server Options (server.fs.deny) can be bypassed using double forward-slash (//) - https://github.com/advisories/GHSA-353f-5xf4-qw67
fix available via `npm audit fix`
node_modules/vite

3 vulnerabilities (1 moderate, 2 high)

To address all issues, run:
  npm audit fix