diff --git a/LICENSE.md b/LICENSE.md index 7a37ed3..a95c2a5 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024 Krzysztof Borowy +Copyright (c) 2023 Krzysztof Borowy Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 1d2b958..d296095 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,12 @@ Multiplatform sqlite storage for React Native AsyncStorage +## Usage + +```groovy +implementation("io.github.react-native-async-storage:sqlite-storage:VERSION") +``` + ## Testing Gradle tasks to run tests: diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3fbac89..18f1d75 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -28,6 +28,7 @@ test-turbine = { module = "app.cash.turbine:turbine", version = "0.12.1" } gradlePlugin-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } gradlePlugin-testLogger = { module = "com.adarshr:gradle-test-logger-plugin", version = "3.2.0" } gradlePlugin-spotless = { module = "com.diffplug.spotless:spotless-plugin-gradle", version.ref = "spotless" } +gradlePlugin-publish = { module = "com.vanniktech:gradle-maven-publish-plugin", version = "0.27.0" } [bundles] common-test = [ diff --git a/package.json b/package.json index 995a52a..5cd3197 100644 --- a/package.json +++ b/package.json @@ -1,25 +1,27 @@ { - "name": "@react-native-async-storage/sqlite-storage-native", - "version": "0.0.0", + "name": "Async Storage Sqlite", + "private": true, + "version": "0.0.1", "description": "Multiplatform sqlite storage for React Native AsyncStorage", - "main": "lib/commonjs/index.js", - "module": "lib/module/index.js", - "react-native": "src/index.ts", - "types": "lib/typescript/index.d.ts", "repository": { "url": "https://github.com/react-native-async-storage/sqlite-storage.git", "owner": "react-native-async-storage", "name": "sqlite-storage" }, + "author": "Krzysztof Borowy ", + "homepage": "https://github.com/react-native-async-storage/sqlite-storage", + "license": "MIT", + "main": "lib/commonjs/index.js", + "module": "lib/module/index.js", + "react-native": "src/index.ts", + "types": "lib/typescript/index.d.ts", "files": [ "src", "lib", "nativeLib", "AsyncStorageSqlite.podspec" ], - "author": "Krzysztof Borowy ", - "license": "MIT", - "homepage": "https://github.com/react-native-async-storage/sqlite-storage", + "packageManager": "yarn@4.0.2", "scripts": { "build": "yarn build:js && yarn build:native", diff --git a/samples/android/build.gradle.kts b/samples/android/build.gradle.kts index 4b9c571..12c24ea 100644 --- a/samples/android/build.gradle.kts +++ b/samples/android/build.gradle.kts @@ -36,8 +36,8 @@ dependencies { implementation("com.google.android.material:material:1.4.0") implementation("androidx.appcompat:appcompat:1.3.1") implementation("androidx.constraintlayout:constraintlayout:2.1.0") - implementation ("androidx.activity:activity-compose:1.4.0") + implementation("androidx.activity:activity-compose:1.4.0") implementation("androidx.compose.ui:ui:1.5.4") implementation("androidx.compose.foundation:foundation:1.5.4") - implementation ("androidx.compose.material:material:1.5.4") + implementation("androidx.compose.material:material:1.5.4") } diff --git a/settings.gradle.kts b/settings.gradle.kts index 0fecb7a..5cd29ed 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -14,7 +14,7 @@ dependencyResolutionManagement { } } -rootProject.name = "SqliteStorage" +rootProject.name = "AsyncStorageSqlite" include(":sqlite-storage") include(":sample-android") project(":sample-android").projectDir = File(rootDir, "samples/android") diff --git a/sqlite-storage-plugin/build.gradle.kts b/sqlite-storage-plugin/build.gradle.kts index d18a534..2015778 100644 --- a/sqlite-storage-plugin/build.gradle.kts +++ b/sqlite-storage-plugin/build.gradle.kts @@ -35,5 +35,6 @@ dependencies { implementation(libs.gradlePlugin.testLogger) implementation(libs.gradlePlugin.kotlin) implementation(libs.gradlePlugin.spotless) + implementation(libs.gradlePlugin.publish) implementation(libs.gson) } diff --git a/sqlite-storage-plugin/src/main/kotlin/ConfigurePublish.kt b/sqlite-storage-plugin/src/main/kotlin/ConfigurePublish.kt new file mode 100644 index 0000000..c637e01 --- /dev/null +++ b/sqlite-storage-plugin/src/main/kotlin/ConfigurePublish.kt @@ -0,0 +1,42 @@ +package org.asyncstorage.sqlite.plugin + +import com.vanniktech.maven.publish.MavenPublishBaseExtension +import com.vanniktech.maven.publish.SonatypeHost +import org.asyncstorage.sqlite.plugin.extensions.PackageInfoExtension +import org.gradle.api.Project +import org.gradle.api.plugins.ExtensionAware +import org.gradle.kotlin.dsl.configure + + +// todo: configure task for easier publishing +// todo: setup GH actions for publishing (secrets): https://vanniktech.github.io/gradle-maven-publish-plugin/central/#secrets +fun Project.configurePublish(info: PackageInfoExtension) { + (project as ExtensionAware).extensions.configure { + publishToMavenCentral(SonatypeHost.S01) + signAllPublications() + + coordinates( + groupId = "io.github.react-native-async-storage", + artifactId = "sqlite-storage", + version = info.version + ) + pom { + name.set(info.name) + description.set(info.description) + inceptionYear.set("2023") + url.set(info.repoUrl) + licenses { + license { + name.set("MIT") + url.set("https://github.com/react-native-async-storage/sqlite-storage/blob/main/LICENSE.md") + } + } + developers { + developer { + name.set("Krzysztof Borowy") + url.set("https://github.com/krizzu") + } + } + } + } +} diff --git a/sqlite-storage-plugin/src/main/kotlin/extensions/PackageInfoExtension.kt b/sqlite-storage-plugin/src/main/kotlin/extensions/PackageInfoExtension.kt index 8f9f6e9..dd0c4df 100644 --- a/sqlite-storage-plugin/src/main/kotlin/extensions/PackageInfoExtension.kt +++ b/sqlite-storage-plugin/src/main/kotlin/extensions/PackageInfoExtension.kt @@ -5,6 +5,7 @@ import org.gradle.api.Project import java.io.File data class PackageJsonContent( + var name: String, var version: String, val description: String, val homepage: String, @@ -24,9 +25,11 @@ data class PackageJsonContent( * package.json in root. */ abstract class PackageInfoExtension(private val pckJson: PackageJsonContent) { - val group = "org.asyncstorage" + val group = "org.asyncstorage.sqlitestorage" val version: String get() = pckJson.version + val name: String + get() = pckJson.name val description: String get() = pckJson.description val homepage: String