@sphido/core 2.0.3 → 2.0.6
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/lib/copy-file.js +18 -0
- package/lib/index.js +1 -0
- package/package.json +7 -2
package/lib/copy-file.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {mkdir, copyFile as copyFileSync} from 'node:fs/promises';
|
|
2
|
+
import {existsSync} from 'node:fs';
|
|
3
|
+
import {dirname} from 'node:path';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Write content to the file and create directory if not exists
|
|
7
|
+
*
|
|
8
|
+
* @param {string} file
|
|
9
|
+
* @param {string} content
|
|
10
|
+
* @returns {Promise<*>}
|
|
11
|
+
*/
|
|
12
|
+
export async function copyFile(src, dest) {
|
|
13
|
+
if (!existsSync(dirname(dest))) {
|
|
14
|
+
await mkdir(dirname(dest), {recursive: true});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return copyFileSync(src, dest);
|
|
18
|
+
}
|
package/lib/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphido/core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Roman Ožana",
|
|
6
6
|
"email": "roman@ozana.cz",
|
|
@@ -40,5 +40,10 @@
|
|
|
40
40
|
"scripts": {
|
|
41
41
|
"test": "ava"
|
|
42
42
|
},
|
|
43
|
-
"
|
|
43
|
+
"xo": {
|
|
44
|
+
"rules": {
|
|
45
|
+
"no-await-in-loop": 0
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"gitHead": "0da6b1833720df984911fdf6d560a82022a15407"
|
|
44
49
|
}
|