Support installing dev packages, add reply support flag
This commit is contained in:
parent
bed3cba38b
commit
c444a03884
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@squeebot/core",
|
"name": "@squeebot/core",
|
||||||
"version": "3.6.2",
|
"version": "3.6.3",
|
||||||
"description": "Squeebot v3 core for the execution environment",
|
"description": "Squeebot v3 core for the execution environment",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"types": "lib/index.d.ts",
|
"types": "lib/index.d.ts",
|
||||||
|
@ -56,8 +56,9 @@ export class NPMExecutor {
|
|||||||
/**
|
/**
|
||||||
* Install a npm package (examples: `@squeebot/core`, `@squeebot/core@3.3.3`, `node-ical`)
|
* Install a npm package (examples: `@squeebot/core`, `@squeebot/core@3.3.3`, `node-ical`)
|
||||||
* @param pkg Package name
|
* @param pkg Package name
|
||||||
|
* @param development Install as devDependency
|
||||||
*/
|
*/
|
||||||
public async installPackage(pkg: string): Promise<void> {
|
public async installPackage(pkg: string, development = false): Promise<void> {
|
||||||
if (!(await fs.pathExists(this.packageFile))) {
|
if (!(await fs.pathExists(this.packageFile))) {
|
||||||
await this.init();
|
await this.init();
|
||||||
}
|
}
|
||||||
@ -92,7 +93,7 @@ export class NPMExecutor {
|
|||||||
|
|
||||||
const { code, stderr, stdout } = await spawnProcess(
|
const { code, stderr, stdout } = await spawnProcess(
|
||||||
'npm',
|
'npm',
|
||||||
['install', pkg],
|
development ? ['install', '--save-dev', pkg] : ['install', pkg],
|
||||||
this.environment
|
this.environment
|
||||||
);
|
);
|
||||||
if (code > 0) {
|
if (code > 0) {
|
||||||
|
@ -98,4 +98,9 @@ export interface IMessage {
|
|||||||
* @param target UserTarget to mention (i.e. `msg.sender`)
|
* @param target UserTarget to mention (i.e. `msg.sender`)
|
||||||
*/
|
*/
|
||||||
mention(target: IMessageTarget): string;
|
mention(target: IMessageTarget): string;
|
||||||
|
/**
|
||||||
|
* Same as `resolve`, but replies (on supported protocols) instead.
|
||||||
|
* @param args Message data
|
||||||
|
*/
|
||||||
|
reply?(...args: any[]): void;
|
||||||
}
|
}
|
||||||
|
@ -76,6 +76,11 @@ export enum ProtocolFeatureFlag {
|
|||||||
*/
|
*/
|
||||||
MENTION,
|
MENTION,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Protocol supports replying.
|
||||||
|
*/
|
||||||
|
REPLY,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Protocol connection manages multiple "servers"
|
* Protocol connection manages multiple "servers"
|
||||||
*/
|
*/
|
||||||
|
@ -17,6 +17,7 @@ export class Service {
|
|||||||
resolve: () => {},
|
resolve: () => {},
|
||||||
reject: () => {},
|
reject: () => {},
|
||||||
mention: () => '',
|
mention: () => '',
|
||||||
|
reply: () => {},
|
||||||
data: pto,
|
data: pto,
|
||||||
source: pto,
|
source: pto,
|
||||||
text: `Protocol ${pto.fullName} running`,
|
text: `Protocol ${pto.fullName} running`,
|
||||||
|
Loading…
Reference in New Issue
Block a user