Skip to content
This repository was archived by the owner on Nov 6, 2019. It is now read-only.

Commit a6e3e91

Browse files
authored
Introduce npm-publishing related tasks to gradle (#123)
* Introduce npm-publishing related tasks to gradle * Disable meta-info, rename NPM_VERSION system property
1 parent b4ef7a6 commit a6e3e91

File tree

4 files changed

+32
-190
lines changed

4 files changed

+32
-190
lines changed

build.gradle

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ compileKotlin2Js {
3838
kotlinOptions {
3939
outputFile = "${distribPath}/ts2kt.js"
4040
sourceMap = true
41+
metaInfo = false
4142
freeCompilerArgs += ["-output-prefix", "${projectDir}/shebang.txt"]
4243

4344
moduleKind = 'commonjs'
@@ -88,7 +89,34 @@ task runTests(type: NodeTask) {
8889
]
8990
}
9091

92+
task prepareNpmPackage(type: Copy) {
93+
from "package.json", "LICENSE", "npm.template/README.md"
94+
into distribPath
95+
}
96+
97+
task npmVersion(type: NpmTask) {
98+
dependsOn = ['prepareNpmPackage']
99+
100+
def npmVersion = System.getProperty('kotlin.npmjs.ts2kt.version')
101+
102+
onlyIf {
103+
npmVersion
104+
}
105+
106+
args = ["version", '--prefix', distribPath, npmVersion]
107+
}
108+
109+
task npmPublish(type: NpmTask) {
110+
dependsOn = [npmVersion]
111+
112+
def token = System.getProperty("kotlin.npmjs.auth.token")
113+
def registry = "http://registry.npmjs.org/:_authToken=${token}"
114+
115+
args = ["publish", distribPath, "--registry", "${registry}"]
116+
}
117+
91118
fetchBuildableDependencies.dependsOn = [compileKotlin2Js]
92119
test.dependsOn = [
93120
runTests
94-
]
121+
]
122+

build.xml

Lines changed: 0 additions & 48 deletions
This file was deleted.

node_utils.xml

Lines changed: 0 additions & 138 deletions
This file was deleted.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"homepage": "https://github.com/Kotlin/ts2kt",
77
"license": "Apache-2.0",
88
"files": [
9-
"build/distrib/**/*.js"
9+
"*.js"
1010
],
1111
"repository": {
1212
"type": "git",
@@ -35,8 +35,8 @@
3535
"mocha-simple-html-reporter": "1.1.0",
3636
"mocha-teamcity-reporter": "2.5.1"
3737
},
38-
"main": "./build/distrib/ts2kt.js",
38+
"main": "./ts2kt.js",
3939
"bin": {
40-
"ts2kt": "./build/distrib/ts2kt.js"
40+
"ts2kt": "./ts2kt.js"
4141
}
4242
}

0 commit comments

Comments
 (0)