Skip to content

Commit

Permalink
convert repo to esm
Browse files Browse the repository at this point in the history
  • Loading branch information
bwp91 authored Sep 2, 2024
1 parent a4a2017 commit d6316e1
Show file tree
Hide file tree
Showing 1,160 changed files with 126,032 additions and 127,035 deletions.
37 changes: 0 additions & 37 deletions .eslintrc

This file was deleted.

2 changes: 0 additions & 2 deletions .gitattributes

This file was deleted.

2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github: Supereg
custom: "https://paypal.me/Supereg"
custom: 'https://paypal.me/Supereg'
6 changes: 3 additions & 3 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Add 'beta' label to any PR where the base branch name starts with `beta` or has a `beta` section in the name
beta:
- base-branch: ['^beta', 'beta', 'beta*']
- base-branch: [^beta, beta, 'beta*']

# Add 'beta' label to any PR where the base branch name starts with `beta` or has a `beta` section in the name
alpha:
- base-branch: ['^alpha', 'alpha', 'alpha*']
- base-branch: [^alpha, alpha, 'alpha*']

# Add 'latest' label to any PR where the base branch name starts with `latest` or has a `latest` section in the name
latest:
- base-branch: ['^latest', 'latest', 'latest*']
- base-branch: [^latest, latest, 'latest*']
18 changes: 9 additions & 9 deletions .github/node-persist-ignore.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
* This script tried to solve the problem of having types collisions of node-persist types.
*/

const path = require("path");
const fs = require("fs");
import { existsSync, readFileSync, writeFileSync } from 'node:fs'
import { resolve } from 'node:path'

const storageDefinition = "./dist/lib/model/HAPStorage.d.ts";
const resolved = path.resolve(storageDefinition);
const storageDefinition = './dist/lib/model/HAPStorage.d.ts'
const resolved = resolve(storageDefinition)

if (!fs.existsSync(resolved)) {
throw new Error("Tried to update definition but could not find HAPStorage.d.ts!");
if (!existsSync(resolved)) {
throw new Error('Tried to update definition but could not find HAPStorage.d.ts!')
}

const rows = fs.readFileSync(resolved, "utf8").split("\n");
rows.unshift("// @ts-ignore");
const rows = readFileSync(resolved, 'utf8').split('\n')
rows.unshift('// @ts-expect-error')

fs.writeFileSync(resolved, rows.join("\n"));
writeFileSync(resolved, rows.join('\n'))
18 changes: 9 additions & 9 deletions .github/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ changelog:
categories:
- title: Breaking Changes 🛠
labels:
- 'breaking change'
- breaking change
- title: Featured Changes ✨
labels:
- 'feature'
- 'enhancement'
- feature
- enhancement
- title: Bug Fixes 🐛
labels:
- 'fix'
- 'bugfix'
- 'bug'
- fix
- bugfix
- bug
- title: Other Changes
labels:
- "chore"
- "housekeeping"
- "*"
- chore
- housekeeping
- '*'
12 changes: 6 additions & 6 deletions .github/workflows/alpha-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ on:
jobs:
publish:
if: ${{ github.repository == 'homebridge/HAP-NodeJS' }}
uses: homebridge/.github/.github/workflows/npm-publish.yml@latest
uses: homebridge/.github/.github/workflows/npm-publish-esm.yml@latest
with:
tag: 'alpha'
tag: alpha
dynamically_adjust_version: true
npm_version_command: 'pre'
pre_id: 'alpha'
npm_version_command: pre
pre_id: alpha
secrets:
npm_auth_token: ${{ secrets.npm_token }}

Expand All @@ -22,9 +22,9 @@ jobs:
needs: [publish]
uses: homebridge/.github/.github/workflows/discord-webhooks.yml@latest
with:
title: "HAP-NodeJS Alpha Release"
title: HAP-NodeJS Alpha Release
description: |
Version `v${{ needs.publish.outputs.NPM_VERSION }}`
url: "https://github.com/homebridge/homebridge/releases/tag/v${{ needs.publish.outputs.NPM_VERSION }}"
url: 'https://github.com/homebridge/homebridge/releases/tag/v${{ needs.publish.outputs.NPM_VERSION }}'
secrets:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL_BETA }}
14 changes: 7 additions & 7 deletions .github/workflows/beta-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,23 @@ jobs:

if: ${{ github.repository == 'homebridge/HAP-NodeJS' }}

uses: homebridge/.github/.github/workflows/npm-publish.yml@latest
uses: homebridge/.github/.github/workflows/npm-publish-esm.yml@latest
with:
tag: 'beta'
tag: beta
dynamically_adjust_version: true
npm_version_command: 'pre'
pre_id: 'beta'
npm_version_command: pre
pre_id: beta
secrets:
npm_auth_token: ${{ secrets.npm_token }}

