Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@slack/cli-test

Package Overview
Dependencies
Maintainers
10
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@slack/cli-test - npm Package Compare versions

Comparing version 0.0.2-cli.2.24.0 to 0.1.0-cli.2.25.0

dist/cli/index.spec.d.ts

7

dist/cli/commands/app.d.ts

@@ -17,2 +17,8 @@ /**

export declare const install: (appPath: string, teamFlag: string) => Promise<string>;
/**
* `slack app list`
* @param appPath path to app
* @returns command output
*/
export declare const list: (appPath: string) => Promise<string>;
declare const _default: {

@@ -23,4 +29,5 @@ workspaceDelete: (appPath: string, teamFlag: string, options?: {

workspaceInstall: (appPath: string, teamFlag: string) => Promise<string>;
workspaceList: (appPath: string) => Promise<string>;
};
export default _default;
//# sourceMappingURL=app.d.ts.map

24

dist/cli/commands/app.js

@@ -15,3 +15,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.install = exports.del = void 0;
exports.list = exports.install = exports.del = void 0;
const cli_process_1 = require("../cli-process");

@@ -66,2 +66,23 @@ const command_error_1 = __importDefault(require("../command-error"));

exports.install = install;
/**
* `slack app list`
* @param appPath path to app
* @returns command output
*/
const list = function appList(appPath) {
return __awaiter(this, void 0, void 0, function* () {
// TODO: (breaking change) separate parameters vs single-param-object
const cmd = new cli_process_1.SlackCLIProcess('app list');
try {
const proc = yield cmd.execAsync({
cwd: appPath,
});
return proc.output;
}
catch (error) {
throw (0, command_error_1.default)(error, 'appList');
}
});
};
exports.list = list;
// TODO: (breaking change): rename properties of this default export to match actual command names

@@ -71,3 +92,4 @@ exports.default = {

workspaceInstall: exports.install,
workspaceList: exports.list,
};
//# sourceMappingURL=app.js.map

29

dist/cli/commands/platform.js

@@ -15,3 +15,2 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const tree_kill_1 = __importDefault(require("tree-kill"));
const logger_1 = __importDefault(require("../../utils/logger"));

@@ -80,11 +79,8 @@ const cli_process_1 = require("../cli-process");

// kill the shell process
(0, tree_kill_1.default)(proc.process.pid, (err) => {
if (err) {
const msg = `activityTailStop command failed to kill process: ${err}`;
logger_1.default.warn(msg);
reject(new Error(msg));
}
else {
resolve(proc.output);
}
shell_1.shell.kill(proc).then(() => {
resolve(proc.output);
}, (err) => {
const msg = `activityTailStop command failed to kill process: ${err}`;
logger_1.default.warn(msg);
reject(new Error(msg));
});

@@ -148,9 +144,4 @@ }, reject);

// kill the shell process
(0, tree_kill_1.default)(proc.process.pid, (err) => {
if (err) {
const msg = `runStop command failed to kill process: ${err}`;
logger_1.default.warn(msg);
reject(new Error(msg));
}
else if (teamName) {
shell_1.shell.kill(proc).then(() => {
if (teamName) {
// TODO: this is messed up. does not match to parameter name at all - team name has nothing to do with this.

@@ -164,2 +155,6 @@ // Check if local app was deleted automatically, if --cleanup was passed to `runStart`

}
}, (err) => {
const msg = `runStop command failed to kill process: ${err}`;
logger_1.default.warn(msg);
reject(new Error(msg));
});

@@ -166,0 +161,0 @@ });

@@ -30,3 +30,3 @@ /// <reference types="node" />

appPath?: string | undefined;
/** Team domain where app is installed */
/** Team domain or ID where app is installed */
appTeamID: string;

@@ -180,2 +180,3 @@ isLocalApp?: boolean | undefined;

install: (appPath: string, teamFlag: string) => Promise<string>;
list: (appPath: string) => Promise<string>;
};

@@ -186,3 +187,4 @@ workspaceDelete: (appPath: string, teamFlag: string, options?: {

workspaceInstall: (appPath: string, teamFlag: string) => Promise<string>;
workspaceList: (appPath: string) => Promise<string>;
};
//# sourceMappingURL=index.d.ts.map

@@ -52,3 +52,2 @@ "use strict";

const trigger_1 = __importDefault(require("./commands/trigger"));
const cli_process_1 = require("./cli-process");
/**

@@ -60,2 +59,3 @@ * Set of functions to spawn and interact with Slack Platform CLI processes and commands

install: app_1.default.workspaceInstall,
list: app_1.default.workspaceList,
} }), auth_1.default), { auth: auth_1.default }), collaborator_1.default), { collaborators: {

@@ -89,4 +89,3 @@ add: collaborator_1.default.collaboratorsAdd,

// List instances of app installation if app path provided
const cmd = new cli_process_1.SlackCLIProcess('workspace list');
const { output: installedAppsOutput } = yield cmd.execAsync({ cwd: appPath });
const installedAppsOutput = yield exports.SlackCLI.app.list(appPath);
// If app is installed

@@ -99,3 +98,3 @@ if (!installedAppsOutput.includes('This project has no apps')) {

catch (error) {
logger_1.default.info(`Could not delete gracefully. Error: ${error}`);
logger_1.default.warn(`stopSession could not delete app gracefully, continuing. Error: ${error}`);
}

@@ -115,3 +114,3 @@ // Delete app.json file. Needed for retries. Otherwise asks for collaborator, if old file is present

// TODO: maybe should error instead? this seems pretty bad
logger_1.default.info(`Could not logout gracefully. Error: ${error}`);
logger_1.default.warn(`Could not logout gracefully. Error: ${error}`);
}

@@ -118,0 +117,0 @@ });

@@ -1,2 +0,2 @@

import * as child from 'child_process';
import child from 'child_process';
import type { ShellProcess } from '../utils/types';

@@ -45,3 +45,4 @@ export declare const shell: {

assembleShellEnv: () => Record<string, string | undefined>;
kill: (proc: ShellProcess) => Promise<boolean>;
};
//# sourceMappingURL=shell.d.ts.map
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -39,3 +16,3 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

exports.shell = void 0;
const child = __importStar(require("child_process"));
const child_process_1 = __importDefault(require("child_process"));
const tree_kill_1 = __importDefault(require("tree-kill"));

@@ -56,3 +33,3 @@ const logger_1 = __importDefault(require("../utils/logger"));

// Start child process
const childProcess = child.spawn(`${command}`, Object.assign({ shell: true, env: exports.shell.assembleShellEnv() }, shellOpts));
const childProcess = child_process_1.default.spawn(`${command}`, Object.assign({ shell: true, env: exports.shell.assembleShellEnv() }, shellOpts));
// Set shell object

@@ -88,3 +65,3 @@ const sh = {

catch (error) {
throw new Error(`runCommandAsync\nFailed to run command.\nCommand: ${command}`);
throw new Error(`spawnProcess failed!\nCommand: ${command}\nError: ${error}`);
}

@@ -105,3 +82,3 @@ },

// Start child process
const result = child.spawnSync(`${command}`, Object.assign({ shell: true, env: exports.shell.assembleShellEnv() }, shellOpts));
const result = child_process_1.default.spawnSync(`${command}`, Object.assign({ shell: true, env: exports.shell.assembleShellEnv() }, shellOpts));
// Log command

@@ -113,3 +90,3 @@ logger_1.default.info(`CLI Command finished: ${command}`);

catch (error) {
throw new Error(`runCommandSync\nFailed to run command.\nCommand: ${command}`);
throw new Error(`runCommandSync failed!\nCommand: ${command}\nError: ${error}`);
}

@@ -128,8 +105,6 @@ },

const killIt = (reason) => {
(0, tree_kill_1.default)(proc.process.pid, (err) => {
let msg = `${reason}\nCommand: ${proc.command}\nOutput: \n${proc.output}`;
if (err) {
msg += `\nAdditionally, further attempting to kill the process errored with ${err.message}`;
}
reject(new Error(msg));
exports.shell.kill(proc).then(() => {
reject(new Error(`${reason}\nCommand: ${proc.command}, output: ${proc.output}`));
}, (err) => {
reject(new Error(`${reason}\nCommand: ${proc.command}, output: ${proc.output}\nAlso errored killing process: ${err.message}`));
});

@@ -146,3 +121,3 @@ };

logger_1.default.error(`CLI Command "${proc.command}" errored with ${err}`);
killIt('Command raised an error!');
killIt(`Command raised an error: ${err.message}`);
};

@@ -201,8 +176,7 @@ // Timeout the process if necessary

// Kill the process
(0, tree_kill_1.default)(proc.process.pid, (err) => {
let msg = `shell.waitForOutput timed out after ${waitedFor} ms. \nExpected output to include: ${expString}\nActual: ${proc.output}`;
if (err) {
msg += `\nAdditionally, killing the process errored with ${err.message}`;
}
reject(new Error(msg));
const reason = `shell.waitForOutput timed out after ${waitedFor} ms. \nExpected output to include: ${expString}\nActual: ${proc.output}`;
exports.shell.kill(proc).then(() => {
reject(new Error(`${reason}\nCommand: ${proc.command}, output: ${proc.output}`));
}, (err) => {
reject(new Error(`${reason}\nCommand: ${proc.command}, output: ${proc.output}\nAlso errored killing process: ${err.message}`));
});

@@ -226,3 +200,17 @@ }

},
kill: function kill(proc) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => {
(0, tree_kill_1.default)(proc.process.pid, (err) => {
if (err) {
reject(new Error(`Failed to kill command "${proc.command}": errored with ${err.message}\nOutput: ${proc.output}`));
}
else {
resolve(true);
}
});
});
});
},
};
//# sourceMappingURL=shell.js.map

@@ -21,2 +21,5 @@ /**

SLACK_TRACE_CREATE_SUCCESS: string;
SLACK_TRACE_DATASTORE_COUNT_DATASTORE: string;
SLACK_TRACE_DATASTORE_COUNT_SUCCESS: string;
SLACK_TRACE_DATASTORE_COUNT_TOTAL: string;
SLACK_TRACE_CREATE_TEMPLATE_OPTIONS: string;

@@ -23,0 +26,0 @@ SLACK_TRACE_FEEDBACK_MESSAGE: string;

@@ -24,2 +24,5 @@ "use strict";

SLACK_TRACE_CREATE_SUCCESS: 'SLACK_TRACE_CREATE_SUCCESS',
SLACK_TRACE_DATASTORE_COUNT_DATASTORE: 'SLACK_TRACE_DATASTORE_COUNT_DATASTORE',
SLACK_TRACE_DATASTORE_COUNT_SUCCESS: 'SLACK_TRACE_DATASTORE_COUNT_SUCCESS',
SLACK_TRACE_DATASTORE_COUNT_TOTAL: 'SLACK_TRACE_DATASTORE_COUNT_TOTAL',
SLACK_TRACE_CREATE_TEMPLATE_OPTIONS: 'SLACK_TRACE_CREATE_TEMPLATE_OPTIONS',

@@ -26,0 +29,0 @@ SLACK_TRACE_FEEDBACK_MESSAGE: 'SLACK_TRACE_FEEDBACK_MESSAGE',

{
"name": "@slack/cli-test",
"version": "0.0.2-cli.2.24.0",
"version": "0.1.0-cli.2.25.0",
"description": "Node.js bindings for the Slack CLI for use in automated testing",

@@ -5,0 +5,0 @@ "author": "Salesforce, Inc.",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc