Skip to content

Commit

Permalink
Added .npmignore. Updated README.md (install + usage)
Browse files Browse the repository at this point in the history
  • Loading branch information
iursevla committed Jul 24, 2024
1 parent 8ebeaa5 commit 6e0015b
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 10 deletions.
8 changes: 8 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
src
test
.eslintrc.js
.prettierrc
tsup.config.ts
tsconfig.json
node_modules
scripts
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
# Shelly API Typescript

Strongly typed Shelly API client written in Typescript

## Install

You can install it in a Typescript/Javascript project by doing the following:

```bash
npm i @intruder-detection/shelly-api-typescript
```

## Usage

```ts
import { ShellyGen2PlusHTTPAPI, ShellyMethods } from '@intruder-detection/shelly-api-typescript';

const gen2Device = new ShellyGen2PlusHTTPAPI('192.168.1.10');
const status = await gen2Device.post(ShellyMethods.GetStatus);
console.log(status);
```
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"keywords": ["Shelly", "Shelly HTTP/RPC API", "Shelly Typescript", "Shelly NodeJS"],
"keywords": [
"Shelly",
"Shelly API",
"Shelly HTTP/RPC API",
"Shelly Typescript",
"Shelly Javascript",
"Shelly NodeJS"
],
"repository": {
"url": "https://github.com/intruder-detection/shelly-api-typescript"
},
Expand Down
5 changes: 2 additions & 3 deletions test/gen3/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ShellyGen2PlusHTTPAPI } from '@common/shelly-gen-2-plus-http-api';
import { BTHomeDeviceMethods, BTHomeMethods, VirtualMethods } from '@gen3/methods.enum';
import { BTHomeDeviceMethods, BTHomeMethods, ShellyGen2PlusHTTPAPI } from '../../src';

async function virtual() {
// await gen3Device.post(VirtualMethods.Add, {
Expand Down Expand Up @@ -119,4 +118,4 @@ async function main() {
await bthomeSensor()
}

void main();
await main();
10 changes: 4 additions & 6 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"compilerOptions": {
"module": "commonjs",
"module": "es2022",
"moduleResolution": "Bundler",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"target": "es2023",
"target": "es2022",
"sourceMap": true,
"outDir": "./dist",
"skipLibCheck": true,
"strictNullChecks": false,
"noEmit": true,
"noImplicitAny": false,
"strictBindCallApply": false,
"forceConsistentCasingInFileNames": false,
Expand All @@ -25,7 +25,5 @@
"@utils/*": ["./src/utils/*"],
"@common/*": ["./src/common/*"]
}
},
"include": ["src"],
"exclude": ["node_modules"]
}
}

0 comments on commit 6e0015b

Please sign in to comment.