File tree Expand file tree Collapse file tree
stack/rush-stack/src/logic Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+
47import { BuildContext } from './BuildContext' ;
58
69export 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}
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments