Skip to content

Commit c996a38

Browse files
committed
refactor: code cleanup, remove unused session commands
1 parent d83acf1 commit c996a38

3 files changed

Lines changed: 9 additions & 37 deletions

File tree

src/command-parser.ts

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -171,33 +171,6 @@ function removeCollaborator(commandName: string, yargs: yargs.Argv): void {
171171
addCommonConfiguration(yargs);
172172
}
173173

174-
function sessionList(commandName: string, yargs: yargs.Argv): void {
175-
isValidCommand = true;
176-
yargs
177-
.usage(USAGE_PREFIX + " session " + commandName + " [options]")
178-
.demand(/*count*/ 0, /*max*/ 0)
179-
.example("session " + commandName, "Lists your sessions in tabular format")
180-
.example("session " + commandName + " --format json", "Lists your login sessions in JSON format")
181-
.option("format", {
182-
default: "table",
183-
demand: false,
184-
description: 'Output format to display your login sessions with ("json" or "table")',
185-
type: "string",
186-
});
187-
188-
addCommonConfiguration(yargs);
189-
}
190-
191-
function sessionRemove(commandName: string, yargs: yargs.Argv): void {
192-
isValidCommand = true;
193-
yargs
194-
.usage(USAGE_PREFIX + " session " + commandName + " <machineName>")
195-
.demand(/*count*/ 1, /*max*/ 1) // Require exactly one non-option arguments
196-
.example("session " + commandName + ' "John\'s PC"', 'Removes the existing login session from "John\'s PC"');
197-
198-
addCommonConfiguration(yargs);
199-
}
200-
201174
function deploymentHistoryClear(commandName: string, yargs: yargs.Argv): void {
202175
isValidCommand = true;
203176
yargs

src/definitions/cli.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ export enum CommandType {
3131
releaseCordova,
3232
releaseReact,
3333
rollback,
34-
sessionList,
35-
sessionRemove,
3634
whoami,
3735
}
3836

src/release-hooks/core-release.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
import fs from "fs";
22
import path from "path";
33
import recursiveFs from "recursive-fs";
4-
import slash = require("slash");
54
import yazl from "yazl";
6-
var progress = require("progress");
75

8-
import AccountManager = require("code-push");
96
import { Package, PackageInfo } from "code-push/script/types";
107
import { out } from "../util/interaction";
118
import { generateRandomFilename } from "../lib/file-utils";
129
import * as cli from "../definitions/cli";
13-
import ReleaseFile = cli.ReleaseFile;
10+
11+
import slash = require("slash");
12+
const progress = require("progress");
13+
14+
import AccountManager = require("code-push");
1415

1516
var coreReleaseHook: cli.ReleaseHook = (
1617
currentCommand: cli.IReleaseCommand,
@@ -19,7 +20,7 @@ var coreReleaseHook: cli.ReleaseHook = (
1920
): Promise<cli.IReleaseCommand> => {
2021
return Promise.resolve(<void>null)
2122
.then(() => {
22-
var releaseFiles: ReleaseFile[] = [];
23+
var releaseFiles: cli.ReleaseFile[] = [];
2324

2425
if (!fs.lstatSync(currentCommand.package).isDirectory()) {
2526
releaseFiles.push({
@@ -29,7 +30,7 @@ var coreReleaseHook: cli.ReleaseHook = (
2930
return Promise.resolve(releaseFiles);
3031
}
3132

32-
return new Promise<ReleaseFile[]>((resolve, reject) => {
33+
return new Promise<cli.ReleaseFile[]>((resolve, reject) => {
3334
var directoryPath: string = currentCommand.package;
3435
var baseDirectoryPath = path.join(directoryPath, ".."); // For legacy reasons, put the root directory in the zip
3536

@@ -53,7 +54,7 @@ var coreReleaseHook: cli.ReleaseHook = (
5354
});
5455
});
5556
})
56-
.then((releaseFiles: ReleaseFile[]) => {
57+
.then((releaseFiles: cli.ReleaseFile[]) => {
5758
return new Promise<string>((resolve, reject): void => {
5859
var packagePath: string = path.join(process.cwd(), generateRandomFilename(15) + ".zip");
5960
var zipFile = new yazl.ZipFile();
@@ -68,7 +69,7 @@ var coreReleaseHook: cli.ReleaseHook = (
6869
resolve(packagePath);
6970
});
7071

71-
releaseFiles.forEach((releaseFile: ReleaseFile) => {
72+
releaseFiles.forEach((releaseFile: cli.ReleaseFile) => {
7273
zipFile.addFile(releaseFile.sourceLocation, releaseFile.targetLocation);
7374
});
7475

0 commit comments

Comments
 (0)