Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add doc publication to gh-pages #11

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/deploy-documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
on:
push:
branches:
- master

permissions:
contents: write

jobs:
deploy:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Move to docs
run: cd docs
- uses: actions/setup-node@v4
with:
node-version: 21
- name: Install dependencies
run: cd docs && yarn install --frozen-lockfile
- name: Build website
run: cd docs && yarn build
# Popular action to deploy to GitHub Pages:
# Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Build output to publish to the `gh-pages` branch:
publish_dir: ./docs/build
cname: stylesniffer.cookiecode.dev
# The following lines assign commit authorship to the official
# GH-Actions bot for deploys to `gh-pages` branch:
# https://github.com/actions/checkout/issues/13#issuecomment-724415212
# The GH actions bot is used by default if you didn't specify the two fields.
# You can swap them out with your own user credentials.
user_name: github-actions[bot]
user_email: 41898282+github-actions[bot]@users.noreply.github.com
2 changes: 0 additions & 2 deletions DEV.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Developer guide

Stack: https://stackshare.io/rika2mqtt/rika2mqtt#stack

## IDE

Feel free to use the one you prefer: JAVA is IDE agnostic after all :)
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
## **StyleSniffer: The Ultimate Case Style Detective**

[![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.cookiecode/stylesniffer-parent/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.cookiecode/stylesniffer-parent)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![join discord](https://img.shields.io/badge/join%20discord-gray?style=flat&logo=discord&link=https://discord.gg/uqQ2SWCQCb)](https://discord.gg/uqQ2SWCQCb)

[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=sebastienvermeille_stylesniffer&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=sebastienvermeille_stylesniffer)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=sebastienvermeille_stylesniffer&metric=coverage)](https://sonarcloud.io/summary/new_code?id=sebastienvermeille_stylesniffer)
[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=sebastienvermeille_stylesniffer&metric=ncloc)](https://sonarcloud.io/summary/new_code?id=sebastienvermeille_stylesniffer)
[![code style](https://img.shields.io/badge/code%20style-google%20code%20style-green?style=flat&link=https://google.github.io/styleguide/javaguide.html)](https://google.github.io/styleguide/javaguide.html)
[![OpenSSF Best Practices](https://bestpractices.coreinfrastructure.org/projects/9374/badge)](https://bestpractices.coreinfrastructure.org/projects/9374)


![StyleSniffer Logo](/docs/static/assets/stylesniffer-logo.png)

**StyleSniffer** is a Java library crafted to simplify the detection and analysis of case styles
in strings.

Expand Down Expand Up @@ -33,3 +46,5 @@ caseStyle.ifPresent(style -> System.out.println("Matched style: " + style.getNam
Set<String> supportedStyles = styleSniffer.getSupportedCaseStyles();
System.out.println("Supported styles: " + supportedStyles);
```

Visit the online documentation: https://stylesniffer.cookiecode.dev/
20 changes: 20 additions & 0 deletions docs/.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*
41 changes: 41 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Website

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

### Installation

```
$ yarn
```

### Local Development

```
$ yarn start
```

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

### Build

```
$ yarn build
```

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

### Deployment

Using SSH:

```
$ USE_SSH=true yarn deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> 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.
25 changes: 25 additions & 0 deletions docs/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* The MIT License
* Copyright © 2024 Sebastien Vermeille
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
5 changes: 5 additions & 0 deletions docs/docs/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Contributing

Everyone is welcome to contribute to this Open Source project.

Contributions are very welcome! Please raise issues on GitHub and even better submit some PRs :)
71 changes: 71 additions & 0 deletions docs/docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
sidebar_position: 2
---

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

# Getting Started

## Add the dependency

<Tabs
values={[
{ label: 'Maven', value: 'maven' },
{ label: 'Gradle (Kotlin)', value: 'gradle' },
]}
>
<TabItem value="maven">

**pom.xml**
```xml
<dependency>
<groupId>dev.cookiecode</groupId>
<artifactId>stylesniffer</artifactId>
<version>1.0.0</version>
</dependency>
```

</TabItem>
<TabItem value="gradle">

**gradle.properties**
```kotlin
implementation("dev.cookiecode:stylesniffer-impl:1.0.0")
```

</TabItem>
</Tabs>

> Note: Use the latest version: [![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.cookiecode/stylesniffer-parent/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.cookiecode/stylesniffer-parent)

## Use StyleSniffer in your code

<Tabs
values={[
{ label: 'Java', value: 'java' },
{ label: 'Kotlin', value: 'kotlin' },
]}
>
<TabItem value="java">

```java
var styleSniffer = StyleSnifferFactory.createStyleSniffer();

Optional<CaseStyle> caseStyle = styleSniffer.getCaseStyle("myVariableName");
caseStyle.ifPresent(style -> System.out.println("Matched style: " + style.getName()));

Set<String> supportedStyles = styleSniffer.getSupportedCaseStyles();
System.out.println("Supported styles: " + supportedStyles);
```

</TabItem>
<TabItem value="kotlin">

**gradle.properties**
```kotlin
// TODO: document this code for Kotlin
```

</TabItem>
</Tabs>
40 changes: 40 additions & 0 deletions docs/docs/overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
slug: /
sidebar_position: 1
---
# Overview

## StyleSniffer: The Ultimate Case Style Detective

![StyleSniffer Logo](/assets/stylesniffer-logo.png)


**StyleSniffer** is a Java library crafted to simplify the detection and analysis of case styles
in strings.

Whether you're dealing with camelCase, snake_case, PascalCase, or any other naming convention,
StyleSniffer provides a straightforward and efficient way to understand and manage these styles.

### **Features:**

- **Detect Case Styles:** Automatically identify common case styles such as camelCase,
snake_case, PascalCase, and more.
- **Flexible Integration:** Easily integrate StyleSniffer into your Java applications
- **Simple API:** Enjoy a user-friendly API designed for seamless detection.

### **Why StyleSniffer?**

StyleSniffer excels at uncovering the subtle nuances of string case styles.

- **Playful Precision:** Experience the blend of technical accuracy with a hint of fun.
- **Easy to Use:** Whether you're a seasoned developer or just starting out,
StyleSniffer's intuitive interface makes case style detection straightforward.
- **Reliable:** Depend on StyleSniffer for consistent and accurate results.

### **Which CaseStyle are supported?**

* [PascalCase](https://wiki.c2.com/?PascalCase) also known as ([UpperCamelCase](https://wiki.c2.com/?UpperCamelCase) or [CamelCase](https://en.wikipedia.org/wiki/Camel_case))
* [camelCase](https://en.wikipedia.org/wiki/Camel_case) also known as ([LowerCamelCase](https://en.wikipedia.org/wiki/Camel_case))
* [kebab-case](https://wiki.c2.com/?KebabCase) also known as ([lisp-case](https://www.npmjs.com/package/kebab-case))
* [snake_case](https://en.wikipedia.org/wiki/Snake_case)
* [SCREAMING_SNAKE_CASE](https://en.wiktionary.org/wiki/screaming_snake_case)
112 changes: 112 additions & 0 deletions docs/docusaurus.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
///
/// The MIT License
/// Copyright © 2024 Sebastien Vermeille
///
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
/// copies of the Software, and to permit persons to whom the Software is
/// furnished to do so, subject to the following conditions:
///
/// The above copyright notice and this permission notice shall be included in
/// all copies or substantial portions of the Software.
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
/// THE SOFTWARE.
///

import {themes as prismThemes} from 'prism-react-renderer';
import type {Config} from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';

const config: Config = {
title: 'StyleSniffer',
tagline: 'Detect which case style is used in a name',
favicon: 'img/favicon.ico',

url: 'https://stylesniffer.cookiecode.dev',
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: '/',
trailingSlash: false,

plugins: [require.resolve("docusaurus-plugin-image-zoom")],

// GitHub pages deployment config.
organizationName: 'sebastienvermeille',
projectName: 'StyleSniffer',
deploymentBranch: 'gh-pages',

onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',

// Even if you don't use internationalization, you can use this field to set
// useful metadata like html lang. For example, if your site is Chinese, you
// may want to replace "en" with "zh-Hans".
i18n: {
defaultLocale: 'en',
locales: ['en'],
},

presets: [
[
'classic',
{
docs: {
routeBasePath: '/',
sidebarPath: './sidebars.ts',
editUrl:
'https://github.com/sebastienvermeille/StyleSniffer/tree/master/docs/docs',
},
blog: false,
theme: {
customCss: './src/css/custom.css',
},
} satisfies Preset.Options,
],
],

themeConfig: {
navbar: {
title: 'StyleSniffer',
logo: {
alt: 'StyleSniffer Logo',
src: 'assets/stylesniffer-logo-square-small.png',
},
items: [
{
href: 'https://github.com/sebastienvermeille/StyleSniffer',
label: 'GitHub',
position: 'right',
},
],
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
},
algolia: {
appId: 'E1W6T35JS9',
apiKey: '98471285c8a136a9d660a78e4e523445',
indexName: 'StyleSniffer',

// Optional: see doc section below
contextualSearch: true,

// Optional: Algolia search parameters
searchParameters: {},

// Optional: path for search page that enabled by default (`false` to disable it)
searchPagePath: 'search',

},
} satisfies Preset.ThemeConfig,
};

export default config;
Loading
Loading