Skip to content

Commit

Permalink
ci: add do not auth flag (#129)
Browse files Browse the repository at this point in the history
  • Loading branch information
colinnielsen authored Mar 25, 2024
1 parent d34b2b2 commit 3ca390f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@0xmetropolis/metal",
"version": "0.8.1",
"version": "0.8.2",
"description": "Smart contract visualization tool.",
"author": "Metropolis (@0xmetropolis)",
"bin": {
Expand Down
13 changes: 11 additions & 2 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,16 @@ const bootstrapConstants = () => {
env['AUTH0_AUDIENCE'] ??
CONNECTIONS[MODE].auth0.audience;
const YARG_DEBUG = flagIsPresent('--debug');
const NO_AUTH = flagIsPresent('--no-auth');

// strip the above args from process.argv
const flagsToRemove: string[] = [...MODE_FLAGS, ...METAL_FLAGS, ...AUTH0_FLAGS, '--debug'];
const flagsToRemove: string[] = [
...MODE_FLAGS,
...METAL_FLAGS,
...AUTH0_FLAGS,
'--debug',
'--no-auth',
];
const processArgvWithoutFlags = process.argv.filter(arg => !flagsToRemove.includes(arg));
process.argv = processArgvWithoutFlags;

Expand All @@ -95,6 +102,7 @@ const bootstrapConstants = () => {
AUTH0_CLI_CLIENT_ID,
AUTH0_AUDIENCE,
YARG_DEBUG,
NO_AUTH,
};

const logDebug = (s: string | any) => YARG_DEBUG && console.log('\x1b[36m%s\x1b[0m', s);
Expand All @@ -120,6 +128,7 @@ export const {
AUTH0_CLI_CLIENT_ID,
AUTH0_AUDIENCE,
YARG_DEBUG,
NO_AUTH,
} = bootstrapConstants();

// @dev the directory name of the cli's global cache. @NOTE! is installed wherever the global node_modules lives.
Expand All @@ -135,7 +144,7 @@ export const FILESTORE_NAMES = [ID_TOKEN_FILE] as const;
export type CachedFile = (typeof FILESTORE_NAMES)[number];

export const doNotCommunicateWithMetalService = !!process.env.NO_METAL_SERVICE;
export const doNotAuth = !!process.env.NO_AUTH;
export const doNotAuth = process.env.NO_AUTH === 'true' || NO_AUTH;

export const FORGE_FORK_ALIASES = ['--fork-url', '-f', '--rpc-url'];
export const FORGE_WALLET_OPTIONS = [
Expand Down

0 comments on commit 3ca390f

Please sign in to comment.