因为我们要管理很多依赖,
最后我们选择使用autod来管理,
autod:一个自动分析项目所有的文件,获取所有的项目依赖和它们的版本的工具。
autod 同时可以根据我们传递的一些选项和参数,来直接更新 package.json 文件:
通过这个工具,我们可以很轻松的跟踪到所有依赖的最新版本,同时可以自动更新我们的 package.json 文件,新引入的模块也不需要手动去更新 package.json 文件了,一切都可以交给 autod 来完成。
通常,我们会在 Makefile 中加入 autod 相关的配置项,来自动化完成这个过程:
比如我想完成这个任务:
autod:
@autod -w
@npm install
但是一直报错*** missing separator. Stop.
因为是makefile的命令行,开头必须用tab键,目前没有发现tabstop的设定值的不同,会引起error,但是我已经换成tab键开头了还是一直报这个错。最后才发现原来是webstrom文档的tab键不行,后来换成是文本用tab键才行。真是坑啊。
最后执行代码我们看到了:
zewdeMacBook-Pro:bin zew$ make autod
[DEPENDENCIES]
"dependencies": {
"colors": "1.3.2",
"commander": "2.19.0",
"minimatch": "3.0.4",
"printable": "0.0.3"
}
nothing to update in Dependencies
nothing to update in DevDependencies
[INFO] Write dependencies into package.jso
ok,执行成功了。
可以看出来都下载完成了,可以看出我们通过MakeFile+autod自动化帮package.json里的依赖都下载完,
我们那么我现在如果通过改变package.json里的依赖的版本号可以帮我们动态控制吗?
首先我们执行autod -f获取到版本号:
zewdeMacBook-Pro:bin zew$ autod -f
[DEPENDENCIES]
"dependencies": {
"colors": "~1.3.2",
"commander": "~2.19.0",
"minimatch": "~3.0.4",
"printable": "~0.0.3"
}
好了,下面我来修改一下。把printable修改为0.0.4,再执行一遍脚本
下面我们安装stf
brew install rethinkdb graphicsmagick zeromq protobuf yasm pkg-config
npm install -g stf
再启动:
rethinkdb
新开个窗口启动stf
后来装stf也遇到了一堆的问题,结果是因为nodejs版本太高,我用的是10.x的后来换成8.2的就好了。但是还遇到了权限问题后来修改
sudo chown -R [owner] /usr/local/lib/node_modules
总是安装成功了
打印记过是:
#pragma message("Warning: zmq_utils.h is deprecated. All its functionali...
^
3 warnings generated.
SOLINK_MODULE(target) Release/zmq.node
+ stf@3.4.0
added 755 packages from 681 contributors in 47.692s
就好了。
然后启动一下
rethinkdb
,
新开个窗口启动stf
zewdeMacBook-Pro:~ zew$ stf local
2018-10-10T05:12:18.271Z INF/util:procutil 48057 [*] Forking "/usr/local/lib/node_modules/stf/lib/cli migrate"
2018-10-10T05:12:18.503Z INF/db 48059 [*] Connecting to 127.0.0.1:28015
2018-10-10T05:12:18.535Z INF/db:setup 48059 [*] Database "stf" created
2018-10-10T05:12:20.444Z INF/db:setup 48059 [*] Table "devices" created
2018-10-10T05:12:20.472Z INF/db:setup 48059 [*] Table "logs" created
2018-10-10T05:12:20.528Z INF/db:setup 48059 [*] Index "devices"."owner" created
2018-10-10T05:12:20.528Z INF/db:setup 48059 [*] Waiting for index "devices"."owner"
2018-10-10T05:12:20.621Z INF/db:setup 48059 [*] Index "devices"."present" created
2018-10-10T05:12:20.621Z INF/db:setup 48059 [*] Waiting for index "devices"."present"
2018-10-10T05:12:20.713Z INF/db:setup 48059 [*] Index "devices"."providerChannel" created
2018-10-10T05:12:20.713Z INF/db:setup 48059 [*] Waiting for index "devices"."providerChannel"
2018-10-10T05:12:20.916Z INF/db:setup 48059 [*] Table "accessTokens" created
2018-10-10T05:12:20.962Z INF/db:setup 48059 [*] Table "vncauth" created
2018-10-10T05:12:21.097Z INF/db:setup 48059 [*] Table "users" created
2018-10-10T05:12:21.098Z INF/db:setup 48059 [*] Index "accessTokens"."email" created
2018-10-10T05:12:21.098Z INF/db:setup 48059 [*] Waiting for index "accessTokens"."email"
2018-10-10T05:12:21.152Z INF/db:setup 48059 [*] Index "vncauth"."response" created
2018-10-10T05:12:21.152Z INF/db:setup 48059 [*] Waiting for index "vncauth"."response"
2018-10-10T05:12:21.347Z INF/db:setup 48059 [*] Index "devices"."owner" is ready
2018-10-10T05:12:21.352Z INF/db:setup 48059 [*] Index "users"."adbKeys" created
2018-10-10T05:12:21.353Z INF/db:setup 48059 [*] Waiting for index "users"."adbKeys"
2018-10-10T05:12:21.465Z INF/db:setup 48059 [*] Index "vncauth"."responsePerDevice" created
2018-10-10T05:12:21.465Z INF/db:setup 48059 [*] Waiting for index "vncauth"."responsePerDevice"
2018-10-10T05:12:22.660Z INF/db:setup 48059 [*] Index "accessTokens"."email" is ready
2018-10-10T05:12:22.759Z INF/db:setup 48059 [*] Index "vncauth"."response" is ready
2018-10-10T05:12:22.924Z INF/db:setup 48059 [*] Index "users"."adbKeys" is ready
2018-10-10T05:12:23.033Z INF/db:setup 48059 [*] Index "vncauth"."responsePerDevice" is ready
2018-10-10T05:12:23.796Z INF/db:setup 48059 [*] Index "devices"."present" is ready
2018-10-10T05:12:23.889Z INF/db:setup 48059 [*] Index "devices"."providerChannel" is ready
2018-10-10T05:12:23.896Z INF/util:procutil 48057 [*] Forking "/usr/local/lib/node_modules/stf/lib/cli triproxy app001 --bind-pub tcp://127.0.0.1:7111 --bind-dealer tcp://127.0.0.1:7112 --bind-pull tcp://127.0.0.1:7113"
2018-10-10T05:12:23.898Z INF/util:procutil 48057 [*] Forking "/usr/local/lib/node_modules/stf/lib/cli triproxy dev001 --bind-pub tcp://127.0.0.1:7114 --bind-dealer tcp://127.0.0.1:7115 --bind-pull tcp://127.0.0.1:7116"
2018-10-10T05:12:23.900Z INF/util:procutil 48057 [*] Forking "/usr/local/lib/node_modules/stf/lib/cli processor proc001 --connect-app-dealer tcp://127.0.0.1:7112 --connect-dev-dealer tcp://127.0.0.1:7115"
2018-10-10T05:12:23.902Z INF/util:procutil 48057 [*] Forking "/usr/local/lib/node_modules/stf/lib/cli processor proc002 --connect-app-dealer tcp://127.0.0.1:7112 --connect-dev-dealer tcp://127.0.0.1:7115"
2018-10-10T05:12:23.905Z INF/util:procutil 48057 [*] Forking "/usr/local/lib/node_modules/stf/lib/cli reaper reaper001 --connect-push tcp://127.0.0.1:7116 --connect-sub tcp://127.0.0.1:7111"
2018-10-10T05:12:23.917Z INF/util:procutil 48057 [*] Forking "/usr/local/lib/node_modules/stf/lib/cli provider --name zewdeMacBook-Pro.local --min-port 7400 --max-port 7700 --connect-sub tcp://127.0.0.1:7114 --connect-push tcp://127.0.0.1:7116 --group-timeout 900 --public-ip localhost --storage-url http://localhost:7100/ --adb-host 127.0.0.1 --adb-port 5037 --vnc-initial-size 600x800 --mute-master never"
2018-10-10T05:12:23.941Z INF/util:procutil 48057 [*] Forking "/usr/local/lib/node_modules/stf/lib/cli auth-mock --port 7120 --secret kute kittykat --app-url http://localhost:7100/"
2018-10-10T05:12:23.976Z INF/util:procutil 48057 [*] Forking "/usr/local/lib/node_modules/stf/lib/cli app --port 7105 --secret kute kittykat --auth-url http://localhost:7100/auth/mock/ --websocket-url http://localhost:7110/"
2018-10-10T05:12:24.034Z INF/util:procutil 48057 [*] Forking "/usr/local/lib/node_modules/stf/lib/cli api --port 7106 --secret kute kittykat --connect-push tcp://127.0.0.1:7113 --connect-sub tcp://127.0.0.1:7111"
2018-10-10T05:12:24.039Z INF/util:procutil 48057 [*] Forking "/usr/local/lib/node_modules/stf/lib/cli websocket --port 7110 --secret kute kittykat --storage-url http://localhost:7100/ --connect-sub tcp://127.0.0.1:7111 --connect-push tcp://127.0.0.1:7113"
2018-10-10T05:12:24.044Z INF/util:procutil 48057 [*] Forking "/usr/local/lib/node_modules/stf/lib/cli storage-temp --port 7102"
2018-10-10T05:12:24.053Z INF/util:procutil 48057 [*] Forking "/usr/local/lib/node_modules/stf/lib/cli storage-plugin-image --port 7103 --storage-url http://localhost:7100/"
2018-10-10T05:12:24.063Z INF/util:procutil 48057 [*] Forking "/usr/local/lib/node_modules/stf/lib/cli storage-plugin-apk --port 7104 --storage-url http://localhost:7100/"
2018-10-10T05:12:24.068Z INF/util:procutil 48057 [*] Forking "/usr/local/lib/node_modules/stf/lib/cli poorxy --port 7100 --app-url http://localhost:7105/ --auth-url http://localhost:7120/ --api-url http://localhost:7106/ --websocket-url http://localhost:7110/ --storage-url http://localhost:7102/ --storage-plugin-image-url http://localhost:7103/ --storage-plugin-apk-url http://localhost:7104/"
2018-10-10T05:12:25.152Z INF/triproxy 48060 [app001] PUB socket bound on tcp://127.0.0.1:7111
2018-10-10T05:12:25.156Z INF/triproxy 48060 [app001] DEALER socket bound on tcp://127.0.0.1:7112
2018-10-10T05:12:25.157Z INF/triproxy 48060 [app001] PULL socket bound on tcp://127.0.0.1:7113
2018-10-10T05:12:25.162Z INF/triproxy 48061 [dev001] PUB socket bound on tcp://127.0.0.1:7114
2018-10-10T05:12:25.165Z INF/triproxy 48061 [dev001] DEALER socket bound on tcp://127.0.0.1:7115
2018-10-10T05:12:25.166Z INF/triproxy 48061 [dev001] PULL socket bound on tcp://127.0.0.1:7116
2018-10-10T05:12:25.678Z INF/poorxy 48073 [*] Listening on port 7100
2018-10-10T05:12:25.659Z INF/reaper 48064 [reaper001] Subscribing to permanent channel "*ALL"
2018-10-10T05:12:25.738Z INF/reaper 48064 [reap