This commit is contained in:
Evert Prants 2020-11-28 22:26:42 +02:00
parent 037ccb62c4
commit 9841b7d571
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
4 changed files with 17 additions and 12 deletions

4
.npmignore Normal file
View File

@ -0,0 +1,4 @@
/src/
/tsconfig.json
/tsconfig.tsbuildinfo
/tslint.json

View File

@ -2,7 +2,7 @@
"name": "@squeebot/cli", "name": "@squeebot/cli",
"version": "3.0.0", "version": "3.0.0",
"description": "Squeebot v3 runtime, environments and configuration", "description": "Squeebot v3 runtime, environments and configuration",
"main": "index.js", "main": "dist/squeebot.js",
"bin": { "bin": {
"squeebot": "./dist/squeebot.js", "squeebot": "./dist/squeebot.js",
"squeebotd": "./dist/squeebotd.js" "squeebotd": "./dist/squeebotd.js"
@ -11,7 +11,8 @@
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"build": "tsc", "build": "tsc",
"watch": "tsc -w", "watch": "tsc -w",
"start": "node ./dist/squeebot" "start": "node ./dist/squeebot",
"prepare": "npm run build"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -50,7 +50,7 @@ export class SqueebotCLI {
for (const namep of args.slice(1)) { for (const namep of args.slice(1)) {
await this.bot.repositoryManager.uninstallRepository(namep); await this.bot.repositoryManager.uninstallRepository(namep);
logger.log('Installed repository %s.', namep); logger.log('Installed repository %s.', namep);
}; }
break; break;
case 'u': case 'u':
case 'upd': case 'upd':
@ -62,7 +62,7 @@ export class SqueebotCLI {
} }
return; return;
} }
for (const namep of args.slice(1)) { for (const namep of args.slice(1)) {
const repo = this.bot.repositoryManager.getRepoByName(namep); const repo = this.bot.repositoryManager.getRepoByName(namep);
if (!repo) { if (!repo) {
@ -71,7 +71,7 @@ export class SqueebotCLI {
} }
await this.checkUpdate(repo); await this.checkUpdate(repo);
}; }
break; break;
default: default:
logger.log(help); logger.log(help);
@ -99,7 +99,7 @@ export class SqueebotCLI {
case 'remove': case 'remove':
case 'uninstall': case 'uninstall':
for (const name of args.slice(1)) { for (const name of args.slice(1)) {
await this.bot.repositoryManager.uninstallPlugin(name) await this.bot.repositoryManager.uninstallPlugin(name);
logger.log('Uninstalled plugin %s.', name); logger.log('Uninstalled plugin %s.', name);
} }
break; break;
@ -135,7 +135,7 @@ export class SqueebotCLI {
} }
logger.log('Stopping plugin', name); logger.log('Stopping plugin', name);
this.bot.stream.emitTo(name, 'pluginUnload', name); this.bot.stream.emitTo(name, 'pluginUnload', name);
} }
break; break;
@ -193,7 +193,7 @@ export class SqueebotCLI {
return; return;
} }
switch(args[0]) { switch (args[0]) {
case 'new': case 'new':
if (this.bot.channelManager.getChannelByName(args[1])) { if (this.bot.channelManager.getChannelByName(args[1])) {
logger.error('A channel by that name already exists!'); logger.error('A channel by that name already exists!');
@ -303,7 +303,7 @@ export class SqueebotCLI {
await this.bot.config.save(); await this.bot.config.save();
} }
public attach(rl: ReadLine) { public attach(rl: ReadLine): void {
rl.on('line', (line: string) => { rl.on('line', (line: string) => {
const split = line.split(' '); const split = line.split(' ');
@ -311,7 +311,7 @@ export class SqueebotCLI {
return; return;
} }
switch(split[0]) { switch (split[0]) {
case 'r': case 'r':
case 'repo': case 'repo':
case 'repository': case 'repository':
@ -339,4 +339,4 @@ export class SqueebotCLI {
} }
}); });
} }
} }

View File

@ -31,7 +31,7 @@ export class Squeebot {
this.stream, this.stream,
this.environment, this.environment,
this.npm); this.npm);
public repositoryManager: RepositoryManager = new RepositoryManager( public repositoryManager: RepositoryManager = new RepositoryManager(
this.environment, this.environment,
this.pluginManager, this.pluginManager,