This repository was archived by the owner on Dec 18, 2023. It is now read-only.
File tree 3 files changed +19
-4
lines changed
3 files changed +19
-4
lines changed Original file line number Diff line number Diff line change 16
16
"cliff" : " ^0.1.10" ,
17
17
"command-line-args" : " ^5.1.1" ,
18
18
"node-fetch" : " ^2.6.1" ,
19
+ "node-watch" : " ^0.7.2" ,
19
20
"prompts" : " ^2.4.0" ,
20
21
"rimraf" : " ^3.0.2"
21
22
}
Original file line number Diff line number Diff line change @@ -2,8 +2,11 @@ const fs = require('fs')
2
2
const { execSync } = require ( 'child_process' )
3
3
const getLivestormPluginInformation = require ( '../helpers/getLivestormPluginInformation' )
4
4
const env = process . argv [ 3 ]
5
+ const nodeWatch = require ( 'node-watch' ) ;
5
6
6
- function updatePlugin ( ) {
7
+
8
+ function updatePlugin ( evt , name ) {
9
+ console . log ( '%s changed' , name ) ;
7
10
process . stdout . write ( '\x1b[0m.\x1b[0m' )
8
11
9
12
const res = execSync ( `livestorm publish ${ env || '' } ` ) . toString ( )
@@ -16,9 +19,15 @@ function updatePlugin() {
16
19
}
17
20
18
21
module . exports = function watch ( ) {
19
- const config = getLivestormPluginInformation ( env )
22
+ getLivestormPluginInformation ( env )
20
23
console . log ( `${ env ? `Will publish to ${ env } , ` : '' } waiting for file change...` )
21
24
22
- fs . watch ( process . cwd ( ) , updatePlugin )
23
- if ( fs . existsSync ( `${ process . cwd ( ) } /src` ) ) fs . watch ( `${ process . cwd ( ) } /src` , updatePlugin )
25
+ nodeWatch ( './' , {
26
+ recursive : true ,
27
+ filter : ( f , skip ) => {
28
+ if ( / \/ n o d e _ m o d u l e s / . test ( f ) ) return skip ;
29
+ if ( / \/ b u i l d / . test ( f ) ) return skip ;
30
+ return true
31
+ } ,
32
+ } , updatePlugin ) ;
24
33
}
Original file line number Diff line number Diff line change @@ -138,6 +138,11 @@ node-fetch@^2.6.1:
138
138
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052"
139
139
integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==
140
140
141
+ node-watch@^0.7.2 :
142
+ version "0.7.2"
143
+ resolved "https://registry.yarnpkg.com/node-watch/-/node-watch-0.7.2.tgz#545f057da8500487eb8287adcb4cb5a7338d7e21"
144
+ integrity sha512-g53VjSARRv1JdST0LZRIg8RiuLr1TaBbVPsVvxh0/0Ymvi0xYUjDuoqQQAWtHJQUXhiShowPT/aXKNeHBcyQsw==
145
+
141
146
once@^1.3.0 :
142
147
version "1.4.0"
143
148
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
You can’t perform that action at this time.
0 commit comments