add ha addon support
This commit is contained in:
parent
0425f6e8df
commit
838aa38b5c
36
.devcontainer/devcontainer.json
Normal file
36
.devcontainer/devcontainer.json
Normal file
@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "devcontainer for add-on repositories",
|
||||
"image": "ghcr.io/home-assistant/devcontainer:addons",
|
||||
"appPort": [
|
||||
"7123:8123",
|
||||
"7357:4357"
|
||||
],
|
||||
"postStartCommand": "bash devcontainer_bootstrap",
|
||||
"runArgs": [
|
||||
"-e",
|
||||
"GIT_EDITOR=code --wait",
|
||||
"--privileged"
|
||||
],
|
||||
"containerEnv": {
|
||||
"WORKSPACE_DIRECTORY": "${containerWorkspaceFolder}"
|
||||
},
|
||||
"extensions": [
|
||||
"timonwong.shellcheck",
|
||||
"esbenp.prettier-vscode"
|
||||
],
|
||||
"mounts": [
|
||||
"type=volume,target=/var/lib/docker"
|
||||
],
|
||||
"settings": {
|
||||
"terminal.integrated.profiles.linux": {
|
||||
"zsh": {
|
||||
"path": "/usr/bin/zsh"
|
||||
}
|
||||
},
|
||||
"terminal.integrated.defaultProfile.linux": "zsh",
|
||||
"editor.formatOnPaste": false,
|
||||
"editor.formatOnSave": true,
|
||||
"editor.formatOnType": true,
|
||||
"files.trimTrailingWhitespace": true
|
||||
}
|
||||
}
|
20
.vscode/tasks.json
vendored
Normal file
20
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Start Home Assistant",
|
||||
"type": "shell",
|
||||
"command": "supervisor_run",
|
||||
"group": {
|
||||
"kind": "test",
|
||||
"isDefault": true
|
||||
},
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "new"
|
||||
},
|
||||
"problemMatcher": []
|
||||
}
|
||||
]
|
||||
}
|
||||
|
1
.gitignore → matter-bridge/.gitignore
vendored
1
.gitignore → matter-bridge/.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
node_modules
|
||||
deviceData
|
||||
.env
|
||||
build
|
35
matter-bridge/Dockerfile
Normal file
35
matter-bridge/Dockerfile
Normal file
@ -0,0 +1,35 @@
|
||||
ARG BUILD_FROM=ghcr.io/hassio-addons/base:15.0.3
|
||||
|
||||
FROM node:18.19.0-alpine as buildbase
|
||||
|
||||
COPY ./package.json ./
|
||||
COPY ./package-lock.json ./
|
||||
COPY ./src ./src
|
||||
COPY ./tsconfig.json ./
|
||||
RUN npm install
|
||||
RUN npm run build
|
||||
|
||||
FROM node:18.19.0-alpine as deps
|
||||
|
||||
COPY ./package.json ./
|
||||
COPY ./package-lock.json ./
|
||||
COPY ./src ./src
|
||||
COPY ./tsconfig.json ./
|
||||
RUN npm install --production
|
||||
|
||||
|
||||
FROM ${BUILD_FROM} as runenv
|
||||
|
||||
COPY --from=buildbase /usr/lib /usr/lib
|
||||
COPY --from=buildbase /usr/local/lib /usr/local/lib
|
||||
COPY --from=buildbase /usr/local/include /usr/local/include
|
||||
COPY --from=buildbase /usr/local/bin /usr/local/bin
|
||||
COPY --from=buildbase ./build ./build
|
||||
COPY --from=deps ./node_modules ./node_modules
|
||||
COPY --from=deps ./package.json ./package.json
|
||||
|
||||
|
||||
COPY run.sh /
|
||||
RUN chmod a+x /run.sh
|
||||
|
||||
CMD [ "/run.sh" ]
|
17
matter-bridge/config.yml
Normal file
17
matter-bridge/config.yml
Normal file
@ -0,0 +1,17 @@
|
||||
---
|
||||
name: 'HA Matter Bridge'
|
||||
version: '1.0.0'
|
||||
slug: ha-matter-bridge
|
||||
description: This project serves as a proof of concept to connect HomeAssistant devices to Voice Assistants through the Matter Protocol.
|
||||
init: false
|
||||
arch:
|
||||
- amd64
|
||||
ports:
|
||||
5540/tcp: 5540
|
||||
|
||||
hassio_role: homeassistant
|
||||
hassio_api: true
|
||||
homeassistant_api: true
|
||||
auth_api: true
|
||||
map:
|
||||
- addon_config:rw
|
5
matter-bridge/options.yml
Normal file
5
matter-bridge/options.yml
Normal file
@ -0,0 +1,5 @@
|
||||
message: "settings"
|
||||
settings:
|
||||
- HA_HOST: localhost
|
||||
HA_PORT: 8123
|
||||
HA_ACCESS_TOKEN: "your acces token"
|
@ -7,7 +7,7 @@
|
||||
"": {
|
||||
"name": "ha-matter-bridge",
|
||||
"version": "1.0.0",
|
||||
"license": "ISC",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"@project-chip/matter-node.js": "^0.7.4",
|
||||
"@project-chip/matter.js-tools": "^0.7.4",
|
@ -4,10 +4,11 @@
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "ts-node ./src/index.ts"
|
||||
"build": "tsc",
|
||||
"start": "node ./build/index.js"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"@project-chip/matter-node.js": "^0.7.4",
|
||||
"@project-chip/matter.js-tools": "^0.7.4",
|
3
matter-bridge/run.sh
Normal file
3
matter-bridge/run.sh
Normal file
@ -0,0 +1,3 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
|
||||
npm run start
|
5
matter-bridge/schema.yml
Normal file
5
matter-bridge/schema.yml
Normal file
@ -0,0 +1,5 @@
|
||||
message: str
|
||||
settings:
|
||||
- HA_HOST: str
|
||||
HA_PORT: int
|
||||
HA_ACCESS_TOKEN: str
|
@ -8,7 +8,6 @@ export class HAMiddleware {
|
||||
private logger = new Logger('HAMiddleware');
|
||||
private hassClient: HassApi;
|
||||
private static instance: HAMiddleware;
|
||||
private connectionOpen: boolean = false;
|
||||
private requestFulfilled: boolean = true;
|
||||
private entities: { [k: string]: HassEntity } = {};
|
||||
private functionsToCallOnChange: {
|
||||
@ -36,8 +35,7 @@ export class HAMiddleware {
|
||||
subscribe() {
|
||||
this.hassClient.on('state_changed', (event) => {
|
||||
this.logger.debug(event);
|
||||
const toDo =
|
||||
this.functionsToCallOnChange[event.data.entity_id];
|
||||
const toDo = this.functionsToCallOnChange[event.data.entity_id];
|
||||
if (toDo) {
|
||||
toDo(event.data);
|
||||
}
|
||||
@ -97,12 +95,6 @@ export class HAMiddleware {
|
||||
if (!HAMiddleware.instance) {
|
||||
const client = await hass(callerOptions);
|
||||
HAMiddleware.instance = new HAMiddleware(client);
|
||||
let waited = 0;
|
||||
const timeOut = 5000;
|
||||
while (!HAMiddleware.instance.connectionOpen && waited < timeOut) {
|
||||
await sleep(1000);
|
||||
waited += 1000;
|
||||
}
|
||||
}
|
||||
return HAMiddleware.instance;
|
||||
}
|
43
matter-bridge/src/index.ts
Normal file
43
matter-bridge/src/index.ts
Normal file
@ -0,0 +1,43 @@
|
||||
import { getParameter } from './utils/utils';
|
||||
import { Bridge, getBridge } from './matter';
|
||||
import { Logger } from '@project-chip/matter-node.js/log';
|
||||
import { HAMiddleware } from './home-assistant/HAmiddleware';
|
||||
import { addAllDevicesToBridge } from './mapper/Mapper';
|
||||
|
||||
const LOGGER = new Logger('Main');
|
||||
let HA_MIDDLEWARE: HAMiddleware;
|
||||
let BRIDGE: Bridge;
|
||||
|
||||
async function run() {
|
||||
LOGGER.info('Startup ...');
|
||||
const token = getParameter('SUPERVISOR_TOKEN');
|
||||
if (!token) {
|
||||
throw new Error('Missing auth token cannot run without it');
|
||||
}
|
||||
HA_MIDDLEWARE = await HAMiddleware.getInstance({
|
||||
host: 'supervisor',
|
||||
port: 80,
|
||||
path: '/core/websocket',
|
||||
token,
|
||||
});
|
||||
LOGGER.info('Connected to home assistant');
|
||||
BRIDGE = getBridge();
|
||||
LOGGER.info('Creating the bridge');
|
||||
await addAllDevicesToBridge(HA_MIDDLEWARE, BRIDGE);
|
||||
LOGGER.info('all devices added');
|
||||
BRIDGE.start();
|
||||
}
|
||||
|
||||
run()
|
||||
.then()
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
LOGGER.error(JSON.stringify(error));
|
||||
});
|
||||
|
||||
process.on('SIGINT', () => {
|
||||
HA_MIDDLEWARE.stop();
|
||||
BRIDGE.stop()
|
||||
.then(() => process.exit(0))
|
||||
.catch((err) => LOGGER.error(err));
|
||||
});
|
@ -1,12 +1,15 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { addDimmerableLightDevice, addOnOffLightDevice } from './devices/lights';
|
||||
import { HassEntity } from '../HA/HAssTypes';
|
||||
import { Bridge, HAMiddleware } from '.';
|
||||
import {
|
||||
addDimmerableLightDevice,
|
||||
addOnOffLightDevice,
|
||||
} from './devices/lights';
|
||||
import { HassEntity } from '../home-assistant/HAssTypes';
|
||||
import { Bridge } from '../matter';
|
||||
import { Logger } from '@project-chip/matter-node.js/log';
|
||||
import { HAMiddleware } from '../home-assistant/HAmiddleware';
|
||||
|
||||
const LOGGER = new Logger('Mapper');
|
||||
|
||||
|
||||
const lightsMap: Map<
|
||||
string,
|
||||
(haEntity: HassEntity, haMiddleware: HAMiddleware, bridge: Bridge) => void
|
14
matter-bridge/src/mapper/devices/MapperType.ts
Normal file
14
matter-bridge/src/mapper/devices/MapperType.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import { Device } from '@project-chip/matter-node.js/device';
|
||||
import { HassEntity } from '../../home-assistant/HAssTypes';
|
||||
|
||||
import { HAMiddleware } from '../../home-assistant/HAmiddleware';
|
||||
import { Bridge } from '../../matter';
|
||||
|
||||
export type AddHaDeviceToBridge = (
|
||||
haEntity: HassEntity,
|
||||
haMiddleware: HAMiddleware,
|
||||
bridge: Bridge
|
||||
) => Device;
|
||||
|
||||
export { HAMiddleware } from '../../home-assistant/HAmiddleware';
|
||||
export { Bridge } from '../../matter';
|
@ -1,12 +1,21 @@
|
||||
import { Device, DimmableLightDevice } from "@project-chip/matter-node.js/device";
|
||||
import { MD5 } from "crypto-js";
|
||||
import { HAMiddleware, Bridge } from "../..";
|
||||
import { HassEntity, StateChangedEvent } from "../../../HA/HAssTypes";
|
||||
import { AddHaDeviceToBridge } from "../MapperType";
|
||||
import { Logger } from "@project-chip/matter-node.js/log";
|
||||
import {
|
||||
Device,
|
||||
DimmableLightDevice,
|
||||
} from '@project-chip/matter-node.js/device';
|
||||
import { MD5 } from 'crypto-js';
|
||||
import {
|
||||
HassEntity,
|
||||
StateChangedEvent,
|
||||
} from '../../../home-assistant/HAssTypes';
|
||||
import { AddHaDeviceToBridge, Bridge, HAMiddleware } from '../MapperType';
|
||||
import { Logger } from '@project-chip/matter-node.js/log';
|
||||
|
||||
const LOGGER = new Logger('DimmableLight');
|
||||
export const addDimmerableLightDevice: AddHaDeviceToBridge = (haEntity: HassEntity, haMiddleware: HAMiddleware, bridge: Bridge): Device => {
|
||||
export const addDimmerableLightDevice: AddHaDeviceToBridge = (
|
||||
haEntity: HassEntity,
|
||||
haMiddleware: HAMiddleware,
|
||||
bridge: Bridge
|
||||
): Device => {
|
||||
const device = new DimmableLightDevice();
|
||||
const serialFromId = MD5(haEntity.entity_id).toString();
|
||||
device.addOnOffListener((value, oldValue) => {
|
||||
@ -36,7 +45,8 @@ export const addDimmerableLightDevice: AddHaDeviceToBridge = (haEntity: HassEnti
|
||||
(event: StateChangedEvent) => {
|
||||
device.setOnOff(event.data.new_state?.state === 'on');
|
||||
device.setCurrentLevel(
|
||||
(event.data.new_state?.attributes as never)['brightness']);
|
||||
(event.data.new_state?.attributes as never)['brightness']
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
@ -46,4 +56,4 @@ export const addDimmerableLightDevice: AddHaDeviceToBridge = (haEntity: HassEnti
|
||||
serialNumber: serialFromId,
|
||||
});
|
||||
return device;
|
||||
}
|
||||
};
|
@ -1,13 +1,19 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { Device, OnOffLightDevice } from "@project-chip/matter-node.js/device";
|
||||
import { MD5 } from "crypto-js";
|
||||
import { HAMiddleware, Bridge } from "../..";
|
||||
import { HassEntity, StateChangedEvent } from "../../../HA/HAssTypes";
|
||||
import { AddHaDeviceToBridge } from "../MapperType";
|
||||
import { Logger } from "@project-chip/matter-node.js/log";
|
||||
import { Device, OnOffLightDevice } from '@project-chip/matter-node.js/device';
|
||||
import { MD5 } from 'crypto-js';
|
||||
import {
|
||||
HassEntity,
|
||||
StateChangedEvent,
|
||||
} from '../../../home-assistant/HAssTypes';
|
||||
import { AddHaDeviceToBridge, Bridge, HAMiddleware } from '../MapperType';
|
||||
import { Logger } from '@project-chip/matter-node.js/log';
|
||||
|
||||
const LOGGER = new Logger('OnOfflIght');
|
||||
export const addOnOffLightDevice: AddHaDeviceToBridge = (haEntity: HassEntity, haMiddleware: HAMiddleware, bridge: Bridge): Device => {
|
||||
export const addOnOffLightDevice: AddHaDeviceToBridge = (
|
||||
haEntity: HassEntity,
|
||||
haMiddleware: HAMiddleware,
|
||||
bridge: Bridge
|
||||
): Device => {
|
||||
const device = new OnOffLightDevice();
|
||||
const serialFromId = MD5(haEntity.entity_id).toString();
|
||||
device.addOnOffListener((value, oldValue) => {
|
||||
@ -36,4 +42,4 @@ export const addOnOffLightDevice: AddHaDeviceToBridge = (haEntity: HassEntity, h
|
||||
serialNumber: serialFromId,
|
||||
});
|
||||
return device;
|
||||
}
|
||||
};
|
@ -10,7 +10,7 @@ import {
|
||||
} from '@project-chip/matter-node.js/device';
|
||||
import { Logger } from '@project-chip/matter-node.js/log';
|
||||
import { StorageManager } from '@project-chip/matter-node.js/storage';
|
||||
import { getIntParameter, getParameter } from '../../utils/utils';
|
||||
import { getIntParameter, getParameter } from '../utils/utils';
|
||||
import { Time } from '@project-chip/matter-node.js/time';
|
||||
import { VendorId } from '@project-chip/matter-node.js/datatype';
|
||||
import { QrCode } from '@project-chip/matter-node.js/schema';
|
||||
@ -24,14 +24,16 @@ export class Bridge {
|
||||
getParameter('name') || 'Matter Bridge';
|
||||
private static readonly deviceType = DeviceTypes.AGGREGATOR.code;
|
||||
private static readonly vendorName = getParameter('vendor') || 'Jatus';
|
||||
private static readonly productName = 'node-matter OnOff-Bridge';
|
||||
private static readonly productName = 'HomeAssistant';
|
||||
private static readonly port = getIntParameter('port') ?? 5540;
|
||||
private ready = false;
|
||||
|
||||
private matterServer: MatterServer;
|
||||
private static instace: Bridge;
|
||||
private logger = new Logger('bridge');
|
||||
private storageManager: StorageManager;
|
||||
private aggregator: Aggregator;
|
||||
private commissioningServer: CommissioningServer | undefined;
|
||||
|
||||
private constructor(
|
||||
matterServer: MatterServer,
|
||||
@ -106,20 +108,22 @@ export class Bridge {
|
||||
typeof BridgedDeviceBasicInformationCluster.attributes
|
||||
>
|
||||
) {
|
||||
// const id = getIntParameter('uniqueid');
|
||||
if (!this.commissioningServer?.isCommissioned()) {
|
||||
this.logger.warn('System not initialized, may cause crashes');
|
||||
}
|
||||
this.aggregator.addBridgedDevice(device, bridgedBasicInformation);
|
||||
}
|
||||
|
||||
async start() {
|
||||
this.logger.info('Starting...');
|
||||
const commissioningServer =
|
||||
this.commissioningServer =
|
||||
await this.setupContextAndCommissioningServer();
|
||||
commissioningServer.addDevice(this.aggregator);
|
||||
this.matterServer.addCommissioningServer(commissioningServer);
|
||||
this.commissioningServer.addDevice(this.aggregator);
|
||||
this.matterServer.addCommissioningServer(this.commissioningServer);
|
||||
await this.matterServer.start();
|
||||
this.logger.info('Listening');
|
||||
if (!commissioningServer.isCommissioned()) {
|
||||
const pairingData = commissioningServer.getPairingCode();
|
||||
if (!this.commissioningServer.isCommissioned()) {
|
||||
const pairingData = this.commissioningServer.getPairingCode();
|
||||
const { qrPairingCode, manualPairingCode } = pairingData;
|
||||
|
||||
console.log(QrCode.get(qrPairingCode));
|
||||
@ -136,5 +140,9 @@ export class Bridge {
|
||||
|
||||
async stop() {
|
||||
this.matterServer.close();
|
||||
this.storageManager
|
||||
.close()
|
||||
.then(() => process.exit(0))
|
||||
.catch((err) => this.logger.error(err));
|
||||
}
|
||||
}
|
@ -4,6 +4,8 @@ import {
|
||||
StorageManager,
|
||||
} from '@project-chip/matter-node.js/storage';
|
||||
import { getParameter, hasParameter } from '@project-chip/matter-node.js/util';
|
||||
export { Bridge } from './Bridge';
|
||||
import { Bridge } from './Bridge';
|
||||
|
||||
let MATTER_SERVER: MatterServer;
|
||||
let STORAGE: StorageBackendDisk;
|
||||
@ -14,7 +16,7 @@ export function serverSetup(): {
|
||||
storageManager: StorageManager;
|
||||
} {
|
||||
if (!(MATTER_SERVER && STORAGE && STORAGE_MANAGER)) {
|
||||
const storageLocation = getParameter('store') || './deviceData';
|
||||
const storageLocation = getParameter('store') || '/config/deviceData';
|
||||
|
||||
STORAGE = new StorageBackendDisk(
|
||||
storageLocation,
|
||||
@ -27,3 +29,12 @@ export function serverSetup(): {
|
||||
}
|
||||
return { matterServer: MATTER_SERVER, storageManager: STORAGE_MANAGER };
|
||||
}
|
||||
|
||||
export function getBridge(): Bridge {
|
||||
const serverData = serverSetup();
|
||||
const bridge = Bridge.getInstance(
|
||||
serverData.matterServer,
|
||||
serverData.storageManager
|
||||
);
|
||||
return bridge;
|
||||
}
|
@ -2,6 +2,7 @@ import { ValidationError } from '@project-chip/matter.js/common';
|
||||
import { execSync } from 'child_process';
|
||||
|
||||
const envVar = process.env;
|
||||
console.debug({ envVar });
|
||||
|
||||
export function getParameter(name: string) {
|
||||
return envVar[name];
|
13
matter-bridge/tsconfig.json
Normal file
13
matter-bridge/tsconfig.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
||||
"module": "Node16" /* Specify what module code is generated. */,
|
||||
"rootDir": "./src",
|
||||
"outDir": "./build", /* Specify the root folder within your source files. */
|
||||
"moduleResolution": "node16" /* Specify how TypeScript looks up a file from a given module specifier. */,
|
||||
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
|
||||
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
||||
"strict": true /* Enable all strict type-checking options. */,
|
||||
"skipLibCheck": true /* Skip type checking all .d.ts files. */,
|
||||
},
|
||||
}
|
1
repository.yml
Normal file
1
repository.yml
Normal file
@ -0,0 +1 @@
|
||||
name: ha-matter-bridge
|
37
src/index.ts
37
src/index.ts
@ -1,37 +0,0 @@
|
||||
import { Bridge, HAMiddleware, addAllDevicesToBridge } from './matter';
|
||||
import { serverSetup } from './matter/server';
|
||||
import { Logger } from '@project-chip/matter-node.js/log';
|
||||
|
||||
let LOGGER = new Logger('Main');
|
||||
let BRIDGE: Bridge;
|
||||
let HA_MIDDLEWARE: HAMiddleware;
|
||||
const SERVER_DATA = serverSetup();
|
||||
|
||||
async function run() {
|
||||
HA_MIDDLEWARE = await HAMiddleware.getInstance({
|
||||
host: process.env.HA_HOST,
|
||||
port: Number(process.env.HA_PORT),
|
||||
token: process.env.HA_ACCESS_TOKEN,
|
||||
});
|
||||
BRIDGE = Bridge.getInstance(
|
||||
SERVER_DATA.matterServer,
|
||||
SERVER_DATA.storageManager
|
||||
);
|
||||
await addAllDevicesToBridge(HA_MIDDLEWARE, BRIDGE);
|
||||
BRIDGE.start();
|
||||
}
|
||||
|
||||
run().then().catch(LOGGER.error);
|
||||
|
||||
process.on('SIGINT', () => {
|
||||
HA_MIDDLEWARE.stop();
|
||||
BRIDGE.stop()
|
||||
.then(() => {
|
||||
// Pragmatic way to make sure the storage is correctly closed before the process ends.
|
||||
SERVER_DATA.storageManager
|
||||
.close()
|
||||
.then(() => process.exit(0))
|
||||
.catch((err) => LOGGER.error(err));
|
||||
})
|
||||
.catch((err) => LOGGER.error(err));
|
||||
});
|
@ -1,7 +0,0 @@
|
||||
import { Device } from "@project-chip/matter-node.js/device";
|
||||
import { HAMiddleware, Bridge } from "..";
|
||||
import { HassEntity } from "../../HA/HAssTypes";
|
||||
|
||||
export type AddHaDeviceToBridge = (haEntity: HassEntity,
|
||||
haMiddleware: HAMiddleware,
|
||||
bridge: Bridge) => Device
|
@ -1,3 +0,0 @@
|
||||
export * from './server/Bridge';
|
||||
export * from '../HA/HAmiddleware';
|
||||
export * from './Mapper';
|
102
tsconfig.json
102
tsconfig.json
@ -1,102 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
/* Visit https://aka.ms/tsconfig to read more about this file */
|
||||
/* Projects */
|
||||
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
||||
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
||||
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
||||
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
||||
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
||||
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
||||
/* Language and Environment */
|
||||
"target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
||||
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
||||
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
||||
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
||||
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
||||
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
||||
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
||||
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
||||
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
||||
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
||||
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
||||
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
||||
/* Modules */
|
||||
// "module": "commonjs", /* Specify what module code is generated. */
|
||||
"module": "Node16" /* Specify what module code is generated. */,
|
||||
// // "rootDir": "./", /* Specify the root folder within your source files. */
|
||||
"moduleResolution": "node16" /* Specify how TypeScript looks up a file from a given module specifier. */,
|
||||
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
||||
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
||||
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
||||
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
||||
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
||||
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
||||
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
||||
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
||||
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
||||
// "resolveJsonModule": true, /* Enable importing .json files. */
|
||||
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
||||
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
||||
/* JavaScript Support */
|
||||
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
||||
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
||||
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
||||
/* Emit */
|
||||
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
||||
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
||||
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
||||
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
||||
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
||||
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
||||
// "outDir": "./", /* Specify an output folder for all emitted files. */
|
||||
// "removeComments": true, /* Disable emitting comments. */
|
||||
// "noEmit": true, /* Disable emitting files from a compilation. */
|
||||
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
||||
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
||||
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
||||
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
||||
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
||||
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
||||
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
||||
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
||||
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
||||
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
||||
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
||||
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
||||
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
||||
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
||||
/* Interop Constraints */
|
||||
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
||||
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
||||
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
||||
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
|
||||
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
||||
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
||||
/* Type Checking */
|
||||
"strict": true /* Enable all strict type-checking options. */,
|
||||
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
||||
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
||||
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
||||
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
||||
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
||||
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
||||
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
||||
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
||||
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
||||
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
||||
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
||||
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
||||
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
||||
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
||||
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
||||
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
||||
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
||||
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
||||
/* Completeness */
|
||||
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
||||
"skipLibCheck": true /* Skip type checking all .d.ts files. */,
|
||||
},
|
||||
}
|
Loading…
Reference in New Issue
Block a user