Skip to content

Commit ae95e5a

Browse files
committed
Fix npm publication
* Postpone version expansion on after evaluate phase Fixes #1118
1 parent fcfabee commit ae95e5a

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

gradle/node-js.gradle

+6-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ node {
1616
task prepareNodePackage(type: Copy) {
1717
from("npm") {
1818
include 'package.json'
19-
expand (project.properties + [kotlinDependency: ""])
19+
/*
20+
* Postpone expansion of package.json until we configure version property in build.gradle
21+
*/
22+
afterEvaluate {
23+
expand(project.properties + [kotlinDependency: ""])
24+
}
2025
}
2126
from("npm") {
2227
exclude 'package.json'

gradle/publish-npm-js.gradle

+5-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ def distTag(version) {
1616

1717
def npmTemplateDir = file("$projectDir/js/npm")
1818
def npmDeployDir = file("$buildDir/npm")
19-
def npmDeployTag = distTag(version)
2019

2120
def authToken = prop("kotlin.npmjs.auth.token", "")
2221
def dryRun = prop("dryRun", "false")
@@ -32,10 +31,12 @@ task preparePublishNpm(type: Copy) {
3231

3332
task publishNpm(type: NpmTask, dependsOn: [preparePublishNpm]) {
3433
workingDir = npmDeployDir
35-
def deployArgs = ['publish',
36-
"--//registry.npmjs.org/:_authToken=$authToken",
37-
"--tag=$npmDeployTag"]
34+
3835
doFirst {
36+
def npmDeployTag = distTag(version)
37+
def deployArgs = ['publish',
38+
"--//registry.npmjs.org/:_authToken=$authToken",
39+
"--tag=$npmDeployTag"]
3940
if (dryRun == "true") {
4041
println("$npmDeployDir \$ npm arguments: $deployArgs")
4142
args = ['pack']

0 commit comments

Comments
 (0)