Skip to content

Commit

Permalink
Fix npm publication
Browse files Browse the repository at this point in the history
  * Postpone version expansion on after evaluate phase

Fixes Kotlin#1118
  • Loading branch information
qwwdfsad authored and elizarov committed Apr 24, 2019
1 parent 4f0a3b9 commit 390c722
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
7 changes: 6 additions & 1 deletion gradle/node-js.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ node {
task prepareNodePackage(type: Copy) {
from("npm") {
include 'package.json'
expand (project.properties + [kotlinDependency: ""])
/*
* Postpone expansion of package.json until we configure version property in build.gradle
*/
afterEvaluate {
expand(project.properties + [kotlinDependency: ""])
}
}
from("npm") {
exclude 'package.json'
Expand Down
9 changes: 5 additions & 4 deletions gradle/publish-npm-js.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def distTag(version) {

def npmTemplateDir = file("$projectDir/js/npm")
def npmDeployDir = file("$buildDir/npm")
def npmDeployTag = distTag(version)

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

task publishNpm(type: NpmTask, dependsOn: [preparePublishNpm]) {
workingDir = npmDeployDir
def deployArgs = ['publish',
"--//registry.npmjs.org/:_authToken=$authToken",
"--tag=$npmDeployTag"]

doFirst {
def npmDeployTag = distTag(version)
def deployArgs = ['publish',
"--//registry.npmjs.org/:_authToken=$authToken",
"--tag=$npmDeployTag"]
if (dryRun == "true") {
println("$npmDeployDir \$ npm arguments: $deployArgs")
args = ['pack']
Expand Down

0 comments on commit 390c722

Please sign in to comment.