commit 7eb9f4ad8bc5657d86379665b4b074ab23747be4 Author: Pascal Perrenoud Date: Mon May 20 01:15:45 2024 +0200 Dump WIP diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fa5646b --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +bun.lockb +package-lock.json +node_modules/ +.idea/ +._* +.DS_Store diff --git a/index.ts b/index.ts new file mode 100644 index 0000000..05b4160 --- /dev/null +++ b/index.ts @@ -0,0 +1,20 @@ +import logger, {Level, type Writer, type WriterOptions} from 'log' + +export * as log from 'log' +export default logger + +export class Ntfy implements Writer { + readonly _options: WriterOptions & { url: string, token?: string }; + + public constructor(options: WriterOptions & { url: string, token?: string }) { + this._options = options + } + + public log(_level: Level, ...data: any[]) : void { + throw "todo" + } + + get options() : WriterOptions { + return this._options; + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..f05e489 --- /dev/null +++ b/package.json @@ -0,0 +1,18 @@ +{ + "name": "logger-ntfy", + "description": "Log writer that sends logs to a ntfy server", + "version": "1.0.0", + + "author": "Pascal Perrenoud ", + + "module": "index.ts", + "type": "module", + "files": ["index.ts"], + + "dependencies": { + "log": "git+https://git.pband.ch/typescript/log.git" + }, + "peerDependencies": { + "typescript": "^5.0.0" + } +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..3d49bf0 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,32 @@ +{ + "compilerOptions": { + // Enable latest features + "lib": ["ESNext","dom"], + "target": "ESNext", + "module": "ESNext", + "moduleDetection": "force", + "allowJs": true, + "checkJs": true, + + // Bundler mode + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "noEmit": true, + + // Best practices + "strict": true, + "skipLibCheck": true, + "noFallthroughCasesInSwitch": true, + + // Some stricter flags (disabled by default) + "noUnusedLocals": false, + "noUnusedParameters": false, + "forceConsistentCasingInFileNames": true, + "noPropertyAccessFromIndexSignature": false + }, + + "include": [ + "index.ts", + ] +}