Skip to content

Commit 0b611a8

Browse files
committed
Fixing and expanding property resolution
1 parent 3d882a7 commit 0b611a8

File tree

15 files changed

+106
-70
lines changed

15 files changed

+106
-70
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ root = true
33
[*]
44
indent_size = 2
55
continuation_indent_size = 4
6-
ij_kotlin_name_count_to_use_star_import = unset
6+
ij_kotlin_name_count_to_use_star_import = 9000

CHANGELOG.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
1-
# v2.0.4
1+
# v2.1.0
22
## Versions
33
* Kotlin: 1.5.21
4+
* Gradle: 7.2.0
5+
* JDK: 11
6+
7+
## Changes
8+
* Fixed [#24](https://github.com/mpetuska/npm-publish/issues/24): `types` configuration property was ignored
9+
* Added support for setting configuration properties via environment variables too
10+
* Kotlin version bumped to `1.5.21`
11+
12+
# v2.0.4
13+
## Versions
14+
* Kotlin: 1.5.10
415
* Gradle: 7.1.1
516
* JDK: 11
617

README.md

Lines changed: 47 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
Gradle plugin enabling NPM publishing (essentially `maven-publish` for NPM packages). Integrates seamlessly with
1010
Kotlin/JS/MPP plugin if applied, providing auto configurations.
1111

12-
> The plugin was last tested with `JDK 11`, `Kotlin 1.5.21` & `Gradle 7.1.1`
12+
> The plugin was last tested with `JDK 11`, `Kotlin 1.5.21` & `Gradle 7.2.0`
1313
1414
## Setup
1515

@@ -43,7 +43,7 @@ kotlin {
4343

4444
npmPublishing {
4545
repositories {
46-
repository("npmjs") {
46+
repository("npmjs") {
4747
registry = uri("https://registry.npmjs.org")
4848
authToken = "asdhkjsdfjvhnsdrishdl"
4949
}
@@ -164,39 +164,44 @@ npmPublishing {
164164
#### Properties
165165

166166
Most of the DSL configuration options can also be set/overridden via gradle
167-
properties (`./gradlew task -Pprop.name=propValue`), `gradle.properties` or `local.properties`. Bellow is the full list
168-
of supported properties:
169-
170-
Extension:
171-
172-
* `npm.publish.readme`
173-
* `npm.publish.organization`
174-
* `npm.publish.access`
175-
* `npm.publish.bundleKotlinDependencies`
176-
* `npm.publish.shrinkwrapBundledDependencies`
177-
* `npm.publish.dry`
178-
* `npm.publish.version`
179-
180-
Publication:
181-
182-
* `npm.publish.publication.<name>.bundleKotlinDependencies`
183-
* `npm.publish.publication.<name>.shrinkwrapBundledDependencies`
184-
* `npm.publish.publication.<name>.scope`
185-
* `npm.publish.publication.<name>.moduleName`
186-
* `npm.publish.publication.<name>.version`
187-
* `npm.publish.publication.<name>.main`
188-
* `npm.publish.publication.<name>.types`
189-
* `npm.publish.publication.<name>.readme`
190-
* `npm.publish.publication.<name>.nodeJsDir`
191-
* `npm.publish.publication.<name>.destinationDir`
192-
193-
Repository:
194-
195-
* `npm.publish.repository.<name>.dry`
196-
* `npm.publish.repository.<name>.access`
197-
* `npm.publish.repository.<name>.registry`
198-
* `npm.publish.repository.<name>.otp`
199-
* `npm.publish.repository.<name>.authToken`
167+
properties (`./gradlew task -Pprop.name=propValue`), `gradle.properties` or `local.properties`. These properties can
168+
also be set via environment variables by replacing `.`, ` ` & `-` with `_` and capitalising all names. Properties are
169+
resolved in the following priority:
170+
171+
1. DSL
172+
2. Gradle Properties
173+
3. Environment Variables
174+
175+
##### Extension
176+
177+
* `npm.publish.readme (NPM_PUBLISH_README)`
178+
* `npm.publish.organization (NPM_PUBLISH_ORGANIZATION)`
179+
* `npm.publish.access (NPM_PUBLISH_ACCESS)`
180+
* `npm.publish.bundleKotlinDependencies (NPM_PUBLISH_BUNDLEKOTLINDEPENDENCIES)`
181+
* `npm.publish.shrinkwrapBundledDependencies (NPM_PUBLISH_SHRINKWRAPBUNDLEDDEPENDENCIES)`
182+
* `npm.publish.dry (NPM_PUBLISH_DRY)`
183+
* `npm.publish.version (NPM_PUBLISH_VERSION)`
184+
185+
##### Publication
186+
187+
* `npm.publish.publication.<name>.bundleKotlinDependencies (NPM_PUBLISH_PUBLICATION_<NAME>_BUNDLEKOTLINDEPENDENCIES)`
188+
* `npm.publish.publication.<name>.shrinkwrapBundledDependencies (NPM_PUBLISH_PUBLICATION_<NAME>_SHRINKWRAPBUNDLEDDEPENDENCIES)`
189+
* `npm.publish.publication.<name>.scope (NPM_PUBLISH_PUBLICATION_<NAME>_SCOPE)`
190+
* `npm.publish.publication.<name>.moduleName (NPM_PUBLISH_PUBLICATION_<NAME>_MODULENAME)`
191+
* `npm.publish.publication.<name>.version (NPM_PUBLISH_PUBLICATION_<NAME>_VERSION)`
192+
* `npm.publish.publication.<name>.main (NPM_PUBLISH_PUBLICATION_<NAME>_MAIN)`
193+
* `npm.publish.publication.<name>.types (NPM_PUBLISH_PUBLICATION_<NAME>_TYPES)`
194+
* `npm.publish.publication.<name>.readme (NPM_PUBLISH_PUBLICATION_<NAME>_README)`
195+
* `npm.publish.publication.<name>.nodeJsDir (NPM_PUBLISH_PUBLICATION_<NAME>_NODEJSDIR)`
196+
* `npm.publish.publication.<name>.destinationDir (NPM_PUBLISH_PUBLICATION_<NAME>_DESTINATIONDIR)`
197+
198+
##### Repository
199+
200+
* `npm.publish.repository.<name>.dry (NPM_PUBLISH_REPOSITORY_<NAME>_DRY)`
201+
* `npm.publish.repository.<name>.access (NPM_PUBLISH_REPOSITORY_<NAME>_ACCESS)`
202+
* `npm.publish.repository.<name>.registry (NPM_PUBLISH_REPOSITORY_<NAME>_REGISTRY)`
203+
* `npm.publish.repository.<name>.otp (NPM_PUBLISH_REPOSITORY_<NAME>_OTP)`
204+
* `npm.publish.repository.<name>.authToken (NPM_PUBLISH_REPOSITORY_<NAME>_AUTHTOKEN)`
200205

201206
## Tasks
202207

@@ -207,9 +212,7 @@ The plugin generates the following gradle tasks for various configuration elemen
207212
* NpmPackTask: generated for each publication and named as `pack<UpperCammelCasePublicationName>NpmPublication`
208213
* NpmPublishTask: generated for each publication + repository combination and named
209214
as `publish<UpperCammelCasePublicationName>NpmPublicationTo<UpperCammelCaseRepositoryName>`
210-
211-
All created tasks are added as dependencies to grouping tasks to allow for group-invocation:
212-
215+
All created tasks are added as dependencies to grouping tasks to allow for group-invocation:
213216
* NpmPackageAssembleTask: `assemble` task in `build` group
214217
* NpmPackTask: `pack` task in `build` group
215218
* NpmPublishTask: `publish` task in `publishing` group
@@ -222,14 +225,12 @@ priority order by their name (descending priority):
222225
1. Optional
223226
2. Peer
224227
3. Dev
225-
4. Normal
226-
227-
This ensures that any given dependency does not appear in multiple dependency scopes.
228+
4. Normal This ensures that any given dependency does not appear in multiple dependency scopes.
228229

229230
## Known Issues
230231

231-
* [#6435](https://github.com/npm/npm/issues/6435): (Only applies to legacy backend) npm and yarn tries to download bundled dependencies. Can be overcome
232-
for npm (sadly not yarn) with `shrinkwrapBundledDependencies` option. Note that it works fine for both package
233-
managers when installing from a tarball. Bug [#2143](https://github.com/npm/cli/issues/2143) on the new npm repo, so
234-
please vote for that to get it fixed. Bug [#8436](https://github.com/yarnpkg/yarn/issues/8436) on the yarn repo, so
235-
please vote for that to get it fixed.
232+
* [#6435](https://github.com/npm/npm/issues/6435): (Only applies to legacy backend) npm and yarn tries to download
233+
bundled dependencies. Can be overcome for npm (sadly not yarn) with `shrinkwrapBundledDependencies` option. Note that
234+
it works fine for both package managers when installing from a tarball.
235+
Bug [#2143](https://github.com/npm/cli/issues/2143) on the new npm repo, so please vote for that to get it fixed.
236+
Bug [#8436](https://github.com/yarnpkg/yarn/issues/8436) on the yarn repo, so please vote for that to get it fixed.

build.gradle.kts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
import de.fayard.refreshVersions.core.versionFor
12
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
23

34
plugins {
4-
kotlin("jvm") version "1.4.30"
5+
kotlin("jvm") version "1.4.31"
56
`java-gradle-plugin`
67
`maven-publish`
78
id("com.gradle.plugin-publish")
@@ -26,6 +27,11 @@ idea {
2627
}
2728
}
2829

30+
ktlint {
31+
version by versionFor("version.ktlint")
32+
additionalEditorconfigFile.set(rootDir.resolve(".editorconfig"))
33+
}
34+
2935
gradleEnterprise {
3036
buildScan {
3137
termsOfServiceUrl = "https://gradle.com/terms-of-service"
@@ -157,7 +163,7 @@ afterEvaluate {
157163
"Built-By" to System.getProperty("user.name"),
158164
"Build-Jdk" to System.getProperty("java.version"),
159165
"Implementation-Version" to project.version,
160-
"Created-By" to "Gradle v${org.gradle.util.GradleVersion.current()}",
166+
"Created-By" to "Gradle v${GradleVersion.current()}",
161167
"Created-From" to Git.headCommitHash
162168
)
163169
}

gradle/wrapper/gradle-wrapper.jar

333 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

gradlew

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ case "`uname`" in
7272
Darwin* )
7373
darwin=true
7474
;;
75-
MINGW* )
75+
MSYS* | MINGW* )
7676
msys=true
7777
;;
7878
NONSTOP* )

sandbox/gradlew

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../gradlew

sandbox/gradlew.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../gradlew.bat

settings.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
2-
id("de.fayard.refreshVersions") version "0.10.1"
3-
id("com.gradle.enterprise") version "3.6.3"
2+
id("de.fayard.refreshVersions") version "0.11.0"
3+
id("com.gradle.enterprise") version "3.6.4"
44
}
55

66
rootProject.name = "npm-publish"

0 commit comments

Comments
 (0)