• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

rokucommunity / ropm / #874

23 Jan 2024 06:13PM UTC coverage: 89.291%. Remained the same
#874

push

GitHub
Merge 741ad53e2 into 803e66631

517 of 626 branches covered (0.0%)

Branch coverage included in aggregate %.

642 of 672 relevant lines covered (95.54%)

66.73 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

81.48
/src/commands/UninstallCommand.ts
1
import { util } from '../util';
1✔
2
import * as path from 'path';
1✔
3
import { InstallCommand } from './InstallCommand';
1✔
4

5
export class UninstallCommand {
1✔
6
    constructor(
7
        public args: UninstallCommandArgs
1✔
8
    ) {
9

10
    }
11

12
    private get cwd() {
13
        if (this.args?.cwd) {
2!
14
            return path.resolve(process.cwd(), this.args?.cwd);
2!
15
        } else {
16
            return process.cwd();
×
17
        }
18
    }
19

20
    public async run(): Promise<void> {
21
        await this.npmUninstall();
1✔
22
        //after uninstalling the specified packages, we need to run an install again. it's easier than tracking down what files to remove directly
23
        await this.npmInstall();
1✔
24
    }
25

26
    private async npmUninstall() {
27
        await util.spawnNpmAsync([
1✔
28
            'uninstall',
29
            ...(this.args.packages ?? [])
3!
30
        ], {
31
            cwd: this.cwd
32
        });
33
    }
34

35
    /**
36
     * Should be run after an uninstall
37
     */
38
    private async npmInstall() {
39
        const installCommand = new InstallCommand({
1✔
40
            cwd: this.cwd,
41
            packages: []
42
        });
43
        await installCommand.run();
1✔
44
    }
45
}
46

47
export interface UninstallCommandArgs {
48
    /**
49
     * The current working directory for the command.
50
     */
51
    cwd?: string;
52
    /**
53
     * The list of packages that should be uninstalled
54
     */
55
    packages: string[];
56
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc