Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(github): fix type exports in packages/cactus-common #3649

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions packages/cactus-common/src/main/typescript/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,17 @@
export * from "./public-api";
export { IListenOptions, Servers } from "./servers";
export const LogLevel = {
TRACE: "TRACE",
trace: "trace",
ERROR: "ERROR",
error: "error",
WARN: "WARN",
warn: "warn",
INFO: "INFO",
info: "info",
DEBUG: "DEBUG",
debug: "debug",
SILENT: "SILENT",
silent: "silent",
} as const;
export type LogLevelDesc = (typeof LogLevel)[keyof typeof LogLevel];
Comment on lines +3 to +17
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ruzell22

  1. Please do not write code directly in index.ts, it is meant to collect the public API surface exports and that will very noisy if you start writing code directly in it.
  2. Could you make the LogLevelDesc type a match to what is defined in packages/cactus-common/node_modules/loglevel/index.d.ts ? There's nothing wrong by the looks of it with what you have here, but it is the safest if we use the exact same definition that the library uses internally to reduce the risk of type compatibility issues later on.
   /**
     * Log levels
     */
    interface LogLevel {
        TRACE: 0;
        DEBUG: 1;
        INFO: 2;
        WARN: 3;
        ERROR: 4;
        SILENT: 5;
    }

    /**
     * Possible log level numbers.
     */
    type LogLevelNumbers = LogLevel[keyof LogLevel];

    /**
     * Possible log level descriptors, may be string, lower or upper case, or number.
     */
    type LogLevelDesc = LogLevelNumbers
        | 'trace'
        | 'debug'
        | 'info'
        | 'warn'
        | 'error'
        | 'silent'
        | keyof LogLevel;

2 changes: 0 additions & 2 deletions tools/custom-checks/get-all-tgz-path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ export async function getAllTgzPath(): Promise<IGetAllTgzPathResponse> {
"packages/cactus-verifier-client/hyperledger-cactus-verifier-client-*.tgz",
// link for issue ticket relating to this package: https://github.com/hyperledger-cacti/cacti/issues/3634
"packages/cactus-plugin-ledger-connector-polkadot/hyperledger-cactus-plugin-ledger-connector-polkadot-*.tgz",
// link for issue ticket relating to this package: https://github.com/hyperledger-cacti/cacti/issues/3635
"packages/cactus-common/hyperledger-cactus-common-*.tgz",
],
};

Expand Down
Loading