Package parsing for production
This commit is contained in:
parent
31986ca3a0
commit
b8793fd2b6
|
@ -218,8 +218,10 @@ export class BetterDiscord {
|
|||
this.config.compatibility();
|
||||
|
||||
this.bindings();
|
||||
this.parseClientPackage();
|
||||
this.extraPaths();
|
||||
this.parseClientPackage();
|
||||
this.parseEditorPackage();
|
||||
this.parseCorePackage();
|
||||
this.database.init();
|
||||
|
||||
configProxy = () => this.config;
|
||||
|
@ -289,7 +291,7 @@ export class BetterDiscord {
|
|||
*/
|
||||
parseClientPackage() {
|
||||
const clientPath = this.config.getPath('client');
|
||||
const clientPkg = TESTS ? require(`${path.resolve(clientPath, '..')}/package.json`) :require(`${clientPath}/package.json`);
|
||||
const clientPkg = TESTS ? require(`${path.resolve(clientPath, '..')}/package.json`) : require(`${clientPath}/package.json`);
|
||||
const { version } = clientPkg;
|
||||
const main = TESTS ? 'betterdiscord.client.js' : clientPkg.main;
|
||||
this.config.addPath('client_script', `${clientPath}/${main}`);
|
||||
|
@ -297,6 +299,20 @@ export class BetterDiscord {
|
|||
console.log(`[BetterDiscord] Client v${this.config.clientVersion} - ${this.config.getPath('client_script')}`);
|
||||
}
|
||||
|
||||
parseCorePackage() {
|
||||
const corePath = this.config.getPath('core');
|
||||
const corePkg = TESTS ? require(`${path.resolve(corePath, '..')}/package.json`) : require(`${corePath}/package.json`);
|
||||
const { version } = corePkg;
|
||||
this.config.setCoreVersion(version);
|
||||
}
|
||||
|
||||
parseEditorPackage() {
|
||||
const editorPath = this.config.getPath('editor');
|
||||
const editorPkg = TESTS ? require(`${path.resolve(editorPath, '..')}/package.json`) : require(`${editorPath}/package.json`);
|
||||
const { version } = editorPkg;
|
||||
this.config.setEditorVersion(version);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add extra paths to config
|
||||
*/
|
||||
|
|
|
@ -37,7 +37,15 @@ export default class Config extends Module {
|
|||
}
|
||||
|
||||
setClientVersion(clientVersion) {
|
||||
this.args.clientVersion = clientVersion;
|
||||
this.state.clientVersion = clientVersion;
|
||||
}
|
||||
|
||||
setCoreVersion(coreVersion) {
|
||||
this.state.coreVersion = coreVersion;
|
||||
}
|
||||
|
||||
setEditorVersion(editorVersion) {
|
||||
this.state.editorVersion = editorVersion;
|
||||
}
|
||||
|
||||
get paths() {
|
||||
|
|
Loading…
Reference in New Issue