generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nahuel Sotelo
committed
Jan 12, 2024
1 parent
68663d6
commit c8fd812
Showing
8 changed files
with
187 additions
and
263 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1 @@ | ||
{ | ||
"printWidth": 80, | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"semi": false, | ||
"singleQuote": true, | ||
"quoteProps": "as-needed", | ||
"jsxSingleQuote": false, | ||
"trailingComma": "none", | ||
"bracketSpacing": true, | ||
"bracketSameLine": true, | ||
"arrowParens": "avoid", | ||
"proseWrap": "always", | ||
"htmlWhitespaceSensitivity": "css", | ||
"endOfLine": "lf" | ||
} | ||
{} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { CustomError } from "ts-custom-error"; | ||
Check failure on line 1 in src/errors.ts GitHub Actions / Lint Codebase
|
||
|
||
export class InvalidUrlError extends CustomError { | ||
public constructor( | ||
public invalidUrl: string, | ||
cause: unknown, | ||
) { | ||
super(`Invalid URL given: ${invalidUrl}`, { cause }); | ||
// Set name explicitly as minification can mangle class names | ||
Object.defineProperty(this, "name", { value: "InvalidUrlError" }); | ||
} | ||
} | ||
|
||
export class ParseUrlsError extends CustomError { | ||
public constructor( | ||
public wrongUrlString: string, | ||
cause: unknown, | ||
) { | ||
super(`Failed to parse the given URL strings: ${wrongUrlString}`, { | ||
cause, | ||
}); | ||
// Set name explicitly as minification can mangle class names | ||
Object.defineProperty(this, "name", { value: "CannotParseUrlsError" }); | ||
} | ||
} | ||
|
||
export class UnknownError extends CustomError { | ||
public constructor(cause: unknown) { | ||
super(`Unknown error`, { cause }); | ||
// Set name explicitly as minification can mangle class names | ||
Object.defineProperty(this, "name", { value: "UnknownError" }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/** | ||
* The entrypoint for the action. | ||
*/ | ||
import { run } from './main' | ||
|
||
void run() | ||
import { run } from "./main.js"; | ||
|
||
await run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { createLogger, format, transports } from "winston"; | ||
|
||
export const logger = createLogger({ | ||
level: "info", | ||
format: format.combine( | ||
format.timestamp({ | ||
format: "YYYY-MM-DD HH:mm:ss", | ||
}), | ||
format.errors({ stack: true }), | ||
format.splat(), | ||
format.json(), | ||
), | ||
defaultMeta: { service: "diffnews" }, | ||
transports: [ | ||
// | ||
// - Write to all logs with level `info` and below to `quick-start-combined.log`. | ||
// - Write all logs error (and below) to `quick-start-error.log`. | ||
// | ||
new transports.File({ filename: "diffnews-error.log", level: "error" }), | ||
new transports.File({ filename: "diffnews-combined.log" }), | ||
], | ||
}); | ||
|
||
// | ||
// If we're not in production then **ALSO** log to the `console` | ||
// with the colorized simple format. | ||
// | ||
if (process.env.NODE_ENV !== "production") { | ||
logger.add( | ||
new transports.Console({ | ||
format: format.combine(format.colorize(), format.simple()), | ||
}), | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.