Merge pull request #8 from aSemy/update/readme

Update README with Kotlin Multiplatform info, add Contributing guide with lockfile instructions
This commit is contained in:
Erik C. Thauvin 2023-08-06 10:04:17 -07:00 committed by GitHub
commit fb19749795
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 58 additions and 7 deletions

36
CONTRIBUTING.md Normal file
View file

@ -0,0 +1,36 @@
# Contributing to UrlEncoder
First and foremost, thank you for your interest in contributing! Here's a brief guide on how to contribute to the
UrlEncoder project.
## Getting Started
1. Fork the repository.
2. Clone your fork locally.
3. Create a new branch for your feature or bugfix.
## Updating Dependencies
To support deterministic builds, and to help with dependency analysis tools like Snyk, UrlEncoder uses lockfiles
to ensure consistent dependencies. Whenever a dependency is updated the lockfiles must be updated.
### Gradle Lock Files
Gradle's [dependency lockfiles](https://docs.gradle.org/current/userguide/dependency_locking.html)
can be updated by running
```bash
./gradlew resolveAndLockAllDependencies --write-locks
```
### Kotlin/JS Lockfile
The Kotlin/JS target
[also uses a lockfile](https://kotlinlang.org/docs/js-project-setup.html#version-locking-via-kotlin-js-store),
which is managed by Yarn.
To update the Kotlin/JS lockfile, run
```bash
./gradlew kotlinNpmInstall
```

View file

@ -10,7 +10,7 @@
# URL Encoder for Kotlin # URL Encoder for Kotlin
A simple defensive library to encode/decode URL components. UrlEncoder is a simple defensive Kotlin Multiplatform library to encode/decode URL components.
This library was adapted from the [RIFE2 Web Application Framework](https://rife2.com). This library was adapted from the [RIFE2 Web Application Framework](https://rife2.com).
A pure Java version can also be found at [https://github.com/gbevin/urlencoder](https://github.com/gbevin/urlencoder). A pure Java version can also be found at [https://github.com/gbevin/urlencoder](https://github.com/gbevin/urlencoder).
@ -51,19 +51,34 @@ UrlEncoder.decode("foo+bar", plusToSpace = true) // -> foo bar
To use with [Gradle](https://gradle.org/), include the following dependency in your build file: To use with [Gradle](https://gradle.org/), include the following dependency in your build file:
```gradle ```kotlin
repositories { repositories {
mavenCentral() mavenCentral()
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") } // only needed for SNAPSHOT // only needed for SNAPSHOT
maven("https://oss.sonatype.org/content/repositories/snapshots") {
name = "SonatypeSnapshots"
mavenContent { snapshotsOnly() }
}
} }
dependencies { dependencies {
implementation("net.thauvin.erik:urlencoder:1.3.0") implementation("net.thauvin.erik:urlencoder-lib:1.3.0")
} }
``` ```
Instructions for using with Maven, Ivy, etc. can be found Adding a dependency in [Maven](https://maven.apache.org/) requires specifying the JVM variant by adding a `-jvm` suffix
on [Maven Central](https://maven-badges.herokuapp.com/maven-central/net.thauvin.erik/urlencoder-jvm). to the artifact URL.
```xml
<dependency>
<groupId>net.thauvin.erik</groupId>
<artifactId>urlencoder-lib-jvm</artifactId>
<version>1.3.0</version>
</dependency>
```
Instructions for using with Maven, Ivy, etc. can be found on
[Maven Central](https://search.maven.org/artifact/net.thauvin.erik/urlencoder).
## Standalone usage ## Standalone usage
@ -127,7 +142,7 @@ foo+%2Bbar
Trying to decode it with [Spring](https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/util/UriUtils.html#decode(java.lang.String,java.lang.String)), for example: Trying to decode it with [Spring](https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/util/UriUtils.html#decode(java.lang.String,java.lang.String)), for example:
```kotlin ```kotlin
UriUtils.decode(u, StandardCharsets.UTF_8)) UriUtils.decode(u, StandardCharsets.UTF_8)
``` ```
would return: would return: