mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Type check safe-chain package
This commit is contained in:
parent
d5dc801c00
commit
c88b1a624f
60 changed files with 1179 additions and 33 deletions
|
|
@ -7,6 +7,10 @@ import { initializeCliArguments } from "./config/cliArguments.js";
|
|||
import { createSafeChainProxy } from "./registryProxy/registryProxy.js";
|
||||
import chalk from "chalk";
|
||||
|
||||
/**
|
||||
* @param {string[]} args
|
||||
* @returns {Promise<number | never[]>}
|
||||
*/
|
||||
export async function main(args) {
|
||||
const proxy = createSafeChainProxy();
|
||||
await proxy.startServer();
|
||||
|
|
@ -14,6 +18,7 @@ export async function main(args) {
|
|||
// Global error handlers to log unhandled errors
|
||||
process.on("uncaughtException", (error) => {
|
||||
ui.writeError(`Safe-chain: Uncaught exception: ${error.message}`);
|
||||
// @ts-expect-error writeVerbose will be added in a future PR
|
||||
ui.writeVerbose(`Stack trace: ${error.stack}`);
|
||||
process.exit(1);
|
||||
});
|
||||
|
|
@ -21,6 +26,7 @@ export async function main(args) {
|
|||
process.on("unhandledRejection", (reason) => {
|
||||
ui.writeError(`Safe-chain: Unhandled promise rejection: ${reason}`);
|
||||
if (reason instanceof Error) {
|
||||
// @ts-expect-error writeVerbose will be added in a future PR
|
||||
ui.writeVerbose(`Stack trace: ${reason.stack}`);
|
||||
}
|
||||
process.exit(1);
|
||||
|
|
@ -56,7 +62,7 @@ export async function main(args) {
|
|||
// Returning the exit code back to the caller allows the promise
|
||||
// to be awaited in the bin files and return the correct exit code
|
||||
return packageManagerResult.status;
|
||||
} catch (error) {
|
||||
} catch (/** @type any */ error) {
|
||||
ui.writeError("Failed to check for malicious packages:", error.message);
|
||||
|
||||
// Returning the exit code back to the caller allows the promise
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue