@tencent-map/lbs-skills 0.0.3 → 0.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.
- package/README.md +1 -1
- package/bin/cli.js +1 -1
- package/lib/index.js +37 -29
- package/package.json +4 -5
package/README.md
CHANGED
package/bin/cli.js
CHANGED
|
@@ -69,7 +69,7 @@ Run \`tmap-lbs <command> --help\` for command-specific usage.
|
|
|
69
69
|
|
|
70
70
|
配置 Key:
|
|
71
71
|
tmap-lbs config set-key <your-key>
|
|
72
|
-
或 export
|
|
72
|
+
或 export TMAP_WEBSERVICE_KEY=<your-key>
|
|
73
73
|
|
|
74
74
|
获取 Key: https://lbs.qq.com/dev/console/application/mine
|
|
75
75
|
`;
|
package/lib/index.js
CHANGED
|
@@ -40,7 +40,7 @@ function saveConfigFile(config) {
|
|
|
40
40
|
* @returns {string|null}
|
|
41
41
|
*/
|
|
42
42
|
function getKey() {
|
|
43
|
-
return process.env.
|
|
43
|
+
return process.env.TMAP_WEBSERVICE_KEY || loadConfigFile().key || null;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
/**
|
|
@@ -75,7 +75,7 @@ function ensureKey() {
|
|
|
75
75
|
'',
|
|
76
76
|
'请通过以下方式之一设置:',
|
|
77
77
|
' tmap-lbs config set-key <your-key>',
|
|
78
|
-
' export
|
|
78
|
+
' export TMAP_WEBSERVICE_KEY=<your-key>',
|
|
79
79
|
'',
|
|
80
80
|
'获取 Key: https://lbs.qq.com/dev/console/application/mine',
|
|
81
81
|
'',
|
|
@@ -234,12 +234,14 @@ async function walkRoute(params) {
|
|
|
234
234
|
return {
|
|
235
235
|
status: '1',
|
|
236
236
|
route: {
|
|
237
|
-
paths: [
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
237
|
+
paths: [
|
|
238
|
+
{
|
|
239
|
+
distance: route.distance,
|
|
240
|
+
duration: route.duration,
|
|
241
|
+
direction: route.direction || '',
|
|
242
|
+
steps: route.steps || [],
|
|
243
|
+
},
|
|
244
|
+
],
|
|
243
245
|
},
|
|
244
246
|
_raw: data,
|
|
245
247
|
};
|
|
@@ -274,15 +276,17 @@ async function driveRoute(params) {
|
|
|
274
276
|
return {
|
|
275
277
|
status: '1',
|
|
276
278
|
route: {
|
|
277
|
-
paths: [
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
279
|
+
paths: [
|
|
280
|
+
{
|
|
281
|
+
distance: route.distance,
|
|
282
|
+
duration: route.duration,
|
|
283
|
+
toll: route.toll || 0,
|
|
284
|
+
traffic_light_count: route.traffic_light_count || 0,
|
|
285
|
+
restriction: route.restriction || null,
|
|
286
|
+
tags: route.tags || [],
|
|
287
|
+
steps: route.steps || [],
|
|
288
|
+
},
|
|
289
|
+
],
|
|
286
290
|
},
|
|
287
291
|
_raw: data,
|
|
288
292
|
};
|
|
@@ -307,12 +311,14 @@ async function cycleRoute(params) {
|
|
|
307
311
|
return {
|
|
308
312
|
status: '1',
|
|
309
313
|
route: {
|
|
310
|
-
paths: [
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
314
|
+
paths: [
|
|
315
|
+
{
|
|
316
|
+
distance: route.distance,
|
|
317
|
+
duration: route.duration,
|
|
318
|
+
direction: route.direction || '',
|
|
319
|
+
steps: route.steps || [],
|
|
320
|
+
},
|
|
321
|
+
],
|
|
316
322
|
},
|
|
317
323
|
_raw: data,
|
|
318
324
|
};
|
|
@@ -337,12 +343,14 @@ async function ecycleRoute(params) {
|
|
|
337
343
|
return {
|
|
338
344
|
status: '1',
|
|
339
345
|
route: {
|
|
340
|
-
paths: [
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
+
paths: [
|
|
347
|
+
{
|
|
348
|
+
distance: route.distance,
|
|
349
|
+
duration: route.duration,
|
|
350
|
+
direction: route.direction || '',
|
|
351
|
+
steps: route.steps || [],
|
|
352
|
+
},
|
|
353
|
+
],
|
|
346
354
|
},
|
|
347
355
|
_raw: data,
|
|
348
356
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tencent-map/lbs-skills",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "腾讯地图位置服务命令行工具,支持 POI 搜索、地理编码、周边搜索、路径规划、旅游规划、轨迹可视化等功能",
|
|
5
5
|
"bin": {
|
|
6
6
|
"tmap-lbs": "./bin/cli.js"
|
|
@@ -11,9 +11,8 @@
|
|
|
11
11
|
"lib",
|
|
12
12
|
"README.md"
|
|
13
13
|
],
|
|
14
|
-
"scripts": {
|
|
15
|
-
|
|
16
|
-
},
|
|
14
|
+
"scripts": {},
|
|
15
|
+
"homepage": "https://lbs.qq.com",
|
|
17
16
|
"keywords": [
|
|
18
17
|
"tmap",
|
|
19
18
|
"tencent-map",
|
|
@@ -23,7 +22,7 @@
|
|
|
23
22
|
"route-planning",
|
|
24
23
|
"cli"
|
|
25
24
|
],
|
|
26
|
-
"author": "",
|
|
25
|
+
"author": "Tencent Map Teams",
|
|
27
26
|
"license": "MIT",
|
|
28
27
|
"dependencies": {}
|
|
29
28
|
}
|