@sphido/core 2.0.3 → 2.0.4

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.
@@ -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(src))) {
14
+ await mkdir(dirname(src), {recursive: true});
15
+ }
16
+
17
+ return copyFileSync(src, dest);
18
+ }
package/lib/index.js CHANGED
@@ -2,3 +2,4 @@ export {getPages} from './get-pages.js';
2
2
  export {allPages} from './all-pages.js';
3
3
  export {readFile} from './read-file.js';
4
4
  export {writeFile} from './write-file.js';
5
+ export {copyFile} from './copy-file.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sphido/core",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "author": {
5
5
  "name": "Roman Ožana",
6
6
  "email": "roman@ozana.cz",
@@ -40,5 +40,5 @@
40
40
  "scripts": {
41
41
  "test": "ava"
42
42
  },
43
- "gitHead": "c9c4fccbd160f17071fe47c132d0a7e6b0d43da6"
43
+ "gitHead": "725a4f04403f90e7b8979c9f2cf881f413e42498"
44
44
  }