Skip to content

Commit

Permalink
Initial boilerplate
Browse files Browse the repository at this point in the history
  • Loading branch information
duddu committed Apr 16, 2024
1 parent da96092 commit d661f23
Show file tree
Hide file tree
Showing 18 changed files with 615 additions and 154 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"curly": ["warn", "all"],
"brace-style": ["warn"],
"prefer-arrow-callback": ["warn"],
"max-len": ["warn", 140],
"max-len": ["warn", 100],
"no-console": ["warn"], // use the provided Homebridge log method instead
"no-non-null-assertion": ["off"],
"comma-spacing": ["error"],
Expand Down
15 changes: 9 additions & 6 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@ about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

<!-- You must use the issue template below when submitting a bug -->

**Describe The Bug:**

<!-- A clear and concise description of what the bug is. -->

**To Reproduce:**

<!-- Steps to reproduce the behavior. -->

**Expected behavior:**

<!-- A clear and concise description of what you expected to happen. -->

**Logs:**
Expand All @@ -31,14 +33,15 @@ Show your Homebridge config.json here, remove any sensitive information.
```

**Screenshots:**

<!-- If applicable, add screenshots to help explain your problem. -->

**Environment:**

* **Plugin Version**:
* **Homebridge Version**: <!-- homebridge -V -->
* **Node.js Version**: <!-- node -v -->
* **NPM Version**: <!-- npm -v -->
* **Operating System**: <!-- Raspbian / Ubuntu / Debian / Windows / macOS / Docker / hb-service -->
- **Plugin Version**:
- **Homebridge Version**: <!-- homebridge -V -->
- **Node.js Version**: <!-- node -v -->
- **NPM Version**: <!-- npm -v -->
- **Operating System**: <!-- Raspbian / Ubuntu / Debian / Windows / macOS / Docker / hb-service -->

<!-- Click the "Preview" tab before you submit to ensure the formatting is correct. -->
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# contact_links:
# - name: Homebridge Discord Community
# url: https://discord.gg/kqNCe2D
# about: Ask your questions in the #YOUR_CHANNEL_HERE channel
# about: Ask your questions in the #YOUR_CHANNEL_HERE channel
6 changes: 4 additions & 2 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@ about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''

---

**Is your feature request related to a problem? Please describe:**

<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->

**Describe the solution you'd like:**

<!-- A clear and concise description of what you want to happen. -->

**Describe alternatives you've considered:**

<!-- A clear and concise description of any alternative solutions or features you've considered. -->

**Additional context:**
<!-- Add any other context or screenshots about the feature request here. -->

<!-- Add any other context or screenshots about the feature request here. -->

<!-- Click the "Preview" tab before you submit to ensure the formatting is correct. -->
13 changes: 7 additions & 6 deletions .github/ISSUE_TEMPLATE/support-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ about: Need help?
title: ''
labels: question
assignees: ''

---

<!-- You must use the issue template below when submitting a support request -->

**Describe Your Problem:**

<!-- A clear and concise description of what problem you are trying to solve. -->

**Logs:**
Expand All @@ -25,14 +25,15 @@ Show your Homebridge config.json here, remove any sensitive information.
```

**Screenshots:**

<!-- If applicable, add screenshots to help explain your problem. -->

**Environment:**

* **Plugin Version**:
* **Homebridge Version**: <!-- homebridge -V -->
* **Node.js Version**: <!-- node -v -->
* **NPM Version**: <!-- npm -v -->
* **Operating System**: <!-- Raspbian / Ubuntu / Debian / Windows / macOS / Docker / hb-service -->
- **Plugin Version**:
- **Homebridge Version**: <!-- homebridge -V -->
- **Node.js Version**: <!-- node -v -->
- **NPM Version**: <!-- npm -v -->
- **Operating System**: <!-- Raspbian / Ubuntu / Debian / Windows / macOS / Docker / hb-service -->

