Skip to content
This repository has been archived by the owner on Apr 30, 2019. It is now read-only.

reverted "reinstall" implementation. Added "--clean" switch to "reinstall" command. #198

Merged
merged 6 commits into from
Aug 16, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ node_js:

before_install:
- npm install -g grunt-cli
# Token for tsd to increase github rate limit
# See https://github.com/DefinitelyTyped/tsd#tsdrc
- p1=bb4ef6755851f && p2=9e97e89932c5a && p3=8f46a3d85e0a8c && echo {\"token\":\"$p1$p2$p3\"} > .tsdrc

env:
global:
Expand Down
2 changes: 1 addition & 1 deletion src/tsd/API.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ class API {
}).then(() => {
return this.saveBundles(res.written.values(), options);
}).then(() => {
if (!options.keepUnreferencedDefs) {
if (options.reinstallClean) {
this.core.installer.removeUnusedReferences(
this.context.config.getInstalled(), this.core.context.config.toJSON().path).then((removedList: string[]) => {
options.overwriteFiles = options.saveBundle = true;
Expand Down
4 changes: 2 additions & 2 deletions src/tsd/CLI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export function getExpose(): Expose {
job.options.overwriteFiles = ctx.getOpt(Opt.overwrite);
job.options.resolveDependencies = ctx.getOpt(Opt.resolve);
job.options.addToBundles = ctx.getOpt(Opt.bundle);
job.options.keepUnreferencedDefs = ctx.getOpt(Opt.keepUnreferenced);
job.options.reinstallClean = ctx.getOpt(Opt.reinstallClean);

if (ctx.hasOpt(Opt.cacheMode)) {
job.api.core.useCacheMode(ctx.getOpt(Opt.cacheMode));
Expand Down Expand Up @@ -561,7 +561,7 @@ export function getExpose(): Expose {
expose.defineCommand((cmd: ExposeCommand) => {
cmd.name = 'reinstall';
cmd.label = 're-install definitions from config';
cmd.options = [Opt.overwrite, Opt.save, Opt.keepUnreferenced];
cmd.options = [Opt.overwrite, Opt.save, Opt.reinstallClean];
cmd.groups = [Group.manage];
cmd.execute = (ctx: ExposeContext) => {
return executeReinstall(ctx, cmd);
Expand Down
2 changes: 1 addition & 1 deletion src/tsd/Options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Options {
overwriteFiles: boolean = false;
saveToConfig: boolean = false;
saveBundle: boolean = false;
keepUnreferencedDefs: boolean = false;
reinstallClean: boolean = false;
addToBundles: string[] = [];

static fromJSON(json: Object): Options {
Expand Down
4 changes: 2 additions & 2 deletions src/tsd/cli/addCommon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,9 @@ function addCommon(expose: Expose, print: CLIPrinter, style: StyleMap): void {
});

expose.defineOption((opt: ExposeOption) => {
opt.name = Opt.keepUnreferenced;
opt.name = Opt.reinstallClean;
opt.short = 'k';
opt.description = 'keep unreferenced typings when using reinstal command';
opt.description = 'reinstall from tsd.json and remove all unreferenced files';
opt.type = 'flag';
opt.default = false;
});
Expand Down
2 changes: 1 addition & 1 deletion src/tsd/cli/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export module Opt {
export var info = 'info';
export var history = 'history';
export var services = 'services';
export var keepUnreferenced = 'keep-unreferenced';
export var reinstallClean = 'clean';
}
objectUtils.lockPrimitives(Opt);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
reinstall --clean

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion test/nspec/cases/reinstall-keep-unreferenced/command.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
reinstall --keep-unreferenced
reinstall
2 changes: 2 additions & 0 deletions test/nspec/cases/reinstall-two-tsd-json/command.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
reinstall
--config tsd-2.json reinstall