Skip to content

Commit

Permalink
Docusaurus (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
RBusarow authored Jul 14, 2021
1 parent d1f0c95 commit 7428f65
Show file tree
Hide file tree
Showing 28 changed files with 36,825 additions and 0 deletions.
20 changes: 20 additions & 0 deletions docusaurus/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
33 changes: 33 additions & 0 deletions docusaurus/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Website

This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator.

## Installation

```console
yarn install
```

## Local Development

```console
yarn start
```

This command starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server.

## Build

```console
yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

## Deployment

```console
GIT_USER=<Your GitHub username> USE_SSH=true yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
3 changes: 3 additions & 0 deletions docusaurus/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve("@docusaurus/core/lib/babel/preset")],
};
15 changes: 15 additions & 0 deletions docusaurus/docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
id: changelog
title: Change Log
sidebar_label: Change Log
---

## 0.10.0

Initial release

This release supports multi-bound `ViewModel` injection via the `by tangle()` delegate function,
with Compose support.

Automatic `SavedStateHandle` injection is supported, and arguments can be automatically
constructor-injected via the `@FromSavedState("myKey")` annotation.
91 changes: 91 additions & 0 deletions docusaurus/docs/configuration.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
id: configuration
sidebar_label: Configuration
---


The `TangleComponents` holder needs to be initialized with an application-scoped Dagger Component in
order to complete the graph.

``` Kotlin
class MyApplication : Application() {

override fun onCreate() {
super.onCreate()

val myAppComponent = DaggerAppComponent.factory()
.create(this)

TangleComponents.add(myAppComponent)
}
}
```

### Gradle plugin

The simple way to apply Tangle is to just apply the gradle plugin. It will automatically add the
dependencies and perform some basic validation of your module's configuration.

```kotlin
// settings.gradle.kts

pluginManagement {
repositories {
gradlePluginPortal()
}
}
```

```kotlin
// top-level build.gradle.kts

plugins {
id("com.rickbusarow.tangle") version "0.10.0"
}
```

```kotlin
// any Android module's build.gradle.kts

plugins {
id("android-library") // or application, etc.
kotlin("android")
id("com.squareup.anvil")
id("com.rickbusarow.tangle")
}

// optional
tangle {
composeEnabled.set(true) // default is false
}
```

### Explicit dependencies

You can also just add dependencies yourself, without applying the plugin.

Note that `tangle-api` is an Android library, and `tangle-compiler` generates Android-specific code,
so they should only be added to Android modules.

```kotlin
// any Android module's build.gradle.kts

plugins {
id("android-library") // or application, etc.
kotlin("android")
id("com.squareup.anvil")
}

dependencies {

api("com.rickbusarow.tangle:tangle-annotations:0.10.0")

implementation("com.rickbusarow.tangle:tangle-api:0.10.0")

// optional Compose support
implementation("com.rickbusarow.tangle:tangle-compose:0.10.0")

// `anvil` adds the compiler extension to the Anvil plugin's list of code generators
anvil("com.rickbusarow.tangle:tangle-compiler:0.10.0")
}
```
94 changes: 94 additions & 0 deletions docusaurus/docs/quickstart.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
---
id: quickstart
title: Quick Start
sidebar_label: Quick Start
slug: /
---


import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';

## Dependencies

<Tabs groupId="language"
defaultValue="Kotlin"
values={[
{label: 'Kotlin', value: 'Kotlin'}, {label: 'Groovy', value: 'Groovy'},
]}>

<TabItem value="Kotlin">

```kotlin
// settings.gradle.kts

pluginManagement {
repositories {
gradlePluginPortal()
}
}
```

```kotlin
// top-level build.gradle.kts

plugins {
id("com.rickbusarow.tangle") version "0.10.0"
}
```

```kotlin
// any Android module's build.gradle.kts

plugins {
id("android-library") // or application, etc.
kotlin("android")
id("com.squareup.anvil")
id("com.rickbusarow.tangle")
}

// optional
tangle {
composeEnabled.set(true) // default is false
}
```

</TabItem>

<TabItem value="Groovy">

```groovy
// settings.gradle
pluginManagement {
repositories {
gradlePluginPortal()
}
}
```

```groovy
// top-level build.gradle
plugins {
id "com.rickbusarow.module-check" version "0.10.0"
}
```

```groovy
// any Android module's build.gradle
plugins {
id 'android-library' // or application, etc.
kotlin("android")
id 'com.squareup.anvil'
id 'com.rickbusarow.tangle'
}
// optional
tangle {
composeEnabled = true // default is false
}
```

</TabItem>
</Tabs>
88 changes: 88 additions & 0 deletions docusaurus/docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
module.exports = {
title: "Tangle",
tagline: "Android dependency injection using Anvil",
url: "https://rbusarow.github.io/",
baseUrl: "/Tangle/",
onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",
favicon: "img/favicon.ico",
organizationName: "rbusarow", // Usually your GitHub org/user name.
projectName: "Tangle", // Usually your repo name.
themeConfig: {
hideableSidebar: true,
colorMode: {
defaultMode: "light",
disableSwitch: false,
respectPrefersColorScheme: true,
},
announcementBar: {
id: "supportus",
content:
'⭐️ If you like Tangle, give it a star on <a target="_blank" rel="noopener noreferrer" href="https://github.com/rbusarow/Tangle/">GitHub</a>! ⭐️',
},
navbar: {
title: "Tangle",
// logo: {
// alt: 'Tangle Logo',
// src: 'img/logo.svg',
// },
items: [
{
type: "doc",
docId: "quickstart",
label: "Basics",
position: "left",
},
{
type: "docsVersionDropdown",
position: "right",
dropdownActiveClassDisabled: true,
dropdownItemsAfter: [
{
// to: "/versions",
// label: "All versions",
},
],
},
{
label: "Twitter",
href: "https://twitter.com/rbusarow",
position: "right",
},
{
href: "https://github.com/rbusarow/Tangle/",
label: "GitHub",
position: "right",
},
],
},
footer: {
copyright: `Copyright © ${new Date().getFullYear()} Rick Busarow, Built with Docusaurus.`,
},
prism: {
theme: require("prism-react-renderer/themes/github"),
darkTheme: require("prism-react-renderer/themes/dracula"),
additionalLanguages: ["kotlin", "groovy"],
},
},
presets: [
[
"@docusaurus/preset-classic",
{
docs: {
sidebarPath: require.resolve("./sidebars.js"),
// Please change this to your repo.
editUrl: "https://github.com/rbusarow/Tangle/",
},
blog: {
showReadingTime: true,
// Please change this to your repo.
editUrl: "https://github.com/rbusarow/Tangle/",
},
theme: {
customCss: require.resolve("./src/css/custom.css"),
},
},
],
],
};
Loading

0 comments on commit 7428f65

Please sign in to comment.