Yakeen Sewsanker
07/06/2022, 1:15 AMproductionLibrary
for publishing? I have attempted to do the following:
tasks.getByName("publishJsNpmPublicationToNpmjs") {
dependsOn(tasks.getByName("jsBrowserProductionLibraryDistribution"))
doLast {
val jsDir = buildDir.resolve("productionLibrary")
...
}
But jsBrowserProductionLibraryDistribution
does not create productionLibrary
. Any clues to what does?Sebastian
07/06/2022, 9:21 AM/* kotlin.collections.List<any/* com.company.manager.data.ApiAnswer */> */
). The inner comment closing statement (*/
) will make the outer comment closing appear as regular code and thus generate a syntax error in TypeScript. I’ll put a slightly more complete example in the thread.
Did anyone have any issues like that, or is there any related entry in the issue tracker? I haven’t found anything so far, but can’t imagine that I’m the only one with totally broken TypeScript definitions. 🤔Florent Martin
07/07/2022, 12:06 PMEdoardo Luppi
07/08/2022, 10:03 PMNick
07/09/2022, 5:20 AMtransform
property. This works because AffineTransform
has been updated to support scale,
rotation, and translations that involve x, y and z axes. The result is that Views can now be placed in a full 3D space by simply giving them a
transform that has been modified accordingly.
import io.nacular.doodle.drawing.AffineTransform.Companion.Identity
import io.nacular.measured.units.Angle.Companion.degrees
// Rotate this View around they y-axis (through its center) by 45°
view.transform *= Identity.rotateY(around = view.center, by = 45 * degrees)
Views can also now render in 3D, since Canvas
also supports the new 3D transforms.
view {
render = {
transform(Identity.rotateY(by = 45 * degrees)) {
// ...
}
}
}
3D Perspective
A realistic 3D space requires more than just affine transforms (which keep parallel lines parallel). Simulating this requires perspective transforms. Views now
have a camera
property, which gives them a perspective when combined with a 3D transform. The following allows the y-axis rotation to look more realistic.
import io.nacular.doodle.drawing.AffineTransform.Companion.Identity
import io.nacular.measured.units.Angle.Companion.degrees
// Rotate this View around they y-axis (through its center) by 45°
view.transform *= Identity.rotateY(around = view.center, by = 45 * degrees)
// Position the View's camera to apply some realistic perspective warping
view.camera = Camera(position = view.center, distance = 1000.0)
Canvas also takes a Camera
in its transform
method to enable perspective.
view {
render = {
transform(Identity.rotateY(by = 45 * degrees), camera = Camera(Origin, distance = 1000.0)) {
// ...
}
}
}
Kotlin 1.7 Support
Doodle now supports 1.7.10!!
https://github.com/nacular/doodle/releases/tag/v0.8.0Bernhard
07/11/2022, 12:15 PMandylamax
07/11/2022, 12:19 PMCause: command '/home/andylamax/.gradle/nodejs/node-v16.13.0-linux-x64/bin/node' exited with errors (exit code: 1)
Is there a way to at least get the logs of node to see what went wrong? Also, this is after I upgraded to 1.7.0. Anyone met this problem? how did you solve it?eygraber
07/13/2022, 7:18 PMeygraber
07/14/2022, 2:39 AMjs(IR) {
if(jsModuleName != null) {
moduleName = jsModuleName
}
useCommonJs()
browser {
webpackTask {
output.libraryTarget = "commonjs2"
}
if(isJsLeafModule) {
binaries.executable()
}
}
}
What do I do now in terms of getting a javascript file that I can share with my web team?eygraber
07/14/2022, 3:37 PMJsExport
?eygraber
07/15/2022, 9:31 PMSlackbot
07/16/2022, 12:43 PMShumaf Lovpache
07/19/2022, 5:04 PMCameron Probert
07/20/2022, 1:37 AMbuild.gradle.kts
to pass as arguments to webpack-cli
. This is working fine in webpack 4, but I’m trying to upgrade to webpack 5. The following works for webpack 4:Cameron Probert
07/20/2022, 1:38 AMbuild.gradle.kts
to pass as arguments to webpack-cli
. This is working fine in webpack 4, but I’m trying to upgrade to webpack 5. The following works for webpack 4:
kotlin {
js {
browser {
commonWebpackConfig {
cssSupport.enabled = true
mode = buildMode
// stop default export of config object in Webpack code because we do it in 02.envConfig.js webpack extension
export = false
}
// from <https://discuss.kotlinlang.org/t/kotlin-js-react-accessing-configuring-environment-variables/16906/9>
val envTargetWebpackArgs = listOf("--env.envTarget=$envTarget", "--env.version=$version")
webpackTask { args.plusAssign(envTargetWebpackArgs) }
runTask { args.plusAssign(envTargetWebpackArgs) }
}
// Necessary to fix a compilation issue (see <https://github.com/Kotlin/dukat/issues/106>)
useCommonJs()
}
// Force explicit APIs
explicitApi()
}
With the key lines being:Andrey Tabakov
07/20/2022, 2:10 PMrunBlocking
Something like this (not working of course)
fun notSuspendedFunction(block: suspend () -> T): String {
val result = await block() // or runBlocking { block() }
return result
}
I'm okay with something like this (not working of course):
fun notSuspendedFunction(block: suspend () -> T): String {
val job = GlobalScope.async { block() }
while(job.isCompleted) { /* may be set timeout or something with delay */ }
return job.getCompleted()
}
leandro
07/20/2022, 3:28 PMmoduleName
in my modules inside JS(IR) {}
.
js(IR) {
moduleName = "@myCompany/${project.name}"
nodejs()
useCommonJs()
binaries.executable()
...
}
Executing :assemble
, the task :myModule:compileProductionExecutableKotlinJs
crashes with:
/Users/repo/myModule/build/compileSync/main/productionExecutable/kotlin/@myCompany/@myCompany/moduleName.js (No such file or directory)
Note duplicated “/@myCompany/@myCompany/“. This wasn’t the case with Kotlin 1.6.21 and earlier versions.Jonathan Ellis
07/21/2022, 2:18 PMExecution optimizations have been disabled for task ':jsBrowserProductionRun' to ensure correctness due to the following reasons:
- Gradle detected a problem with the following location: 'E:\Projects\sketches-js\build\js\packages\sketches-js\kotlin\sketches-js.js'. Reason: Task ':jsBrowserProductionRun' uses this output of task ':jsProductionExecutableCompileSync' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
Jonathan Ellis
07/21/2022, 2:25 PMandylamax
07/21/2022, 8:44 PMExecution failed for task ':jsNodeTest'.
> command '/media/andylamax/Auxilliary/Devspace/.gradle/nodejs/node-v16.13.0-linux-x64/bin/node' exited with errors (exit code: 1)
Cameron Probert
07/22/2022, 1:50 AMkotlin {
js {
browser {
commonWebpackConfig {
cssSupport.enabled = true
mode = buildMode
export = false
}
// from <https://discuss.kotlinlang.org/t/kotlin-js-react-accessing-configuring-environment-variables/16906/9>
val envTargetWebpackArgs = listOf("--env.envTarget=$envTarget", "--env.version=$version")
webpackTask { args.plusAssign(envTargetWebpackArgs) }
runTask { args.plusAssign(envTargetWebpackArgs) }
}
useCommonJs()
}
explicitApi()
}
With the key lines being:
val envTargetWebpackArgs = listOf("--env.envTarget=$envTarget", "--env.version=$version")
webpackTask { args.plusAssign(envTargetWebpackArgs) }
runTask { args.plusAssign(envTargetWebpackArgs) }
The new way of passing env variables in webpack-cli v4 (which is what webpack 5 uses as far as I understand) is to have a space instead of a .
(i.e. --env envTarget=$envTarget
instead of --env.envTarget=$envTarget
)
Neither the old way nor new way seem to work. The webpack.config.js
file is not generated in the build directory. Both old and new env arg options error in :browserProductionWebpack
with
Starting process 'command '/Users/cameron/.gradle/nodejs/node-v16.13.0-darwin-x64/bin/node''. Working directory: /Users/cameron/IdeaProjects/app/build/js/packages/app Command: /Users/cameron/.gradle/nodejs/node-v16.13.0-darwin-x64/bin/node /Users/cameron/IdeaProjects/app/build/js/node_modules/webpack/bin/webpack.js --env.envTarget=DEV --env.version=2.3.7 --config /Users/cameron/IdeaProjects/app/build/js/packages/app/webpack.config.js
Successfully started process 'command '/Users/cameron/.gradle/nodejs/node-v16.13.0-darwin-x64/bin/node''
[webpack-cli] Error: Unknown option '--env.envTarget=DEV'
[webpack-cli] Run 'webpack --help' to see available commands and options
But, when I go to the above working directory and execute that command it runs without failing and the webpack.config.js
file is generated.Ashley Arthur
07/22/2022, 12:44 PMexternal interface SomeAPI_JS {
fun doSomeAction(context: Json?)
}
It seems like kotlin.js.json comes across as Json
... but the type is undefine?
Is this expected behaviour?Andrey Tabakov
07/26/2022, 8:17 AMFranco
07/27/2022, 12:41 AMExecution failed for task ':browserTest'.
> Errors occurred during launch of browser for testing.
- ChromeHeadless
Please make sure that you have installed browsers.
Or change it via
browser {
testTask {
useKarma {
useFirefox()
useChrome()
useSafari()
}
}
}
However I have Chrome installed in my machine so not sure why this is happening. I have tried using Firefox (which I also have installed) and same error occurs. Anyone knows how to fix this?Cameron Probert
07/27/2022, 8:03 AMbuild
, browserDevelopmentWebpack
and browserProductionWebpack
, and also how they differ from setting the webpack mode to PRODUCTION
or DEVELOPMENT
in build.gradle.kts
.
I ask this because I was using browserDevelopmentWebpack
but with mode=PRODUCTION
, which seem like they would conflict with each other, and the resulting bundle appeared to be a development bundle (not minified, not DCE’d).andylamax
07/27/2022, 2:38 PMkotlinNpmInstall
is failing on CI (github actions), but it passes locally. Full error log in thread.Cheick Kante
07/29/2022, 12:49 AMDialog {
PaperComponent = FC { //this : ChildrenBuilder it: PaperProps
<http://it.sx|it.sx> {
fontSize = FontSize.small
backgroundColor = Color("transparent")
}
}
}
I have also tried this but doesn't do anything
Dialog {
PaperComponent = FC { //this : ChildrenBuilder it: PaperProps
it.asDynamic()["background-color"] = "transparent"
it.asDynamic()["font-size"] = "small"
}
}
Does anyoneLukas S
08/01/2022, 8:48 AMUğur
08/02/2022, 2:45 PMmartmists
08/02/2022, 3:57 PMmartmists
08/02/2022, 3:57 PMRobert Jaros
08/02/2022, 4:03 PMmartmists
08/02/2022, 5:08 PM