Skip to content

Commit 1329709

Browse files
committed
feat: Closes #163 .npmrc support
1 parent 474f0f0 commit 1329709

File tree

10 files changed

+153
-138
lines changed

10 files changed

+153
-138
lines changed

.github/workflows/check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- uses: actions/setup-java@v3
2222
with:
2323
distribution: 'adopt'
24-
java-version: 11
24+
java-version: 21
2525

2626
- name: Restore Gradle cache
2727
id: cache

.github/workflows/deploy-pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- uses: actions/setup-java@v3
2828
with:
2929
distribution: 'adopt'
30-
java-version: 11
30+
java-version: 21
3131
- name: Restore Gradle cache
3232
id: cache
3333
uses: actions/cache@v3

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ jobs:
8282
- name: Set up JDK
8383
uses: actions/setup-java@v3
8484
with:
85-
java-version: 11
85+
java-version: 21
8686
distribution: 'adopt'
8787

8888
- name: Publish to Gradle Plugin Portal
@@ -121,7 +121,7 @@ jobs:
121121
- name: Set up JDK
122122
uses: actions/setup-java@v3
123123
with:
124-
java-version: 11
124+
java-version: 21
125125
distribution: 'adopt'
126126

127127
- name: Publish to GitHub Packages
@@ -159,7 +159,7 @@ jobs:
159159
- name: Set up JDK
160160
uses: actions/setup-java@v3
161161
with:
162-
java-version: 11
162+
java-version: 21
163163
distribution: 'adopt'
164164

165165
- name: Publish to MavenCentral

.github/workflows/sandbox-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
- name: Set up JDK
3737
uses: actions/setup-java@v3
3838
with:
39-
java-version: 11
39+
java-version: 21
4040
distribution: 'adopt'
4141

4242
- name: Publish

CHANGELOG.md

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,37 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
### Verified Versions
1313

14-
- Kotlin: 2.0.21
14+
- Kotlin: 2.1.0
1515
- Gradle: 8.10
16-
- JDK: 11
16+
- JDK: 21
1717

1818
### Added
19+
20+
### Changed
21+
22+
### Removed
23+
24+
---
25+
26+
## [3.5.0]
27+
28+
### Verified Versions
29+
30+
- Kotlin: 2.1.0
31+
- Gradle: 8.10
32+
- JDK: 21
33+
34+
### Added
35+
1936
- Auth, username and password properties of registries.
2037
- K2 support
38+
- `.npmrc` support
39+
- Options to customise `node` and `npm` executables.
2140

2241
### Changed
42+
2343
- Version upgrades
44+
- Licence changed to [The Unlicense](https://unlicense.org)
2445

2546
### Removed
2647

@@ -451,7 +472,9 @@ This is a maintenance release with a few minor bugfixes.
451472

452473
---
453474

454-
[Unreleased]: https://github.com/mpetuska/npm-publish/compare/3.4.2...HEAD
475+
[Unreleased]: https://github.com/mpetuska/npm-publish/compare/3.5.0...HEAD
476+
477+
[3.5.0]: https://github.com/mpetuska/npm-publish/compare/3.4.2...3.5.0
455478

456479
[3.4.2]: https://github.com/mpetuska/npm-publish/compare/3.4.1...3.4.2
457480

gradle/libs.versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[versions]
2-
detekt = "1.23.6"
2+
detekt = "1.23.7"
33
kotest = "5.9.1"
4-
kotlin = "2.0.21"
4+
kotlin = "2.1.0"
55

66
[libraries]
77
detekt-formatting = { module = "io.gitlab.arturbosch.detekt:detekt-formatting", version.ref = "detekt" }

npm-publish-gradle-plugin/src/main/kotlin/task/NpmPublishTask.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,19 @@ public abstract class NpmPublishTask : NpmExecTask() {
7777
@Suppress("unused")
7878
@TaskAction
7979
private fun doAction() {
80-
val pDir = packageDir.asFile.get()
8180
val reg = registry.get()
8281
val uri = reg.uri.get()
8382
val repo = "${uri.authority.trim()}${uri.path.trim()}/"
83+
val pDir = packageDir.asFile.get()
84+
val workingDir = project.layout.buildDirectory.dir("registries/${reg.name}/${pDir.name}").get().asFile
8485

8586
val d = dry.get()
8687
info {
87-
"Publishing package at $pDir to ${reg.name} registry ${if (d) "with" else "without"} --dry-run flag"
88+
"Publishing package at $workingDir to ${reg.name} registry ${if (d) "with" else "without"} --dry-run flag"
8889
}
8990
val args: List<String> = buildList {
9091
add("publish")
91-
add("$pDir")
92+
add("$workingDir")
9293
add("--access=${reg.access.get()}")
9394
add("--registry=${uri.scheme.trim()}://$repo")
9495
if (reg.otp.isPresent) add("--otp=${reg.otp.get()}")
@@ -103,13 +104,12 @@ public abstract class NpmPublishTask : NpmExecTask() {
103104
if (d) add("--dry-run")
104105
if (tag.isPresent) add("--tag=${tag.get()}")
105106
}
106-
val workingDir = project.layout.buildDirectory.dir("registries/${reg.name}/${packageDir.get().asFile.name}")
107107
fs.sync {
108108
it.from(packageDir)
109109
if (reg.npmrc.isPresent) it.from(reg.npmrc)
110110
it.into(workingDir)
111111
}
112-
npmExec(args) { it.workingDir(workingDir.get()) }.rethrowFailure()
113-
if (!d) info { "Published package at $pDir to ${reg.name} registry" }
112+
npmExec(args) { it.workingDir(workingDir) }.rethrowFailure()
113+
if (!d) info { "Published package at $workingDir to ${reg.name} registry" }
114114
}
115115
}

0 commit comments

Comments
 (0)