Skip to content

Commit 6669cb6

Browse files
committed
Refactor and minor fixes for the FileSystem refactor.
1 parent 4344ef8 commit 6669cb6

15 files changed

Lines changed: 32 additions & 35 deletions

File tree

‎apps/api-documenter/package.json‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,10 @@
1919
"@microsoft/node-core-library": "1.4.1",
2020
"@microsoft/ts-command-line": "4.2.0",
2121
"colors": "~1.2.1",
22-
"fs-extra": "~5.0.0",
2322
"js-yaml": "~3.9.1"
2423
},
2524
"devDependencies": {
2625
"@microsoft/node-library-build": "4.3.47",
27-
"@types/fs-extra": "5.0.1",
2826
"@types/js-yaml": "3.9.1",
2927
"@types/node": "8.5.8",
3028
"gulp": "~3.9.1",

‎apps/api-extractor/package.json‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,9 @@
3333
"dependencies": {
3434
"@microsoft/node-core-library": "1.4.1",
3535
"@microsoft/ts-command-line": "4.2.0",
36-
"@types/fs-extra": "5.0.1",
3736
"@types/node": "8.5.8",
3837
"@types/z-schema": "3.16.31",
3938
"colors": "~1.2.1",
40-
"fs-extra": "~5.0.0",
4139
"jju": "~1.3.0",
4240
"lodash": "~4.15.0",
4341
"typescript": "~2.4.1",

‎apps/api-extractor/src/ExternalApiHelper.ts‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@ export class ExternalApiHelper {
3838
rootDir: entryPointFolder
3939
};
4040

41-
let outputPath: string = path.resolve(rootDir, libFolder);
42-
FileSystem.ensureFolder(outputPath);
43-
44-
outputPath = path.join(outputPath, 'external-api-json');
41+
const outputPath: string = path.resolve(rootDir, libFolder, 'external-api-json');
4542
FileSystem.ensureFolder(outputPath);
4643

4744
const extractor: Extractor = new Extractor({

‎apps/rush-lib/package.json‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
"@pnpm/logger": "~1.0.1",
3030
"builtins": "~1.0.3",
3131
"colors": "~1.2.1",
32-
"fs-extra": "~5.0.0",
3332
"git-repo-info": "~1.1.4",
3433
"glob": "~7.0.5",
3534
"glob-escape": "~0.0.1",
@@ -51,7 +50,6 @@
5150
},
5251
"devDependencies": {
5352
"@microsoft/node-library-build": "4.3.47",
54-
"@types/fs-extra": "5.0.1",
5553
"@types/node": "8.5.8",
5654
"@types/node-fetch": "1.6.9",
5755
"@types/tar": "4.0.0",

‎apps/rush-lib/src/api/ChangeFile.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
import * as path from 'path';
55
import gitInfo = require('git-repo-info');
66

7+
import { JsonFile } from '@microsoft/node-core-library';
8+
79
import { RushConfiguration } from './RushConfiguration';
810
import {
911
IChangeFile,
1012
IChangeInfo
1113
} from './ChangeManagement';
12-
import { JsonFile } from '@microsoft/node-core-library';
1314

1415
/**
1516
* This class represents a single change file.

‎apps/rush-lib/src/logic/InstallManager.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,7 @@ export class InstallManager {
303303
packageManagerMarker.create();
304304

305305
// Example: "C:\MyRepo\common\temp"
306-
if (!FileSystem.exists(this._rushConfiguration.commonTempFolder)) {
307-
FileSystem.ensureFolder(this._rushConfiguration.commonTempFolder);
308-
}
306+
FileSystem.ensureFolder(this._rushConfiguration.commonTempFolder);
309307

310308
// Example: "C:\MyRepo\common\temp\pnpm-local"
311309
const localPackageManagerToolFolder: string =

‎apps/rush-lib/src/logic/taskRunner/ProjectTask.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,7 @@ export class ProjectTask implements ITaskDefinition {
125125
return Promise.resolve(TaskStatus.Skipped);
126126
} else {
127127
// If the deps file exists, remove it before starting a build.
128-
if (FileSystem.exists(currentDepsPath)) {
129-
FileSystem.deleteFile(currentDepsPath);
130-
}
128+
FileSystem.deleteFile(currentDepsPath);
131129

132130
if (!taskCommand) {
133131
// tslint:disable-next-line:max-line-length

‎apps/rush/package.json‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,11 @@
3434
"@microsoft/node-core-library": "1.4.1",
3535
"@microsoft/rush-lib": "5.0.0",
3636
"colors": "~1.2.1",
37-
"fs-extra": "~5.0.0",
3837
"semver": "~5.3.0"
3938
},
4039
"devDependencies": {
4140
"@microsoft/node-library-build": "4.3.47",
4241
"@types/chai": "3.4.34",
43-
"@types/fs-extra": "5.0.1",
4442
"@types/mocha": "2.2.38",
4543
"@types/node": "8.5.8",
4644
"@types/semver": "5.3.33",

‎common/reviews/api/node-core-library.api.ts‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ class FileDiffTest {
1212

1313
// @public
1414
class FileSystem {
15-
// WARNING: The type "IFileModeBits" needs to be exported by the package (e.g. added to index.ts)
1615
static changePermissionBits(path: string, mode: IFileModeBits): void;
1716
static copyFile(sourcePath: string, destinationPath: string): void;
1817
static createHardLink(linkTarget: string, linkSource: string): void;
@@ -31,7 +30,6 @@ class FileSystem {
3130
static readFile(filePath: string, options?: IReadFileOptions): string;
3231
static readFileToBuffer(filePath: string): Buffer;
3332
static readFolder(folderPath: string, options?: IReadFolderOptions): Array<string>;
34-
// WARNING: The type "IUpdateTimeParameters" needs to be exported by the package (e.g. added to index.ts)
3533
static updateTimes(path: string, times: IUpdateTimeParameters): void;
3634
static writeFile(filePath: string, contents: string | Buffer, options?: IWriteFileOptions): void;
3735
}
@@ -54,6 +52,16 @@ interface IDeleteFileOptions {
5452
throwIfNotExists?: boolean;
5553
}
5654

55+
// @public
56+
interface IFileModeBits {
57+
// (undocumented)
58+
Group: PermissionsBits;
59+
// (undocumented)
60+
Other: PermissionsBits;
61+
// (undocumented)
62+
Owner: PermissionsBits;
63+
}
64+
5765
// @public
5866
interface IFileSystemMoveOptions {
5967
ensureFolderExists?: boolean;
@@ -162,6 +170,12 @@ interface IReadFolderOptions {
162170
absolutePaths?: boolean;
163171
}
164172

173+
// @public
174+
interface IUpdateTimeParameters {
175+
accessedTime: number | Date;
176+
modifiedTime: number | Date;
177+
}
178+
165179
// @public
166180
interface IWriteFileOptions {
167181
convertLineEndings?: NewlineKind;

‎core-build/gulp-core-build-serve/src/CertificateStore.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,7 @@ export class CertificateStore {
8282
}
8383

8484
this._gcbServeDataPath = path.join(this._userProfilePath, '.gcb-serve-data');
85-
if (!FileSystem.exists(this._gcbServeDataPath)) {
86-
FileSystem.ensureFolder(this._gcbServeDataPath);
87-
}
85+
FileSystem.ensureFolder(this._gcbServeDataPath);
8886

8987
this._certificatePath = path.join(this._gcbServeDataPath, 'gcb-serve.cer');
9088
this._keyPath = path.join(this._gcbServeDataPath, 'gcb-serve.key');

0 commit comments

Comments
 (0)