<!-- Click the "Preview" tab before you submit to ensure the formatting is correct. -->
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
Expand Down
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all",
"useTabs": false
}
5 changes: 0 additions & 5 deletions .vscode/extensions.json

This file was deleted.

15 changes: 9 additions & 6 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint",
"editor.formatOnType": false,
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.formatOnSaveMode": "file",
"editor.rulers": [100],
"files.autoSave": "onFocusChange",
"files.eol": "\n",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"editor.rulers": [ 140 ],
"eslint.enable": true
}
"vs-code-prettier-eslint.prettierLast": false
}
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This template should be used in conjunction with the [developer documentation](h

### Clone As Template

Click the link below to create a new GitHub Repository using this template, or click the *Use This Template* button above.
Click the link below to create a new GitHub Repository using this template, or click the _Use This Template_ button above.

<span align="center">

Expand Down Expand Up @@ -54,7 +54,7 @@ When you are ready to publish the plugin you should set `private` to false, or r
Open the [`src/settings.ts`](./src/settings.ts) file and change the default values:

- `PLATFORM_NAME` - Set this to be the name of your platform. This is the name of the platform that users will use to register the plugin in the Homebridge `config.json`.
- `PLUGIN_NAME` - Set this to be the same name you set in the [`package.json`](./package.json) file.
- `PLUGIN_NAME` - Set this to be the same name you set in the [`package.json`](./package.json) file.

Open the [`config.schema.json`](./config.schema.json) file and change the following attribute:

Expand Down Expand Up @@ -85,6 +85,7 @@ homebridge -D
### Watch For Changes and Build Automatically

If you want to have your code compile automatically as you make changes, and restart Homebridge automatically between changes, you first need to add your plugin as a platform in `~/.homebridge/config.json`:

```
{
...
Expand Down Expand Up @@ -152,7 +153,7 @@ If you are publishing a scoped plugin, i.e. `@username/homebridge-xxx` you will

#### Publishing Beta Versions

You can publish *beta* versions of your plugin for other users to test before you release it to everyone.
You can publish _beta_ versions of your plugin for other users to test before you release it to everyone.

```shell
# create a new pre-release version (eg. 2.1.0-beta.1)
Expand All @@ -162,13 +163,14 @@ npm version prepatch --preid beta
npm publish --tag=beta
```

Users can then install the *beta* version by appending `@beta` to the install command, for example:
Users can then install the _beta_ version by appending `@beta` to the install command, for example:

```shell
sudo npm install -g homebridge-example-plugin@beta
```

### Best Practices

Consider creating your plugin with the [Homebridge Verified](https://github.com/homebridge/verified) criteria in mind. This will help you to create a plugin that is easy to use and works well with Homebridge.
You can then submit your plugin to the Homebridge Verified list for review.
The most up-to-date criteria can be found [here](https://github.com/homebridge/verified#requirements).
Expand All @@ -187,5 +189,7 @@ For reference, the current criteria are:
- If the plugin needs to write files to disk (cache, keys, etc.), it must store them inside the Homebridge storage directory.

### Useful Links

Note these links are here for help but are not supported/verified by the Homebridge team

- [Custom Characteristics](https://github.com/homebridge/homebridge-plugin-template/issues/20)
4 changes: 2 additions & 2 deletions config.schema.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"pluginAlias": "ExampleHomebridgePlugin",
"pluginAlias": "HomebridgeShortcutsButtons",
"pluginType": "platform",
"singular": true,
"schema": {
Expand All @@ -13,4 +13,4 @@
}
}
}
}
}
6 changes: 2 additions & 4 deletions nodemon.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
{
"watch": [
"src"
],
"watch": ["src"],
"ext": "ts",
"ignore": [],
"exec": "tsc && homebridge -I -D",
"signal": "SIGTERM",
"env": {
"NODE_OPTIONS": "--trace-warnings"
}
}
}
Loading

0 comments on commit d661f23

Please sign in to comment.