Skip to content

Commit

Permalink
chore(docs): updates documentation (#24)
Browse files Browse the repository at this point in the history
* chore(docs): updates documentation

* chore(docs): adds scripts section
  • Loading branch information
csantiago132 authored Oct 4, 2024
1 parent d4d51b8 commit bb71372
Show file tree
Hide file tree
Showing 18 changed files with 234 additions and 380 deletions.
5 changes: 2 additions & 3 deletions .github/ci.documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ on:

jobs:
ci-documentation:
uses: kurocado-studio/styleguide/.github/workflows/documentation.yml@main
secrets:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: kurocado-studio/styleguide/.github/workflows/writerside-documentation@main
secrets: inherit
File renamed without changes.
2 changes: 1 addition & 1 deletion .releaserc.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('./src/semantic-release');
module.exports = require('./src/semantic-release/semantic-release.npm');
103 changes: 0 additions & 103 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,106 +2,3 @@

[Read the docs](https://kurocado-studio.github.io/styleguide/starter-topic.html) |
[NPM Package](https://www.npmjs.com/package/@kurocado-studio/style-guide)

This repository contains the style guide for our project, specifically tailored for TypeScript. We
have used the Vercel Style Guide as a base for our TypeScript configurations, and aspire to maintain
the same high standards in our code quality.

## Introduction

This repository houses the configurations for linting and formatting tools, specifically for
TypeScript. The configurations are designed to help maintain consistent code quality and adhere to
best practices throughout the project.

We extend our thanks to [Vercel](https://vercel.com) for providing the foundation for our TypeScript
configurations. We took inspiration from their work to ensure our codebase maintains high standards
similar to those followed at Vercel.

## Prettier

Prettier is a peer dependency and should be installed at the root of your project. It handles code
formatting to ensure consistency across the codebase.

### Installation:

```bash
# If you use npm
npm install --save-dev prettier

# If you use Yarn

yarn add --dev prettier
```

To use our Prettier configuration, add the following to your `package.json`:

```json
{
"prettier": "@kurocado-studio/styleguide/prettier"
}
```

## ESLint

ESLint is also a peer dependency and should be installed at the root of your project. It handles
linting and enforces coding standards.

### Installation:

```bash
# If you use npm
npm install --save-dev eslint

# If you use Yarn
yarn add --dev eslint
```

### Configuring ESLint

Our ESLint setup is designed specifically for TypeScript. To configure ESLint in your project,
extend our TypeScript configuration in your `.eslintrc.js`:

#### Node projects

```javascript
module.exports = {
extends: [require.resolve('@kurocado-studio/styleguide/eslint/eslint.node')],
};
```

This setup ensures that TypeScript rules are enforced, and additional configuration for importing
modules is included to work seamlessly with TypeScript.

## TypeScript

We provide TypeScript configurations specifically for your project. The configuration extends our
base TypeScript settings, ensuring that your TypeScript setup is standardized.

### Installation:

Make sure TypeScript is installed as a dev dependency:

```bash
# If you use npm
npm install --save-dev typescript

# If you use Yarn
yarn add --dev typescript
```

### Using the Configuration

In your `tsconfig.json`, extend our base TypeScript configuration:

```json
{
"extends": "@kurocado-studio/styleguide/typescript/base",
"compilerOptions": {
"outDir": "./dist",
"module": "ESNext",
"target": "ES2021"
}
}
```

This ensures that your TypeScript settings are aligned with our style guide and project standards.
2 changes: 1 addition & 1 deletion Writerside/dcs.tree
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
SYSTEM "https://resources.jetbrains.com/writerside/1.0/product-profile.dtd">

<instance-profile id="dcs"
name="docs"
name="Kurocado Studio Style Guide"
start-page="starter-topic.md">

<toc-element topic="starter-topic.md"/>
Expand Down
21 changes: 7 additions & 14 deletions Writerside/topics/Code-Quality.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,27 +46,20 @@ c. Add Required Secrets
1. **GITHUB_TOKEN**: Automatically provided by GitHub Actions; no need to add manually unless
customizing permissions.

**Install Styleguide**

```
npm install --save-dev @kurocado-studio/styleguide
```

**Create the Release Workflow File in the Consuming Repository**

```yaml
# .github/workflows/code-quality.yml
name: Code Quality

on:
pull_request:
push:
branches:
- main
pull_request:
push:
branches:
- main

jobs:
ci-lint:
uses: @kurocado-studio/styleguide/.github/workflows/lint.yml@v1
secrets:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
code-quality:
uses: kurocado-studio/styleguide/.github/workflows/lint.yml@main
secrets: inherit
```
26 changes: 12 additions & 14 deletions Writerside/topics/Release.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,28 +57,26 @@ c. Add Required Secrets
3. **PAT_FORCE_PUSH**: Personal Access Token with permissions to push to protected branches and
create branches.

**Install Styleguide**

```
npm install --save-dev @kurocado-studio/styleguide
```

**Create the Release Workflow File in the Consuming Repository**
**Create the Release Workflow File in the Consuming Repository with the below permissions**

```yaml
# .github/workflows/release.yml
name: Release
name: Release Workflow

permissions:
pull-requests: write
contents: write
pages: write
id-token: write

on:
workflow_call:
push:
branches:
- main

jobs:
ci-release:
uses: @kurocado-studio/styleguide/.github/workflows/release.yml@v1
secrets:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
PAT_FORCE_PUSH: ${{ secrets.PAT_FORCE_PUSH }}
manage-release:
uses: kurocado-studio/styleguide/.github/workflows/release.yml@main
secrets: inherit
```
76 changes: 10 additions & 66 deletions Writerside/topics/Workflows.md
Original file line number Diff line number Diff line change
@@ -1,68 +1,12 @@
# Workflows

This repository utilizes a **reusable GitHub Actions workflow** to automate the release process
using `semantic-release`. This setup ensures consistent and efficient releases across multiple
projects.

## Features

- **Automated Versioning:** Automatically determines the next version based on commit messages.
- **Changelog Generation:** Generates and updates the `CHANGELOG.md` with release notes.
- **Release Branching:** Creates dedicated release branches for each version.
- **Pull Request Automation:** Automatically creates a PR from the release branch to `main` for
review and merging.
- **Asset Attachment:** Attaches build artifacts to GitHub Releases.

## Setup Guide

Follow these steps to integrate the reusable release workflow into your project.

### 1. **Add Required Secrets**

Ensure that your repository has the necessary secrets configured:

1. **Navigate to Repository Settings:**

- Go to your repository on GitHub.
- Click on **Settings**.

2. **Add Secrets:**
- Go to **Secrets and variables** > **Actions** > **New repository secret**.
- Add the following secrets:
- `GH_TOKEN`: Your GitHub Personal Access Token with `repo` permissions.
- `PAT_FORCE_PUSH`: Your Personal Access Token with permissions to push to protected branches.

### 2. **Create the Reusable Workflow**

The reusable workflow is already defined in this repository at
`.github/workflows/reusable-release.yml`. If you're using this repository as the source, you can
skip this step. Otherwise, ensure that your reusable workflow is correctly defined and accessible.

### 3. **Create an Invoking Workflow**

Add a new workflow file in your repository to call the reusable release workflow.

**File Path:** `.github/workflows/call-reusable-release.yml`

**Content:**

```yaml
name: Call Reusable Release Workflow

on:
push:
branches:
- main

jobs:
release:
uses: @kurocado-studio/style-guide/.github/workflows/reusable-release.yml
with:
node-version: '18'
build-command: 'npm run build'
release-branch-prefix: 'release-'
release-label: 'release'
secrets:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
PAT_FORCE_PUSH: ${{ secrets.PAT_FORCE_PUSH }}# Workflows
```
This repository provides a standardized and reusable GitHub Actions workflow setup inspired by
Vercel’s Styleguide. The setup includes three primary workflows designed to enhance your project’s
CI/CD pipeline:

1. [Release Workflow](Release.md): Automates the release process, including versioning, changelog
generation, and pull request creation.
2. [Code Quality Workflow](Code-Quality.md): Ensures code consistency and quality through automated
linting and formatting checks.
3. [Writerside Documentation Workflow](Writerside.md): Builds and deploys project documentation
using Docker-based builders.
30 changes: 10 additions & 20 deletions Writerside/topics/Writerside.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,37 +53,27 @@ c. Add Required Secrets
1. **GITHUB_TOKEN**: Automatically provided by GitHub Actions; no need to add manually unless
customizing permissions.

**Install Styleguide**
**Add Writerside instance to the root of your project**

```
npm install --save-dev @kurocado-studio/styleguide
```
[Install Writerside IDE](https://www.jetbrains.com/writerside/)
[Download Writerside Jetbrains Plugin](https://plugins.jetbrains.com/plugin/20158-writerside)

- Name of the instance: Docs
- ID of the instance: dcs INSTANCE: 'Writerside/dcs'

**Create the Release Workflow File in the Consuming Repository**

```yaml
# .github/workflows/writerside-documentation.yml
# .github/workflows/writerside-writerside-documentation.yml
name: Writerside Documentation

on:
workflow_call:
push:
branches:
- main

permissions:
contents: write
pages: write
id-token: write

env:
INSTANCE: 'Writerside/dcs' # Name of the module (adjust for your project)
ARTIFACT: 'webHelpDCS2-all.zip' # Name of the artifact to be generated
DOCKER_VERSION: '242.21870' # Specific Docker version

jobs:
build-and-deploy-docs:
uses: @kurocado-studio/styleguide/.github/workflows/documentation.yml@v1
secrets:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
documentation:
uses: kurocado-studio/styleguide/.github/workflows/writerside-documentation@main
secrets: inherit
```
Loading

0 comments on commit bb71372

Please sign in to comment.