UNPKG

5.37 kBMarkdownView Raw
1# wct #
2
3manage components,commands,scaffolding,useful files local
4
5![](https://img.shields.io/npm/v/wct.svg?style=flat)
6
7
8## Installation
9
10```
11npm install wct -g
12```
13
14## example
15
16```js
17//base use
18
19wct config C:\codeStore //storage warehouse
20wct exclude * -doc **/node_modlues //exclude dir or file in all push command
21
22...somedir > wct push component1 //push your code
23...somedir > wct pull component1 //pull your code
24
25//open server to view all libs in browser
26wct lib *
27
28// special handle,special treatment upload code
29wct exec q-react -type webq
30wct exec computer-start -type cmd
31
32//create wctfile.js
33...somedir > wct
34
35// combine resource from wctfile.js
36// wctfile.js module.exports={combine:{ proj1:{ dir1:{ dir2:'url:./q-react',dir3:'store:ropegulp'}}}};
37...somedir > wct combine proj1 //create corresponding resource in current project
38
39//base tool
40..somedir> wct a/b/c/k.js ..somedir > wct rm:a/b
41```
42
43
44
45
46
47## feature list&&api
48
49### config,before use wct,must define a code storage warehouse
50
51```js
52wct config C:\codeStore
53```
54
55### exclude,set dir&file which are not uploaded
56
57exclude use micromatch to filte path [micromatch](https://www.npmjs.com/package/micromatch){:target="_blank"}
58
59
60```js
61// use * for all the upload.it only exclude some dir when push react-material if use wct exclude react-material -doc ..
62//not push node_modlue and .git dir
63
64wct exclude * -doc **/node_modlues someDir/*.md
65
66```
67
68
69
70
71### push, push code to storage warehouse
72
73
74
75```js
76//push current dir and named react-redux-material then upload
77..somedir > wct push react-redux-material
78
79// use special dir to upload
80..somedir > wct push react-redux -url ./dist
81
82// cover true cover the already existing content
83//exclude ,exclude push path for current push task
84// commit ,current push commit instruction
85// des , this lib description
86...somedir > wct push react-redux -cover true -exclude package.json -commit "change cont" -des "this is use for..."
87
88
89// push string between wct-part-start and wct-part-end in file
90..somedir > wct push somename -url ./a.js -part true
91
92
93/* exec tool push,must push json file */
941: webq - some websites collection in one page
95//some.json is like [{"name":"react","des":"office web","link":"https://reactjs.org/docs/hello-world.html"}]
96...someDir > wct push q-react -url ./some.json -type webq
972: cmd -commands step run
98//some.json is like [{"cmd":"start chrome"},{"cmd":"start https://google.com"},{"cmd":"mkdir exp"}]
99...someDir > wct push computer-start -url ./some.json -type cmd
100
101```
102
103
104### pull, pull code to current dir
105
106```js
107//create react-redux/childrenDir...
108...somedir > wct pull react-redux
109
110//pull children contents and not wrap react-redux name,default wrap value is true
111..somedir > wct pull react-redux -wrap false
112
113//create someproj/childrenDir...,cover true cover exist file
114..somedir >wct pull react-redux -rename someproj -cover true
115```
116
117
118### remove,remove exist lib
119
120```js
121//remove some lib
122wct remove react-redux
123```
124
125### rename,rename lib name
126
127```js
128wct rename react-redux -rename react-redux-material
129```
130
131
132
133### lib,view lib(beta can only read file now)
134
135
136```js
137//can use wct lib * -browser chrome
138// to point browser open
139
140wct lib *
141
142```
143
144//auto open page
145
146![image](https://wct666.oss-cn-shenzhen.aliyuncs.com/wctlib.png)
147
148
149
150
151### see
152
153```js
154//see all * in storage warehouse
155wct see *
156// see some *
157wct see * -f react-redux
158//see exclude
159wct see exclude
160```
161
162### create wctfile.js
163
164```js
165...someDir > wct
166
167```
168
169
170### combine resource from wctfile.js
171
172```js
173//wctfile.js module.exports={combine:{ proj1:{ dir1:{ dir2:'url:./q-react',dir3:'store:ropegulp'}}}};
174...somedir > wct combine proj1 //create corresponding resource in current project
175```
176
177
178### base tool
179```js
180//create dir a/b/c in current dir
181...somedir > wct a/b/c/
182//remove dir
183...somedir > wct rm:a/b
184// copy paster
185...somedir > wct copy:./a=to:./c
186```
187
188### exec command
189
190
191###### cmd commands step run
192
193```js
194//the json which use push maybe like as follow
195 [{"cmd":"start chrome"},{"cmd":"start https://google.com"},{"cmd":"mkdir exp"}]
196 //after push computer-start in above
197wct exec computer-start -type cmd
198```
199
200###### webq , see the collection of sites in one page
201need install *iFrame Allow* plugin in browser if want to see some not allow embed iframe website
202
203```js
204//the json which use push maybe like as follow,object which do not have link express type
205[{"name":"A type"},{"name":"react","des":"office web","link":"https://reactjs.org/docs/hello-world.html"}]
206
207//after push q-react in above
208// can use wct exec q-react -type webq -browser chrome
209//to point browser open
210wct exec q-react -type webq
211```
212
213 ![image](https://wct666.oss-cn-shenzhen.aliyuncs.com/webq.png)
214
215
216
217
218## wctfile format
219
220```
221module.exports={
222 combine:{
223 proj1:{
224 a:{
225 b:'./q-react'
226 }
227 }
228
229}};
230
231```
232
233
234## others
235
236* push part contents
237
238```
239//the content of file
240let a=1;
241...
242//wct-part-start
243 function fun1(){}
244 //wct-part-start
245 function fun2(){}
246 //wct-part-end
247//wct-part-end
248//the content of file end
249
250//cmd
251wct push somename -url ./a.js -part true
252```