-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support scalajs-bundler (+ sbt-web-scalajs) workflow #72
Comments
Here is my WIP workaround for (3) and (6), as well as #71: [project]
# ...
[module.appCommon.jvm]
# ...
resources = ["src/main/resources", "src/main/webapp", "target/resource_managed/main"]
[module.appCommon.target.copyJS]
command = """
cd ..
jq '.project.platform.config.version="0.6.31"' .bloop/appJs.json | sponge .bloop/appJs.json
jq '.project.platform.config.kind="commonjs"' .bloop/appJs.json | sponge .bloop/appJs.json
bloop link appJs
cd -
dir=target/resource_managed/main/public
mkdir -p $dir
cp $BUILD_PATH/appJs.js $dir/
""" Note this is in a subdirectory due to the issue mentioned here: #48 (comment) |
Thanks for your suggestions! I am not familiar with scalajs-bundler, so I will have to better understand the workflow first.
At the moment, there is no distinction between library and application modules in Seed. If I understood you correctly, it would only be of significance for Scala.js modules. Could you research how other build tools (Mill, Gradle, Fury etc.) implemented the scalajs-bundler workflow? |
Sorry about that
The ultimate goal is to be able to consume javascript libraries that are published to npm, write facades that use them, and consume facades from libraries or other modules without having to repeat the npm packages' coordinates. This means that
There isn't really a choice for modern frontend development. I mean I suppose it can't be that hard to scrape packages from the npm registry directly (there's a URL that gives you a tarball), so if you'd rather do it that way I won't complain. ;)
Maybe for now we should figure out a way to pass all the build info to a custom target so that this can be implemented outside the tool?
Would it have to start with '..'? Because the default is to put it in
That doesn't seem much better than
How about make parallel the default, assuming you have a way to know when one subcommand ends and the next starts. If you want to add sequentially (sync points) there could be a delimiter. Or if you don't have a generalized way to know where a subcommand ends, use delimiters for both. For example, So you could do e.g.
Mill I've worked with. There's an old PR for support which is outdated and I had to finish myself (A version of that is here: https://gist.github.com/nafg/6ecce298a0a20f1e4a259cdae5634060). At least it exposes enough to implement it. Gradle I would guess does not support it and you have to manage your own package.json and webpack config files and run the commands manually. I can't recall reading anything about using gradle with scala.js at all, in fact, although I haven't looked into it. Fury I would also guess does not support it, first of all it's barely installable. I have not seen @propensive mention anything about it in any talks I watched; in fact he's said it would not do lots of things or allow plugins. He's a fan of good old Makefiles for things outside the problem of compiling and sharing scala code. Maybe he can chime in. |
You would have to get transitive dependencies so you'd be writing a dependency manager of course. Someone wanted to do this: https://stackoverflow.com/questions/36002732/java-plugin-for-installing-npm-modules |
Thanks for the detailed answer!
Is the Generating
Does CommonJS work with Bloop already?
We should implement this outside of Seed given that all major browsers have been supporting modules for 1-2 years already.
If it is only about fetching the packages, we can reimplement the logic. Otherwise, we would have to add npm/yarn to the Docker image which increases the image size and the attack surface.
Generating the Can we get the transitive dependencies of Scala.js façades from the registry API or will we have to read them from the
Agreed. Generally, we are better off improving abstractions that would allow developers to express custom workflows.
No. The default path is
As for sequential execution there is little benefit indeed, unless combined with the parallel operator.
Using operators is a good idea. We could use seed 'build module1; run module2' For parallel execution, seed 'build module1 | test module2; run module3'
What I am ultimately hoping to achieve is something along these lines: seed 'link --watch app:js | run --watch app:jvm' This is a fairly common use case. Currently, we need two separate Seed instances running in two terminals. This would have a significantly lower memory footprint, and better reuse resources as only a single Bsp connection is needed. |
And all its transitive dependencies, yes.
I think so
Scalajs facades are not on npm, so I guess the latter
I think an operator that doesn't require quoting is better for usability |
@JSImport
worksThe text was updated successfully, but these errors were encountered: