I have a fairly standard Kotlin Multiplatform library project that produces library targets for android, jvm, and JavaScript. My project includes a single module, let’s call it ‘my-module’. When I assemble the project, I wind up with a publish-able npm package in the build/js/packages/my-module directory. The produced package.json looks like this:
{
“main”: “kotlin/my-module.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.41”
},
“name”: “my-module”,
“version”: “1.0.20”
}
I want to publish this package to my organization’s npm registry. However, the registry requires that the package name in the package.json be scoped to the organization. So, in the package.json, the name should be:
“name”: “@my-organization/my-module”
Is there some way I can achieve this with a setting in my gradle configuration so that at compile-time the package.json gets produced with the correct scoped name?