Skip to content

Commit

Permalink
docs: update README with comprehensive development guide (#9345)
Browse files Browse the repository at this point in the history
* docs: update README with comprehensive development guide

* docs: refine README description
  • Loading branch information
Timeraa authored Feb 28, 2025
1 parent 5322c79 commit 3be9513
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 17 deletions.
8 changes: 4 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE.MD
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
## Description
## Description
<!-- A clear and detailed description of the changes, referencing issues if applicable -->

## Acknowledgements
- [ ] I read the [Activity Guidelines](https://github.com/PreMiD/Presences/blob/main/.github/CONTRIBUTING.md)
- [ ] I read the [Activity Guidelines](https://github.com/PreMiD/Activities/blob/main/.github/CONTRIBUTING.md)
- [ ] I linted the code by running `yarn format`
- [ ] The PR title follows the repo's [commit conventions](https://github.com/PreMiD/Presences/blob/main/.github/COMMIT_CONVENTION.md)
- [ ] The PR title follows the repo's [commit conventions](https://github.com/PreMiD/Activities/blob/main/.github/COMMIT_CONVENTION.md)

## Screenshots
<details>
<summary> Proof showing the creation/modification is working as expected </summary>
<!--
<!--
Screenshots of the activity settings (if applicable) and at least TWO screenshots of the activity displaying correctly
Including these screenshots will assist the reviewing processes thus speeding up the process of the pull request being merged
-->
Expand Down
81 changes: 75 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<h1>PreMiD Activities</h1>
</div>

This repository contains the source code of all Activities that are available in [PreMiD's Store](https://premid.app/store). If you wish to add your Activity or update one, open a Pull Request.
This repository contains the source code of all Activities that are available in [PreMiD's Store](https://premid.app/store). Activities enhance your Discord presence by showing what you're doing on various websites.

<div align="left">
<a target="_blank" href="https://discord.premid.app/" title="Join our Discord!">
Expand All @@ -13,15 +13,84 @@ This repository contains the source code of all Activities that are available in

---

## Getting started
## Getting Started

Please refer to our [documentation](https://docs.premid.app/dev/presence) to get started.
Want to create your own Activity or modify an existing one? Great! Follow these simple steps:

---
1. **Set up your development environment**

- Install [Node.js](https://nodejs.org/) (version 20 or higher)
- Clone this repository: `git clone https://github.com/PreMiD/Activities.git`
- Navigate to the project directory: `cd Activities`
- Install dependencies: `npm install`

2. **Learn the basics**

- Read our [documentation](https://docs.premid.app/dev/presence) to understand how Activities work
- Browse through existing Activities to see examples and best practices

3. **Start creating/editing**
- Use our CLI tool as described below to create and develop your Activity

## CLI Commands

The repository includes a command-line tool (`pmd`) to help you create and develop Activities easily.

### Creating a New Activity

To create a new Activity with all the necessary files and structure:

```bash
npx pmd new my-activity-name
```

This will guide you through a setup process, asking for basic information to generate the Activity structure.

### Developing an Activity

Once you've created an Activity, you can develop it with live-reload functionality:

```bash
npx pmd dev my-activity-name
```

This command will:

- Start a development server
- Watch for changes in your Activity files
- Automatically rebuild when you make changes
- Validate your Activity against PreMiD standards

Useful options:

- `--validate`: Run additional validation checks for metadata, images, etc.

## Testing Your Activity

To test your Activity:

1. Install the [PreMiD Extension](https://premid.app/downloads) in your browser
2. **Enable "Activity Developer Mode"** in the extension settings:
- Click on the PreMiD extension icon in your browser
- Go to settings (⚙️)
- Enable "Activity Developer Mode"
3. Run the development command:
```bash
npx pmd dev my-activity-name
```
4. The `pmd` tool will automatically send your Activity to the extension while in development mode
5. Navigate to the website your Activity supports to see it in action
6. Changes you make will be automatically picked up and sent to the extension

This development workflow allows you to see your changes in real-time without having to manually load the Activity each time you make a change.

## Submitting Your Activity

## Translator Tool
When your Activity is ready:

Translate Activities by using `npx pmd` (or your package manager of choice).
1. Make sure it passes all validation checks
2. Create a Pull Request to this repository
3. Wait for a review from our maintainers

## Committing

Expand Down
6 changes: 3 additions & 3 deletions cli/src/commands/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ export async function release() {
return exit(MESSAGES.ciOnly)
}

//* Only run for PreMiD/Presences repository
if (github.context.repo.owner !== 'PreMiD' || github.context.repo.repo !== 'Presences') {
//* Only run for PreMiD/Activities repository
if (github.context.repo.owner !== 'PreMiD' || github.context.repo.repo !== 'Activities') {
return success(MESSAGES.wrongRepository)
}

Expand Down Expand Up @@ -106,7 +106,7 @@ export async function release() {
apiVersion: activity.versionized ? activity.metadata.apiVersion : undefined,
metadata: activity.metadata,
folderName,
githubUrl: `https://github.com/PreMiD/Presences/tree/main/websites/${folderLetter}/${folderNameEncoded}${apiVersion}`,
githubUrl: `https://github.com/PreMiD/Activities/tree/main/websites/${folderLetter}/${folderNameEncoded}${apiVersion}`,
url: `https://api.premid.app/v6/activities${apiVersion}/${folderNameEncoded}`,
presenceJs: await readFile(resolve(activity.folder, 'dist', 'presence.js'), 'utf8'),
...(existsSync(resolve(activity.folder, 'dist', 'iframe.js')) && {
Expand Down
4 changes: 2 additions & 2 deletions cli/src/commands/updateAssets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export async function updateAssets() {
return exit(MESSAGES.ciOnly)
}

//* Only run for PreMiD/Presences repository
if (github.context.repo.owner !== 'PreMiD' || github.context.repo.repo !== 'Presences') {
//* Only run for PreMiD/Activities repository
if (github.context.repo.owner !== 'PreMiD' || github.context.repo.repo !== 'Activities') {
return success(MESSAGES.wrongRepository)
}

Expand Down
2 changes: 1 addition & 1 deletion cli/src/util/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ export const MESSAGES = {
someInvalidAssets: 'Some invalid assets were found, check the logs for more details',
assetsUpdated: 'Assets have been updated successfully',
error: 'An error occurred - please check the logs for details',
wrongRepository: 'This command can only be run in PreMiD/Presences repository',
wrongRepository: 'This command can only be run in PreMiD/Activities repository',
assetsUpdatedCount: (count: number) => count === 0 ? 'No assets updated' : `${count} assets updated successfully`,
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"license": "MPL-2.0",
"engines": {
"node": ">=14.8.0"
"node": ">=20.0.0"
},
"scripts": {
"prepare": "cd cli && npm ci && npm run build && cd .. && npm ci --ignore-scripts",
Expand Down

0 comments on commit 3be9513

Please sign in to comment.