Remove sbt-scalajs-bundler dependency - #755
Conversation
…npm install sbt-scalajs-bundler has no sbt 2.0/Scala 3 build and appears dormant, which blocks moving sbt-converter to sbt 2.0. sbt-converter never used its bundling features (JS resource hooks were already stubbed to Nil) -- only its npm-dependency declaration and npm-install plumbing. Replaces it with a self-contained NpmInstall task that writes package.json and runs npm/yarn install directly via os-lib, exposed via new stNpmDependencies/stNpmDevDependencies/stNpmResolutions/stUseYarn/stNpmInstall keys (renamed from the bundler's npmDependencies/useYarn/etc). This is a prerequisite refactor only; the actual sbt 2.0 cross-build is tracked separately.
|
Hi! @oyvindberg! I hope it's ok, I had my AI draft this PR. I'm trying to move my projects to sbt 2.0 and I don't see any work on the sbt-converter towards that, the big stumbling block is the bundler, which I don't think is maintained, so this first PR is to remove the dependency with the bundler, and having the sbt plugin reproduce the parts that it made. |
|
Hey, long time! I would be ok with many solutions here, really. I don't use sbt-scalajs-bundler or even sbt myself, so most of all i would like to nuke the sbt plugin from orbit 😅 but to be less dramatic, lets do something like you propose. i guess what i want to know is if there can be a well-defined hook which users of bundlers integrated with sbt can use? one thing has the responsibility of calling npm install, then ST needs to be called, and finally the results of ST needs to be appended to the resolved deps of the build. can you have your agent look into it? maybe consider it in relation with an sbt vite plugin as well? i seem to have an impression that exists |
|
the sbt-vite plugin is also dormant, I think the recommended approach is to use vite directly, but that's for scalajs end users, if I understand correctly, what sbt-scalajs-bundler was doing here was setting up which js the converter was going to convert. So even if you recommend to end users to use vite (or sbt-esbuild, which is another option) you still need a way to figure out what to convert, and that's why replacing it with this minimal implementation seems to make sense. |
Summary
sbt-scalajs-bundlerdependency fromsbt-converter. It has no sbt 2.0/Scala 3 build and looks dormant — it was blocking a move to sbt 2.0, but sbt-converter never actually used its bundling features (JS resource hooks were already stubbed toNil), only its npm-dependency-declaration andnpm installplumbing.NpmInstalltask (sbt-converter/.../internal/NpmInstall.scala) that writespackage.jsonand runsnpm install/yarn installdirectly via os-lib, with content-hash caching to skip redundant installs.st-prefixed ones:npmDependencies→stNpmDependencies,npmDevDependencies→stNpmDevDependencies,useYarn→stUseYarn; addsstNpmResolutionsandstNpmInstall.sourcegen,sourcegen-mixed,japgolly) and docs to the new key names, and dropssbt-scalajs-bundlerfrom theirplugins.sbt.This is a prerequisite refactor only — the actual sbt 2.0 cross-build (Scala 3 axis,
pluginCrossBuild/crossSbtVersions, porting to sbt 2.0 APIs) is tracked separately in a follow-up PR.Test plan
sbt-converter/compileand whole-buildTest/compilesucceed under JDK 17sbt-converter/scripted(could not be verified in this sandbox due to a pre-existing, unrelated dependency-resolution issue reproduced identically on unmodifiedmaster; should be re-run in normal dev/CI)https://claude.ai/code/session_01TBZdpjcwLC4C22494C7zNH