Hello, do the new `org.jetbrains.kotlin.js` gradle...
# javascript
g
Hello, do the new
org.jetbrains.kotlin.js
gradle plugin has capabilities to deploy the code as an npm module? Where can I find its documentation?
a
cc @snrostov
s
Publishing not supported yet. Please create issue in youtrack .
🙏 1
g
Ok will do!
@snrostov What can I do in the meantime? Manually copy the /build/ files and add a package.json?
s
package.json
already created by the plugin. It is located in
build/js/packages/<compilationName>/package.json
. But it is has some issues for publishing:
devDependencies
messed with
dependencies
and some other minor things. So, yes, meanwhile it is better to create package.json for publishing manually by copying
build/js/packages/<compilationName>
contents and replacing/patching
package.json
.
g
Ok, I’ll look at this
@snrostov I couldn’t tag it
new-multiplatform
but here you go https://youtrack.jetbrains.com/issue/KT-32332
s
Thanks!
g
@snrostov Is this what you meant by messed up dependencies?
Copy code
npm ERR! notarget No matching version found for kotlinx-io@0.1.10
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
I found this https://www.npmjs.com/package/kotlinx-coroutines-io but this old
0.1.4-SNAPSHOT
doesn’t seem relevant, is it?
What I am supposed to do if dependencies I need are not deployed themselves to https://www.npmjs.com/ ?
s
@snrostov Is this what you meant by messed up dependencies?
No, I mean that
webpack
and other dev tools are in
dependencies
, but should be in
devDependencies
. For example, currently this
package.json
generated:
Copy code
{
  "main": "kotlin/mppapp18.js",
  "devDependencies": {},
  "dependencies": {
    "webpack": "4.29.6",
    "webpack-cli": "3.3.0",
    "source-map-loader": "0.2.4",
    "source-map-support": "0.5.12",
    "webpack-dev-server": "3.3.1",
    "kotlin": "1.3.40"
  },
  "name": "mppapp18",
  "version": "0.0.0-unspecified"
}
But should be:
Copy code
{
  "main": "kotlin/mppapp18.js",
  "devDependencies": {
    "webpack": "4.29.6",
    "webpack-cli": "3.3.0",
    "source-map-loader": "0.2.4",
    "source-map-support": "0.5.12",
    "webpack-dev-server": "3.3.1"
  },
  "dependencies": {
    "kotlin": "1.3.40"
  },
  "name": "mppapp18",
  "version": "0.0.0-unspecified"
}
What I am supposed to do if dependencies I need are not deployed themselves to https://www.npmjs.com/ ?
You may bundle this dependencies in your package. There is http://npm.github.io/using-pkgs-docs/package-json/types/bundleddependencies.html for that.
g
Awesome thank you!