Skip to content

Commit 7e690d9

Browse files
committed
adding watcher, for better development of component
1 parent 7138755 commit 7e690d9

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

bin/watch.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const chokidar = require('chokidar');
2+
const fs = require('fs-extra');
3+
const path = require('path');
4+
5+
const location = path.join(__dirname, '../src');
6+
const destination = path.join(location, '../example/react-native-markdown-renderer');
7+
8+
const watcher = chokidar.watch(location);
9+
watcher.on('change', dir => {
10+
11+
12+
console.log('Updating %s by removing it', destination);
13+
14+
fs.remove(destination, err => {
15+
16+
console.log('Copy %s ', location);
17+
18+
fs.copy(location, destination, err => {
19+
if (err) return console.error(err)
20+
21+
console.log('to %s ', destination);
22+
console.log('success!')
23+
})
24+
});
25+
});

0 commit comments

Comments
 (0)