reciple 6.0.0-dev.17 → 6.0.0-dev.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/lib/bin.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  import { RecipleClient } from './reciple/classes/RecipleClient.js';
3
3
  import { RecipleConfig } from './reciple/classes/RecipleConfig.js';
4
4
  import { rawVersion } from './reciple/version.js';
5
- import { existsSync, readdirSync } from 'fs';
5
+ import { existsSync, mkdirSync, readdirSync } from 'fs';
6
6
  import { cwd, flags } from './reciple/flags.js';
7
7
  import { input } from 'fallout-utility';
8
8
  import chalk from 'chalk';
@@ -10,7 +10,10 @@ import 'dotenv/config';
10
10
  import path from 'path';
11
11
  import { inspect } from 'util';
12
12
  const allowedFiles = ['node_modules', 'reciple.yml', 'package.json'];
13
- const configPath = path.join(cwd, 'reciple.yml');
13
+ const configPath = path.resolve(cwd, 'reciple.yml');
14
+ console.log(cwd);
15
+ if (!existsSync(cwd))
16
+ mkdirSync(cwd, { recursive: true });
14
17
  if (readdirSync(cwd).filter(f => !f.startsWith('.') && allowedFiles.indexOf(f)).length > 0 && !existsSync(flags.config ?? configPath)) {
15
18
  const ask = (flags.yes ? 'y' : null) ?? input('This directory does not contain reciple.yml. Would you like to init axis here? [y/n] ') ?? '';
16
19
  if (ask.toString().toLowerCase() !== 'y')
@@ -39,7 +39,7 @@ class RecipleClient extends discord_js_1.Client {
39
39
  this.logger = (0, util_1.createLogger)(!!options.config?.fileLogging.stringifyLoggedJSON, options.config?.fileLogging.debugmode);
40
40
  this.config = { ...this.config, ...(options.config ?? {}) };
41
41
  if (this.config.fileLogging.enabled)
42
- this.logger.logFile(path_1.default.join(flags_1.cwd, this.config.fileLogging.logFilePath ?? 'logs/latest.log'), false);
42
+ this.logger.logFile(path_1.default.resolve(flags_1.cwd, this.config.fileLogging.logFilePath ?? 'logs/latest.log'), false);
43
43
  this.cwd = options.cwd ?? process.cwd();
44
44
  this.applicationCommands = new ApplicationCommandManager_1.ApplicationCommandManager(this);
45
45
  }
@@ -19,7 +19,7 @@ class RecipleConfig {
19
19
  */
20
20
  constructor(configPath) {
21
21
  this.config = RecipleConfig.getDefaultConfig();
22
- this.configPath = path_1.default.join(process.cwd(), 'reciple.yml');
22
+ this.configPath = path_1.default.resolve(process.cwd(), 'reciple.yml');
23
23
  if (!configPath)
24
24
  throw new Error('Config path is not defined');
25
25
  this.configPath = configPath;
@@ -62,17 +62,17 @@ class RecipleConfig {
62
62
  }
63
63
  /**
64
64
  * Parse token from config
65
- * @param askIfNull Ask for token if the token is null/undefined
65
+ * @param askIfEmpty Ask for token if the token is undefined
66
66
  */
67
- parseToken(askIfNull = true) {
68
- let token = flags_1.token || this.config?.token || null;
67
+ parseToken(askIfEmpty = true) {
68
+ let token = flags_1.token || this.config?.token || undefined;
69
69
  if (!token)
70
- return token || (askIfNull ? this._askToken() : null);
70
+ return token || (askIfEmpty ? this._askToken() : null);
71
71
  const envToken = token.toString().split(':');
72
72
  if (envToken.length === 2 && envToken[0].toLocaleLowerCase() === 'env' && envToken[1]) {
73
- token = process.env[envToken[1]] || null;
73
+ token = process.env[envToken[1]] || undefined;
74
74
  }
75
- return token || (askIfNull ? this._askToken() : null);
75
+ return token || (askIfEmpty == null ? this._askToken() : null);
76
76
  }
77
77
  /**
78
78
  * Check if the config version is supported
@@ -103,4 +103,4 @@ class RecipleConfig {
103
103
  }
104
104
  }
105
105
  exports.RecipleConfig = RecipleConfig;
106
- RecipleConfig.defaultConfigPath = path_1.default.join(__dirname, '../../../../resource/reciple.yml');
106
+ RecipleConfig.defaultConfigPath = path_1.default.resolve(__dirname, '../../../../resource/reciple.yml');
@@ -174,7 +174,7 @@ class ClientModuleManager {
174
174
  if (!(0, fs_1.lstatSync)(dir).isDirectory())
175
175
  continue;
176
176
  modules.push(...(0, fs_1.readdirSync)(dir)
177
- .map(file => path_1.default.join(!dir.startsWith('/') ? this.client.cwd : '', dir, file))
177
+ .map(file => path_1.default.resolve(!dir.startsWith('/') ? this.client.cwd : '', dir, file))
178
178
  .filter(file => (options?.filter ? options.filter(file) : file.endsWith('.js'))));
179
179
  }
180
180
  return modules.filter(file => !(options?.ignoredFiles ?? this.client.config.ignoredFiles).some(ignored => (0, wildcard_match_1.default)(ignored)(path_1.default.basename(file))));
@@ -82,9 +82,9 @@ export declare class RecipleConfig {
82
82
  getConfig(): Config;
83
83
  /**
84
84
  * Parse token from config
85
- * @param askIfNull Ask for token if the token is null/undefined
85
+ * @param askIfEmpty Ask for token if the token is undefined
86
86
  */
87
- parseToken(askIfNull?: boolean): string | null;
87
+ parseToken(askIfEmpty?: boolean): string | null;
88
88
  /**
89
89
  * Check if the config version is supported
90
90
  */
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "reciple",
3
- "version": "6.0.0-dev.17",
3
+ "version": "6.0.0-dev.18",
4
4
  "bin": "./dist/lib/bin.mjs",
5
5
  "license": "GPL-3.0",
6
6
  "type": "commonjs",
7
7
  "main": "./dist/lib/index.js",
8
8
  "types": "./dist/types/index.d.ts",
9
- "module": "./esm.mjs",
9
+ "module": "./dist/lib/esm.mjs",
10
10
  "author": "FalloutStudios",
11
11
  "description": "Handler for Discord.js",
12
12
  "homepage": "https://reciple.js.org",