Skip to content

Commit

Permalink
πŸ‘“ Good starting point (#2)
Browse files Browse the repository at this point in the history
* wip

* Create set.response.json

* Create ls.response.json

* Create ls2.response.json

* Create props.response.json

* Create info.response.json

* Create stat.response.json

* Create unsupported-version.error.json

* wip

* Create ParamsSerializer.ts

* Create ParamsSerializer.spec.ts

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* Delete stat.response.json

* Update CoolMasterNetConnection.spec.ts

* wip

* wip

* wip

* wip

* wip

* Update CoolMasterNetConnection.spec.ts

* Update CoolMasterNetConnection.spec.ts

* Create test.yml

* Update CoolMasterNetConnection.spec.ts

* Update CoolMasterNetConnection.spec.ts

* wip

* wip

* wip

* wip

* added set

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* lowered complexity of connection + partial lint

* wip

* Update boot-required.response.json

* added properties and settings as subcommands

* Added prop set, closes #1

* wip

* Added `callGeneric`

* Update README.md

* Update README.md

* Add files via upload

* Update README.md
  • Loading branch information
bdsoha committed Jan 19, 2023
1 parent f5e5903 commit ee595d6
Show file tree
Hide file tree
Showing 64 changed files with 9,350 additions and 358 deletions.
55 changes: 55 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
const IN_PRODUCTION = process.env.NODE_ENV !== 'production'

const OFF = 0
const WARN = 1
const ERR = 2

module.exports = {
root: true,

ignorePatterns: [
'/*',
'!/src'
],

extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended'
],

parser: '@typescript-eslint/parser',

plugins: [
'@typescript-eslint',
'eslint-plugin-align-import'
],

rules: {
'camelcase': ERR,
'complexity': [WARN, {max: 4}],
'comma-spacing': [ERR, { before: false, after: true }],
'key-spacing': [ERR, { align: 'value' }],
'eol-last': [ERR, 'always'],
'linebreak-style': [ERR, 'unix'],
'no-console': IN_PRODUCTION ? OFF : ERR,
'no-duplicate-imports': ERR,
'no-empty': [ERR, { allowEmptyCatch: true }],
'no-extra-parens': ERR,
'no-trailing-spaces': [ERR, { ignoreComments: true }],
'no-useless-rename': ERR,
'object-curly-newline': [ERR, {
ObjectExpression: { multiline: true },
ObjectPattern: { multiline: true },
ImportDeclaration: { multiline: true, minProperties: 4 },
ExportDeclaration: { multiline: true, minProperties: 4 }
}],
'object-curly-spacing': [ERR, 'always'],
'quotes': [ERR, 'single'],
'semi': [ERR, 'never'],
'spaced-comment': [ERR, 'always', { exceptions: ['-', '+'] }],
'space-infix-ops': ERR,

'align-import/align-import': ERR,
'@typescript-eslint/ban-ts-comment': OFF
}
}
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.js text eol=lf
*.ts text eol=lf
34 changes: 34 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: πŸš€ Publish

on:
release:
types:
- published

jobs:
publish:
name: πŸš€ Publish

runs-on: ubuntu-latest

steps:
- name: πŸ“š Checkout
uses: actions/checkout@v3

- name: πŸ”΅ Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
cache: yarn
registry-url: 'https://registry.npmjs.org'

- name: ⏬ Install Dependencies
run: yarn install --frozen-lockfile

- name: πŸ— Build
run: npm run build

- name: πŸš€ Publish
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
39 changes: 39 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: πŸ§ͺ Test

on:
push:
branches:
- '*'

pull_request:
types:
- opened
- synchronize

jobs:
test:
name: πŸ§ͺ Test

runs-on: ubuntu-latest

steps:
- name: πŸ“š Checkout
uses: actions/checkout@v3

- name: πŸ”΅ Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
cache: yarn

- name: ⏬ Install Dependencies
run: yarn install --frozen-lockfile

- name: πŸ§ͺ Run tests
run: npm run test:cov

- name: πŸ’― Coverage
uses: paambaati/[email protected]
if: github.ref == 'refs/heads/develop'
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
39 changes: 37 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,40 @@
# CoolMasterNet Client

> CoolMasterNet API Client for TypeScript
**CoolMasterNet API Client for TypeScript**

🚧🚧🚧 Work in Progress 🚧🚧🚧
<a href="https://github.com/bdsoha/coolmaster-client/actions/workflows/test.yml">
<img alt="GitHub Workflow" src="https://img.shields.io/github/actions/workflow/status/bdsoha/coolmaster-client/test.yml?branch=develop&logo=github&style=for-the-badge">
</a>

<a href="https://codeclimate.com/github/bdsoha/coolmaster-client">
<img alt="Code Climate maintainability" src="https://img.shields.io/codeclimate/maintainability/bdsoha/coolmaster-client?logo=codeclimate&style=for-the-badge">
</a>

<a href="https://codeclimate.com/github/bdsoha/coolmaster-client">
<img alt="Code Climate coverage" src="https://img.shields.io/codeclimate/coverage/bdsoha/coolmaster-client?logo=codeclimate&style=for-the-badge">
</a>

![Banner](coolautomation.jpg)

---

## Installation

```bash
npm install coolmaster-client
```

## Usage

```ts
import { CoolMasterNetClient } from 'coolmaster-client'

const client = CoolMasterNetClient.create({
host: '192.168.1.111',
port: 1234, // Optional, defaults to `10103`
secure: true, // Optional, defaults to `false`
device: '443B960055F0',
})

const results = await client.ls2()
```
Binary file added coolautomation.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 7 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */

module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
collectCoverageFrom: [
'src/**/*',
'!src/**/index.ts',
'!src/__stubs__/*',
],
moduleNameMapper: {
"^@src/(.*)$": "<rootDir>/src/$1"
}
}
}
Loading

0 comments on commit ee595d6

Please sign in to comment.