Skip to content

Commit 6639733

Browse files
committed
Completed implementation of "rush-stack clean"
1 parent 6c180b3 commit 6639733

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
22
// See LICENSE in the project root for license information.
33

4+
import * as fsx from 'fs-extra';
5+
import * as path from 'path';
6+
47
import { BuildContext } from './BuildContext';
58

69
export class BasicTasks {
710
public static doClean(buildContext: BuildContext): void {
8-
console.log(`Project folder is: "${buildContext.projectFolder}"`);
11+
const foldersToClean: string[] = [
12+
'temp',
13+
'lib',
14+
'dist'
15+
];
16+
17+
for (const folderToClean of foldersToClean) {
18+
const fullPath: string = path.join(buildContext.projectFolder, folderToClean);
19+
console.log(`Cleaning folder: "${fullPath}"`);
20+
fsx.emptyDirSync(fullPath);
21+
}
922
}
1023
}

stack/rush-stack/src/logic/BuildContext.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,14 @@ export class BuildContext {
2727
currentWorkingDirectory = parameters.currentWorkingDirectory;
2828
}
2929
}
30+
3031
const projectFolder: string | undefined = this.packageJsonLookup
3132
.tryGetPackageFolderFor(currentWorkingDirectory);
3233
if (!projectFolder) {
3334
throw new Error('Unable to find a package.json for the current folder: ' + currentWorkingDirectory);
3435
}
36+
37+
console.log(`Project folder is: "${projectFolder}"`);
3538
this.projectFolder = projectFolder;
3639
}
3740
}

0 commit comments

Comments
 (0)