mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
feat: better cyclic.sh script compatibility
This commit is contained in:
1 parent
4e49d22c4c
commit
3330dce264
13 files changed
+72
-164
No files matched your search
@@ -1,28 +1,9 @@
|
||||
import { argv } from 'process';
|
||||
import errorWithCause from './errorWithCause.js';
|
||||
export const discordToken = process.env.DISCORD_TOKEN!;
|
||||
export const wargamingApplicationId = process.env.WARGAMING_APPLICATION_ID!;
|
||||
|
||||
type ArgumentName = 'discord-token' | 'wargaming-application-id';
|
||||
|
||||
const args: Record<ArgumentName, string> = {
|
||||
'discord-token': '',
|
||||
'wargaming-application-id': '',
|
||||
};
|
||||
|
||||
argv.forEach((arg) => {
|
||||
if (arg.includes('=')) {
|
||||
const [name, value] = arg.split('=');
|
||||
args[name as ArgumentName] = value;
|
||||
}
|
||||
});
|
||||
|
||||
Object.keys(args).forEach((arg) => {
|
||||
if (args[arg as ArgumentName] === '') {
|
||||
throw errorWithCause(
|
||||
`Missing argument: ${arg}`,
|
||||
'Missing required auth key.',
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
export const discordToken = args['discord-token'];
|
||||
export const wargamingApplicationId = args['wargaming-application-id'];
|
||||
if (!discordToken) {
|
||||
throw new Error('No Discord token provided');
|
||||
}
|
||||
if (!wargamingApplicationId) {
|
||||
throw new Error('No Wargaming application id provided}');
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
const isDevBoolean = process.argv.includes('--dev');
|
||||
const isDevBoolean = process.env.NODE_ENV === 'development';
|
||||
|
||||
export default function isDev() {
|
||||
return isDevBoolean;
|
||||
}
|
||||
|
||||
console.log(process.env.NODE_ENV);
|
||||
Reference in new issue
Block a user