@bemoje/fs 0.0.10 → 0.0.12

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.
Files changed (102) hide show
  1. package/package.json +6 -4
  2. package/src/index.ts +35 -0
  3. package/src/lib/AppData.ts +25 -0
  4. package/src/lib/JsonFile.ts +158 -0
  5. package/src/lib/LogFile.ts +117 -0
  6. package/src/lib/absoluteToRelativePath.test.ts +11 -0
  7. package/{dist/types/lib/absoluteToRelativePath.d.ts → src/lib/absoluteToRelativePath.ts} +20 -14
  8. package/src/lib/appendLineToFile.test.ts +49 -0
  9. package/src/lib/appendLineToFile.ts +21 -0
  10. package/src/lib/cleanDirectorySync.test.ts +57 -0
  11. package/{dist/types/lib/cleanDirectorySync.d.ts → src/lib/cleanDirectorySync.ts} +24 -17
  12. package/src/lib/createDirectory.test.ts +14 -0
  13. package/{dist/types/lib/createDirectory.d.ts → src/lib/createDirectory.ts} +5 -2
  14. package/src/lib/createDirectorySync.test.ts +14 -0
  15. package/{dist/types/lib/createDirectorySync.d.ts → src/lib/createDirectorySync.ts} +6 -2
  16. package/src/lib/createFileExtensionFilter.test.ts +17 -0
  17. package/{dist/types/lib/createFileExtensionFilter.d.ts → src/lib/createFileExtensionFilter.ts} +14 -2
  18. package/src/lib/cwdpath.test.ts +48 -0
  19. package/{dist/types/lib/cwdpath.d.ts → src/lib/cwdpath.ts} +16 -13
  20. package/src/lib/deleteDirectory.test.ts +24 -0
  21. package/{dist/types/lib/deleteDirectory.d.ts → src/lib/deleteDirectory.ts} +5 -2
  22. package/src/lib/deleteDirectorySafe.test.ts +40 -0
  23. package/{dist/types/lib/deleteDirectorySafe.d.ts → src/lib/deleteDirectorySafe.ts} +5 -2
  24. package/src/lib/deleteDirectorySafeSync.test.ts +30 -0
  25. package/{dist/types/lib/deleteDirectorySafeSync.d.ts → src/lib/deleteDirectorySafeSync.ts} +7 -2
  26. package/src/lib/deleteDirectorySync.test.ts +23 -0
  27. package/{dist/types/lib/deleteDirectorySync.d.ts → src/lib/deleteDirectorySync.ts} +6 -2
  28. package/src/lib/ensureValidWindowsPath.test.ts +80 -0
  29. package/{dist/types/lib/ensureValidWindowsPath.d.ts → src/lib/ensureValidWindowsPath.ts} +57 -23
  30. package/src/lib/getDiskDrivesWindows.ts +13 -0
  31. package/src/lib/getDownloadsDirectory.ts +6 -0
  32. package/src/lib/getHomeDirectory.ts +7 -0
  33. package/src/lib/getLastMofifiedFileIn.ts +15 -0
  34. package/src/lib/getRootDir.ts +5 -0
  35. package/src/lib/isWindows.ts +3 -0
  36. package/src/lib/normalizeFileExtension.test.ts +15 -0
  37. package/{dist/types/lib/normalizeFileExtension.d.ts → src/lib/normalizeFileExtension.ts} +29 -23
  38. package/src/lib/readFileLastLines.ts +12 -0
  39. package/src/lib/readJsonFile.test.ts +34 -0
  40. package/{dist/types/lib/readJsonFile.d.ts → src/lib/readJsonFile.ts} +16 -13
  41. package/src/lib/readJsonFileSync.test.ts +36 -0
  42. package/{dist/types/lib/readJsonFileSync.d.ts → src/lib/readJsonFileSync.ts} +16 -13
  43. package/src/lib/readPackageJson.ts +9 -0
  44. package/src/lib/removeIllegalFilenameCharacters.ts +3 -0
  45. package/src/lib/tempFile.ts +20 -0
  46. package/src/lib/types/IEnsureValidWindowsPathOptions.ts +10 -0
  47. package/src/lib/types/ILogFileData.ts +5 -0
  48. package/src/lib/unzipFile.ts +5 -0
  49. package/src/lib/unzipMergeFiles.ts +20 -0
  50. package/src/lib/wipeDirectorySafe.ts +7 -0
  51. package/src/lib/writeJsonFile.test.ts +26 -0
  52. package/{dist/types/lib/writeJsonFile.d.ts → src/lib/writeJsonFile.ts} +5 -2
  53. package/src/lib/writeJsonFileSync.test.ts +28 -0
  54. package/{dist/types/lib/writeJsonFileSync.d.ts → src/lib/writeJsonFileSync.ts} +5 -2
  55. package/dist/index.cjs.js +0 -6
  56. package/dist/index.cjs.js.map +0 -1
  57. package/dist/index.esm.js +0 -6
  58. package/dist/index.esm.js.map +0 -1
  59. package/dist/types/index.d.ts +0 -30
  60. package/dist/types/index.d.ts.map +0 -1
  61. package/dist/types/lib/absoluteToRelativePath.d.ts.map +0 -1
  62. package/dist/types/lib/appendLineToFile.d.ts +0 -12
  63. package/dist/types/lib/appendLineToFile.d.ts.map +0 -1
  64. package/dist/types/lib/cleanDirectorySync.d.ts.map +0 -1
  65. package/dist/types/lib/createDirectory.d.ts.map +0 -1
  66. package/dist/types/lib/createDirectorySync.d.ts.map +0 -1
  67. package/dist/types/lib/createFileExtensionFilter.d.ts.map +0 -1
  68. package/dist/types/lib/cwdpath.d.ts.map +0 -1
  69. package/dist/types/lib/deleteDirectory.d.ts.map +0 -1
  70. package/dist/types/lib/deleteDirectorySafe.d.ts.map +0 -1
  71. package/dist/types/lib/deleteDirectorySafeSync.d.ts.map +0 -1
  72. package/dist/types/lib/deleteDirectorySync.d.ts.map +0 -1
  73. package/dist/types/lib/ensureValidWindowsPath.d.ts.map +0 -1
  74. package/dist/types/lib/getDiskDrivesWindows.d.ts +0 -2
  75. package/dist/types/lib/getDiskDrivesWindows.d.ts.map +0 -1
  76. package/dist/types/lib/getDownloadsDirectory.d.ts +0 -2
  77. package/dist/types/lib/getDownloadsDirectory.d.ts.map +0 -1
  78. package/dist/types/lib/getHomeDirectory.d.ts +0 -2
  79. package/dist/types/lib/getHomeDirectory.d.ts.map +0 -1
  80. package/dist/types/lib/getLastMofifiedFileIn.d.ts +0 -2
  81. package/dist/types/lib/getLastMofifiedFileIn.d.ts.map +0 -1
  82. package/dist/types/lib/getRootDir.d.ts +0 -2
  83. package/dist/types/lib/getRootDir.d.ts.map +0 -1
  84. package/dist/types/lib/isWindows.d.ts +0 -2
  85. package/dist/types/lib/isWindows.d.ts.map +0 -1
  86. package/dist/types/lib/normalizeFileExtension.d.ts.map +0 -1
  87. package/dist/types/lib/readJsonFile.d.ts.map +0 -1
  88. package/dist/types/lib/readJsonFileSync.d.ts.map +0 -1
  89. package/dist/types/lib/readPackageJson.d.ts +0 -2
  90. package/dist/types/lib/readPackageJson.d.ts.map +0 -1
  91. package/dist/types/lib/removeIllegalFilenameCharacters.d.ts +0 -2
  92. package/dist/types/lib/removeIllegalFilenameCharacters.d.ts.map +0 -1
  93. package/dist/types/lib/types/IEnsureValidWindowsPathOptions.d.ts +0 -11
  94. package/dist/types/lib/types/IEnsureValidWindowsPathOptions.d.ts.map +0 -1
  95. package/dist/types/lib/unzipFile.d.ts +0 -2
  96. package/dist/types/lib/unzipFile.d.ts.map +0 -1
  97. package/dist/types/lib/unzipMergeFiles.d.ts +0 -5
  98. package/dist/types/lib/unzipMergeFiles.d.ts.map +0 -1
  99. package/dist/types/lib/wipeDirectorySafe.d.ts +0 -2
  100. package/dist/types/lib/wipeDirectorySafe.d.ts.map +0 -1
  101. package/dist/types/lib/writeJsonFile.d.ts.map +0 -1
  102. package/dist/types/lib/writeJsonFileSync.d.ts.map +0 -1
