@bemoje/fs 0.4.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +113 -0
- package/index.mjs +172 -0
- package/package.json +24 -19
- package/LICENSE +0 -21
- package/README.md +0 -34
- package/cjs/index.d.ts +0 -82
- package/cjs/index.d.ts.map +0 -1
- package/cjs/index.js +0 -85
- package/cjs/index.js.map +0 -1
- package/cjs/lib/FSPathFilter.d.ts +0 -84
- package/cjs/lib/FSPathFilter.d.ts.map +0 -1
- package/cjs/lib/FSPathFilter.js +0 -174
- package/cjs/lib/FSPathFilter.js.map +0 -1
- package/cjs/lib/appendFile.d.ts +0 -10
- package/cjs/lib/appendFile.d.ts.map +0 -1
- package/cjs/lib/appendFile.js +0 -23
- package/cjs/lib/appendFile.js.map +0 -1
- package/cjs/lib/appendFileLine.d.ts +0 -7
- package/cjs/lib/appendFileLine.d.ts.map +0 -1
- package/cjs/lib/appendFileLine.js +0 -16
- package/cjs/lib/appendFileLine.js.map +0 -1
- package/cjs/lib/appendFileLineSync.d.ts +0 -7
- package/cjs/lib/appendFileLineSync.d.ts.map +0 -1
- package/cjs/lib/appendFileLineSync.js +0 -16
- package/cjs/lib/appendFileLineSync.js.map +0 -1
- package/cjs/lib/appendFileSync.d.ts +0 -10
- package/cjs/lib/appendFileSync.d.ts.map +0 -1
- package/cjs/lib/appendFileSync.js +0 -23
- package/cjs/lib/appendFileSync.js.map +0 -1
- package/cjs/lib/createDirectory.d.ts +0 -9
- package/cjs/lib/createDirectory.d.ts.map +0 -1
- package/cjs/lib/createDirectory.js +0 -18
- package/cjs/lib/createDirectory.js.map +0 -1
- package/cjs/lib/createDirectorySync.d.ts +0 -8
- package/cjs/lib/createDirectorySync.d.ts.map +0 -1
- package/cjs/lib/createDirectorySync.js +0 -17
- package/cjs/lib/createDirectorySync.js.map +0 -1
- package/cjs/lib/emptyDirectory.d.ts +0 -17
- package/cjs/lib/emptyDirectory.d.ts.map +0 -1
- package/cjs/lib/emptyDirectory.js +0 -26
- package/cjs/lib/emptyDirectory.js.map +0 -1
- package/cjs/lib/emptyDirectorySync.d.ts +0 -17
- package/cjs/lib/emptyDirectorySync.d.ts.map +0 -1
- package/cjs/lib/emptyDirectorySync.js +0 -29
- package/cjs/lib/emptyDirectorySync.js.map +0 -1
- package/cjs/lib/getJsonIndentation.d.ts +0 -7
- package/cjs/lib/getJsonIndentation.d.ts.map +0 -1
- package/cjs/lib/getJsonIndentation.js +0 -17
- package/cjs/lib/getJsonIndentation.js.map +0 -1
- package/cjs/lib/getLastMofifiedFileIn.d.ts +0 -2
- package/cjs/lib/getLastMofifiedFileIn.d.ts.map +0 -1
- package/cjs/lib/getLastMofifiedFileIn.js +0 -20
- package/cjs/lib/getLastMofifiedFileIn.js.map +0 -1
- package/cjs/lib/promptUserEditInTextEditor.d.ts +0 -10
- package/cjs/lib/promptUserEditInTextEditor.d.ts.map +0 -1
- package/cjs/lib/promptUserEditInTextEditor.js +0 -29
- package/cjs/lib/promptUserEditInTextEditor.js.map +0 -1
- package/cjs/lib/promptUserEditInTextEditorSync.d.ts +0 -10
- package/cjs/lib/promptUserEditInTextEditorSync.d.ts.map +0 -1
- package/cjs/lib/promptUserEditInTextEditorSync.js +0 -27
- package/cjs/lib/promptUserEditInTextEditorSync.js.map +0 -1
- package/cjs/lib/promptUserEditJsonInTextEditor.d.ts +0 -13
- package/cjs/lib/promptUserEditJsonInTextEditor.d.ts.map +0 -1
- package/cjs/lib/promptUserEditJsonInTextEditor.js +0 -25
- package/cjs/lib/promptUserEditJsonInTextEditor.js.map +0 -1
- package/cjs/lib/promptUserEditJsonInTextEditorSync.d.ts +0 -13
- package/cjs/lib/promptUserEditJsonInTextEditorSync.d.ts.map +0 -1
- package/cjs/lib/promptUserEditJsonInTextEditorSync.js +0 -25
- package/cjs/lib/promptUserEditJsonInTextEditorSync.js.map +0 -1
- package/cjs/lib/readDirectoryDirents.d.ts +0 -11
- package/cjs/lib/readDirectoryDirents.d.ts.map +0 -1
- package/cjs/lib/readDirectoryDirents.js +0 -17
- package/cjs/lib/readDirectoryDirents.js.map +0 -1
- package/cjs/lib/readDirectoryDirentsPaths.d.ts +0 -14
- package/cjs/lib/readDirectoryDirentsPaths.d.ts.map +0 -1
- package/cjs/lib/readDirectoryDirentsPaths.js +0 -27
- package/cjs/lib/readDirectoryDirentsPaths.js.map +0 -1
- package/cjs/lib/readDirectoryDirentsPathsSafe.d.ts +0 -15
- package/cjs/lib/readDirectoryDirentsPathsSafe.d.ts.map +0 -1
- package/cjs/lib/readDirectoryDirentsPathsSafe.js +0 -22
- package/cjs/lib/readDirectoryDirentsPathsSafe.js.map +0 -1
- package/cjs/lib/readDirectoryDirentsPathsSafeSync.d.ts +0 -15
- package/cjs/lib/readDirectoryDirentsPathsSafeSync.d.ts.map +0 -1
- package/cjs/lib/readDirectoryDirentsPathsSafeSync.js +0 -22
- package/cjs/lib/readDirectoryDirentsPathsSafeSync.js.map +0 -1
- package/cjs/lib/readDirectoryDirentsPathsSync.d.ts +0 -14
- package/cjs/lib/readDirectoryDirentsPathsSync.d.ts.map +0 -1
- package/cjs/lib/readDirectoryDirentsPathsSync.js +0 -27
- package/cjs/lib/readDirectoryDirentsPathsSync.js.map +0 -1
- package/cjs/lib/readDirectoryDirentsSafe.d.ts +0 -12
- package/cjs/lib/readDirectoryDirentsSafe.d.ts.map +0 -1
- package/cjs/lib/readDirectoryDirentsSafe.js +0 -20
- package/cjs/lib/readDirectoryDirentsSafe.js.map +0 -1
- package/cjs/lib/readDirectoryDirentsSafeSync.d.ts +0 -12
- package/cjs/lib/readDirectoryDirentsSafeSync.d.ts.map +0 -1
- package/cjs/lib/readDirectoryDirentsSafeSync.js +0 -20
- package/cjs/lib/readDirectoryDirentsSafeSync.js.map +0 -1
- package/cjs/lib/readDirectoryDirentsSync.d.ts +0 -11
- package/cjs/lib/readDirectoryDirentsSync.d.ts.map +0 -1
- package/cjs/lib/readDirectoryDirentsSync.js +0 -17
- package/cjs/lib/readDirectoryDirentsSync.js.map +0 -1
- package/cjs/lib/readDirectoryNames.d.ts +0 -7
- package/cjs/lib/readDirectoryNames.d.ts.map +0 -1
- package/cjs/lib/readDirectoryNames.js +0 -15
- package/cjs/lib/readDirectoryNames.js.map +0 -1
- package/cjs/lib/readDirectoryNamesPaths.d.ts +0 -11
- package/cjs/lib/readDirectoryNamesPaths.d.ts.map +0 -1
- package/cjs/lib/readDirectoryNamesPaths.js +0 -24
- package/cjs/lib/readDirectoryNamesPaths.js.map +0 -1
- package/cjs/lib/readDirectoryNamesPathsSafe.d.ts +0 -12
- package/cjs/lib/readDirectoryNamesPathsSafe.d.ts.map +0 -1
- package/cjs/lib/readDirectoryNamesPathsSafe.js +0 -20
- package/cjs/lib/readDirectoryNamesPathsSafe.js.map +0 -1
- package/cjs/lib/readDirectoryNamesPathsSafeSync.d.ts +0 -12
- package/cjs/lib/readDirectoryNamesPathsSafeSync.d.ts.map +0 -1
- package/cjs/lib/readDirectoryNamesPathsSafeSync.js +0 -20
- package/cjs/lib/readDirectoryNamesPathsSafeSync.js.map +0 -1
- package/cjs/lib/readDirectoryNamesPathsSync.d.ts +0 -11
- package/cjs/lib/readDirectoryNamesPathsSync.d.ts.map +0 -1
- package/cjs/lib/readDirectoryNamesPathsSync.js +0 -24
- package/cjs/lib/readDirectoryNamesPathsSync.js.map +0 -1
- package/cjs/lib/readDirectoryNamesSafe.d.ts +0 -8
- package/cjs/lib/readDirectoryNamesSafe.d.ts.map +0 -1
- package/cjs/lib/readDirectoryNamesSafe.js +0 -18
- package/cjs/lib/readDirectoryNamesSafe.js.map +0 -1
- package/cjs/lib/readDirectoryNamesSafeSync.d.ts +0 -8
- package/cjs/lib/readDirectoryNamesSafeSync.d.ts.map +0 -1
- package/cjs/lib/readDirectoryNamesSafeSync.js +0 -18
- package/cjs/lib/readDirectoryNamesSafeSync.js.map +0 -1
- package/cjs/lib/readDirectoryNamesSync.d.ts +0 -7
- package/cjs/lib/readDirectoryNamesSync.d.ts.map +0 -1
- package/cjs/lib/readDirectoryNamesSync.js +0 -15
- package/cjs/lib/readDirectoryNamesSync.js.map +0 -1
- package/cjs/lib/readDirectoryPaths.d.ts +0 -7
- package/cjs/lib/readDirectoryPaths.d.ts.map +0 -1
- package/cjs/lib/readDirectoryPaths.js +0 -18
- package/cjs/lib/readDirectoryPaths.js.map +0 -1
- package/cjs/lib/readDirectoryPathsSafe.d.ts +0 -8
- package/cjs/lib/readDirectoryPathsSafe.d.ts.map +0 -1
- package/cjs/lib/readDirectoryPathsSafe.js +0 -19
- package/cjs/lib/readDirectoryPathsSafe.js.map +0 -1
- package/cjs/lib/readDirectoryPathsSafeSync.d.ts +0 -8
- package/cjs/lib/readDirectoryPathsSafeSync.d.ts.map +0 -1
- package/cjs/lib/readDirectoryPathsSafeSync.js +0 -19
- package/cjs/lib/readDirectoryPathsSafeSync.js.map +0 -1
- package/cjs/lib/readDirectoryPathsSync.d.ts +0 -7
- package/cjs/lib/readDirectoryPathsSync.d.ts.map +0 -1
- package/cjs/lib/readDirectoryPathsSync.js +0 -18
- package/cjs/lib/readDirectoryPathsSync.js.map +0 -1
- package/cjs/lib/readDirectoryStats.d.ts +0 -13
- package/cjs/lib/readDirectoryStats.d.ts.map +0 -1
- package/cjs/lib/readDirectoryStats.js +0 -33
- package/cjs/lib/readDirectoryStats.js.map +0 -1
- package/cjs/lib/readDirectoryStatsSafe.d.ts +0 -14
- package/cjs/lib/readDirectoryStatsSafe.d.ts.map +0 -1
- package/cjs/lib/readDirectoryStatsSafe.js +0 -20
- package/cjs/lib/readDirectoryStatsSafe.js.map +0 -1
- package/cjs/lib/readDirectoryStatsSafeSync.d.ts +0 -14
- package/cjs/lib/readDirectoryStatsSafeSync.d.ts.map +0 -1
- package/cjs/lib/readDirectoryStatsSafeSync.js +0 -20
- package/cjs/lib/readDirectoryStatsSafeSync.js.map +0 -1
- package/cjs/lib/readDirectoryStatsSync.d.ts +0 -13
- package/cjs/lib/readDirectoryStatsSync.d.ts.map +0 -1
- package/cjs/lib/readDirectoryStatsSync.js +0 -32
- package/cjs/lib/readDirectoryStatsSync.js.map +0 -1
- package/cjs/lib/readFile.d.ts +0 -22
- package/cjs/lib/readFile.d.ts.map +0 -1
- package/cjs/lib/readFile.js +0 -21
- package/cjs/lib/readFile.js.map +0 -1
- package/cjs/lib/readFileBuffer.d.ts +0 -20
- package/cjs/lib/readFileBuffer.d.ts.map +0 -1
- package/cjs/lib/readFileBuffer.js +0 -20
- package/cjs/lib/readFileBuffer.js.map +0 -1
- package/cjs/lib/readFileBufferSafe.d.ts +0 -12
- package/cjs/lib/readFileBufferSafe.d.ts.map +0 -1
- package/cjs/lib/readFileBufferSafe.js +0 -24
- package/cjs/lib/readFileBufferSafe.js.map +0 -1
- package/cjs/lib/readFileBufferSafeSync.d.ts +0 -12
- package/cjs/lib/readFileBufferSafeSync.d.ts.map +0 -1
- package/cjs/lib/readFileBufferSafeSync.js +0 -24
- package/cjs/lib/readFileBufferSafeSync.js.map +0 -1
- package/cjs/lib/readFileBufferSync.d.ts +0 -10
- package/cjs/lib/readFileBufferSync.d.ts.map +0 -1
- package/cjs/lib/readFileBufferSync.js +0 -17
- package/cjs/lib/readFileBufferSync.js.map +0 -1
- package/cjs/lib/readFileFirstLine.d.ts +0 -5
- package/cjs/lib/readFileFirstLine.d.ts.map +0 -1
- package/cjs/lib/readFileFirstLine.js +0 -21
- package/cjs/lib/readFileFirstLine.js.map +0 -1
- package/cjs/lib/readFileSafe.d.ts +0 -14
- package/cjs/lib/readFileSafe.d.ts.map +0 -1
- package/cjs/lib/readFileSafe.js +0 -26
- package/cjs/lib/readFileSafe.js.map +0 -1
- package/cjs/lib/readFileSafeSync.d.ts +0 -14
- package/cjs/lib/readFileSafeSync.d.ts.map +0 -1
- package/cjs/lib/readFileSafeSync.js +0 -26
- package/cjs/lib/readFileSafeSync.js.map +0 -1
- package/cjs/lib/readFileSync.d.ts +0 -11
- package/cjs/lib/readFileSync.d.ts.map +0 -1
- package/cjs/lib/readFileSync.js +0 -18
- package/cjs/lib/readFileSync.js.map +0 -1
- package/cjs/lib/readJsonFile.d.ts +0 -2
- package/cjs/lib/readJsonFile.d.ts.map +0 -1
- package/cjs/lib/readJsonFile.js +0 -6
- package/cjs/lib/readJsonFile.js.map +0 -1
- package/cjs/lib/readJsonFileSafe.d.ts +0 -10
- package/cjs/lib/readJsonFileSafe.d.ts.map +0 -1
- package/cjs/lib/readJsonFileSafe.js +0 -22
- package/cjs/lib/readJsonFileSafe.js.map +0 -1
- package/cjs/lib/readJsonFileSafeSync.d.ts +0 -10
- package/cjs/lib/readJsonFileSafeSync.d.ts.map +0 -1
- package/cjs/lib/readJsonFileSafeSync.js +0 -22
- package/cjs/lib/readJsonFileSafeSync.js.map +0 -1
- package/cjs/lib/readJsonFileSync.d.ts +0 -2
- package/cjs/lib/readJsonFileSync.d.ts.map +0 -1
- package/cjs/lib/readJsonFileSync.js +0 -6
- package/cjs/lib/readJsonFileSync.js.map +0 -1
- package/cjs/lib/removeDirectory.d.ts +0 -2
- package/cjs/lib/removeDirectory.d.ts.map +0 -1
- package/cjs/lib/removeDirectory.js +0 -6
- package/cjs/lib/removeDirectory.js.map +0 -1
- package/cjs/lib/removeDirectorySync.d.ts +0 -2
- package/cjs/lib/removeDirectorySync.d.ts.map +0 -1
- package/cjs/lib/removeDirectorySync.js +0 -6
- package/cjs/lib/removeDirectorySync.js.map +0 -1
- package/cjs/lib/removeFile.d.ts +0 -2
- package/cjs/lib/removeFile.d.ts.map +0 -1
- package/cjs/lib/removeFile.js +0 -6
- package/cjs/lib/removeFile.js.map +0 -1
- package/cjs/lib/removeFileSync.d.ts +0 -2
- package/cjs/lib/removeFileSync.d.ts.map +0 -1
- package/cjs/lib/removeFileSync.js +0 -6
- package/cjs/lib/removeFileSync.js.map +0 -1
- package/cjs/lib/tempFile.d.ts +0 -7
- package/cjs/lib/tempFile.d.ts.map +0 -1
- package/cjs/lib/tempFile.js +0 -27
- package/cjs/lib/tempFile.js.map +0 -1
- package/cjs/lib/tempFileSync.d.ts +0 -7
- package/cjs/lib/tempFileSync.d.ts.map +0 -1
- package/cjs/lib/tempFileSync.js +0 -27
- package/cjs/lib/tempFileSync.js.map +0 -1
- package/cjs/lib/types/IGetUserInputFromEditorOptions.d.ts +0 -16
- package/cjs/lib/types/IGetUserInputFromEditorOptions.d.ts.map +0 -1
- package/cjs/lib/types/IGetUserInputFromEditorOptions.js +0 -3
- package/cjs/lib/types/IGetUserInputFromEditorOptions.js.map +0 -1
- package/cjs/lib/types/IJFReadOptions.d.ts +0 -2
- package/cjs/lib/types/IJFReadOptions.d.ts.map +0 -1
- package/cjs/lib/types/IJFReadOptions.js +0 -3
- package/cjs/lib/types/IJFReadOptions.js.map +0 -1
- package/cjs/lib/types/IJFWriteOptions.d.ts +0 -2
- package/cjs/lib/types/IJFWriteOptions.d.ts.map +0 -1
- package/cjs/lib/types/IJFWriteOptions.js +0 -3
- package/cjs/lib/types/IJFWriteOptions.js.map +0 -1
- package/cjs/lib/types/IJsonOutputOptions.d.ts +0 -2
- package/cjs/lib/types/IJsonOutputOptions.d.ts.map +0 -1
- package/cjs/lib/types/IJsonOutputOptions.js +0 -3
- package/cjs/lib/types/IJsonOutputOptions.js.map +0 -1
- package/cjs/lib/types/ILogFileData.d.ts +0 -6
- package/cjs/lib/types/ILogFileData.d.ts.map +0 -1
- package/cjs/lib/types/ILogFileData.js +0 -3
- package/cjs/lib/types/ILogFileData.js.map +0 -1
- package/cjs/lib/types/IReadJsonFileOptions.d.ts +0 -2
- package/cjs/lib/types/IReadJsonFileOptions.d.ts.map +0 -1
- package/cjs/lib/types/IReadJsonFileOptions.js +0 -3
- package/cjs/lib/types/IReadJsonFileOptions.js.map +0 -1
- package/cjs/lib/types/JsonReplacerReviver.d.ts +0 -2
- package/cjs/lib/types/JsonReplacerReviver.d.ts.map +0 -1
- package/cjs/lib/types/JsonReplacerReviver.js +0 -3
- package/cjs/lib/types/JsonReplacerReviver.js.map +0 -1
- package/cjs/lib/updateFile.d.ts +0 -11
- package/cjs/lib/updateFile.d.ts.map +0 -1
- package/cjs/lib/updateFile.js +0 -20
- package/cjs/lib/updateFile.js.map +0 -1
- package/cjs/lib/updateFileSafe.d.ts +0 -13
- package/cjs/lib/updateFileSafe.d.ts.map +0 -1
- package/cjs/lib/updateFileSafe.js +0 -28
- package/cjs/lib/updateFileSafe.js.map +0 -1
- package/cjs/lib/updateFileSafeSync.d.ts +0 -13
- package/cjs/lib/updateFileSafeSync.d.ts.map +0 -1
- package/cjs/lib/updateFileSafeSync.js +0 -28
- package/cjs/lib/updateFileSafeSync.js.map +0 -1
- package/cjs/lib/updateFileSync.d.ts +0 -11
- package/cjs/lib/updateFileSync.d.ts.map +0 -1
- package/cjs/lib/updateFileSync.js +0 -20
- package/cjs/lib/updateFileSync.js.map +0 -1
- package/cjs/lib/updateJsonFile.d.ts +0 -15
- package/cjs/lib/updateJsonFile.d.ts.map +0 -1
- package/cjs/lib/updateJsonFile.js +0 -20
- package/cjs/lib/updateJsonFile.js.map +0 -1
- package/cjs/lib/updateJsonFileSafe.d.ts +0 -17
- package/cjs/lib/updateJsonFileSafe.d.ts.map +0 -1
- package/cjs/lib/updateJsonFileSafe.js +0 -28
- package/cjs/lib/updateJsonFileSafe.js.map +0 -1
- package/cjs/lib/updateJsonFileSafeSync.d.ts +0 -17
- package/cjs/lib/updateJsonFileSafeSync.d.ts.map +0 -1
- package/cjs/lib/updateJsonFileSafeSync.js +0 -28
- package/cjs/lib/updateJsonFileSafeSync.js.map +0 -1
- package/cjs/lib/updateJsonFileSync.d.ts +0 -15
- package/cjs/lib/updateJsonFileSync.d.ts.map +0 -1
- package/cjs/lib/updateJsonFileSync.js +0 -20
- package/cjs/lib/updateJsonFileSync.js.map +0 -1
- package/cjs/lib/writeFile.d.ts +0 -2
- package/cjs/lib/writeFile.d.ts.map +0 -1
- package/cjs/lib/writeFile.js +0 -6
- package/cjs/lib/writeFile.js.map +0 -1
- package/cjs/lib/writeFileSafe.d.ts +0 -2
- package/cjs/lib/writeFileSafe.d.ts.map +0 -1
- package/cjs/lib/writeFileSafe.js +0 -6
- package/cjs/lib/writeFileSafe.js.map +0 -1
- package/cjs/lib/writeFileSafeSync.d.ts +0 -2
- package/cjs/lib/writeFileSafeSync.d.ts.map +0 -1
- package/cjs/lib/writeFileSafeSync.js +0 -6
- package/cjs/lib/writeFileSafeSync.js.map +0 -1
- package/cjs/lib/writeFileSync.d.ts +0 -2
- package/cjs/lib/writeFileSync.d.ts.map +0 -1
- package/cjs/lib/writeFileSync.js +0 -6
- package/cjs/lib/writeFileSync.js.map +0 -1
- package/cjs/lib/writeJsonFile.d.ts +0 -2
- package/cjs/lib/writeJsonFile.d.ts.map +0 -1
- package/cjs/lib/writeJsonFile.js +0 -6
- package/cjs/lib/writeJsonFile.js.map +0 -1
- package/cjs/lib/writeJsonFileSafe.d.ts +0 -2
- package/cjs/lib/writeJsonFileSafe.d.ts.map +0 -1
- package/cjs/lib/writeJsonFileSafe.js +0 -6
- package/cjs/lib/writeJsonFileSafe.js.map +0 -1
- package/cjs/lib/writeJsonFileSafeSync.d.ts +0 -2
- package/cjs/lib/writeJsonFileSafeSync.d.ts.map +0 -1
- package/cjs/lib/writeJsonFileSafeSync.js +0 -6
- package/cjs/lib/writeJsonFileSafeSync.js.map +0 -1
- package/cjs/lib/writeJsonFileSync.d.ts +0 -2
- package/cjs/lib/writeJsonFileSync.d.ts.map +0 -1
- package/cjs/lib/writeJsonFileSync.js +0 -6
- package/cjs/lib/writeJsonFileSync.js.map +0 -1
package/cjs/lib/tempFile.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.tempFile = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
6
|
-
const os_1 = tslib_1.__importDefault(require("os"));
|
|
7
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
8
|
-
/**
|
|
9
|
-
* Asyncrhonously creates a temporary file and deletes it after the callback has finished.
|
|
10
|
-
* @param fileExtension - The file extension to use for the temporary file.
|
|
11
|
-
* @param callback - The callback to execute with the temporary file path. The callback can return a promise and the temporary file will not be deleted until the promise has resolved or rejected.
|
|
12
|
-
*/
|
|
13
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
|
-
async function tempFile(fileExtension, callback) {
|
|
15
|
-
const fpath = path_1.default.join(fs_extra_1.default.realpathSync(os_1.default.tmpdir()), 'temp', Date.now() + (fileExtension.startsWith('.') ? fileExtension : '.' + fileExtension));
|
|
16
|
-
await fs_extra_1.default.ensureFile(fpath);
|
|
17
|
-
try {
|
|
18
|
-
const retval = await callback(fpath);
|
|
19
|
-
fs_extra_1.default.remove(fpath);
|
|
20
|
-
return retval;
|
|
21
|
-
}
|
|
22
|
-
catch (error) {
|
|
23
|
-
fs_extra_1.default.remove(fpath);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
exports.tempFile = tempFile;
|
|
27
|
-
//# sourceMappingURL=tempFile.js.map
|
package/cjs/lib/tempFile.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tempFile.js","sourceRoot":"","sources":["../../../../../packages/fs/src/lib/tempFile.ts"],"names":[],"mappings":";;;;AAAA,gEAAyB;AACzB,oDAAmB;AACnB,wDAAuB;AAEvB;;;;GAIG;AACH,8DAA8D;AACvD,KAAK,UAAU,QAAQ,CAAC,aAAqB,EAAE,QAA+C;IACnG,MAAM,KAAK,GAAG,cAAI,CAAC,IAAI,CACrB,kBAAE,CAAC,YAAY,CAAC,YAAE,CAAC,MAAM,EAAE,CAAC,EAC5B,MAAM,EACN,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,aAAa,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,GAAG,aAAa,CAAC,CACnF,CAAA;IACD,MAAM,kBAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;IAC1B,IAAI;QACF,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,CAAA;QACpC,kBAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QAChB,OAAO,MAAM,CAAA;KACd;IAAC,OAAO,KAAK,EAAE;QACd,kBAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;KACjB;AACH,CAAC;AAdD,4BAcC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Syncrhonously creates a temporary file and deletes it after the callback has finished.
|
|
3
|
-
* @param fileExtension - The file extension to use for the temporary file.
|
|
4
|
-
* @param callback - The callback to execute with the temporary file path. The callback can return a promise and the temporary file will not be deleted until the promise has resolved or rejected.
|
|
5
|
-
*/
|
|
6
|
-
export declare function tempFileSync(fileExtension: string, callback: (fpath: string) => any): any;
|
|
7
|
-
//# sourceMappingURL=tempFileSync.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tempFileSync.d.ts","sourceRoot":"","sources":["../../../../../packages/fs/src/lib/tempFileSync.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AAEH,wBAAgB,YAAY,CAAC,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,GAAG,OAcnF"}
|
package/cjs/lib/tempFileSync.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.tempFileSync = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
6
|
-
const os_1 = tslib_1.__importDefault(require("os"));
|
|
7
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
8
|
-
/**
|
|
9
|
-
* Syncrhonously creates a temporary file and deletes it after the callback has finished.
|
|
10
|
-
* @param fileExtension - The file extension to use for the temporary file.
|
|
11
|
-
* @param callback - The callback to execute with the temporary file path. The callback can return a promise and the temporary file will not be deleted until the promise has resolved or rejected.
|
|
12
|
-
*/
|
|
13
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
|
-
function tempFileSync(fileExtension, callback) {
|
|
15
|
-
const fpath = path_1.default.join(fs_extra_1.default.realpathSync(os_1.default.tmpdir()), 'temp', Date.now() + (fileExtension.startsWith('.') ? fileExtension : '.' + fileExtension));
|
|
16
|
-
fs_extra_1.default.ensureFileSync(fpath);
|
|
17
|
-
try {
|
|
18
|
-
const retval = callback(fpath);
|
|
19
|
-
fs_extra_1.default.remove(fpath);
|
|
20
|
-
return retval;
|
|
21
|
-
}
|
|
22
|
-
catch (error) {
|
|
23
|
-
fs_extra_1.default.remove(fpath);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
exports.tempFileSync = tempFileSync;
|
|
27
|
-
//# sourceMappingURL=tempFileSync.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tempFileSync.js","sourceRoot":"","sources":["../../../../../packages/fs/src/lib/tempFileSync.ts"],"names":[],"mappings":";;;;AAAA,gEAAyB;AACzB,oDAAmB;AACnB,wDAAuB;AAEvB;;;;GAIG;AACH,8DAA8D;AAC9D,SAAgB,YAAY,CAAC,aAAqB,EAAE,QAAgC;IAClF,MAAM,KAAK,GAAG,cAAI,CAAC,IAAI,CACrB,kBAAE,CAAC,YAAY,CAAC,YAAE,CAAC,MAAM,EAAE,CAAC,EAC5B,MAAM,EACN,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,aAAa,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,GAAG,aAAa,CAAC,CACnF,CAAA;IACD,kBAAE,CAAC,cAAc,CAAC,KAAK,CAAC,CAAA;IACxB,IAAI;QACF,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;QAC9B,kBAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QAChB,OAAO,MAAM,CAAA;KACd;IAAC,OAAO,KAAK,EAAE;QACd,kBAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;KACjB;AACH,CAAC;AAdD,oCAcC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export interface IGetUserInputFromEditorOptions {
|
|
2
|
-
/**
|
|
3
|
-
* The content to put in the temp file so that the user can edit it. Defaults to an empty file.
|
|
4
|
-
*/
|
|
5
|
-
content?: string;
|
|
6
|
-
/**
|
|
7
|
-
* Launch command to start your editor. Defaults to VSCode: 'code -w' (if installed).
|
|
8
|
-
* Otherwise this logic: isWindows() ? 'notepad' : isOSX() ? 'open vi' : 'xdg-open'
|
|
9
|
-
*/
|
|
10
|
-
editor?: string;
|
|
11
|
-
/**
|
|
12
|
-
* The file extension to use for the temporary file. Defaults to '.txt'.
|
|
13
|
-
*/
|
|
14
|
-
extension?: string;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=IGetUserInputFromEditorOptions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IGetUserInputFromEditorOptions.d.ts","sourceRoot":"","sources":["../../../../../../packages/fs/src/lib/types/IGetUserInputFromEditorOptions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,8BAA8B;IAC7C;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IGetUserInputFromEditorOptions.js","sourceRoot":"","sources":["../../../../../../packages/fs/src/lib/types/IGetUserInputFromEditorOptions.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IJFReadOptions.d.ts","sourceRoot":"","sources":["../../../../../../packages/fs/src/lib/types/IJFReadOptions.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,aAAa,IAAI,cAAc,EAAE,MAAM,UAAU,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IJFReadOptions.js","sourceRoot":"","sources":["../../../../../../packages/fs/src/lib/types/IJFReadOptions.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IJFWriteOptions.d.ts","sourceRoot":"","sources":["../../../../../../packages/fs/src/lib/types/IJFWriteOptions.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,IAAI,eAAe,EAAE,MAAM,UAAU,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IJFWriteOptions.js","sourceRoot":"","sources":["../../../../../../packages/fs/src/lib/types/IJFWriteOptions.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IJsonOutputOptions.d.ts","sourceRoot":"","sources":["../../../../../../packages/fs/src/lib/types/IJsonOutputOptions.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,iBAAiB,IAAI,kBAAkB,EAAE,MAAM,UAAU,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IJsonOutputOptions.js","sourceRoot":"","sources":["../../../../../../packages/fs/src/lib/types/IJsonOutputOptions.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ILogFileData.d.ts","sourceRoot":"","sources":["../../../../../../packages/fs/src/lib/types/ILogFileData.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,CAAC,CAAA;CACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ILogFileData.js","sourceRoot":"","sources":["../../../../../../packages/fs/src/lib/types/ILogFileData.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IReadJsonFileOptions.d.ts","sourceRoot":"","sources":["../../../../../../packages/fs/src/lib/types/IReadJsonFileOptions.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,aAAa,IAAI,oBAAoB,EAAE,MAAM,UAAU,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IReadJsonFileOptions.js","sourceRoot":"","sources":["../../../../../../packages/fs/src/lib/types/IReadJsonFileOptions.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JsonReplacerReviver.d.ts","sourceRoot":"","sources":["../../../../../../packages/fs/src/lib/types/JsonReplacerReviver.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,OAAO,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JsonReplacerReviver.js","sourceRoot":"","sources":["../../../../../../packages/fs/src/lib/types/JsonReplacerReviver.ts"],"names":[],"mappings":""}
|
package/cjs/lib/updateFile.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/**
|
|
3
|
-
* Updates a text file based on a provided update function.
|
|
4
|
-
* The update function takes the file's current source string as a parameter and should return a string.
|
|
5
|
-
*
|
|
6
|
-
* @param filepath - The path to the file to update.
|
|
7
|
-
* @param update - The function to update the file. Takes the current source string as a parameter and should return a string.
|
|
8
|
-
* @param encoding - The encoding to use when reading and writing the file.
|
|
9
|
-
*/
|
|
10
|
-
export declare function updateFile(filepath: string, update: (src: string) => string | Promise<string>, encoding?: BufferEncoding): Promise<void>;
|
|
11
|
-
//# sourceMappingURL=updateFile.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"updateFile.d.ts","sourceRoot":"","sources":["../../../../../packages/fs/src/lib/updateFile.ts"],"names":[],"mappings":";AAEA;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,EACjD,QAAQ,GAAE,cAAuB,GAChC,OAAO,CAAC,IAAI,CAAC,CAIf"}
|
package/cjs/lib/updateFile.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateFile = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
6
|
-
/**
|
|
7
|
-
* Updates a text file based on a provided update function.
|
|
8
|
-
* The update function takes the file's current source string as a parameter and should return a string.
|
|
9
|
-
*
|
|
10
|
-
* @param filepath - The path to the file to update.
|
|
11
|
-
* @param update - The function to update the file. Takes the current source string as a parameter and should return a string.
|
|
12
|
-
* @param encoding - The encoding to use when reading and writing the file.
|
|
13
|
-
*/
|
|
14
|
-
async function updateFile(filepath, update, encoding = 'utf8') {
|
|
15
|
-
const src = await fs_extra_1.default.readFile(filepath, encoding);
|
|
16
|
-
const retval = await update(src);
|
|
17
|
-
await fs_extra_1.default.writeFile(filepath, retval, encoding);
|
|
18
|
-
}
|
|
19
|
-
exports.updateFile = updateFile;
|
|
20
|
-
//# sourceMappingURL=updateFile.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"updateFile.js","sourceRoot":"","sources":["../../../../../packages/fs/src/lib/updateFile.ts"],"names":[],"mappings":";;;;AAAA,gEAAyB;AAEzB;;;;;;;GAOG;AACI,KAAK,UAAU,UAAU,CAC9B,QAAgB,EAChB,MAAiD,EACjD,WAA2B,MAAM;IAEjC,MAAM,GAAG,GAAG,MAAM,kBAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;IACjD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,CAAA;IAChC,MAAM,kBAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAA;AAChD,CAAC;AARD,gCAQC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/**
|
|
3
|
-
* Updates a text file based on a provided update function.
|
|
4
|
-
* The update function takes the file's current source string as a parameter and should return a string.
|
|
5
|
-
* If the file does not exist or cannot be read, the defaultContent will be used instead.
|
|
6
|
-
*
|
|
7
|
-
* @param filepath - The path to the file to update.
|
|
8
|
-
* @param update - The function to update the file. Takes the current source string as a parameter and should return a string.
|
|
9
|
-
* @param defaultContent - The default string to use if the file cannot be read.
|
|
10
|
-
* @param encoding - The encoding to use when reading and writing the file.
|
|
11
|
-
*/
|
|
12
|
-
export declare function updateFileSafe(filepath: string, update: (src: string) => string | Promise<string>, defaultContent?: string, encoding?: BufferEncoding): Promise<void>;
|
|
13
|
-
//# sourceMappingURL=updateFileSafe.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"updateFileSafe.d.ts","sourceRoot":"","sources":["../../../../../packages/fs/src/lib/updateFileSafe.ts"],"names":[],"mappings":";AAEA;;;;;;;;;GASG;AAEH,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,EACjD,cAAc,SAAK,EACnB,QAAQ,GAAE,cAAuB,GAChC,OAAO,CAAC,IAAI,CAAC,CASf"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateFileSafe = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
6
|
-
/**
|
|
7
|
-
* Updates a text file based on a provided update function.
|
|
8
|
-
* The update function takes the file's current source string as a parameter and should return a string.
|
|
9
|
-
* If the file does not exist or cannot be read, the defaultContent will be used instead.
|
|
10
|
-
*
|
|
11
|
-
* @param filepath - The path to the file to update.
|
|
12
|
-
* @param update - The function to update the file. Takes the current source string as a parameter and should return a string.
|
|
13
|
-
* @param defaultContent - The default string to use if the file cannot be read.
|
|
14
|
-
* @param encoding - The encoding to use when reading and writing the file.
|
|
15
|
-
*/
|
|
16
|
-
async function updateFileSafe(filepath, update, defaultContent = '', encoding = 'utf8') {
|
|
17
|
-
let src;
|
|
18
|
-
try {
|
|
19
|
-
src = await fs_extra_1.default.readFile(filepath, encoding);
|
|
20
|
-
}
|
|
21
|
-
catch (e) {
|
|
22
|
-
src = defaultContent;
|
|
23
|
-
}
|
|
24
|
-
const retval = await update(src);
|
|
25
|
-
await fs_extra_1.default.outputFile(filepath, retval, encoding);
|
|
26
|
-
}
|
|
27
|
-
exports.updateFileSafe = updateFileSafe;
|
|
28
|
-
//# sourceMappingURL=updateFileSafe.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"updateFileSafe.js","sourceRoot":"","sources":["../../../../../packages/fs/src/lib/updateFileSafe.ts"],"names":[],"mappings":";;;;AAAA,gEAAyB;AAEzB;;;;;;;;;GASG;AAEI,KAAK,UAAU,cAAc,CAClC,QAAgB,EAChB,MAAiD,EACjD,cAAc,GAAG,EAAE,EACnB,WAA2B,MAAM;IAEjC,IAAI,GAAW,CAAA;IACf,IAAI;QACF,GAAG,GAAG,MAAM,kBAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;KAC5C;IAAC,OAAO,CAAC,EAAE;QACV,GAAG,GAAG,cAAc,CAAA;KACrB;IACD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,CAAA;IAChC,MAAM,kBAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAA;AACjD,CAAC;AAdD,wCAcC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/**
|
|
3
|
-
* Updates a text file based on a provided update function.
|
|
4
|
-
* The update function takes the file's current source string as a parameter and should return a string.
|
|
5
|
-
* If the file does not exist or cannot be read, the defaultContent will be used instead.
|
|
6
|
-
*
|
|
7
|
-
* @param filepath - The path to the file to update.
|
|
8
|
-
* @param update - The function to update the file. Takes the current source string as a parameter and should return a string.
|
|
9
|
-
* @param defaultContent - The default string to use if the file cannot be read.
|
|
10
|
-
* @param encoding - The encoding to use when reading and writing the file.
|
|
11
|
-
*/
|
|
12
|
-
export declare function updateFileSafeSync(filepath: string, update: (src: string) => string, defaultContent?: string, encoding?: BufferEncoding): void;
|
|
13
|
-
//# sourceMappingURL=updateFileSafeSync.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"updateFileSafeSync.d.ts","sourceRoot":"","sources":["../../../../../packages/fs/src/lib/updateFileSafeSync.ts"],"names":[],"mappings":";AAEA;;;;;;;;;GASG;AAEH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,EAC/B,cAAc,SAAK,EACnB,QAAQ,GAAE,cAAuB,GAChC,IAAI,CASN"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateFileSafeSync = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
6
|
-
/**
|
|
7
|
-
* Updates a text file based on a provided update function.
|
|
8
|
-
* The update function takes the file's current source string as a parameter and should return a string.
|
|
9
|
-
* If the file does not exist or cannot be read, the defaultContent will be used instead.
|
|
10
|
-
*
|
|
11
|
-
* @param filepath - The path to the file to update.
|
|
12
|
-
* @param update - The function to update the file. Takes the current source string as a parameter and should return a string.
|
|
13
|
-
* @param defaultContent - The default string to use if the file cannot be read.
|
|
14
|
-
* @param encoding - The encoding to use when reading and writing the file.
|
|
15
|
-
*/
|
|
16
|
-
function updateFileSafeSync(filepath, update, defaultContent = '', encoding = 'utf8') {
|
|
17
|
-
let src;
|
|
18
|
-
try {
|
|
19
|
-
src = fs_extra_1.default.readFileSync(filepath, encoding);
|
|
20
|
-
}
|
|
21
|
-
catch (e) {
|
|
22
|
-
src = defaultContent;
|
|
23
|
-
}
|
|
24
|
-
const retval = update(src);
|
|
25
|
-
fs_extra_1.default.outputFileSync(filepath, retval, encoding);
|
|
26
|
-
}
|
|
27
|
-
exports.updateFileSafeSync = updateFileSafeSync;
|
|
28
|
-
//# sourceMappingURL=updateFileSafeSync.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"updateFileSafeSync.js","sourceRoot":"","sources":["../../../../../packages/fs/src/lib/updateFileSafeSync.ts"],"names":[],"mappings":";;;;AAAA,gEAAyB;AAEzB;;;;;;;;;GASG;AAEH,SAAgB,kBAAkB,CAChC,QAAgB,EAChB,MAA+B,EAC/B,cAAc,GAAG,EAAE,EACnB,WAA2B,MAAM;IAEjC,IAAI,GAAW,CAAA;IACf,IAAI;QACF,GAAG,GAAG,kBAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;KAC1C;IAAC,OAAO,CAAC,EAAE;QACV,GAAG,GAAG,cAAc,CAAA;KACrB;IACD,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;IAC1B,kBAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAA;AAC/C,CAAC;AAdD,gDAcC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/**
|
|
3
|
-
* Updates a text file based on a provided update function.
|
|
4
|
-
* The update function takes the file's current source string as a parameter and should return a string.
|
|
5
|
-
*
|
|
6
|
-
* @param filepath - The path to the file to update.
|
|
7
|
-
* @param update - The function to update the file. Takes the current source string as a parameter and should return a string.
|
|
8
|
-
* @param encoding - The encoding to use when reading and writing the file.
|
|
9
|
-
*/
|
|
10
|
-
export declare function updateFileSync(filepath: string, update: (src: string) => string, encoding?: BufferEncoding): void;
|
|
11
|
-
//# sourceMappingURL=updateFileSync.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"updateFileSync.d.ts","sourceRoot":"","sources":["../../../../../packages/fs/src/lib/updateFileSync.ts"],"names":[],"mappings":";AAEA;;;;;;;GAOG;AAEH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,EAC/B,QAAQ,GAAE,cAAuB,GAChC,IAAI,CAIN"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateFileSync = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
6
|
-
/**
|
|
7
|
-
* Updates a text file based on a provided update function.
|
|
8
|
-
* The update function takes the file's current source string as a parameter and should return a string.
|
|
9
|
-
*
|
|
10
|
-
* @param filepath - The path to the file to update.
|
|
11
|
-
* @param update - The function to update the file. Takes the current source string as a parameter and should return a string.
|
|
12
|
-
* @param encoding - The encoding to use when reading and writing the file.
|
|
13
|
-
*/
|
|
14
|
-
function updateFileSync(filepath, update, encoding = 'utf8') {
|
|
15
|
-
const src = fs_extra_1.default.readFileSync(filepath, encoding);
|
|
16
|
-
const retval = update(src);
|
|
17
|
-
fs_extra_1.default.writeFileSync(filepath, retval, encoding);
|
|
18
|
-
}
|
|
19
|
-
exports.updateFileSync = updateFileSync;
|
|
20
|
-
//# sourceMappingURL=updateFileSync.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"updateFileSync.js","sourceRoot":"","sources":["../../../../../packages/fs/src/lib/updateFileSync.ts"],"names":[],"mappings":";;;;AAAA,gEAAyB;AAEzB;;;;;;;GAOG;AAEH,SAAgB,cAAc,CAC5B,QAAgB,EAChB,MAA+B,EAC/B,WAA2B,MAAM;IAEjC,MAAM,GAAG,GAAG,kBAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;IAC/C,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;IAC1B,kBAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAA;AAC9C,CAAC;AARD,wCAQC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { IJFReadOptions } from './types/IJFReadOptions';
|
|
2
|
-
import { IJFWriteOptions } from './types/IJFWriteOptions';
|
|
3
|
-
/**
|
|
4
|
-
* Updates a JSON file based on a provided update function.
|
|
5
|
-
* The update function takes the file's current source string as a parameter and should return an object.
|
|
6
|
-
*
|
|
7
|
-
* @param filepath - The path to the file to update.
|
|
8
|
-
* @param update - The function to update the file. Takes the parsed source string as a parameter and should return a string.
|
|
9
|
-
* @param encoding - The encoding to use when reading and writing the file.
|
|
10
|
-
*/
|
|
11
|
-
export declare function updateJsonFile(filepath: string, update: (o: Record<string | number, unknown>) => Record<string | number, unknown> | Promise<Record<string | number, unknown>>, options?: {
|
|
12
|
-
read?: IJFReadOptions;
|
|
13
|
-
write?: IJFWriteOptions;
|
|
14
|
-
}): Promise<void>;
|
|
15
|
-
//# sourceMappingURL=updateJsonFile.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"updateJsonFile.d.ts","sourceRoot":"","sources":["../../../../../packages/fs/src/lib/updateJsonFile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAEzD;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,CACN,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,KAChC,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,CAAC,EACjF,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,cAAc,CAAC;IAAC,KAAK,CAAC,EAAE,eAAe,CAAA;CAAO,GAC/D,OAAO,CAAC,IAAI,CAAC,CAIf"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateJsonFile = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
6
|
-
/**
|
|
7
|
-
* Updates a JSON file based on a provided update function.
|
|
8
|
-
* The update function takes the file's current source string as a parameter and should return an object.
|
|
9
|
-
*
|
|
10
|
-
* @param filepath - The path to the file to update.
|
|
11
|
-
* @param update - The function to update the file. Takes the parsed source string as a parameter and should return a string.
|
|
12
|
-
* @param encoding - The encoding to use when reading and writing the file.
|
|
13
|
-
*/
|
|
14
|
-
async function updateJsonFile(filepath, update, options = {}) {
|
|
15
|
-
const parsed = await fs_extra_1.default.readJson(filepath, options.read);
|
|
16
|
-
const retval = await update(parsed);
|
|
17
|
-
await fs_extra_1.default.writeJson(filepath, retval, options.write || { spaces: 2 });
|
|
18
|
-
}
|
|
19
|
-
exports.updateJsonFile = updateJsonFile;
|
|
20
|
-
//# sourceMappingURL=updateJsonFile.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"updateJsonFile.js","sourceRoot":"","sources":["../../../../../packages/fs/src/lib/updateJsonFile.ts"],"names":[],"mappings":";;;;AAAA,gEAAyB;AAIzB;;;;;;;GAOG;AACI,KAAK,UAAU,cAAc,CAClC,QAAgB,EAChB,MAEiF,EACjF,UAA8D,EAAE;IAEhE,MAAM,MAAM,GAAG,MAAM,kBAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;IACxD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,CAAA;IACnC,MAAM,kBAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAA;AACtE,CAAC;AAVD,wCAUC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { IJFReadOptions } from './types/IJFReadOptions';
|
|
2
|
-
import { IJsonOutputOptions } from './types/IJsonOutputOptions';
|
|
3
|
-
/**
|
|
4
|
-
* Updates a JSON file based on a provided update function.
|
|
5
|
-
* The update function takes the file's parsed source string as a parameter and should return an object.
|
|
6
|
-
* If the file does not exist or cannot be read, the defaultJson will be used instead.
|
|
7
|
-
*
|
|
8
|
-
* @param filepath - The path to the file to update.
|
|
9
|
-
* @param update - The function to update the file. Takes the current source string as a parameter and should return a string.
|
|
10
|
-
* @param defaultJson - The default string to use if the file cannot be read.
|
|
11
|
-
* @param encoding - The encoding to use when reading and writing the file.
|
|
12
|
-
*/
|
|
13
|
-
export declare function updateJsonFileSafe(filepath: string, update: (src: Record<string | number, unknown>) => Record<string | number, unknown> | Promise<Record<string | number, unknown>>, defaultJson: string, options?: {
|
|
14
|
-
read?: IJFReadOptions;
|
|
15
|
-
write?: IJsonOutputOptions;
|
|
16
|
-
}): Promise<void>;
|
|
17
|
-
//# sourceMappingURL=updateJsonFileSafe.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"updateJsonFileSafe.d.ts","sourceRoot":"","sources":["../../../../../packages/fs/src/lib/updateJsonFileSafe.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAE/D;;;;;;;;;GASG;AAEH,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,CACN,GAAG,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,KAClC,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,CAAC,EACjF,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,cAAc,CAAC;IAAC,KAAK,CAAC,EAAE,kBAAkB,CAAA;CAAO,GAClE,OAAO,CAAC,IAAI,CAAC,CASf"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateJsonFileSafe = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
6
|
-
/**
|
|
7
|
-
* Updates a JSON file based on a provided update function.
|
|
8
|
-
* The update function takes the file's parsed source string as a parameter and should return an object.
|
|
9
|
-
* If the file does not exist or cannot be read, the defaultJson will be used instead.
|
|
10
|
-
*
|
|
11
|
-
* @param filepath - The path to the file to update.
|
|
12
|
-
* @param update - The function to update the file. Takes the current source string as a parameter and should return a string.
|
|
13
|
-
* @param defaultJson - The default string to use if the file cannot be read.
|
|
14
|
-
* @param encoding - The encoding to use when reading and writing the file.
|
|
15
|
-
*/
|
|
16
|
-
async function updateJsonFileSafe(filepath, update, defaultJson, options = {}) {
|
|
17
|
-
let parsed;
|
|
18
|
-
try {
|
|
19
|
-
parsed = await fs_extra_1.default.readJson(filepath, options.read);
|
|
20
|
-
}
|
|
21
|
-
catch (e) {
|
|
22
|
-
parsed = JSON.parse(defaultJson);
|
|
23
|
-
}
|
|
24
|
-
const retval = await update(parsed);
|
|
25
|
-
await fs_extra_1.default.outputJson(filepath, retval, options.write || { spaces: 2 });
|
|
26
|
-
}
|
|
27
|
-
exports.updateJsonFileSafe = updateJsonFileSafe;
|
|
28
|
-
//# sourceMappingURL=updateJsonFileSafe.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"updateJsonFileSafe.js","sourceRoot":"","sources":["../../../../../packages/fs/src/lib/updateJsonFileSafe.ts"],"names":[],"mappings":";;;;AAAA,gEAAyB;AAIzB;;;;;;;;;GASG;AAEI,KAAK,UAAU,kBAAkB,CACtC,QAAgB,EAChB,MAEiF,EACjF,WAAmB,EACnB,UAAiE,EAAE;IAEnE,IAAI,MAAwC,CAAA;IAC5C,IAAI;QACF,MAAM,GAAG,MAAM,kBAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;KACnD;IAAC,OAAO,CAAC,EAAE;QACV,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;KACjC;IACD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,CAAA;IACnC,MAAM,kBAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAA;AACvE,CAAC;AAhBD,gDAgBC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { IJFReadOptions } from './types/IJFReadOptions';
|
|
2
|
-
import { IJsonOutputOptions } from './types/IJsonOutputOptions';
|
|
3
|
-
/**
|
|
4
|
-
* Updates a JSON file based on a provided update function.
|
|
5
|
-
* The update function takes the file's parsed source string as a parameter and should return an object.
|
|
6
|
-
* If the file does not exist or cannot be read, the defaultJson will be used instead.
|
|
7
|
-
*
|
|
8
|
-
* @param filepath - The path to the file to update.
|
|
9
|
-
* @param update - The function to update the file. Takes the current source string as a parameter and should return a string.
|
|
10
|
-
* @param defaultJson - The default string to use if the file cannot be read.
|
|
11
|
-
* @param encoding - The encoding to use when reading and writing the file.
|
|
12
|
-
*/
|
|
13
|
-
export declare function updateJsonFileSafeSync(filepath: string, update: (src: Record<string | number, unknown>) => Record<string | number, unknown>, defaultJson: string, options?: {
|
|
14
|
-
read?: IJFReadOptions;
|
|
15
|
-
write?: IJsonOutputOptions;
|
|
16
|
-
}): void;
|
|
17
|
-
//# sourceMappingURL=updateJsonFileSafeSync.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"updateJsonFileSafeSync.d.ts","sourceRoot":"","sources":["../../../../../packages/fs/src/lib/updateJsonFileSafeSync.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAE/D;;;;;;;;;GASG;AAEH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,EACnF,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,cAAc,CAAC;IAAC,KAAK,CAAC,EAAE,kBAAkB,CAAA;CAAO,GAClE,IAAI,CASN"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateJsonFileSafeSync = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
6
|
-
/**
|
|
7
|
-
* Updates a JSON file based on a provided update function.
|
|
8
|
-
* The update function takes the file's parsed source string as a parameter and should return an object.
|
|
9
|
-
* If the file does not exist or cannot be read, the defaultJson will be used instead.
|
|
10
|
-
*
|
|
11
|
-
* @param filepath - The path to the file to update.
|
|
12
|
-
* @param update - The function to update the file. Takes the current source string as a parameter and should return a string.
|
|
13
|
-
* @param defaultJson - The default string to use if the file cannot be read.
|
|
14
|
-
* @param encoding - The encoding to use when reading and writing the file.
|
|
15
|
-
*/
|
|
16
|
-
function updateJsonFileSafeSync(filepath, update, defaultJson, options = {}) {
|
|
17
|
-
let parsed;
|
|
18
|
-
try {
|
|
19
|
-
parsed = fs_extra_1.default.readJsonSync(filepath, options.read);
|
|
20
|
-
}
|
|
21
|
-
catch (e) {
|
|
22
|
-
parsed = JSON.parse(defaultJson);
|
|
23
|
-
}
|
|
24
|
-
const retval = update(parsed);
|
|
25
|
-
fs_extra_1.default.outputJsonSync(filepath, retval, options.write || { spaces: 2 });
|
|
26
|
-
}
|
|
27
|
-
exports.updateJsonFileSafeSync = updateJsonFileSafeSync;
|
|
28
|
-
//# sourceMappingURL=updateJsonFileSafeSync.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"updateJsonFileSafeSync.js","sourceRoot":"","sources":["../../../../../packages/fs/src/lib/updateJsonFileSafeSync.ts"],"names":[],"mappings":";;;;AAAA,gEAAyB;AAIzB;;;;;;;;;GASG;AAEH,SAAgB,sBAAsB,CACpC,QAAgB,EAChB,MAAmF,EACnF,WAAmB,EACnB,UAAiE,EAAE;IAEnE,IAAI,MAAwC,CAAA;IAC5C,IAAI;QACF,MAAM,GAAG,kBAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;KACjD;IAAC,OAAO,CAAC,EAAE;QACV,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;KACjC;IACD,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;IAC7B,kBAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAA;AACrE,CAAC;AAdD,wDAcC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { IJFReadOptions } from './types/IJFReadOptions';
|
|
2
|
-
import { IJFWriteOptions } from './types/IJFWriteOptions';
|
|
3
|
-
/**
|
|
4
|
-
* Updates a JSON file based on a provided update function.
|
|
5
|
-
* The update function takes the file's current source string as a parameter and should return an object.
|
|
6
|
-
*
|
|
7
|
-
* @param filepath - The path to the file to update.
|
|
8
|
-
* @param update - The function to update the file. Takes the parsed source string as a parameter and should return a string.
|
|
9
|
-
* @param encoding - The encoding to use when reading and writing the file.
|
|
10
|
-
*/
|
|
11
|
-
export declare function updateJsonFileSync(filepath: string, update: (o: Record<string | number, unknown>) => Record<string | number, unknown>, options?: {
|
|
12
|
-
read?: IJFReadOptions;
|
|
13
|
-
write?: IJFWriteOptions;
|
|
14
|
-
}): void;
|
|
15
|
-
//# sourceMappingURL=updateJsonFileSync.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"updateJsonFileSync.d.ts","sourceRoot":"","sources":["../../../../../packages/fs/src/lib/updateJsonFileSync.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAEzD;;;;;;;GAOG;AAEH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,EACjF,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,cAAc,CAAC;IAAC,KAAK,CAAC,EAAE,eAAe,CAAA;CAAO,GAC/D,IAAI,CAIN"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateJsonFileSync = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
6
|
-
/**
|
|
7
|
-
* Updates a JSON file based on a provided update function.
|
|
8
|
-
* The update function takes the file's current source string as a parameter and should return an object.
|
|
9
|
-
*
|
|
10
|
-
* @param filepath - The path to the file to update.
|
|
11
|
-
* @param update - The function to update the file. Takes the parsed source string as a parameter and should return a string.
|
|
12
|
-
* @param encoding - The encoding to use when reading and writing the file.
|
|
13
|
-
*/
|
|
14
|
-
function updateJsonFileSync(filepath, update, options = {}) {
|
|
15
|
-
const parsed = fs_extra_1.default.readJsonSync(filepath, options.read);
|
|
16
|
-
const retval = update(parsed);
|
|
17
|
-
fs_extra_1.default.writeJsonSync(filepath, retval, options.write || { spaces: 2 });
|
|
18
|
-
}
|
|
19
|
-
exports.updateJsonFileSync = updateJsonFileSync;
|
|
20
|
-
//# sourceMappingURL=updateJsonFileSync.js.map
|