fs-target-file 1.0.4 → 1.0.8
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/CHANGELOG.md +46 -0
- package/index.js +2 -2
- package/index.js.map +1 -1
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,52 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.0.8](https://github.com/bluelovers/ws-iconv/compare/fs-target-file@1.0.7...fs-target-file@1.0.8) (2021-12-06)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### ♻️ Chores
|
|
10
|
+
|
|
11
|
+
* **deps:** update deps ([64ec271](https://github.com/bluelovers/ws-iconv/commit/64ec2718aaa422a5d8761198824886410200c47f))
|
|
12
|
+
* **deps:** update deps ([6f71294](https://github.com/bluelovers/ws-iconv/commit/6f712943603f8e19ac85a365c96dc5f510ada784))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## [1.0.7](https://github.com/bluelovers/ws-iconv/compare/fs-target-file@1.0.6...fs-target-file@1.0.7) (2021-08-13)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### ♻️ Chores
|
|
22
|
+
|
|
23
|
+
* **deps:** update deps ([ffdf75f](https://github.com/bluelovers/ws-iconv/commit/ffdf75f27917b2698690436b66df040f2cc5cebc))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## [1.0.6](https://github.com/bluelovers/ws-iconv/compare/fs-target-file@1.0.5...fs-target-file@1.0.6) (2021-07-23)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### ♻️ Chores
|
|
33
|
+
|
|
34
|
+
* **deps:** update deps ([4b2bc91](https://github.com/bluelovers/ws-iconv/commit/4b2bc919ffe997c6f6ec01111f54041ee15fecc8))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
## [1.0.5](https://github.com/bluelovers/ws-iconv/compare/fs-target-file@1.0.4...fs-target-file@1.0.5) (2021-07-08)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### 🛠 Build System
|
|
44
|
+
|
|
45
|
+
* update .js ([a50437a](https://github.com/bluelovers/ws-iconv/commit/a50437a84acedeabe884b56978507ee04ea90d58))
|
|
46
|
+
* use tslib ([897fbd2](https://github.com/bluelovers/ws-iconv/commit/897fbd2808c31f284dd368759f715c450b033e5e))
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
6
52
|
## 1.0.4 (2021-06-16)
|
|
7
53
|
|
|
8
54
|
|
package/index.js
CHANGED
|
@@ -7,10 +7,10 @@ function fsFileMethodAsync(options) {
|
|
|
7
7
|
const { readOptions, writeOptions = {
|
|
8
8
|
spaces: 2,
|
|
9
9
|
}, } = options;
|
|
10
|
-
const { read = (file, options) => fs_extra_1.readJSON(file, {
|
|
10
|
+
const { read = (file, options) => (0, fs_extra_1.readJSON)(file, {
|
|
11
11
|
...readOptions,
|
|
12
12
|
...options,
|
|
13
|
-
}), write = (file, data, options) => fs_extra_1.outputJSON(file, data, {
|
|
13
|
+
}), write = (file, data, options) => (0, fs_extra_1.outputJSON)(file, data, {
|
|
14
14
|
...writeOptions,
|
|
15
15
|
...options,
|
|
16
16
|
}), } = options !== null && options !== void 0 ? options : {};
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAAA,uCAA2E;AAa3E,SAAgB,iBAAiB,CAA+D,OAA+C;IAE9I,OAAO,aAAP,OAAO,cAAP,OAAO,IAAP,OAAO,GAAK,EAAE,EAAC;IAEf,MAAM,EACL,WAAW,EACX,YAAY,GAAG;QACd,MA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AAS;QACT,UAAU;KACV,CAAA;AACF,CAAC;AAtBD,kDAsBC;AAED,SAAgB,YAAY,CAA+D,aAAwC,EAAE,OAA+C;IAEnL,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,iBAAiB,CAAe,OAAO,CAAC,CAAC;IAEjE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,mBAAmB,CAAC,aAAa,CAAC,CAAC;IAErE,MAAM,MAAM,GAAG;QAEd,IAAI,SAAS;YAEZ,OAAO,SAAS,CAAA;QACjB,CAAC;QAED,IAAI,UAAU;YAEb,OAAO,UAAU,CAAA;QAClB,CAAC;QAED,IAAI,CAAQ,OAAY;YAEvB,OAAO,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;QAChC,CAAC;QAED,KAAK,CAAkB,IAAO,EAAE,OAAY;YAE3C,OAAO,KAAK,CAAC,UAAU,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;QACxC,CAAC;QAED,KAAK,CAAC,KAAK;YAEV,OAAO,MAAM,CAAA;QACd,CAAC;KAED,CAAC;IAEF,OAAO,MAAM,CAAA;AAEd,CAAC;AArCD,oCAqCC;AAED,kBAAe,YAAY,CAAA","sourcesContent":["import { outputJSON, readJSON, ReadOptions, WriteOptions } from 'fs-extra';\nimport { ITSResolvable } from 'ts-type/lib/generic';\nimport { ITSRequiredPick } from 'ts-type/lib/type/record';\n\nexport interface IFileMethodAsyncOptions<RO = ReadOptions, WO = WriteOptions, D = unknown, N = string>\n{\n\tread?<T = D>(file: N, options?: RO): Promise<T>,\n\twrite?<T = D>(file: N, data: ITSResolvable<T>, options?: RO): Promise<any>,\n\n\treadOptions?: RO,\n\twriteOptions?: WO,\n}\n\nexport function fsFileMethodAsync<RO = ReadOptions, WO = WriteOptions, D = unknown, N = string>(options?: IFileMethodAsyncOptions<RO, WO, D, N>)\n{\n\toptions ??= {};\n\n\tconst {\n\t\treadOptions,\n\t\twriteOptions = {\n\t\t\tspaces: 2,\n\t\t},\n\t} = options;\n\n\tconst {\n\t\tread = (file, options) => readJSON(file, {\n\t\t\t...readOptions,\n\t\t\t...options,\n\t\t}),\n\t\twrite = (file, data, options) => outputJSON(file, data, {\n\t\t\t...writeOptions,\n\t\t\t...options,\n\t\t}),\n\t} = options ?? {};\n\n\treturn {\n\t\tread,\n\t\twrite,\n\t}\n}\n\nexport interface ITargetFileOptions<N = string>\n{\n\tinputFile: N,\n\toutputFile?: N,\n}\n\nexport function toTargetFileOptions<N = string>(targetOptions: N | ITargetFileOptions<N>): ITSRequiredPick<ITargetFileOptions<N>>\n{\n\tlet inputFile: N;\n\tlet outputFile: N;\n\n\t// @ts-ignore\n\tif (typeof targetOptions?.inputFile !== 'undefined')\n\t{\n\t\t// @ts-ignore\n\t\tinputFile = targetOptions.inputFile;\n\t\t// @ts-ignore\n\t\toutputFile = targetOptions.outputFile ?? inputFile;\n\t}\n\telse\n\t{\n\t\tinputFile = outputFile = targetOptions as N;\n\t}\n\n\treturn {\n\t\tinputFile,\n\t\toutputFile,\n\t}\n}\n\nexport function fsTargetFile<D = unknown, RO = ReadOptions, WO = WriteOptions, N = string>(targetOptions: N | ITargetFileOptions<N>, options?: IFileMethodAsyncOptions<RO, WO, D, N>)\n{\n\tconst { read, write } = fsFileMethodAsync<RO, WO, D, N>(options);\n\n\tconst { inputFile, outputFile } = toTargetFileOptions(targetOptions);\n\n\tconst target = {\n\n\t\tget inputFile()\n\t\t{\n\t\t\treturn inputFile\n\t\t},\n\n\t\tget outputFile()\n\t\t{\n\t\t\treturn outputFile\n\t\t},\n\n\t\tread<T = D>(options?: RO): Promise<T>\n\t\t{\n\t\t\treturn read(inputFile, options)\n\t\t},\n\n\t\twrite<T extends D = D>(data: T, options?: RO): Promise<unknown>\n\t\t{\n\t\t\treturn write(outputFile, data, options)\n\t\t},\n\n\t\tasync async()\n\t\t{\n\t\t\treturn target\n\t\t}\n\n\t};\n\n\treturn target\n\n}\n\nexport default fsTargetFile\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fs-target-file",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"homepage": "https://github.com/bluelovers/ws-iconv/tree/master/packages/fs-target-file#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -27,10 +27,11 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"fs-extra": "^10.0.0",
|
|
30
|
-
"ts-type": "^1.2
|
|
30
|
+
"ts-type": "^2.1.2",
|
|
31
|
+
"tslib": "^2.3.1"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
34
|
"@types/fs-extra": "^9"
|
|
34
35
|
},
|
|
35
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "d191647544bb12e909dcbe181280d087666d4995"
|
|
36
37
|
}
|