github-releases-to-discord:
name: Discord Webhooks
needs: [build_and_test,publish]
needs: [build_and_test, publish]
uses: homebridge/.github/.github/workflows/discord-webhooks.yml@latest
with:
title: "HAP-NodeJS Beta Release"
title: HAP-NodeJS Beta Release
description: |
Version `v${{ needs.publish.outputs.NPM_VERSION }}`
url: "https://github.com/homebridge/homebridge/releases/tag/v${{ needs.publish.outputs.NPM_VERSION }}"
url: 'https://github.com/homebridge/homebridge/releases/tag/v${{ needs.publish.outputs.NPM_VERSION }}'
secrets:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL_BETA }}
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: "CodeQL"
name: CodeQL

on:
push:
branches: [ master, beta* ]
branches: [master, beta*]
pull_request:
branches: [ master, beta* ]
branches: [master, beta*]
schedule:
- cron: '44 16 * * 5'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ jobs:
stale:
uses: homebridge/.github/.github/workflows/pr-labeler.yml@latest
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ jobs:
stale:
uses: homebridge/.github/.github/workflows/release-drafter.yml@latest
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ jobs:

if: ${{ github.repository == 'homebridge/HAP-NodeJS' }}

uses: homebridge/.github/.github/workflows/npm-publish.yml@latest
uses: homebridge/.github/.github/workflows/npm-publish-esm.yml@latest
secrets:
npm_auth_token: ${{ secrets.npm_token }}

github-releases-to-discord:
name: Discord Webhooks
needs: [build_and_test,publish]
needs: [build_and_test, publish]
uses: homebridge/.github/.github/workflows/discord-webhooks.yml@latest
with:
title: "HAP-NodeJS Release"
title: HAP-NodeJS Release
description: |
Version `v${{ needs.publish.outputs.NPM_VERSION }}`
url: "https://github.com/homebridge/homebridge-config-ui-x/releases/tag/v${{ needs.publish.outputs.NPM_VERSION }}"
url: 'https://github.com/homebridge/homebridge-config-ui-x/releases/tag/v${{ needs.publish.outputs.NPM_VERSION }}'
secrets:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL_LATEST }}
2 changes: 1 addition & 1 deletion .github/workflows/wiki-change-notification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
notify:
runs-on: ubuntu-latest
steps:
- uses: 'oznu/gh-wiki-edit-discord-notification@main'
- uses: oznu/gh-wiki-edit-discord-notification@main
with:
discord-webhook-url: ${{ secrets.DISCORD_WEBHOOK_WIKI_EDIT }}
ignore-collaborators: true
103 changes: 50 additions & 53 deletions @types/bonjour-hap.d.ts
Original file line number Diff line number Diff line change
@@ -1,66 +1,63 @@
declare module "bonjour-hap" {

declare module 'bonjour-hap' {
export const enum Protocols {
TCP = "tcp",
UDP = "udp",
TCP = 'tcp',
UDP = 'udp',
}

export type Nullable<T> = T | null;
export type TxtRecord = Record<string, string>;
export type Nullable<T> = T | null
export type TxtRecord = Record<string, string>

export class BonjourHAPService {
name: string;
type: string;
subtypes: Nullable<string[]>;
protocol: Protocols;
host: string;
port: number;
fqdn: string;
txt: Nullable<Record<string, string>>;
published: boolean;

start(): void;
stop(callback?: () => void): void;
destroy(): void;
updateTxt(txt: TxtRecord, silent?: boolean): void;
name: string
type: string
subtypes: Nullable<string[]>
protocol: Protocols
host: string
port: number
fqdn: string
txt: Nullable<Record<string, string>>
published: boolean

start(): void
stop(callback?: () => void): void
destroy(): void
updateTxt(txt: TxtRecord, silent?: boolean): void
}

export type PublishOptions = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
category?: any,
host?: string;
name?: string;
pincode?: string;
port: number;
protocol?: Protocols;
subtypes?: string[];
txt?: Record<string, string>;
type?: string;
username?: string;

addUnsafeServiceEnumerationRecord?: boolean,

restrictedAddresses?: string[];
disabledIpv6?: boolean;
};
export interface PublishOptions {
category?: any
host?: string
name?: string
pincode?: string
port: number
protocol?: Protocols
subtypes?: string[]
txt?: Record<string, string>
type?: string
username?: string

addUnsafeServiceEnumerationRecord?: boolean

restrictedAddresses?: string[]
disabledIpv6?: boolean
}

export class BonjourHAP {
publish(options: PublishOptions): BonjourHAPService;
unpublishAll(callback: () => void): void;
destroy(): void;
publish(options: PublishOptions): BonjourHAPService
unpublishAll(callback: () => void): void
destroy(): void
}

export interface MulticastOptions {
multicast?: boolean
interface?: string
port?: number
ip?: string
ttl?: number
loopback?: boolean
reuseAddr?: boolean
}
function createWithOptions(options?: MulticastOptions): BonjourHAP

export type MulticastOptions = {
multicast?: boolean;
interface?: string;
port?: number;
ip?: string;
ttl?: number;
loopback?: boolean;
reuseAddr?: boolean;
};
function createWithOptions(options?: MulticastOptions): BonjourHAP;

export default createWithOptions;
export default createWithOptions
}
4 changes: 0 additions & 4 deletions @types/simple-plist.d.ts

This file was deleted.

Loading

0 comments on commit d6316e1

Please sign in to comment.