@@ -1,13 +1,16 @@
1
- /**
2
- * Reads a JSON file from the given filepath and returns its content as a Promise.
3
- * The Promise will resolve with the parsed JSON content as an object of type T.
4
- * @template T The expected return type of the JSON object.
5
- * @param filepath The path to the JSON file to read.
6
- * @returns A Promise that resolves with the parsed JSON content as an object of type T.
7
- * @throws Will throw an error if reading the file fails for any reason.
8
- * @example ```ts
9
- * const data: MyType = await readJsonFile<MyType>('path/to/myfile.json');
10
- * ```
11
- */
12
- export declare function readJsonFile<T>(filepath: string): Promise<T>;
13
- //# sourceMappingURL=readJsonFile.d.ts.map
1
+ import fs from 'fs'
2
+
3
+ /**
4
+ * Reads a JSON file from the given filepath and returns its content as a Promise.
5
+ * The Promise will resolve with the parsed JSON content as an object of type T.
6
+ * @template T The expected return type of the JSON object.
7
+ * @param filepath The path to the JSON file to read.
8
+ * @returns A Promise that resolves with the parsed JSON content as an object of type T.
9
+ * @throws Will throw an error if reading the file fails for any reason.
10
+ * @example ```ts
11
+ * const data: MyType = await readJsonFile<MyType>('path/to/myfile.json');
12
+ * ```
13
+ */
14
+ export async function readJsonFile<T>(filepath: string): Promise<T> {
15
+ return JSON.parse(await fs.promises.readFile(filepath, 'utf8'))
16
+ }
@@ -0,0 +1,36 @@
1
+ import fs from 'fs'
2
+ import { readJsonFileSync } from './readJsonFileSync'
3
+
4
+ describe(readJsonFileSync.name, () => {
5
+ afterEach(() => {
6
+ jest.restoreAllMocks()
7
+ })
8
+
9
+ it('should read and parse JSON file successfully', () => {
10
+ const jsonData = { key: 'value' }
11
+ const jsonString = JSON.stringify(jsonData)
12
+ const readFileSyncMock = jest.spyOn(fs, 'readFileSync')
13
+ readFileSyncMock.mockReturnValue(Buffer.from(jsonString))
14
+ const result = readJsonFileSync('test.json')
15
+ expect(result).toEqual(jsonData)
16
+ expect(readFileSyncMock).toHaveBeenCalledWith('test.json', 'utf8')
17
+ })
18
+
19
+ it('should throw an error if the file cannot be read', () => {
20
+ const readFileSyncMock = jest.spyOn(fs, 'readFileSync')
21
+ const error = new Error('Failed to read file')
22
+ readFileSyncMock.mockImplementation(() => {
23
+ throw error
24
+ })
25
+ expect(() => readJsonFileSync('test.json')).toThrow(error)
26
+ expect(readFileSyncMock).toHaveBeenCalledWith('test.json', 'utf8')
27
+ })
28
+
29
+ it('should throw an error if the file has invalid JSON', () => {
30
+ const readFileSyncMock = jest.spyOn(fs, 'readFileSync')
31
+ const invalidJsonString = 'invalid json'
32
+ readFileSyncMock.mockReturnValue(Buffer.from(invalidJsonString))
33
+ expect(() => readJsonFileSync('test.json')).toThrow(SyntaxError)
34
+ expect(readFileSyncMock).toHaveBeenCalledWith('test.json', 'utf8')
35
+ })
36
+ })
@@ -1,13 +1,16 @@
1
- /**
2
- * Reads a JSON file synchronously and returns a Promise that resolves with the parsed JSON data.
3
- * @template T The expected return type of the JSON data.
4
- * @param filepath The path to the JSON file to read.
5
- * @returns A Promise that resolves with the parsed JSON data.
6
- * @throws If the file cannot be read or the content cannot be parsed as JSON.
7
- * @example ```ts
8
- * const data = await readJsonFileSync<MyType>('/path/to/file.json');
9
- * console.log(data);
10
- * ```
11
- */
12
- export declare function readJsonFileSync<T>(filepath: string): T;
13
- //# sourceMappingURL=readJsonFileSync.d.ts.map
1
+ import fs from 'fs'
2
+
3
+ /**
4
+ * Reads a JSON file synchronously and returns a Promise that resolves with the parsed JSON data.
5
+ * @template T The expected return type of the JSON data.
6
+ * @param filepath The path to the JSON file to read.
7
+ * @returns A Promise that resolves with the parsed JSON data.
8
+ * @throws If the file cannot be read or the content cannot be parsed as JSON.
9
+ * @example ```ts
10
+ * const data = await readJsonFileSync<MyType>('/path/to/file.json');
11
+ * console.log(data);
12
+ * ```
13
+ */
14
+ export function readJsonFileSync<T>(filepath: string): T {
15
+ return JSON.parse(fs.readFileSync(filepath, 'utf8'))
16
+ }
@@ -0,0 +1,9 @@
1
+ import fs from 'fs'
2
+ import path from 'path'
3
+ import { readJsonFileSync } from './readJsonFileSync'
4
+
5
+ export function readPackageJson(projectRoot = process.cwd()): Record<string, any> | undefined {
6
+ const filepath = path.join(projectRoot, 'package.json')
7
+ if (!fs.existsSync(filepath)) return
8
+ return readJsonFileSync(filepath)
9
+ }
@@ -0,0 +1,3 @@
1
+ export function removeIllegalFilenameCharacters(string: string) {
2
+ return string.replace(/[/\\?%*:|"<>]/g, '')
3
+ }
@@ -0,0 +1,20 @@
1
+ import fs from 'fs'
2
+ import path from 'path'
3
+
4
+ /**
5
+ * Creates a temporary file and deletes it after the callback has finished.
6
+ * @param fileExtension - The file extension to use for the temporary file.
7
+ * @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.
8
+ */
9
+ export function tempFile(fileExtension: string, callback: (fpath: string) => void | Promise<void>): void {
10
+ const dir = path.join(process.env['TEMP']!, 'bemoje', 'temp')
11
+ const fpath = path.join(dir, Date.now() + fileExtension)
12
+ fs.mkdirSync(dir, { recursive: true })
13
+ const prom = callback(fpath)
14
+ if (prom instanceof Promise) {
15
+ const rm = () => fs.rmSync(fpath)
16
+ prom.then(rm).catch(rm)
17
+ } else {
18
+ fs.rmSync(fpath)
19
+ }
20
+ }
@@ -0,0 +1,10 @@
1
+ export interface IEnsureValidWindowsPathOptions {
2
+ /**
3
+ * On most versions of windows, the max allowed length of paths has been raised.
4
+ */
5
+ extendedMaxLength?: boolean
6
+ /**
7
+ * Throw if not valid, otherwise return false.
8
+ */
9
+ assert?: boolean
10
+ }
@@ -0,0 +1,5 @@
1
+ export interface ILogFileData<T> {
2
+ source: string
3
+ key: string
4
+ value: T
5
+ }
@@ -0,0 +1,5 @@
1
+ import extract from 'extract-zip'
2
+
3
+ export async function unzipFile(filepath: string, outdir: string) {
4
+ await extract(filepath, { dir: outdir })
5
+ }
@@ -0,0 +1,20 @@
1
+ import extract from 'extract-zip'
2
+ import fs from 'fs'
3
+ import path from 'path'
4
+
5
+ /**
6
+ * @param source Either a directory containing zip files or an array of zip file paths.
7
+ */
8
+ export async function unzipMergeFiles(source: string | string[], target: string) {
9
+ if (typeof source === 'string') {
10
+ source = fs.readdirSync(source).map((filename) => {
11
+ return path.join(source as string, filename)
12
+ })
13
+ }
14
+ for (const filepath of source) {
15
+ const stat = await fs.promises.stat(filepath)
16
+ if (stat.isDirectory()) continue
17
+ if (!filepath.endsWith('.zip')) continue
18
+ await extract(filepath, { dir: target })
19
+ }
20
+ }
@@ -0,0 +1,7 @@
1
+ import { createDirectory } from './createDirectory'
2
+ import { deleteDirectorySafe } from './deleteDirectorySafe'
3
+
4
+ export async function wipeDirectorySafe(dirpath: string) {
5
+ await deleteDirectorySafe(dirpath)
6
+ await createDirectory(dirpath)
7
+ }
@@ -0,0 +1,26 @@
1
+ import fs from 'fs'
2
+ import { writeJsonFile } from './writeJsonFile'
3
+
4
+ describe(writeJsonFile.name, () => {
5
+ afterEach(() => {
6
+ jest.resetAllMocks()
7
+ })
8
+
9
+ it('should write JSON data to a file successfully', async () => {
10
+ const jsonData = { key: 'value' }
11
+ const jsonString = JSON.stringify(jsonData)
12
+ const writeFileMock = jest.spyOn(fs.promises, 'writeFile')
13
+ writeFileMock.mockResolvedValue(undefined)
14
+ await writeJsonFile('test.json', jsonData)
15
+ expect(writeFileMock).toHaveBeenCalledWith('test.json', jsonString)
16
+ })
17
+
18
+ it('should throw an error if the file cannot be written', async () => {
19
+ const jsonData = { key: 'value' }
20
+ const error = new Error('Failed to write file')
21
+ const writeFileMock = jest.spyOn(fs.promises, 'writeFile')
22
+ writeFileMock.mockRejectedValue(error)
23
+ await expect(writeJsonFile('test.json', jsonData)).rejects.toThrow(error)
24
+ expect(writeFileMock).toHaveBeenCalledWith('test.json', JSON.stringify(jsonData))
25
+ })
26
+ })
@@ -1,3 +1,5 @@
1
+ import fs from 'fs'
2
+
1
3
  /**
2
4
  * Writes a JSON file to the specified filepath. The data to be written is passed as an argument.
3
5
  * If the 'pretty' argument is set to true, the JSON data will be formatted in a more human-readable way.
@@ -11,5 +13,6 @@
11
13
  * await writeJsonFile('./data.json', data, true);
12
14
  * ```
13
15
  */
14
- export declare function writeJsonFile<T>(filepath: string, data: T, pretty?: boolean): Promise<void>;
15
- //# sourceMappingURL=writeJsonFile.d.ts.map
16
+ export async function writeJsonFile<T>(filepath: string, data: T, pretty = false): Promise<void> {
17
+ await fs.promises.writeFile(filepath, JSON.stringify(data, null, pretty ? 2 : undefined))
18
+ }
@@ -0,0 +1,28 @@
1
+ import fs from 'fs'
2
+ import { writeJsonFileSync } from './writeJsonFileSync'
3
+
4
+ describe(writeJsonFileSync.name, () => {
5
+ afterEach(() => {
6
+ jest.restoreAllMocks()
7
+ })
8
+
9
+ it('should write JSON data to a file successfully', () => {
10
+ const jsonData = { key: 'value' }
11
+ const jsonString = JSON.stringify(jsonData)
12
+ const writeFileSyncMock = jest.spyOn(fs, 'writeFileSync')
13
+ writeFileSyncMock.mockImplementation(() => undefined)
14
+ writeJsonFileSync('test.json', jsonData)
15
+ expect(writeFileSyncMock).toHaveBeenCalledWith('test.json', jsonString)
16
+ })
17
+
18
+ it('should throw an error if the file cannot be written', () => {
19
+ const jsonData = { key: 'value' }
20
+ const error = new Error('Failed to write file')
21
+ const writeFileSyncMock = jest.spyOn(fs, 'writeFileSync')
22
+ writeFileSyncMock.mockImplementation(() => {
23
+ throw error
24
+ })
25
+ expect(() => writeJsonFileSync('test.json', jsonData)).toThrow(error)
26
+ expect(writeFileSyncMock).toHaveBeenCalledWith('test.json', JSON.stringify(jsonData))
27
+ })
28
+ })
@@ -1,3 +1,5 @@
1
+ import fs from 'fs'
2
+
1
3
  /**
2
4
  * Writes a JSON object to a file synchronously.
3
5
  * @typeParam T - The type of the JSON object.
@@ -10,5 +12,6 @@
10
12
  * writeJsonFileSync('./data.json', data, true);
11
13
  * ```
12
14
  */
13
- export declare function writeJsonFileSync<T>(filepath: string, data: T, pretty?: boolean): void;
14
- //# sourceMappingURL=writeJsonFileSync.d.ts.map
15
+ export function writeJsonFileSync<T>(filepath: string, data: T, pretty = false): void {
16
+ fs.writeFileSync(filepath, JSON.stringify(data, null, pretty ? 2 : undefined))
17
+ }
package/dist/index.cjs.js DELETED
@@ -1,6 +0,0 @@
1
- /*!
2
- * @bemoje/fs v0.0.9
3
- * (c) Benjamin Møller Jensen
4
- * Released under the MIT License.
5
- */"use strict";var string=require("@bemoje/string"),path=require("path"),fs=require("fs"),child_process=require("child_process"),extract=require("extract-zip");function absoluteToRelativePath(absolute,workingDirectory=process.cwd()){return path.normalize(absolute).replace(new RegExp(string.regexEscapeString(path.normalize(workingDirectory)+path.sep),"i"),"")}function __awaiter(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})}"function"==typeof SuppressedError?SuppressedError:function(error,suppressed,message){var e=new Error(message);return e.name="SuppressedError",e.error=error,e.suppressed=suppressed,e};function createDirectory(dirpath){return __awaiter(this,void 0,void 0,function*(){return yield fs.promises.mkdir(dirpath,{recursive:!0}),dirpath})}function appendLineToFile(filepath,line,linebreakBefore=!1){return __awaiter(this,void 0,void 0,function*(){fs.existsSync(filepath)||(yield createDirectory(path.dirname(filepath)),yield fs.promises.writeFile(filepath,"")),yield fs.promises.appendFile(filepath,linebreakBefore?"\n"+line:line+"\n")})}function cleanDirectorySync(dirpath,predicate){for(const filename of fs.readdirSync(dirpath)){const filepath=path.join(dirpath,filename),stat=fs.statSync(filepath);predicate(filepath,stat)&&fs.unlinkSync(filepath)}}function createDirectorySync(dirpath){return fs.mkdirSync(dirpath,{recursive:!0}),dirpath}function normalizeFileExtension(ext){if(""===ext||"."===ext)return"";if(/[<>"|?*:]/g.test(ext))throw new Error(`Illegal characters in file extension: ${ext} | Illegal characters are: <>"|?:*`);return ext.includes(".")?ext.substring(ext.lastIndexOf(".")):"."+ext}function createFileExtensionFilter(...fileExtensions){return fileExtensions.length?filepath=>{for(const ext of fileExtensions.map(normalizeFileExtension))if(path.extname(filepath)===ext)return!0;return!1}:()=>!0}function cwdpath(...paths){return path.join(process.cwd(),...paths)}function deleteDirectory(dirpath){return __awaiter(this,void 0,void 0,function*(){yield fs.promises.rm(dirpath,{recursive:!0,force:!0})})}function deleteDirectorySafe(dirpath){return __awaiter(this,void 0,void 0,function*(){fs.existsSync(dirpath)&&(yield fs.promises.rm(dirpath,{recursive:!0,force:!0}))})}function deleteDirectorySafeSync(dirpath){return fs.existsSync(dirpath)?(fs.rmSync(dirpath,{recursive:!0,force:!0}),dirpath):dirpath}function deleteDirectorySync(dirpath){return fs.rmSync(dirpath,{recursive:!0,force:!0}),dirpath}function ensureValidWindowsPath(path,options){const throwOrFalse=msg=>{if(options&&!0===options.assert)throw new Error(`Invalid windows path. ${msg} | input received: ${path}`);return!1};if(0===path.length)return throwOrFalse("Path string is length 0.");if(-1!==path.indexOf("/")&&-1!==path.indexOf("\\"))return throwOrFalse("Path contains both backslash and forward slash.");const maxLength=(options&&options.extendedMaxLength?32767:260)-12;if(path.length>maxLength)return throwOrFalse(`Maximum length of ${maxLength} exceeded`);let noDriveLetter=path;return /^\w:(\\|\/)/g.test(path)&&(noDriveLetter=path.substring(2)),/[<>"|?*:]/g.test(noDriveLetter)?throwOrFalse(`Illegal characters in: ${path} | Illegal characters are: <>"|?:*`):!/(\\|\/)(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])((\\|\/)|$)/g.test(path)||throwOrFalse("Illegal name in path string")}function isWindows(){return process.platform.includes("win")}function getDiskDrivesWindows(){if(!isWindows())throw new Error("This function is only available on Windows.");return child_process.execSync("wmic logicaldisk get name").toString().split("\n").map(s=>s.trim()).filter(s=>/^[a-z]:/i.test(s)).map(s=>s.substring(0,2)+path.sep)}function getHomeDirectory(){const home=path.resolve(process.env.HOME||process.env.USERPROFILE||"");if(!home)throw new Error("Home directory not found");return home}function getDownloadsDirectory(){return path.join(getHomeDirectory(),"Downloads")}function getLastMofifiedFileIn(dirpath){return __awaiter(this,void 0,void 0,function*(){const children=yield fs.promises.readdir(dirpath),filtered=children.map(fname=>{const fpath=path.join(dirpath,fname),stat=fs.statSync(fpath);return[fpath,stat.mtimeMs,stat.isFile()]}).filter(a=>a[2]),sorted=filtered.sort((a,b)=>b[1]-a[1]);return sorted[0][0]})}function getRootDir(){return path.parse(process.cwd()).root}function readJsonFile(filepath){return __awaiter(this,void 0,void 0,function*(){return JSON.parse(yield fs.promises.readFile(filepath,"utf8"))})}function readJsonFileSync(filepath){return JSON.parse(fs.readFileSync(filepath,"utf8"))}function readPackageJson(projectRoot=process.cwd()){const filepath=path.join(projectRoot,"package.json");return fs.existsSync(filepath)?readJsonFileSync(filepath):void 0}function removeIllegalFilenameCharacters(string){return string.replace(/[/\\?%*:|"<>]/g,"")}function unzipFile(filepath,outdir){return __awaiter(this,void 0,void 0,function*(){yield extract(filepath,{dir:outdir})})}function unzipMergeFiles(source,target){return __awaiter(this,void 0,void 0,function*(){"string"==typeof source&&(source=fs.readdirSync(source).map(filename=>path.join(source,filename)));for(const filepath of source){const stat=yield fs.promises.stat(filepath);stat.isDirectory()||filepath.endsWith(".zip")&&(yield extract(filepath,{dir:target}))}})}function wipeDirectorySafe(dirpath){return __awaiter(this,void 0,void 0,function*(){yield deleteDirectorySafe(dirpath),yield createDirectory(dirpath)})}function writeJsonFile(filepath,data,pretty=!1){return __awaiter(this,void 0,void 0,function*(){yield fs.promises.writeFile(filepath,JSON.stringify(data,null,pretty?2:void 0))})}function writeJsonFileSync(filepath,data,pretty=!1){fs.writeFileSync(filepath,JSON.stringify(data,null,pretty?2:void 0))}exports.absoluteToRelativePath=absoluteToRelativePath,exports.appendLineToFile=appendLineToFile,exports.cleanDirectorySync=cleanDirectorySync,exports.createDirectory=createDirectory,exports.createDirectorySync=createDirectorySync,exports.createFileExtensionFilter=createFileExtensionFilter,exports.cwdpath=cwdpath,exports.deleteDirectory=deleteDirectory,exports.deleteDirectorySafe=deleteDirectorySafe,exports.deleteDirectorySafeSync=deleteDirectorySafeSync,exports.deleteDirectorySync=deleteDirectorySync,exports.ensureValidWindowsPath=ensureValidWindowsPath,exports.getDiskDrivesWindows=getDiskDrivesWindows,exports.getDownloadsDirectory=getDownloadsDirectory,exports.getHomeDirectory=getHomeDirectory,exports.getLastMofifiedFileIn=getLastMofifiedFileIn,exports.getRootDir=getRootDir,exports.isWindows=isWindows,exports.normalizeFileExtension=normalizeFileExtension,exports.readJsonFile=readJsonFile,exports.readJsonFileSync=readJsonFileSync,exports.readPackageJson=readPackageJson,exports.removeIllegalFilenameCharacters=removeIllegalFilenameCharacters,exports.unzipFile=unzipFile,exports.unzipMergeFiles=unzipMergeFiles,exports.wipeDirectorySafe=wipeDirectorySafe,exports.writeJsonFile=writeJsonFile,exports.writeJsonFileSync=writeJsonFileSync;
6
- //# sourceMappingURL=index.cjs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../src/lib/absoluteToRelativePath.ts","../src/lib/createDirectory.ts","../src/lib/appendLineToFile.ts","../src/lib/cleanDirectorySync.ts","../src/lib/createDirectorySync.ts","../src/lib/normalizeFileExtension.ts","../src/lib/createFileExtensionFilter.ts","../src/lib/cwdpath.ts","../src/lib/deleteDirectory.ts","../src/lib/deleteDirectorySafe.ts","../src/lib/deleteDirectorySafeSync.ts","../src/lib/deleteDirectorySync.ts","../src/lib/ensureValidWindowsPath.ts","../src/lib/isWindows.ts","../src/lib/getDiskDrivesWindows.ts","../src/lib/getHomeDirectory.ts","../src/lib/getDownloadsDirectory.ts","../src/lib/getLastMofifiedFileIn.ts","../src/lib/getRootDir.ts","../src/lib/readJsonFile.ts","../src/lib/readJsonFileSync.ts","../src/lib/readPackageJson.ts","../src/lib/removeIllegalFilenameCharacters.ts","../src/lib/unzipFile.ts","../src/lib/unzipMergeFiles.ts","../src/lib/wipeDirectorySafe.ts","../src/lib/writeJsonFile.ts","../src/lib/writeJsonFileSync.ts"],"sourcesContent":["import { regexEscapeString } from '@bemoje/string'\r\nimport path from 'path'\r\n\r\n/**\r\n * If the filepath is somewhere in the current working directory, it can be converted into a relative path.\r\n * @remarks This function takes an absolute path as input and returns a relative path. It replaces the current working directory in the path with an empty string,\r\n * replaces all backslashes with forward slashes, and removes any leading forward slashes.\r\n * @param workingDirectory The directory relative to which the path should be converted. Defaults to the current working directory.\r\n * @returns The relative path.\r\n * @param absolute the absolute filepath to convert.\r\n * @example ```ts\r\n * absoluteToRelativePath(__filename)\r\n * //=> 'src/absoluteToRelativePath.ts'\r\n * ```\r\n */\r\nexport function absoluteToRelativePath(absolute: string, workingDirectory = process.cwd()): string {\r\n return path\r\n .normalize(absolute)\r\n .replace(new RegExp(regexEscapeString(path.normalize(workingDirectory) + path.sep), 'i'), '')\r\n}\r\n","import fs from 'fs'\n/**\n * Create a directory at a given path if it does not exist.\n * Automatically creates parent directories if they do not exist.\n * @param dirpath The path where the directory should be created.\n * @returns The path of the directory.\n * @throws Will throw an error if the directory cannot be created.\n * @example ```ts\n * createDirectory('/path/to/directory').then((dirpath) => {\n * //=> `Directory created at ${dirpath}`\n * });\n * ```\n */\nexport async function createDirectory(dirpath: string): Promise<string> {\n await fs.promises.mkdir(dirpath, { recursive: true })\n return dirpath\n}\n","import fs from 'fs'\r\nimport path from 'path'\r\nimport { createDirectory } from './createDirectory'\r\n\r\n/**\r\n * Append a line to a file. Creates the file if it does not exist.\r\n * @param filepath The path of the file.\r\n * @param line The string data to append.\r\n * @returns A Promise that resolves when the line has been appended to the file.\r\n * @throws Will throw an error if the operation fails.\r\n * @example ```ts\r\n * await appendLineToFile('/path/to/file', 'This is a new line')\r\n * ```\r\n */\r\nexport async function appendLineToFile(filepath: string, line: string, linebreakBefore = false): Promise<void> {\r\n if (!fs.existsSync(filepath)) {\r\n await createDirectory(path.dirname(filepath))\r\n await fs.promises.writeFile(filepath, '')\r\n }\r\n await fs.promises.appendFile(filepath, linebreakBefore ? '\\n' + line : line + '\\n')\r\n}\r\n","import type { Stats } from 'fs'\r\nimport fs from 'fs'\r\nimport path from 'path'\r\n\r\n/**\r\n * Synchronously cleans a directory by removing files that satisfy a given predicate.\r\n * @remarks This function is a part of the File System module.\r\n * @param dirpath - The path to the directory that needs to be cleaned.\r\n * @param predicate - A function that takes a filepath and its stats as arguments and returns a boolean. If the function returns true for a file, that file is removed from the directory.\r\n * @throws If the directory at the provided path does not exist or cannot be read.\r\n * @example ```ts\r\n * import { Stats } from 'fs';\r\n * const dirpath = './my-directory';\r\n * const predicate = (filepath: string, stat: Stats) => stat.size > 1024;\r\n * cleanDirectorySync(dirpath, predicate);\r\n * ```\r\n */\r\nexport function cleanDirectorySync(dirpath: string, predicate: (filepath: string, stat: Stats) => boolean): void {\r\n for (const filename of fs.readdirSync(dirpath)) {\r\n const filepath = path.join(dirpath, filename)\r\n const stat = fs.statSync(filepath)\r\n if (predicate(filepath, stat)) fs.unlinkSync(filepath)\r\n }\r\n}\r\n","import fs from 'fs'\n\n/**\n * Create a directory at a given path if it does not exist.\n * Automatically creates parent directories if they do not exist.\n * @param dirpath The path where the directory should be created.\n * @returns The path of the directory.\n * @example ```ts\n * createDirectorySync('/path/to/directory')\n * ```\n */\nexport function createDirectorySync(dirpath: string): string {\n fs.mkdirSync(dirpath, { recursive: true })\n return dirpath\n}\n","/**\r\n * Normalize a file extension to the form: .[ext]\r\n * Anything before the last \".\" is not returned.\r\n * @returns The normalized file extension.\r\n * @throws If the extension contains illegal characters.\r\n * @param ext file extension\r\n * @example ```ts\r\n * normalizeFileExtension('jpg');;\r\n * //=> '.jpg'\r\n * normalizeFileExtension('.jpg');;\r\n * //=> '.jpg'\r\n * normalizeFileExtension('..jpg');;\r\n * //=> '.jpg'\r\n * normalizeFileExtension('');;\r\n * //=> ''\r\n * normalizeFileExtension('.');;\r\n * //=> ''\r\n * normalizeFileExtension('jpg|png');;\r\n * //=> Error\r\n * ```\r\n */\r\nexport function normalizeFileExtension(ext: string): string {\r\n if (ext === '' || ext === '.') return ''\r\n if (/[<>\"|?*:]/g.test(ext)) {\r\n throw new Error(`Illegal characters in file extension: ${ext} | Illegal characters are: <>\"|?:*`)\r\n }\r\n if (!ext.includes('.')) return '.' + ext\r\n return ext.substring(ext.lastIndexOf('.'))\r\n}\r\n","import path from 'path'\nimport { normalizeFileExtension } from './normalizeFileExtension'\n\n/**\n * Takes a list of file extensions and returns a filter function that returns true if a filepath/filename passed to it contains one of the given file extensions.\n * @remarks If no file extensions are provided, the filter will always return true.\n * @returns A function that takes a filepath and returns true if the filepath has one of the specified file extensions, false otherwise.\n * @param fileExtensions file extensions\n * @example ```ts\n * createFileExtensionFilter('.ts', '.tsx')('index.ts');;\n * //=> true\n * createFileExtensionFilter('.ts', '.tsx')('index.js');;\n * //=> false\n * ```\n */\nexport function createFileExtensionFilter(...fileExtensions: string[]): (filepath: string) => boolean {\n if (!fileExtensions.length) return () => true\n return (filepath: string) => {\n for (const ext of fileExtensions.map(normalizeFileExtension)) {\n if (path.extname(filepath) === ext) {\n return true\n }\n }\n return false\n }\n}\n","import path from 'path'\r\n\r\n/**\r\n * Joins the given path segments to the current working directory path, and normalizes the resulting path.\r\n * @remarks\r\n * The function uses the `path.join` method from the Node.js `path` module, and the `process.cwd` method from the Node.js `process` module.\r\n * @param paths - The path segments to join to the current working directory path.\r\n * @returns The resulting path.\r\n * @example ```ts\r\n * console.log(cwdpath('src', 'index.ts'));\r\n * //=> '{working_directory}/src/index.ts'\r\n * ```\r\n */\r\nexport function cwdpath(...paths: string[]): string {\r\n return path.join(process.cwd(), ...paths)\r\n}\r\n","import fs from 'fs'\n\n/**\n * Deletes a directory and all of its contents.\n * @remarks This function uses Node.js's `fs.promises.rm` method with the `recursive` and `force` options set to `true`.\n * This means it will delete the directory and all of its contents, even if the directory is not empty.\n * @param dirpath The path to the directory to delete.\n * @returns A Promise that resolves when the directory has been deleted.\n * @throws Will throw an error if the directory does not exist, or if there was a problem deleting the directory.\n * @example ```ts\n * deleteDirectory('/path/to/directory');\n * ```\n */\nexport async function deleteDirectory(dirpath: string): Promise<void> {\n await fs.promises.rm(dirpath, { recursive: true, force: true })\n}\n","import fs from 'fs'\n\n/**\n * Deletes a directory safely if it exists.\n * @remarks This function uses Node.js' `fs.promises.rm` method with the `recursive` and `force` options set to `true`.\n * This means it will delete the directory and all its contents, even if the directory is not empty.\n * @param dirpath The path of the directory to delete.\n * @returns A promise that resolves to `void` when the directory has been deleted.\n * @throws Will throw an error if the `fs.promises.rm` operation fails.\n * @example ```ts\n * deleteDirectorySafe('/path/to/directory');;\n * //=> undefined\n * ```\n */\nexport async function deleteDirectorySafe(dirpath: string): Promise<void> {\n if (fs.existsSync(dirpath)) await fs.promises.rm(dirpath, { recursive: true, force: true })\n}\n","import fs from 'fs'\n\n/**\n * Deletes a directory synchronously in a safe manner. If the directory does not exist, it will simply return the directory path without throwing an error.\n * @param dirpath The path of the directory to be deleted.\n * @returns The path of the directory that was intended to be deleted.\n * @throws Will throw an error if the operation fails for reasons other than the directory not existing.\n * @example ```ts\n * deleteDirectorySafeSync('/path/to/directory');;\n * //=> undefined\n * ```\n */\nexport function deleteDirectorySafeSync(dirpath: string): string {\n if (!fs.existsSync(dirpath)) return dirpath\n fs.rmSync(dirpath, { recursive: true, force: true })\n return dirpath\n}\n","import fs from 'fs'\n\n/**\n * Deletes a directory synchronously.\n * @remarks This function uses Node.js's `fs.rmSync` method with the options `{ recursive: true, force: true }`.\n * @param dirpath The path of the directory to delete.\n * @returns The path of the deleted directory.\n * @throws Will throw an error if the directory does not exist or if the process lacks permissions to delete it.\n * @example ```ts\n * deleteDirectorySync('/path/to/directory');;\n * //=> undefined\n * ```\n */\nexport function deleteDirectorySync(dirpath: string): string {\n fs.rmSync(dirpath, { recursive: true, force: true })\n return dirpath\n}\n","import { IEnsureValidWindowsPathOptions } from './types/IEnsureValidWindowsPathOptions'\r\n\r\n/**\r\n * Check whether a provided windows filesystem path string is valid according to:\r\n * https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx\r\n * @param path The path to validate.\r\n * @returns A boolean indicating whether the path is valid. If the `assert` option is true, the function will throw an error instead of returning false.\r\n * @throws Will throw an error if the `assert` option is true and the path is invalid.\r\n * @param options An optional object that may contain the following properties:\r\n * - `assert`: If true, the function will throw an error if the path is invalid. Default is false.\r\n * - `extendedMaxLength`: If true, the function will allow paths up to 32767 characters long. Default is false.\r\n * @example ```ts\r\n * ensureValidWindowsPath('C:\\\\Users\\\\User\\\\Documents\\\\file.txt');;\r\n * //=> true\r\n * ensureValidWindowsPath('C:/Users/User/Documents/file.txt');;\r\n * //=> false\r\n * ensureValidWindowsPath('C:\\\\Users\\\\User\\\\Documents\\\\file.txt', { assert: true });;\r\n * //=> throws an error\r\n * ensureValidWindowsPath('C:\\\\Users\\\\User\\\\Documents\\\\file.txt', { extendedMaxLength: true });;\r\n * //=> true\r\n * ```\r\n */\r\nexport function ensureValidWindowsPath(path: string, options?: IEnsureValidWindowsPathOptions): boolean {\r\n const throwOrFalse = (msg: string) => {\r\n if (options && options.assert === true) {\r\n throw new Error(`Invalid windows path. ${msg} | input received: ${path}`)\r\n }\r\n return false\r\n }\r\n\r\n if (path.length === 0) {\r\n return throwOrFalse('Path string is length 0.')\r\n }\r\n\r\n if (path.indexOf('/') !== -1 && path.indexOf('\\\\') !== -1) {\r\n return throwOrFalse('Path contains both backslash and forward slash.')\r\n }\r\n\r\n const maxLength = (options && options.extendedMaxLength ? 32767 : 260) - 12\r\n if (path.length > maxLength) {\r\n return throwOrFalse(`Maximum length of ${maxLength} exceeded`)\r\n }\r\n\r\n let noDriveLetter = path\r\n if (/^\\w:(\\\\|\\/)/g.test(path)) {\r\n noDriveLetter = path.substring(2)\r\n }\r\n if (/[<>\"|?*:]/g.test(noDriveLetter)) {\r\n return throwOrFalse(`Illegal characters in: ${path} | Illegal characters are: <>\"|?:*`)\r\n }\r\n\r\n if (/(\\\\|\\/)(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])((\\\\|\\/)|$)/g.test(path)) {\r\n return throwOrFalse('Illegal name in path string')\r\n }\r\n\r\n return true\r\n}\r\n","export function isWindows() {\r\n return process.platform.includes('win')\r\n}\r\n","import { execSync } from 'child_process'\r\nimport path from 'path'\r\nimport { isWindows } from './isWindows'\r\n\r\nexport function getDiskDrivesWindows(): string[] {\r\n if (!isWindows()) throw new Error('This function is only available on Windows.')\r\n return execSync('wmic logicaldisk get name')\r\n .toString()\r\n .split('\\n')\r\n .map((s) => s.trim())\r\n .filter((s) => /^[a-z]:/i.test(s))\r\n .map((s) => s.substring(0, 2) + path.sep)\r\n}\r\n","import path from 'path'\r\n\r\nexport function getHomeDirectory(): string {\r\n const home = path.resolve(process.env['HOME'] || process.env['USERPROFILE'] || '')\r\n if (!home) throw new Error('Home directory not found')\r\n return home\r\n}\r\n","import path from 'path'\r\nimport { getHomeDirectory } from './getHomeDirectory'\r\n\r\nexport function getDownloadsDirectory() {\r\n return path.join(getHomeDirectory(), 'Downloads')\r\n}\r\n","import fs from 'fs'\r\nimport path from 'path'\r\n\r\nexport async function getLastMofifiedFileIn(dirpath: string): Promise<string> {\r\n const children = await fs.promises.readdir(dirpath)\r\n const filtered = children\r\n .map((fname: string) => {\r\n const fpath = path.join(dirpath, fname)\r\n const stat = fs.statSync(fpath)\r\n return [fpath, stat.mtimeMs, stat.isFile()]\r\n })\r\n .filter((a) => a[2]) as [string, number, boolean][]\r\n const sorted = filtered.sort((a, b) => b[1] - a[1])\r\n return sorted[0][0]\r\n}\r\n","import path from 'path'\r\n\r\nexport function getRootDir() {\r\n return path.parse(process.cwd()).root\r\n}\r\n","import fs from 'fs'\r\n\r\n/**\r\n * Reads a JSON file from the given filepath and returns its content as a Promise.\r\n * The Promise will resolve with the parsed JSON content as an object of type T.\r\n * @template T The expected return type of the JSON object.\r\n * @param filepath The path to the JSON file to read.\r\n * @returns A Promise that resolves with the parsed JSON content as an object of type T.\r\n * @throws Will throw an error if reading the file fails for any reason.\r\n * @example ```ts\r\n * const data: MyType = await readJsonFile<MyType>('path/to/myfile.json');\r\n * ```\r\n */\r\nexport async function readJsonFile<T>(filepath: string): Promise<T> {\r\n return JSON.parse(await fs.promises.readFile(filepath, 'utf8'))\r\n}\r\n","import fs from 'fs'\r\n\r\n/**\r\n * Reads a JSON file synchronously and returns a Promise that resolves with the parsed JSON data.\r\n * @template T The expected return type of the JSON data.\r\n * @param filepath The path to the JSON file to read.\r\n * @returns A Promise that resolves with the parsed JSON data.\r\n * @throws If the file cannot be read or the content cannot be parsed as JSON.\r\n * @example ```ts\r\n * const data = await readJsonFileSync<MyType>('/path/to/file.json');\r\n * console.log(data);\r\n * ```\r\n */\r\nexport function readJsonFileSync<T>(filepath: string): T {\r\n return JSON.parse(fs.readFileSync(filepath, 'utf8'))\r\n}\r\n","import fs from 'fs'\r\nimport path from 'path'\r\nimport { readJsonFileSync } from './readJsonFileSync'\r\n\r\nexport function readPackageJson(projectRoot = process.cwd()): Record<string, any> | undefined {\r\n const filepath = path.join(projectRoot, 'package.json')\r\n if (!fs.existsSync(filepath)) return\r\n return readJsonFileSync(filepath)\r\n}\r\n","export function removeIllegalFilenameCharacters(string: string) {\r\n return string.replace(/[/\\\\?%*:|\"<>]/g, '')\r\n}\r\n","import extract from 'extract-zip'\r\n\r\nexport async function unzipFile(filepath: string, outdir: string) {\r\n await extract(filepath, { dir: outdir })\r\n}\r\n","import extract from 'extract-zip'\r\nimport fs from 'fs'\r\nimport path from 'path'\r\n\r\n/**\r\n * @param source Either a directory containing zip files or an array of zip file paths.\r\n */\r\nexport async function unzipMergeFiles(source: string | string[], target: string) {\r\n if (typeof source === 'string') {\r\n source = fs.readdirSync(source).map((filename) => {\r\n return path.join(source as string, filename)\r\n })\r\n }\r\n for (const filepath of source) {\r\n const stat = await fs.promises.stat(filepath)\r\n if (stat.isDirectory()) continue\r\n if (!filepath.endsWith('.zip')) continue\r\n await extract(filepath, { dir: target })\r\n }\r\n}\r\n","import { createDirectory } from './createDirectory'\r\nimport { deleteDirectorySafe } from './deleteDirectorySafe'\r\n\r\nexport async function wipeDirectorySafe(dirpath: string) {\r\n await deleteDirectorySafe(dirpath)\r\n await createDirectory(dirpath)\r\n}\r\n","import fs from 'fs'\n\n/**\n * Writes a JSON file to the specified filepath. The data to be written is passed as an argument.\n * If the 'pretty' argument is set to true, the JSON data will be formatted in a more human-readable way.\n * @template T - The type of the data to be written to the file.\n * @param filepath - The path to the file where the data should be written.\n * @param data - The data to be written to the file.\n * @param pretty - Optional. If set to true, formats the JSON data in a more human-readable way. Default is false.\n * @returns A Promise that resolves when the file has been successfully written.\n * @example ```ts\n * const data = { name: 'John', age: 30 };\n * await writeJsonFile('./data.json', data, true);\n * ```\n */\nexport async function writeJsonFile<T>(filepath: string, data: T, pretty = false): Promise<void> {\n await fs.promises.writeFile(filepath, JSON.stringify(data, null, pretty ? 2 : undefined))\n}\n","import fs from 'fs'\n\n/**\n * Writes a JSON object to a file synchronously.\n * @typeParam T - The type of the JSON object.\n * @param filepath - The path of the file where the JSON object will be written.\n * @param data - The JSON object that will be written to the file.\n * @param pretty - If true, the JSON object will be formatted with indentation and line breaks. Default is false.\n * @throws If the file cannot be written.\n * @example ```ts\n * const data = { name: 'John', age: 30 };\n * writeJsonFileSync('./data.json', data, true);\n * ```\n */\nexport function writeJsonFileSync<T>(filepath: string, data: T, pretty = false): void {\n fs.writeFileSync(filepath, JSON.stringify(data, null, pretty ? 2 : undefined))\n}\n"],"names":["absoluteToRelativePath","absolute","workingDirectory","process","cwd","path","normalize","replace","RegExp","regexEscapeString","sep","createDirectory","dirpath","fs","promises","mkdir","recursive","appendLineToFile","filepath","line","linebreakBefore","existsSync","dirname","writeFile","appendFile","cleanDirectorySync","predicate","filename","readdirSync","join","stat","statSync","unlinkSync","createDirectorySync","mkdirSync","normalizeFileExtension","ext","test","Error","includes","substring","lastIndexOf","createFileExtensionFilter","fileExtensions","length","map","extname","cwdpath","paths","deleteDirectory","rm","force","deleteDirectorySafe","deleteDirectorySafeSync","rmSync","deleteDirectorySync","ensureValidWindowsPath","options","throwOrFalse","msg","assert","indexOf","maxLength","extendedMaxLength","noDriveLetter","isWindows","platform","getDiskDrivesWindows","execSync","toString","split","s","trim","filter","getHomeDirectory","home","resolve","env","HOME","USERPROFILE","getDownloadsDirectory","getLastMofifiedFileIn","children","readdir","filtered","fname","fpath","mtimeMs","isFile","a","sorted","sort","b","getRootDir","parse","root","readJsonFile","JSON","readFile","readJsonFileSync","readFileSync","readPackageJson","projectRoot","removeIllegalFilenameCharacters","string","unzipFile","outdir","extract","dir","unzipMergeFiles","source","target","isDirectory","endsWith","wipeDirectorySafe","writeJsonFile","data","pretty","stringify","writeJsonFileSync","writeFileSync"],"mappings":";;;;iKAeM,QAAU,CAAAA,sBAAsBA,CAACC,QAAgB,CAAEC,gBAAgB,CAAGC,OAAO,CAACC,GAAG,CAAA,CAAE,CAAA,CACvF,MAAO,CAAAC,IAAI,CACRC,SAAS,CAACL,QAAQ,CAAC,CACnBM,OAAO,CAAC,GAAI,CAAAC,MAAM,CAACC,wBAAiB,CAACJ,IAAI,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AQ,CAAA,CAAC,CACzC,EACF,CAAA,CChBK,QAAgB,CAAAG,iBAAiBA,CAACtG,OAAe,CAAA,iDACrD,KAAM,CAAAwC,mBAAmB,CAACxC,OAAO,CAAC,CAClC,KAAM,CAAAD,eAAe,CAACC,OAAO,EAC9B,CAAA,CCSK,QAAgB,CAAAuG,aAAaA,CAAIjG,QAAgB,CAAEkG,IAAO,CAAEC,MAAM,GAAQ,CAAA,iDAC9E,KAAM,CAAAxG,EAAE,CAACC,QAAQ,CAACS,SAAS,CAACL,QAAQ,CAAE+E,IAAI,CAACqB,SAAS,CAACF,IAAI,CAAE,IAAI,CAAEC,MAAM,CAAG,CAAC,OAAY,CAAC,EACzF,CAAA,CCHK,QAAU,CAAAE,iBAAiBA,CAAIrG,QAAgB,CAAEkG,IAAO,CAAEC,MAAM,GAAQ,CAAA,CAC5ExG,EAAE,CAAC2G,aAAa,CAACtG,QAAQ,CAAE+E,IAAI,CAACqB,SAAS,CAACF,IAAI,CAAE,IAAI,CAAEC,MAAM,CAAG,CAAC,OAAY,CAAC,CAC/E"}
package/dist/index.esm.js DELETED
@@ -1,6 +0,0 @@
1
- /*!
2
- * @bemoje/fs v0.0.9
3
- * (c) Benjamin Møller Jensen
4
- * Released under the MIT License.
5
- */import{regexEscapeString}from"@bemoje/string";import path from"path";import fs from"fs";import{execSync}from"child_process";import extract from"extract-zip";function absoluteToRelativePath(absolute,workingDirectory=process.cwd()){return path.normalize(absolute).replace(new RegExp(regexEscapeString(path.normalize(workingDirectory)+path.sep),"i"),"")}function __awaiter(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})}"function"==typeof SuppressedError?SuppressedError:function(error,suppressed,message){var e=new Error(message);return e.name="SuppressedError",e.error=error,e.suppressed=suppressed,e};function createDirectory(dirpath){return __awaiter(this,void 0,void 0,function*(){return yield fs.promises.mkdir(dirpath,{recursive:!0}),dirpath})}function appendLineToFile(filepath,line,linebreakBefore=!1){return __awaiter(this,void 0,void 0,function*(){fs.existsSync(filepath)||(yield createDirectory(path.dirname(filepath)),yield fs.promises.writeFile(filepath,"")),yield fs.promises.appendFile(filepath,linebreakBefore?"\n"+line:line+"\n")})}function cleanDirectorySync(dirpath,predicate){for(const filename of fs.readdirSync(dirpath)){const filepath=path.join(dirpath,filename),stat=fs.statSync(filepath);predicate(filepath,stat)&&fs.unlinkSync(filepath)}}function createDirectorySync(dirpath){return fs.mkdirSync(dirpath,{recursive:!0}),dirpath}function normalizeFileExtension(ext){if(""===ext||"."===ext)return"";if(/[<>"|?*:]/g.test(ext))throw new Error(`Illegal characters in file extension: ${ext} | Illegal characters are: <>"|?:*`);return ext.includes(".")?ext.substring(ext.lastIndexOf(".")):"."+ext}function createFileExtensionFilter(...fileExtensions){return fileExtensions.length?filepath=>{for(const ext of fileExtensions.map(normalizeFileExtension))if(path.extname(filepath)===ext)return!0;return!1}:()=>!0}function cwdpath(...paths){return path.join(process.cwd(),...paths)}function deleteDirectory(dirpath){return __awaiter(this,void 0,void 0,function*(){yield fs.promises.rm(dirpath,{recursive:!0,force:!0})})}function deleteDirectorySafe(dirpath){return __awaiter(this,void 0,void 0,function*(){fs.existsSync(dirpath)&&(yield fs.promises.rm(dirpath,{recursive:!0,force:!0}))})}function deleteDirectorySafeSync(dirpath){return fs.existsSync(dirpath)?(fs.rmSync(dirpath,{recursive:!0,force:!0}),dirpath):dirpath}function deleteDirectorySync(dirpath){return fs.rmSync(dirpath,{recursive:!0,force:!0}),dirpath}function ensureValidWindowsPath(path,options){const throwOrFalse=msg=>{if(options&&!0===options.assert)throw new Error(`Invalid windows path. ${msg} | input received: ${path}`);return!1};if(0===path.length)return throwOrFalse("Path string is length 0.");if(-1!==path.indexOf("/")&&-1!==path.indexOf("\\"))return throwOrFalse("Path contains both backslash and forward slash.");const maxLength=(options&&options.extendedMaxLength?32767:260)-12;if(path.length>maxLength)return throwOrFalse(`Maximum length of ${maxLength} exceeded`);let noDriveLetter=path;return /^\w:(\\|\/)/g.test(path)&&(noDriveLetter=path.substring(2)),/[<>"|?*:]/g.test(noDriveLetter)?throwOrFalse(`Illegal characters in: ${path} | Illegal characters are: <>"|?:*`):!/(\\|\/)(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])((\\|\/)|$)/g.test(path)||throwOrFalse("Illegal name in path string")}function isWindows(){return process.platform.includes("win")}function getDiskDrivesWindows(){if(!isWindows())throw new Error("This function is only available on Windows.");return execSync("wmic logicaldisk get name").toString().split("\n").map(s=>s.trim()).filter(s=>/^[a-z]:/i.test(s)).map(s=>s.substring(0,2)+path.sep)}function getHomeDirectory(){const home=path.resolve(process.env.HOME||process.env.USERPROFILE||"");if(!home)throw new Error("Home directory not found");return home}function getDownloadsDirectory(){return path.join(getHomeDirectory(),"Downloads")}function getLastMofifiedFileIn(dirpath){return __awaiter(this,void 0,void 0,function*(){const children=yield fs.promises.readdir(dirpath),filtered=children.map(fname=>{const fpath=path.join(dirpath,fname),stat=fs.statSync(fpath);return[fpath,stat.mtimeMs,stat.isFile()]}).filter(a=>a[2]),sorted=filtered.sort((a,b)=>b[1]-a[1]);return sorted[0][0]})}function getRootDir(){return path.parse(process.cwd()).root}function readJsonFile(filepath){return __awaiter(this,void 0,void 0,function*(){return JSON.parse(yield fs.promises.readFile(filepath,"utf8"))})}function readJsonFileSync(filepath){return JSON.parse(fs.readFileSync(filepath,"utf8"))}function readPackageJson(projectRoot=process.cwd()){const filepath=path.join(projectRoot,"package.json");return fs.existsSync(filepath)?readJsonFileSync(filepath):void 0}function removeIllegalFilenameCharacters(string){return string.replace(/[/\\?%*:|"<>]/g,"")}function unzipFile(filepath,outdir){return __awaiter(this,void 0,void 0,function*(){yield extract(filepath,{dir:outdir})})}function unzipMergeFiles(source,target){return __awaiter(this,void 0,void 0,function*(){"string"==typeof source&&(source=fs.readdirSync(source).map(filename=>path.join(source,filename)));for(const filepath of source){const stat=yield fs.promises.stat(filepath);stat.isDirectory()||filepath.endsWith(".zip")&&(yield extract(filepath,{dir:target}))}})}function wipeDirectorySafe(dirpath){return __awaiter(this,void 0,void 0,function*(){yield deleteDirectorySafe(dirpath),yield createDirectory(dirpath)})}function writeJsonFile(filepath,data,pretty=!1){return __awaiter(this,void 0,void 0,function*(){yield fs.promises.writeFile(filepath,JSON.stringify(data,null,pretty?2:void 0))})}function writeJsonFileSync(filepath,data,pretty=!1){fs.writeFileSync(filepath,JSON.stringify(data,null,pretty?2:void 0))}export{absoluteToRelativePath,appendLineToFile,cleanDirectorySync,createDirectory,createDirectorySync,createFileExtensionFilter,cwdpath,deleteDirectory,deleteDirectorySafe,deleteDirectorySafeSync,deleteDirectorySync,ensureValidWindowsPath,getDiskDrivesWindows,getDownloadsDirectory,getHomeDirectory,getLastMofifiedFileIn,getRootDir,isWindows,normalizeFileExtension,readJsonFile,readJsonFileSync,readPackageJson,removeIllegalFilenameCharacters,unzipFile,unzipMergeFiles,wipeDirectorySafe,writeJsonFile,writeJsonFileSync};
6
- //# sourceMappingURL=index.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.esm.js","sources":["../src/lib/absoluteToRelativePath.ts","../src/lib/createDirectory.ts","../src/lib/appendLineToFile.ts","../src/lib/cleanDirectorySync.ts","../src/lib/createDirectorySync.ts","../src/lib/normalizeFileExtension.ts","../src/lib/createFileExtensionFilter.ts","../src/lib/cwdpath.ts","../src/lib/deleteDirectory.ts","../src/lib/deleteDirectorySafe.ts","../src/lib/deleteDirectorySafeSync.ts","../src/lib/deleteDirectorySync.ts","../src/lib/ensureValidWindowsPath.ts","../src/lib/isWindows.ts","../src/lib/getDiskDrivesWindows.ts","../src/lib/getHomeDirectory.ts","../src/lib/getDownloadsDirectory.ts","../src/lib/getLastMofifiedFileIn.ts","../src/lib/getRootDir.ts","../src/lib/readJsonFile.ts","../src/lib/readJsonFileSync.ts","../src/lib/readPackageJson.ts","../src/lib/removeIllegalFilenameCharacters.ts","../src/lib/unzipFile.ts","../src/lib/unzipMergeFiles.ts","../src/lib/wipeDirectorySafe.ts","../src/lib/writeJsonFile.ts","../src/lib/writeJsonFileSync.ts"],"sourcesContent":["import { regexEscapeString } from '@bemoje/string'\r\nimport path from 'path'\r\n\r\n/**\r\n * If the filepath is somewhere in the current working directory, it can be converted into a relative path.\r\n * @remarks This function takes an absolute path as input and returns a relative path. It replaces the current working directory in the path with an empty string,\r\n * replaces all backslashes with forward slashes, and removes any leading forward slashes.\r\n * @param workingDirectory The directory relative to which the path should be converted. Defaults to the current working directory.\r\n * @returns The relative path.\r\n * @param absolute the absolute filepath to convert.\r\n * @example ```ts\r\n * absoluteToRelativePath(__filename)\r\n * //=> 'src/absoluteToRelativePath.ts'\r\n * ```\r\n */\r\nexport function absoluteToRelativePath(absolute: string, workingDirectory = process.cwd()): string {\r\n return path\r\n .normalize(absolute)\r\n .replace(new RegExp(regexEscapeString(path.normalize(workingDirectory) + path.sep), 'i'), '')\r\n}\r\n","import fs from 'fs'\n/**\n * Create a directory at a given path if it does not exist.\n * Automatically creates parent directories if they do not exist.\n * @param dirpath The path where the directory should be created.\n * @returns The path of the directory.\n * @throws Will throw an error if the directory cannot be created.\n * @example ```ts\n * createDirectory('/path/to/directory').then((dirpath) => {\n * //=> `Directory created at ${dirpath}`\n * });\n * ```\n */\nexport async function createDirectory(dirpath: string): Promise<string> {\n await fs.promises.mkdir(dirpath, { recursive: true })\n return dirpath\n}\n","import fs from 'fs'\r\nimport path from 'path'\r\nimport { createDirectory } from './createDirectory'\r\n\r\n/**\r\n * Append a line to a file. Creates the file if it does not exist.\r\n * @param filepath The path of the file.\r\n * @param line The string data to append.\r\n * @returns A Promise that resolves when the line has been appended to the file.\r\n * @throws Will throw an error if the operation fails.\r\n * @example ```ts\r\n * await appendLineToFile('/path/to/file', 'This is a new line')\r\n * ```\r\n */\r\nexport async function appendLineToFile(filepath: string, line: string, linebreakBefore = false): Promise<void> {\r\n if (!fs.existsSync(filepath)) {\r\n await createDirectory(path.dirname(filepath))\r\n await fs.promises.writeFile(filepath, '')\r\n }\r\n await fs.promises.appendFile(filepath, linebreakBefore ? '\\n' + line : line + '\\n')\r\n}\r\n","import type { Stats } from 'fs'\r\nimport fs from 'fs'\r\nimport path from 'path'\r\n\r\n/**\r\n * Synchronously cleans a directory by removing files that satisfy a given predicate.\r\n * @remarks This function is a part of the File System module.\r\n * @param dirpath - The path to the directory that needs to be cleaned.\r\n * @param predicate - A function that takes a filepath and its stats as arguments and returns a boolean. If the function returns true for a file, that file is removed from the directory.\r\n * @throws If the directory at the provided path does not exist or cannot be read.\r\n * @example ```ts\r\n * import { Stats } from 'fs';\r\n * const dirpath = './my-directory';\r\n * const predicate = (filepath: string, stat: Stats) => stat.size > 1024;\r\n * cleanDirectorySync(dirpath, predicate);\r\n * ```\r\n */\r\nexport function cleanDirectorySync(dirpath: string, predicate: (filepath: string, stat: Stats) => boolean): void {\r\n for (const filename of fs.readdirSync(dirpath)) {\r\n const filepath = path.join(dirpath, filename)\r\n const stat = fs.statSync(filepath)\r\n if (predicate(filepath, stat)) fs.unlinkSync(filepath)\r\n }\r\n}\r\n","import fs from 'fs'\n\n/**\n * Create a directory at a given path if it does not exist.\n * Automatically creates parent directories if they do not exist.\n * @param dirpath The path where the directory should be created.\n * @returns The path of the directory.\n * @example ```ts\n * createDirectorySync('/path/to/directory')\n * ```\n */\nexport function createDirectorySync(dirpath: string): string {\n fs.mkdirSync(dirpath, { recursive: true })\n return dirpath\n}\n","/**\r\n * Normalize a file extension to the form: .[ext]\r\n * Anything before the last \".\" is not returned.\r\n * @returns The normalized file extension.\r\n * @throws If the extension contains illegal characters.\r\n * @param ext file extension\r\n * @example ```ts\r\n * normalizeFileExtension('jpg');;\r\n * //=> '.jpg'\r\n * normalizeFileExtension('.jpg');;\r\n * //=> '.jpg'\r\n * normalizeFileExtension('..jpg');;\r\n * //=> '.jpg'\r\n * normalizeFileExtension('');;\r\n * //=> ''\r\n * normalizeFileExtension('.');;\r\n * //=> ''\r\n * normalizeFileExtension('jpg|png');;\r\n * //=> Error\r\n * ```\r\n */\r\nexport function normalizeFileExtension(ext: string): string {\r\n if (ext === '' || ext === '.') return ''\r\n if (/[<>\"|?*:]/g.test(ext)) {\r\n throw new Error(`Illegal characters in file extension: ${ext} | Illegal characters are: <>\"|?:*`)\r\n }\r\n if (!ext.includes('.')) return '.' + ext\r\n return ext.substring(ext.lastIndexOf('.'))\r\n}\r\n","import path from 'path'\nimport { normalizeFileExtension } from './normalizeFileExtension'\n\n/**\n * Takes a list of file extensions and returns a filter function that returns true if a filepath/filename passed to it contains one of the given file extensions.\n * @remarks If no file extensions are provided, the filter will always return true.\n * @returns A function that takes a filepath and returns true if the filepath has one of the specified file extensions, false otherwise.\n * @param fileExtensions file extensions\n * @example ```ts\n * createFileExtensionFilter('.ts', '.tsx')('index.ts');;\n * //=> true\n * createFileExtensionFilter('.ts', '.tsx')('index.js');;\n * //=> false\n * ```\n */\nexport function createFileExtensionFilter(...fileExtensions: string[]): (filepath: string) => boolean {\n if (!fileExtensions.length) return () => true\n return (filepath: string) => {\n for (const ext of fileExtensions.map(normalizeFileExtension)) {\n if (path.extname(filepath) === ext) {\n return true\n }\n }\n return false\n }\n}\n","import path from 'path'\r\n\r\n/**\r\n * Joins the given path segments to the current working directory path, and normalizes the resulting path.\r\n * @remarks\r\n * The function uses the `path.join` method from the Node.js `path` module, and the `process.cwd` method from the Node.js `process` module.\r\n * @param paths - The path segments to join to the current working directory path.\r\n * @returns The resulting path.\r\n * @example ```ts\r\n * console.log(cwdpath('src', 'index.ts'));\r\n * //=> '{working_directory}/src/index.ts'\r\n * ```\r\n */\r\nexport function cwdpath(...paths: string[]): string {\r\n return path.join(process.cwd(), ...paths)\r\n}\r\n","import fs from 'fs'\n\n/**\n * Deletes a directory and all of its contents.\n * @remarks This function uses Node.js's `fs.promises.rm` method with the `recursive` and `force` options set to `true`.\n * This means it will delete the directory and all of its contents, even if the directory is not empty.\n * @param dirpath The path to the directory to delete.\n * @returns A Promise that resolves when the directory has been deleted.\n * @throws Will throw an error if the directory does not exist, or if there was a problem deleting the directory.\n * @example ```ts\n * deleteDirectory('/path/to/directory');\n * ```\n */\nexport async function deleteDirectory(dirpath: string): Promise<void> {\n await fs.promises.rm(dirpath, { recursive: true, force: true })\n}\n","import fs from 'fs'\n\n/**\n * Deletes a directory safely if it exists.\n * @remarks This function uses Node.js' `fs.promises.rm` method with the `recursive` and `force` options set to `true`.\n * This means it will delete the directory and all its contents, even if the directory is not empty.\n * @param dirpath The path of the directory to delete.\n * @returns A promise that resolves to `void` when the directory has been deleted.\n * @throws Will throw an error if the `fs.promises.rm` operation fails.\n * @example ```ts\n * deleteDirectorySafe('/path/to/directory');;\n * //=> undefined\n * ```\n */\nexport async function deleteDirectorySafe(dirpath: string): Promise<void> {\n if (fs.existsSync(dirpath)) await fs.promises.rm(dirpath, { recursive: true, force: true })\n}\n","import fs from 'fs'\n\n/**\n * Deletes a directory synchronously in a safe manner. If the directory does not exist, it will simply return the directory path without throwing an error.\n * @param dirpath The path of the directory to be deleted.\n * @returns The path of the directory that was intended to be deleted.\n * @throws Will throw an error if the operation fails for reasons other than the directory not existing.\n * @example ```ts\n * deleteDirectorySafeSync('/path/to/directory');;\n * //=> undefined\n * ```\n */\nexport function deleteDirectorySafeSync(dirpath: string): string {\n if (!fs.existsSync(dirpath)) return dirpath\n fs.rmSync(dirpath, { recursive: true, force: true })\n return dirpath\n}\n","import fs from 'fs'\n\n/**\n * Deletes a directory synchronously.\n * @remarks This function uses Node.js's `fs.rmSync` method with the options `{ recursive: true, force: true }`.\n * @param dirpath The path of the directory to delete.\n * @returns The path of the deleted directory.\n * @throws Will throw an error if the directory does not exist or if the process lacks permissions to delete it.\n * @example ```ts\n * deleteDirectorySync('/path/to/directory');;\n * //=> undefined\n * ```\n */\nexport function deleteDirectorySync(dirpath: string): string {\n fs.rmSync(dirpath, { recursive: true, force: true })\n return dirpath\n}\n","import { IEnsureValidWindowsPathOptions } from './types/IEnsureValidWindowsPathOptions'\r\n\r\n/**\r\n * Check whether a provided windows filesystem path string is valid according to:\r\n * https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx\r\n * @param path The path to validate.\r\n * @returns A boolean indicating whether the path is valid. If the `assert` option is true, the function will throw an error instead of returning false.\r\n * @throws Will throw an error if the `assert` option is true and the path is invalid.\r\n * @param options An optional object that may contain the following properties:\r\n * - `assert`: If true, the function will throw an error if the path is invalid. Default is false.\r\n * - `extendedMaxLength`: If true, the function will allow paths up to 32767 characters long. Default is false.\r\n * @example ```ts\r\n * ensureValidWindowsPath('C:\\\\Users\\\\User\\\\Documents\\\\file.txt');;\r\n * //=> true\r\n * ensureValidWindowsPath('C:/Users/User/Documents/file.txt');;\r\n * //=> false\r\n * ensureValidWindowsPath('C:\\\\Users\\\\User\\\\Documents\\\\file.txt', { assert: true });;\r\n * //=> throws an error\r\n * ensureValidWindowsPath('C:\\\\Users\\\\User\\\\Documents\\\\file.txt', { extendedMaxLength: true });;\r\n * //=> true\r\n * ```\r\n */\r\nexport function ensureValidWindowsPath(path: string, options?: IEnsureValidWindowsPathOptions): boolean {\r\n const throwOrFalse = (msg: string) => {\r\n if (options && options.assert === true) {\r\n throw new Error(`Invalid windows path. ${msg} | input received: ${path}`)\r\n }\r\n return false\r\n }\r\n\r\n if (path.length === 0) {\r\n return throwOrFalse('Path string is length 0.')\r\n }\r\n\r\n if (path.indexOf('/') !== -1 && path.indexOf('\\\\') !== -1) {\r\n return throwOrFalse('Path contains both backslash and forward slash.')\r\n }\r\n\r\n const maxLength = (options && options.extendedMaxLength ? 32767 : 260) - 12\r\n if (path.length > maxLength) {\r\n return throwOrFalse(`Maximum length of ${maxLength} exceeded`)\r\n }\r\n\r\n let noDriveLetter = path\r\n if (/^\\w:(\\\\|\\/)/g.test(path)) {\r\n noDriveLetter = path.substring(2)\r\n }\r\n if (/[<>\"|?*:]/g.test(noDriveLetter)) {\r\n return throwOrFalse(`Illegal characters in: ${path} | Illegal characters are: <>\"|?:*`)\r\n }\r\n\r\n if (/(\\\\|\\/)(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])((\\\\|\\/)|$)/g.test(path)) {\r\n return throwOrFalse('Illegal name in path string')\r\n }\r\n\r\n return true\r\n}\r\n","export function isWindows() {\r\n return process.platform.includes('win')\r\n}\r\n","import { execSync } from 'child_process'\r\nimport path from 'path'\r\nimport { isWindows } from './isWindows'\r\n\r\nexport function getDiskDrivesWindows(): string[] {\r\n if (!isWindows()) throw new Error('This function is only available on Windows.')\r\n return execSync('wmic logicaldisk get name')\r\n .toString()\r\n .split('\\n')\r\n .map((s) => s.trim())\r\n .filter((s) => /^[a-z]:/i.test(s))\r\n .map((s) => s.substring(0, 2) + path.sep)\r\n}\r\n","import path from 'path'\r\n\r\nexport function getHomeDirectory(): string {\r\n const home = path.resolve(process.env['HOME'] || process.env['USERPROFILE'] || '')\r\n if (!home) throw new Error('Home directory not found')\r\n return home\r\n}\r\n","import path from 'path'\r\nimport { getHomeDirectory } from './getHomeDirectory'\r\n\r\nexport function getDownloadsDirectory() {\r\n return path.join(getHomeDirectory(), 'Downloads')\r\n}\r\n","import fs from 'fs'\r\nimport path from 'path'\r\n\r\nexport async function getLastMofifiedFileIn(dirpath: string): Promise<string> {\r\n const children = await fs.promises.readdir(dirpath)\r\n const filtered = children\r\n .map((fname: string) => {\r\n const fpath = path.join(dirpath, fname)\r\n const stat = fs.statSync(fpath)\r\n return [fpath, stat.mtimeMs, stat.isFile()]\r\n })\r\n .filter((a) => a[2]) as [string, number, boolean][]\r\n const sorted = filtered.sort((a, b) => b[1] - a[1])\r\n return sorted[0][0]\r\n}\r\n","import path from 'path'\r\n\r\nexport function getRootDir() {\r\n return path.parse(process.cwd()).root\r\n}\r\n","import fs from 'fs'\r\n\r\n/**\r\n * Reads a JSON file from the given filepath and returns its content as a Promise.\r\n * The Promise will resolve with the parsed JSON content as an object of type T.\r\n * @template T The expected return type of the JSON object.\r\n * @param filepath The path to the JSON file to read.\r\n * @returns A Promise that resolves with the parsed JSON content as an object of type T.\r\n * @throws Will throw an error if reading the file fails for any reason.\r\n * @example ```ts\r\n * const data: MyType = await readJsonFile<MyType>('path/to/myfile.json');\r\n * ```\r\n */\r\nexport async function readJsonFile<T>(filepath: string): Promise<T> {\r\n return JSON.parse(await fs.promises.readFile(filepath, 'utf8'))\r\n}\r\n","import fs from 'fs'\r\n\r\n/**\r\n * Reads a JSON file synchronously and returns a Promise that resolves with the parsed JSON data.\r\n * @template T The expected return type of the JSON data.\r\n * @param filepath The path to the JSON file to read.\r\n * @returns A Promise that resolves with the parsed JSON data.\r\n * @throws If the file cannot be read or the content cannot be parsed as JSON.\r\n * @example ```ts\r\n * const data = await readJsonFileSync<MyType>('/path/to/file.json');\r\n * console.log(data);\r\n * ```\r\n */\r\nexport function readJsonFileSync<T>(filepath: string): T {\r\n return JSON.parse(fs.readFileSync(filepath, 'utf8'))\r\n}\r\n","import fs from 'fs'\r\nimport path from 'path'\r\nimport { readJsonFileSync } from './readJsonFileSync'\r\n\r\nexport function readPackageJson(projectRoot = process.cwd()): Record<string, any> | undefined {\r\n const filepath = path.join(projectRoot, 'package.json')\r\n if (!fs.existsSync(filepath)) return\r\n return readJsonFileSync(filepath)\r\n}\r\n","export function removeIllegalFilenameCharacters(string: string) {\r\n return string.replace(/[/\\\\?%*:|\"<>]/g, '')\r\n}\r\n","import extract from 'extract-zip'\r\n\r\nexport async function unzipFile(filepath: string, outdir: string) {\r\n await extract(filepath, { dir: outdir })\r\n}\r\n","import extract from 'extract-zip'\r\nimport fs from 'fs'\r\nimport path from 'path'\r\n\r\n/**\r\n * @param source Either a directory containing zip files or an array of zip file paths.\r\n */\r\nexport async function unzipMergeFiles(source: string | string[], target: string) {\r\n if (typeof source === 'string') {\r\n source = fs.readdirSync(source).map((filename) => {\r\n return path.join(source as string, filename)\r\n })\r\n }\r\n for (const filepath of source) {\r\n const stat = await fs.promises.stat(filepath)\r\n if (stat.isDirectory()) continue\r\n if (!filepath.endsWith('.zip')) continue\r\n await extract(filepath, { dir: target })\r\n }\r\n}\r\n","import { createDirectory } from './createDirectory'\r\nimport { deleteDirectorySafe } from './deleteDirectorySafe'\r\n\r\nexport async function wipeDirectorySafe(dirpath: string) {\r\n await deleteDirectorySafe(dirpath)\r\n await createDirectory(dirpath)\r\n}\r\n","import fs from 'fs'\n\n/**\n * Writes a JSON file to the specified filepath. The data to be written is passed as an argument.\n * If the 'pretty' argument is set to true, the JSON data will be formatted in a more human-readable way.\n * @template T - The type of the data to be written to the file.\n * @param filepath - The path to the file where the data should be written.\n * @param data - The data to be written to the file.\n * @param pretty - Optional. If set to true, formats the JSON data in a more human-readable way. Default is false.\n * @returns A Promise that resolves when the file has been successfully written.\n * @example ```ts\n * const data = { name: 'John', age: 30 };\n * await writeJsonFile('./data.json', data, true);\n * ```\n */\nexport async function writeJsonFile<T>(filepath: string, data: T, pretty = false): Promise<void> {\n await fs.promises.writeFile(filepath, JSON.stringify(data, null, pretty ? 2 : undefined))\n}\n","import fs from 'fs'\n\n/**\n * Writes a JSON object to a file synchronously.\n * @typeParam T - The type of the JSON object.\n * @param filepath - The path of the file where the JSON object will be written.\n * @param data - The JSON object that will be written to the file.\n * @param pretty - If true, the JSON object will be formatted with indentation and line breaks. Default is false.\n * @throws If the file cannot be written.\n * @example ```ts\n * const data = { name: 'John', age: 30 };\n * writeJsonFileSync('./data.json', data, true);\n * ```\n */\nexport function writeJsonFileSync<T>(filepath: string, data: T, pretty = false): void {\n fs.writeFileSync(filepath, JSON.stringify(data, null, pretty ? 2 : undefined))\n}\n"],"names":["absoluteToRelativePath","absolute","workingDirectory","process","cwd","path","normalize","replace","RegExp","regexEscapeString","sep","createDirectory","dirpath","fs","promises","mkdir","recursive","appendLineToFile","filepath","line","linebreakBefore","existsSync","dirname","writeFile","appendFile","cleanDirectorySync","predicate","filename","readdirSync","join","stat","statSync","unlinkSync","createDirectorySync","mkdirSync","normalizeFileExtension","ext","test","Error","includes","substring","lastIndexOf","createFileExtensionFilter","fileExtensions","length","map","extname","cwdpath","paths","deleteDirectory","rm","force","deleteDirectorySafe","deleteDirectorySafeSync","rmSync","deleteDirectorySync","ensureValidWindowsPath","options","throwOrFalse","msg","assert","indexOf","maxLength","extendedMaxLength","noDriveLetter","isWindows","platform","getDiskDrivesWindows","execSync","toString","split","s","trim","filter","getHomeDirectory","home","resolve","env","HOME","USERPROFILE","getDownloadsDirectory","getLastMofifiedFileIn","children","readdir","filtered","fname","fpath","mtimeMs","isFile","a","sorted","sort","b","getRootDir","parse","root","readJsonFile","JSON","readFile","readJsonFileSync","readFileSync","readPackageJson","projectRoot","removeIllegalFilenameCharacters","string","unzipFile","outdir","extract","dir","unzipMergeFiles","source","target","isDirectory","endsWith","wipeDirectorySafe","writeJsonFile","data","pretty","stringify","writeJsonFileSync","writeFileSync"],"mappings":";;;;gKAeM,QAAU,CAAAA,sBAAsBA,CAACC,QAAgB,CAAEC,gBAAgB,CAAGC,OAAO,CAACC,GAAG,CAAA,CAAE,CAAA,CACvF,MAAO,CAAAC,IAAI,CACRC,SAAS,CAACL,QAAQ,CAAC,CACnBM,OAAO,CAAC,GAAI,CAAAC,MAAM,CAACC,iBAAiB,CAACJ,IAAI,CAACC,SAAS,CAACJ,gBAAgB,CAAC,CAAGG,IAAI,CAACK,GAAG,CAAC,CAAE,GAAG,CAAC,CAAE,EAAE,CAChG,ssBCNM,QAAgB,CAAAC,eAAeA,CAACC,OAAe,CAAA,iDAEnD,MADA,MAAM,CAAAC,EAAE,CAACC,QAAQ,CAACC,KAAK,CAACH,OAAO,CAAE,CAAEI,SAAS,GAAM,CAAE,CAAC,CAC9CJ,QACR,CAAA,CCFK,QAAgB,CAAAK,gBAAgBA,CAACC,QAAgB,CAAEC,IAAY,CAAEC,eAAe,GAAQ,CAAA,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CAAE,IAAI,CAAEC,MAAM,CAAG,CAAC,OAAY,CAAC,EACzF,CAAA,CCHK,QAAU,CAAAE,iBAAiBA,CAAIrG,QAAgB,CAAEkG,IAAO,CAAEC,MAAM,GAAQ,CAAA,CAC5ExG,EAAE,CAAC2G,aAAa,CAACtG,QAAQ,CAAE+E,IAAI,CAACqB,SAAS,CAACF,IAAI,CAAE,IAAI,CAAEC,MAAM,CAAG,CAAC,OAAY,CAAC,CAC/E"}
@@ -1,30 +0,0 @@
1
- export * from './lib/absoluteToRelativePath';
2
- export * from './lib/appendLineToFile';
3
- export * from './lib/cleanDirectorySync';
4
- export * from './lib/createDirectory';
5
- export * from './lib/createDirectorySync';
6
- export * from './lib/createFileExtensionFilter';
7
- export * from './lib/cwdpath';
8
- export * from './lib/deleteDirectory';
9
- export * from './lib/deleteDirectorySafe';
10
- export * from './lib/deleteDirectorySafeSync';
11
- export * from './lib/deleteDirectorySync';
12
- export * from './lib/ensureValidWindowsPath';
13
- export * from './lib/getDiskDrivesWindows';
14
- export * from './lib/getDownloadsDirectory';
15
- export * from './lib/getHomeDirectory';
16
- export * from './lib/getLastMofifiedFileIn';
17
- export * from './lib/getRootDir';
18
- export * from './lib/isWindows';
19
- export * from './lib/normalizeFileExtension';
20
- export * from './lib/readJsonFile';
21
- export * from './lib/readJsonFileSync';
22
- export * from './lib/readPackageJson';
23
- export * from './lib/removeIllegalFilenameCharacters';
24
- export * from './lib/types/IEnsureValidWindowsPathOptions';
25
- export * from './lib/unzipFile';
26
- export * from './lib/unzipMergeFiles';
27
- export * from './lib/wipeDirectorySafe';
28
- export * from './lib/writeJsonFile';
29
- export * from './lib/writeJsonFileSync';
30
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,uBAAuB,CAAA;AACrC,cAAc,2BAA2B,CAAA;AACzC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,eAAe,CAAA;AAC7B,cAAc,uBAAuB,CAAA;AACrC,cAAc,2BAA2B,CAAA;AACzC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,2BAA2B,CAAA;AACzC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,wBAAwB,CAAA;AACtC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,8BAA8B,CAAA;AAC5C,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA;AACrC,cAAc,uCAAuC,CAAA;AACrD,cAAc,4CAA4C,CAAA;AAC1D,cAAc,iBAAiB,CAAA;AAC/B,cAAc,uBAAuB,CAAA;AACrC,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,yBAAyB,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"absoluteToRelativePath.d.ts","sourceRoot":"","sources":["../../../src/lib/absoluteToRelativePath.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,gBAAgB,SAAgB,GAAG,MAAM,CAIjG"}
@@ -1,12 +0,0 @@
1
- /**
2
- * Append a line to a file. Creates the file if it does not exist.
3
- * @param filepath The path of the file.
4
- * @param line The string data to append.
5
- * @returns A Promise that resolves when the line has been appended to the file.
6
- * @throws Will throw an error if the operation fails.
7
- * @example ```ts
8
- * await appendLineToFile('/path/to/file', 'This is a new line')
9
- * ```
10
- */
11
- export declare function appendLineToFile(filepath: string, line: string, linebreakBefore?: boolean): Promise<void>;
12
- //# sourceMappingURL=appendLineToFile.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"appendLineToFile.d.ts","sourceRoot":"","sources":["../../../src/lib/appendLineToFile.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AACH,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,eAAe,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAM7G"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"cleanDirectorySync.d.ts","sourceRoot":"","sources":["../../../src/lib/cleanDirectorySync.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,IAAI,CAAA;AAI/B;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,KAAK,OAAO,GAAG,IAAI,CAM/G"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"createDirectory.d.ts","sourceRoot":"","sources":["../../../src/lib/createDirectory.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;GAWG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAGtE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"createDirectorySync.d.ts","sourceRoot":"","sources":["../../../src/lib/createDirectorySync.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAG3D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"createFileExtensionFilter.d.ts","sourceRoot":"","sources":["../../../src/lib/createFileExtensionFilter.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,cAAc,EAAE,MAAM,EAAE,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAUpG"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"cwdpath.d.ts","sourceRoot":"","sources":["../../../src/lib/cwdpath.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,wBAAgB,OAAO,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAElD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"deleteDirectory.d.ts","sourceRoot":"","sources":["../../../src/lib/deleteDirectory.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEpE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"deleteDirectorySafe.d.ts","sourceRoot":"","sources":["../../../src/lib/deleteDirectorySafe.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAExE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"deleteDirectorySafeSync.d.ts","sourceRoot":"","sources":["../../../src/lib/deleteDirectorySafeSync.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAI/D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"deleteDirectorySync.d.ts","sourceRoot":"","sources":["../../../src/lib/deleteDirectorySync.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAG3D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ensureValidWindowsPath.d.ts","sourceRoot":"","sources":["../../../src/lib/ensureValidWindowsPath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,wCAAwC,CAAA;AAEvF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,8BAA8B,GAAG,OAAO,CAkCtG"}
@@ -1,2 +0,0 @@
1
- export declare function getDiskDrivesWindows(): string[];
2
- //# sourceMappingURL=getDiskDrivesWindows.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getDiskDrivesWindows.d.ts","sourceRoot":"","sources":["../../../src/lib/getDiskDrivesWindows.ts"],"names":[],"mappings":"AAIA,wBAAgB,oBAAoB,IAAI,MAAM,EAAE,CAQ/C"}
@@ -1,2 +0,0 @@
1
- export declare function getDownloadsDirectory(): string;
2
- //# sourceMappingURL=getDownloadsDirectory.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getDownloadsDirectory.d.ts","sourceRoot":"","sources":["../../../src/lib/getDownloadsDirectory.ts"],"names":[],"mappings":"AAGA,wBAAgB,qBAAqB,WAEpC"}
@@ -1,2 +0,0 @@
1
- export declare function getHomeDirectory(): string;
2
- //# sourceMappingURL=getHomeDirectory.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getHomeDirectory.d.ts","sourceRoot":"","sources":["../../../src/lib/getHomeDirectory.ts"],"names":[],"mappings":"AAEA,wBAAgB,gBAAgB,IAAI,MAAM,CAIzC"}
@@ -1,2 +0,0 @@
1
- export declare function getLastMofifiedFileIn(dirpath: string): Promise<string>;
2
- //# sourceMappingURL=getLastMofifiedFileIn.d.ts.map