@itentialopensource/adapter-mockdevice 2.1.5 → 2.2.1
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/AUTH.md +2 -2
- package/ENHANCE.md +3 -3
- package/README.md +8 -8
- package/TAB2.md +3 -3
- package/coverage/{adapter.js.html → adapter-mockdevice/adapter.js.html} +10 -10
- package/coverage/adapter-mockdevice/index.html +116 -0
- package/coverage/adapter-mockdevice/utils/argParser.js.html +217 -0
- package/coverage/adapter-mockdevice/utils/index.html +131 -0
- package/coverage/adapter-mockdevice/utils/logger.js.html +163 -0
- package/coverage/index.html +25 -10
- package/package.json +35 -38
- package/utils/argParser.js +44 -0
- package/utils/logger.js +26 -0
- package/utils/artifactize.js +0 -146
- package/utils/packModificationScript.js +0 -35
package/AUTH.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
## Authenticating Mock Device Adapter
|
|
2
2
|
|
|
3
|
-
This document will go through the steps for authenticating the Mock Device adapter with. Properly configuring the properties for an adapter in
|
|
3
|
+
This document will go through the steps for authenticating the Mock Device adapter with. Properly configuring the properties for an adapter in Itential Platform is critical for getting the adapter online. You can read more about adapter authentication <a href="https://docs.itential.com/opensource/docs/authentication" target="_blank">HERE</a>.
|
|
4
4
|
|
|
5
5
|
### No Authentication
|
|
6
6
|
The Winston Syslog Adapter does not require any authentication.
|
|
7
7
|
|
|
8
8
|
### Troubleshooting
|
|
9
9
|
- Make sure you copied over the correct username and password.
|
|
10
|
-
- Turn on debug level logs for the adapter in
|
|
10
|
+
- Turn on debug level logs for the adapter in Itential Platform Admin Essentials.
|
|
11
11
|
- Investigate the logs
|
package/ENHANCE.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
### Adding a Second Instance of an Adapter
|
|
4
4
|
|
|
5
|
-
You can add a second instance of this adapter without adding new code on the file system. To do this go into the
|
|
5
|
+
You can add a second instance of this adapter without adding new code on the file system. To do this go into the Itential Platform Admin Essentials and add a new service config for this adapter. The two instances of the adapter should have unique ids. In addition, they should point to different instances (unique host and port) of the other system.
|
|
6
6
|
|
|
7
7
|
### Adding Adapter Calls
|
|
8
8
|
|
|
@@ -18,7 +18,7 @@ npm run adapter:update
|
|
|
18
18
|
|
|
19
19
|
If you do not have a Swagger or OpenAPI document, you can use a Postman Collection and convert that to an OpenAPI document using APIMatic and then follow the first process.
|
|
20
20
|
|
|
21
|
-
If you want to manually update the adapter that can also be done the key thing is to make sure you update all of the right files. Within the entities directory you will find 1 or more entities. You can create a new entity or add to an existing entity. Each entity has an action.json file, any new call will need to be put in the action.json file. It will also need to be added to the enum for the ph_request_type in the appropriate schema files. Once this configuration is complete you will need to add the call to the adapter.js file and, in order to make it available as a workflow task in
|
|
21
|
+
If you want to manually update the adapter that can also be done the key thing is to make sure you update all of the right files. Within the entities directory you will find 1 or more entities. You can create a new entity or add to an existing entity. Each entity has an action.json file, any new call will need to be put in the action.json file. It will also need to be added to the enum for the ph_request_type in the appropriate schema files. Once this configuration is complete you will need to add the call to the adapter.js file and, in order to make it available as a workflow task in Itential Platform, it should also be added to the pronghorn.json file. You can optionally add it to the unit and integration test files. There is more information on how to work on each of these files in the <a href="https://docs.itential.com/opensource/docs/adapters" target="_blank">Adapter Technical Resources</a> on our Documentation Site.
|
|
22
22
|
|
|
23
23
|
```text
|
|
24
24
|
Files to update
|
|
@@ -32,7 +32,7 @@ Files to update
|
|
|
32
32
|
|
|
33
33
|
### Adding Adapter Properties
|
|
34
34
|
|
|
35
|
-
While changing adapter properties is done in the service instance configuration section of
|
|
35
|
+
While changing adapter properties is done in the service instance configuration section of Itential Platform, adding properties has to be done in the adapter. To add a property you should edit the propertiesSchema.json with the proper information for the property. In addition, you should modify the sampleProperties to have the new property in it.
|
|
36
36
|
|
|
37
37
|
```text
|
|
38
38
|
Files to update
|
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ Git
|
|
|
21
21
|
|
|
22
22
|
### How to Install
|
|
23
23
|
|
|
24
|
-
1. Set up the name space location in your
|
|
24
|
+
1. Set up the name space location in your Itential Platform node_modules.
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
27
|
cd /opt/pronghorn/current/node_modules (* could be in a different place)
|
|
@@ -29,7 +29,7 @@ if the @itentialopensource directory does not exist, create it:
|
|
|
29
29
|
mkdir @itentialopensource
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
2. Clone/unzip/tar the adapter into your
|
|
32
|
+
2. Clone/unzip/tar the adapter into your Itential Platform environment.
|
|
33
33
|
|
|
34
34
|
```bash
|
|
35
35
|
cd \@itentialopensource
|
|
@@ -47,15 +47,15 @@ cd adapter-mockdevice
|
|
|
47
47
|
npm run adapter:install
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
4. Restart
|
|
50
|
+
4. Restart Itential Platform
|
|
51
51
|
|
|
52
52
|
```bash
|
|
53
53
|
systemctl restart pronghorn
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
-
5. Change the adapter service instance configuration (host, port, credentials, etc) in
|
|
56
|
+
5. Change the adapter service instance configuration (host, port, credentials, etc) in Itential Platform Admin Essentials GUI
|
|
57
57
|
|
|
58
|
-
npm run adapter:install can be dependent on where the adapter is installed and on the version of
|
|
58
|
+
npm run adapter:install can be dependent on where the adapter is installed and on the version of Itential Platform so it is subject to fail. If this happens you can replace step 3-5 above with these:
|
|
59
59
|
|
|
60
60
|
3. Install adapter dependencies and check the adapter.
|
|
61
61
|
|
|
@@ -66,17 +66,17 @@ npm run lint:errors
|
|
|
66
66
|
npm run test
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
-
4. Restart
|
|
69
|
+
4. Restart Itential Platform
|
|
70
70
|
|
|
71
71
|
```bash
|
|
72
72
|
systemctl restart pronghorn
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
-
5. Create an adapter service instance configuration in
|
|
75
|
+
5. Create an adapter service instance configuration in Itential Platform Admin Essentials GUI
|
|
76
76
|
|
|
77
77
|
### Adapter Properties and Descriptions
|
|
78
78
|
|
|
79
|
-
This section provides sample properties that can be used to configure the adpater in
|
|
79
|
+
This section provides sample properties that can be used to configure the adpater in Itential Platform .
|
|
80
80
|
|
|
81
81
|
```JSON
|
|
82
82
|
{
|
package/TAB2.md
CHANGED
|
@@ -10,18 +10,18 @@
|
|
|
10
10
|
## Specific Adapter Information
|
|
11
11
|
### Authentication
|
|
12
12
|
|
|
13
|
-
This document will go through the steps for authenticating the Mock Device adapter with. Properly configuring the properties for an adapter in
|
|
13
|
+
This document will go through the steps for authenticating the Mock Device adapter with. Properly configuring the properties for an adapter in Itential Platform is critical for getting the adapter online. You can read more about adapter authentication <a href="https://docs.itential.com/opensource/docs/authentication" target="_blank">HERE</a>.
|
|
14
14
|
|
|
15
15
|
#### No Authentication
|
|
16
16
|
The Winston Syslog Adapter does not require any authentication.
|
|
17
17
|
|
|
18
18
|
#### Troubleshooting
|
|
19
19
|
- Make sure you copied over the correct username and password.
|
|
20
|
-
- Turn on debug level logs for the adapter in
|
|
20
|
+
- Turn on debug level logs for the adapter in Itential Platform Admin Essentials.
|
|
21
21
|
- Investigate the logs
|
|
22
22
|
### Sample Properties
|
|
23
23
|
|
|
24
|
-
Sample Properties can be used to help you configure the adapter in the Itential
|
|
24
|
+
Sample Properties can be used to help you configure the adapter in the Itential Platform. You will need to update connectivity information such as the host, port, protocol and credentials.
|
|
25
25
|
|
|
26
26
|
```json
|
|
27
27
|
"properties": {
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
<html lang="en">
|
|
4
4
|
|
|
5
5
|
<head>
|
|
6
|
-
<title>Code coverage report for adapter.js</title>
|
|
6
|
+
<title>Code coverage report for adapter-mockdevice/adapter.js</title>
|
|
7
7
|
<meta charset="utf-8" />
|
|
8
|
-
<link rel="stylesheet" href="prettify.css" />
|
|
9
|
-
<link rel="stylesheet" href="base.css" />
|
|
10
|
-
<link rel="shortcut icon" type="image/x-icon" href="favicon.png" />
|
|
8
|
+
<link rel="stylesheet" href="../prettify.css" />
|
|
9
|
+
<link rel="stylesheet" href="../base.css" />
|
|
10
|
+
<link rel="shortcut icon" type="image/x-icon" href="../favicon.png" />
|
|
11
11
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
12
12
|
<style type='text/css'>
|
|
13
13
|
.coverage-summary .sorter {
|
|
14
|
-
background-image: url(sort-arrow-sprite.png);
|
|
14
|
+
background-image: url(../sort-arrow-sprite.png);
|
|
15
15
|
}
|
|
16
16
|
</style>
|
|
17
17
|
</head>
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
<body>
|
|
20
20
|
<div class='wrapper'>
|
|
21
21
|
<div class='pad1'>
|
|
22
|
-
<h1><a href="index.html">All files</a> adapter.js</h1>
|
|
22
|
+
<h1><a href="../index.html">All files</a> / <a href="index.html">adapter-mockdevice</a> adapter.js</h1>
|
|
23
23
|
<div class='clearfix'>
|
|
24
24
|
|
|
25
25
|
<div class='fl pad1y space-right2'>
|
|
@@ -1597,16 +1597,16 @@ module.exports = MockDevice;
|
|
|
1597
1597
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
1598
1598
|
Code coverage generated by
|
|
1599
1599
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
1600
|
-
at 2025-
|
|
1600
|
+
at 2025-07-01T16:25:40.172Z
|
|
1601
1601
|
</div>
|
|
1602
|
-
<script src="prettify.js"></script>
|
|
1602
|
+
<script src="../prettify.js"></script>
|
|
1603
1603
|
<script>
|
|
1604
1604
|
window.onload = function () {
|
|
1605
1605
|
prettyPrint();
|
|
1606
1606
|
};
|
|
1607
1607
|
</script>
|
|
1608
|
-
<script src="sorter.js"></script>
|
|
1609
|
-
<script src="block-navigation.js"></script>
|
|
1608
|
+
<script src="../sorter.js"></script>
|
|
1609
|
+
<script src="../block-navigation.js"></script>
|
|
1610
1610
|
</body>
|
|
1611
1611
|
</html>
|
|
1612
1612
|
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
|
|
2
|
+
<!doctype html>
|
|
3
|
+
<html lang="en">
|
|
4
|
+
|
|
5
|
+
<head>
|
|
6
|
+
<title>Code coverage report for adapter-mockdevice</title>
|
|
7
|
+
<meta charset="utf-8" />
|
|
8
|
+
<link rel="stylesheet" href="../prettify.css" />
|
|
9
|
+
<link rel="stylesheet" href="../base.css" />
|
|
10
|
+
<link rel="shortcut icon" type="image/x-icon" href="../favicon.png" />
|
|
11
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
12
|
+
<style type='text/css'>
|
|
13
|
+
.coverage-summary .sorter {
|
|
14
|
+
background-image: url(../sort-arrow-sprite.png);
|
|
15
|
+
}
|
|
16
|
+
</style>
|
|
17
|
+
</head>
|
|
18
|
+
|
|
19
|
+
<body>
|
|
20
|
+
<div class='wrapper'>
|
|
21
|
+
<div class='pad1'>
|
|
22
|
+
<h1><a href="../index.html">All files</a> adapter-mockdevice</h1>
|
|
23
|
+
<div class='clearfix'>
|
|
24
|
+
|
|
25
|
+
<div class='fl pad1y space-right2'>
|
|
26
|
+
<span class="strong">10.18% </span>
|
|
27
|
+
<span class="quiet">Statements</span>
|
|
28
|
+
<span class='fraction'>22/216</span>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
<div class='fl pad1y space-right2'>
|
|
33
|
+
<span class="strong">3.33% </span>
|
|
34
|
+
<span class="quiet">Branches</span>
|
|
35
|
+
<span class='fraction'>2/60</span>
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
<div class='fl pad1y space-right2'>
|
|
40
|
+
<span class="strong">7.14% </span>
|
|
41
|
+
<span class="quiet">Functions</span>
|
|
42
|
+
<span class='fraction'>3/42</span>
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
<div class='fl pad1y space-right2'>
|
|
47
|
+
<span class="strong">10.32% </span>
|
|
48
|
+
<span class="quiet">Lines</span>
|
|
49
|
+
<span class='fraction'>22/213</span>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
<p class="quiet">
|
|
55
|
+
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
|
56
|
+
</p>
|
|
57
|
+
<template id="filterTemplate">
|
|
58
|
+
<div class="quiet">
|
|
59
|
+
Filter:
|
|
60
|
+
<input type="search" id="fileSearch">
|
|
61
|
+
</div>
|
|
62
|
+
</template>
|
|
63
|
+
</div>
|
|
64
|
+
<div class='status-line low'></div>
|
|
65
|
+
<div class="pad1">
|
|
66
|
+
<table class="coverage-summary">
|
|
67
|
+
<thead>
|
|
68
|
+
<tr>
|
|
69
|
+
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
|
|
70
|
+
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
|
|
71
|
+
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
|
|
72
|
+
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
|
|
73
|
+
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
|
|
74
|
+
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
|
|
75
|
+
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
|
|
76
|
+
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
|
|
77
|
+
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
|
|
78
|
+
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
|
|
79
|
+
</tr>
|
|
80
|
+
</thead>
|
|
81
|
+
<tbody><tr>
|
|
82
|
+
<td class="file low" data-value="adapter.js"><a href="adapter.js.html">adapter.js</a></td>
|
|
83
|
+
<td data-value="10.18" class="pic low">
|
|
84
|
+
<div class="chart"><div class="cover-fill" style="width: 10%"></div><div class="cover-empty" style="width: 90%"></div></div>
|
|
85
|
+
</td>
|
|
86
|
+
<td data-value="10.18" class="pct low">10.18%</td>
|
|
87
|
+
<td data-value="216" class="abs low">22/216</td>
|
|
88
|
+
<td data-value="3.33" class="pct low">3.33%</td>
|
|
89
|
+
<td data-value="60" class="abs low">2/60</td>
|
|
90
|
+
<td data-value="7.14" class="pct low">7.14%</td>
|
|
91
|
+
<td data-value="42" class="abs low">3/42</td>
|
|
92
|
+
<td data-value="10.32" class="pct low">10.32%</td>
|
|
93
|
+
<td data-value="213" class="abs low">22/213</td>
|
|
94
|
+
</tr>
|
|
95
|
+
|
|
96
|
+
</tbody>
|
|
97
|
+
</table>
|
|
98
|
+
</div>
|
|
99
|
+
<div class='push'></div><!-- for sticky footer -->
|
|
100
|
+
</div><!-- /wrapper -->
|
|
101
|
+
<div class='footer quiet pad2 space-top1 center small'>
|
|
102
|
+
Code coverage generated by
|
|
103
|
+
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
104
|
+
at 2025-07-01T16:25:40.172Z
|
|
105
|
+
</div>
|
|
106
|
+
<script src="../prettify.js"></script>
|
|
107
|
+
<script>
|
|
108
|
+
window.onload = function () {
|
|
109
|
+
prettyPrint();
|
|
110
|
+
};
|
|
111
|
+
</script>
|
|
112
|
+
<script src="../sorter.js"></script>
|
|
113
|
+
<script src="../block-navigation.js"></script>
|
|
114
|
+
</body>
|
|
115
|
+
</html>
|
|
116
|
+
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
|
|
2
|
+
<!doctype html>
|
|
3
|
+
<html lang="en">
|
|
4
|
+
|
|
5
|
+
<head>
|
|
6
|
+
<title>Code coverage report for adapter-mockdevice/utils/argParser.js</title>
|
|
7
|
+
<meta charset="utf-8" />
|
|
8
|
+
<link rel="stylesheet" href="../../prettify.css" />
|
|
9
|
+
<link rel="stylesheet" href="../../base.css" />
|
|
10
|
+
<link rel="shortcut icon" type="image/x-icon" href="../../favicon.png" />
|
|
11
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
12
|
+
<style type='text/css'>
|
|
13
|
+
.coverage-summary .sorter {
|
|
14
|
+
background-image: url(../../sort-arrow-sprite.png);
|
|
15
|
+
}
|
|
16
|
+
</style>
|
|
17
|
+
</head>
|
|
18
|
+
|
|
19
|
+
<body>
|
|
20
|
+
<div class='wrapper'>
|
|
21
|
+
<div class='pad1'>
|
|
22
|
+
<h1><a href="../../index.html">All files</a> / <a href="index.html">adapter-mockdevice/utils</a> argParser.js</h1>
|
|
23
|
+
<div class='clearfix'>
|
|
24
|
+
|
|
25
|
+
<div class='fl pad1y space-right2'>
|
|
26
|
+
<span class="strong">57.14% </span>
|
|
27
|
+
<span class="quiet">Statements</span>
|
|
28
|
+
<span class='fraction'>12/21</span>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
<div class='fl pad1y space-right2'>
|
|
33
|
+
<span class="strong">33.33% </span>
|
|
34
|
+
<span class="quiet">Branches</span>
|
|
35
|
+
<span class='fraction'>5/15</span>
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
<div class='fl pad1y space-right2'>
|
|
40
|
+
<span class="strong">100% </span>
|
|
41
|
+
<span class="quiet">Functions</span>
|
|
42
|
+
<span class='fraction'>2/2</span>
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
<div class='fl pad1y space-right2'>
|
|
47
|
+
<span class="strong">57.14% </span>
|
|
48
|
+
<span class="quiet">Lines</span>
|
|
49
|
+
<span class='fraction'>12/21</span>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
<p class="quiet">
|
|
55
|
+
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
|
56
|
+
</p>
|
|
57
|
+
<template id="filterTemplate">
|
|
58
|
+
<div class="quiet">
|
|
59
|
+
Filter:
|
|
60
|
+
<input type="search" id="fileSearch">
|
|
61
|
+
</div>
|
|
62
|
+
</template>
|
|
63
|
+
</div>
|
|
64
|
+
<div class='status-line medium'></div>
|
|
65
|
+
<pre><table class="coverage">
|
|
66
|
+
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
|
67
|
+
<a name='L2'></a><a href='#L2'>2</a>
|
|
68
|
+
<a name='L3'></a><a href='#L3'>3</a>
|
|
69
|
+
<a name='L4'></a><a href='#L4'>4</a>
|
|
70
|
+
<a name='L5'></a><a href='#L5'>5</a>
|
|
71
|
+
<a name='L6'></a><a href='#L6'>6</a>
|
|
72
|
+
<a name='L7'></a><a href='#L7'>7</a>
|
|
73
|
+
<a name='L8'></a><a href='#L8'>8</a>
|
|
74
|
+
<a name='L9'></a><a href='#L9'>9</a>
|
|
75
|
+
<a name='L10'></a><a href='#L10'>10</a>
|
|
76
|
+
<a name='L11'></a><a href='#L11'>11</a>
|
|
77
|
+
<a name='L12'></a><a href='#L12'>12</a>
|
|
78
|
+
<a name='L13'></a><a href='#L13'>13</a>
|
|
79
|
+
<a name='L14'></a><a href='#L14'>14</a>
|
|
80
|
+
<a name='L15'></a><a href='#L15'>15</a>
|
|
81
|
+
<a name='L16'></a><a href='#L16'>16</a>
|
|
82
|
+
<a name='L17'></a><a href='#L17'>17</a>
|
|
83
|
+
<a name='L18'></a><a href='#L18'>18</a>
|
|
84
|
+
<a name='L19'></a><a href='#L19'>19</a>
|
|
85
|
+
<a name='L20'></a><a href='#L20'>20</a>
|
|
86
|
+
<a name='L21'></a><a href='#L21'>21</a>
|
|
87
|
+
<a name='L22'></a><a href='#L22'>22</a>
|
|
88
|
+
<a name='L23'></a><a href='#L23'>23</a>
|
|
89
|
+
<a name='L24'></a><a href='#L24'>24</a>
|
|
90
|
+
<a name='L25'></a><a href='#L25'>25</a>
|
|
91
|
+
<a name='L26'></a><a href='#L26'>26</a>
|
|
92
|
+
<a name='L27'></a><a href='#L27'>27</a>
|
|
93
|
+
<a name='L28'></a><a href='#L28'>28</a>
|
|
94
|
+
<a name='L29'></a><a href='#L29'>29</a>
|
|
95
|
+
<a name='L30'></a><a href='#L30'>30</a>
|
|
96
|
+
<a name='L31'></a><a href='#L31'>31</a>
|
|
97
|
+
<a name='L32'></a><a href='#L32'>32</a>
|
|
98
|
+
<a name='L33'></a><a href='#L33'>33</a>
|
|
99
|
+
<a name='L34'></a><a href='#L34'>34</a>
|
|
100
|
+
<a name='L35'></a><a href='#L35'>35</a>
|
|
101
|
+
<a name='L36'></a><a href='#L36'>36</a>
|
|
102
|
+
<a name='L37'></a><a href='#L37'>37</a>
|
|
103
|
+
<a name='L38'></a><a href='#L38'>38</a>
|
|
104
|
+
<a name='L39'></a><a href='#L39'>39</a>
|
|
105
|
+
<a name='L40'></a><a href='#L40'>40</a>
|
|
106
|
+
<a name='L41'></a><a href='#L41'>41</a>
|
|
107
|
+
<a name='L42'></a><a href='#L42'>42</a>
|
|
108
|
+
<a name='L43'></a><a href='#L43'>43</a>
|
|
109
|
+
<a name='L44'></a><a href='#L44'>44</a>
|
|
110
|
+
<a name='L45'></a><a href='#L45'>45</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
|
|
111
|
+
<span class="cline-any cline-neutral"> </span>
|
|
112
|
+
<span class="cline-any cline-neutral"> </span>
|
|
113
|
+
<span class="cline-any cline-neutral"> </span>
|
|
114
|
+
<span class="cline-any cline-neutral"> </span>
|
|
115
|
+
<span class="cline-any cline-neutral"> </span>
|
|
116
|
+
<span class="cline-any cline-neutral"> </span>
|
|
117
|
+
<span class="cline-any cline-neutral"> </span>
|
|
118
|
+
<span class="cline-any cline-neutral"> </span>
|
|
119
|
+
<span class="cline-any cline-neutral"> </span>
|
|
120
|
+
<span class="cline-any cline-neutral"> </span>
|
|
121
|
+
<span class="cline-any cline-yes">1x</span>
|
|
122
|
+
<span class="cline-any cline-yes">1x</span>
|
|
123
|
+
<span class="cline-any cline-yes">1x</span>
|
|
124
|
+
<span class="cline-any cline-yes">1x</span>
|
|
125
|
+
<span class="cline-any cline-neutral"> </span>
|
|
126
|
+
<span class="cline-any cline-yes">1x</span>
|
|
127
|
+
<span class="cline-any cline-yes">5x</span>
|
|
128
|
+
<span class="cline-any cline-neutral"> </span>
|
|
129
|
+
<span class="cline-any cline-no"> </span>
|
|
130
|
+
<span class="cline-any cline-no"> </span>
|
|
131
|
+
<span class="cline-any cline-yes">5x</span>
|
|
132
|
+
<span class="cline-any cline-neutral"> </span>
|
|
133
|
+
<span class="cline-any cline-no"> </span>
|
|
134
|
+
<span class="cline-any cline-neutral"> </span>
|
|
135
|
+
<span class="cline-any cline-no"> </span>
|
|
136
|
+
<span class="cline-any cline-no"> </span>
|
|
137
|
+
<span class="cline-any cline-neutral"> </span>
|
|
138
|
+
<span class="cline-any cline-yes">5x</span>
|
|
139
|
+
<span class="cline-any cline-no"> </span>
|
|
140
|
+
<span class="cline-any cline-no"> </span>
|
|
141
|
+
<span class="cline-any cline-no"> </span>
|
|
142
|
+
<span class="cline-any cline-neutral"> </span>
|
|
143
|
+
<span class="cline-any cline-yes">5x</span>
|
|
144
|
+
<span class="cline-any cline-no"> </span>
|
|
145
|
+
<span class="cline-any cline-neutral"> </span>
|
|
146
|
+
<span class="cline-any cline-neutral"> </span>
|
|
147
|
+
<span class="cline-any cline-neutral"> </span>
|
|
148
|
+
<span class="cline-any cline-yes">1x</span>
|
|
149
|
+
<span class="cline-any cline-neutral"> </span>
|
|
150
|
+
<span class="cline-any cline-neutral"> </span>
|
|
151
|
+
<span class="cline-any cline-neutral"> </span>
|
|
152
|
+
<span class="cline-any cline-neutral"> </span>
|
|
153
|
+
<span class="cline-any cline-yes">1x</span>
|
|
154
|
+
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">const customLevels = {
|
|
155
|
+
spam: 6,
|
|
156
|
+
trace: 5,
|
|
157
|
+
debug: 4,
|
|
158
|
+
info: 3,
|
|
159
|
+
warn: 2,
|
|
160
|
+
error: 1,
|
|
161
|
+
none: 0
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
function parseArgs(argv = process.argv) {
|
|
165
|
+
let properties = null;
|
|
166
|
+
let logLevel = 'none';
|
|
167
|
+
let maxCalls = 5;
|
|
168
|
+
let host = null;
|
|
169
|
+
|
|
170
|
+
argv.forEach((val) => {
|
|
171
|
+
<span class="missing-if-branch" title="if path not taken" >I</span>if (val.startsWith('--PROPS=')) {
|
|
172
|
+
// get the properties
|
|
173
|
+
const inputVal = <span class="cstat-no" title="statement not covered" >val.split('=')[1];</span>
|
|
174
|
+
<span class="cstat-no" title="statement not covered" > properties = JSON.parse(inputVal);</span>
|
|
175
|
+
} else <span class="missing-if-branch" title="if path not taken" >I</span>if (val.startsWith('--LOG=')) {
|
|
176
|
+
// get the desired log level
|
|
177
|
+
const level = <span class="cstat-no" title="statement not covered" >val.split('=')[1];</span>
|
|
178
|
+
// validate the log level is supported, if so set it
|
|
179
|
+
<span class="cstat-no" title="statement not covered" > if (Object.hasOwnProperty.call(customLevels, level)) {</span>
|
|
180
|
+
<span class="cstat-no" title="statement not covered" > logLevel = level;</span>
|
|
181
|
+
}
|
|
182
|
+
} else <span class="missing-if-branch" title="if path not taken" >I</span>if (val.startsWith('--MAXCALLS=')) {
|
|
183
|
+
const override = <span class="cstat-no" title="statement not covered" >parseInt(val.split('=')[1], 10);</span>
|
|
184
|
+
<span class="cstat-no" title="statement not covered" > if (!Number.isNaN(override) && override > 0) {</span>
|
|
185
|
+
<span class="cstat-no" title="statement not covered" > maxCalls = override;</span>
|
|
186
|
+
}
|
|
187
|
+
} else <span class="missing-if-branch" title="if path not taken" >I</span>if (val.startsWith('--HOST=')) {
|
|
188
|
+
<span class="cstat-no" title="statement not covered" > [, host] = val.split('=');</span>
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
return {
|
|
193
|
+
properties, logLevel, maxCalls, host
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
module.exports = { parseArgs };
|
|
198
|
+
</pre></td></tr></table></pre>
|
|
199
|
+
|
|
200
|
+
<div class='push'></div><!-- for sticky footer -->
|
|
201
|
+
</div><!-- /wrapper -->
|
|
202
|
+
<div class='footer quiet pad2 space-top1 center small'>
|
|
203
|
+
Code coverage generated by
|
|
204
|
+
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
205
|
+
at 2025-07-01T16:25:40.172Z
|
|
206
|
+
</div>
|
|
207
|
+
<script src="../../prettify.js"></script>
|
|
208
|
+
<script>
|
|
209
|
+
window.onload = function () {
|
|
210
|
+
prettyPrint();
|
|
211
|
+
};
|
|
212
|
+
</script>
|
|
213
|
+
<script src="../../sorter.js"></script>
|
|
214
|
+
<script src="../../block-navigation.js"></script>
|
|
215
|
+
</body>
|
|
216
|
+
</html>
|
|
217
|
+
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
|
|
2
|
+
<!doctype html>
|
|
3
|
+
<html lang="en">
|
|
4
|
+
|
|
5
|
+
<head>
|
|
6
|
+
<title>Code coverage report for adapter-mockdevice/utils</title>
|
|
7
|
+
<meta charset="utf-8" />
|
|
8
|
+
<link rel="stylesheet" href="../../prettify.css" />
|
|
9
|
+
<link rel="stylesheet" href="../../base.css" />
|
|
10
|
+
<link rel="shortcut icon" type="image/x-icon" href="../../favicon.png" />
|
|
11
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
12
|
+
<style type='text/css'>
|
|
13
|
+
.coverage-summary .sorter {
|
|
14
|
+
background-image: url(../../sort-arrow-sprite.png);
|
|
15
|
+
}
|
|
16
|
+
</style>
|
|
17
|
+
</head>
|
|
18
|
+
|
|
19
|
+
<body>
|
|
20
|
+
<div class='wrapper'>
|
|
21
|
+
<div class='pad1'>
|
|
22
|
+
<h1><a href="../../index.html">All files</a> adapter-mockdevice/utils</h1>
|
|
23
|
+
<div class='clearfix'>
|
|
24
|
+
|
|
25
|
+
<div class='fl pad1y space-right2'>
|
|
26
|
+
<span class="strong">67.85% </span>
|
|
27
|
+
<span class="quiet">Statements</span>
|
|
28
|
+
<span class='fraction'>19/28</span>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
<div class='fl pad1y space-right2'>
|
|
33
|
+
<span class="strong">33.33% </span>
|
|
34
|
+
<span class="quiet">Branches</span>
|
|
35
|
+
<span class='fraction'>6/18</span>
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
<div class='fl pad1y space-right2'>
|
|
40
|
+
<span class="strong">100% </span>
|
|
41
|
+
<span class="quiet">Functions</span>
|
|
42
|
+
<span class='fraction'>2/2</span>
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
<div class='fl pad1y space-right2'>
|
|
47
|
+
<span class="strong">67.85% </span>
|
|
48
|
+
<span class="quiet">Lines</span>
|
|
49
|
+
<span class='fraction'>19/28</span>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
<p class="quiet">
|
|
55
|
+
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
|
56
|
+
</p>
|
|
57
|
+
<template id="filterTemplate">
|
|
58
|
+
<div class="quiet">
|
|
59
|
+
Filter:
|
|
60
|
+
<input type="search" id="fileSearch">
|
|
61
|
+
</div>
|
|
62
|
+
</template>
|
|
63
|
+
</div>
|
|
64
|
+
<div class='status-line medium'></div>
|
|
65
|
+
<div class="pad1">
|
|
66
|
+
<table class="coverage-summary">
|
|
67
|
+
<thead>
|
|
68
|
+
<tr>
|
|
69
|
+
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
|
|
70
|
+
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
|
|
71
|
+
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
|
|
72
|
+
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
|
|
73
|
+
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
|
|
74
|
+
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
|
|
75
|
+
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
|
|
76
|
+
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
|
|
77
|
+
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
|
|
78
|
+
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
|
|
79
|
+
</tr>
|
|
80
|
+
</thead>
|
|
81
|
+
<tbody><tr>
|
|
82
|
+
<td class="file medium" data-value="argParser.js"><a href="argParser.js.html">argParser.js</a></td>
|
|
83
|
+
<td data-value="57.14" class="pic medium">
|
|
84
|
+
<div class="chart"><div class="cover-fill" style="width: 57%"></div><div class="cover-empty" style="width: 43%"></div></div>
|
|
85
|
+
</td>
|
|
86
|
+
<td data-value="57.14" class="pct medium">57.14%</td>
|
|
87
|
+
<td data-value="21" class="abs medium">12/21</td>
|
|
88
|
+
<td data-value="33.33" class="pct low">33.33%</td>
|
|
89
|
+
<td data-value="15" class="abs low">5/15</td>
|
|
90
|
+
<td data-value="100" class="pct high">100%</td>
|
|
91
|
+
<td data-value="2" class="abs high">2/2</td>
|
|
92
|
+
<td data-value="57.14" class="pct medium">57.14%</td>
|
|
93
|
+
<td data-value="21" class="abs medium">12/21</td>
|
|
94
|
+
</tr>
|
|
95
|
+
|
|
96
|
+
<tr>
|
|
97
|
+
<td class="file high" data-value="logger.js"><a href="logger.js.html">logger.js</a></td>
|
|
98
|
+
<td data-value="100" class="pic high">
|
|
99
|
+
<div class="chart"><div class="cover-fill cover-full" style="width: 100%"></div><div class="cover-empty" style="width: 0%"></div></div>
|
|
100
|
+
</td>
|
|
101
|
+
<td data-value="100" class="pct high">100%</td>
|
|
102
|
+
<td data-value="7" class="abs high">7/7</td>
|
|
103
|
+
<td data-value="33.33" class="pct low">33.33%</td>
|
|
104
|
+
<td data-value="3" class="abs low">1/3</td>
|
|
105
|
+
<td data-value="100" class="pct high">100%</td>
|
|
106
|
+
<td data-value="0" class="abs high">0/0</td>
|
|
107
|
+
<td data-value="100" class="pct high">100%</td>
|
|
108
|
+
<td data-value="7" class="abs high">7/7</td>
|
|
109
|
+
</tr>
|
|
110
|
+
|
|
111
|
+
</tbody>
|
|
112
|
+
</table>
|
|
113
|
+
</div>
|
|
114
|
+
<div class='push'></div><!-- for sticky footer -->
|
|
115
|
+
</div><!-- /wrapper -->
|
|
116
|
+
<div class='footer quiet pad2 space-top1 center small'>
|
|
117
|
+
Code coverage generated by
|
|
118
|
+
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
119
|
+
at 2025-07-01T16:25:40.172Z
|
|
120
|
+
</div>
|
|
121
|
+
<script src="../../prettify.js"></script>
|
|
122
|
+
<script>
|
|
123
|
+
window.onload = function () {
|
|
124
|
+
prettyPrint();
|
|
125
|
+
};
|
|
126
|
+
</script>
|
|
127
|
+
<script src="../../sorter.js"></script>
|
|
128
|
+
<script src="../../block-navigation.js"></script>
|
|
129
|
+
</body>
|
|
130
|
+
</html>
|
|
131
|
+
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
|
|
2
|
+
<!doctype html>
|
|
3
|
+
<html lang="en">
|
|
4
|
+
|
|
5
|
+
<head>
|
|
6
|
+
<title>Code coverage report for adapter-mockdevice/utils/logger.js</title>
|
|
7
|
+
<meta charset="utf-8" />
|
|
8
|
+
<link rel="stylesheet" href="../../prettify.css" />
|
|
9
|
+
<link rel="stylesheet" href="../../base.css" />
|
|
10
|
+
<link rel="shortcut icon" type="image/x-icon" href="../../favicon.png" />
|
|
11
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
12
|
+
<style type='text/css'>
|
|
13
|
+
.coverage-summary .sorter {
|
|
14
|
+
background-image: url(../../sort-arrow-sprite.png);
|
|
15
|
+
}
|
|
16
|
+
</style>
|
|
17
|
+
</head>
|
|
18
|
+
|
|
19
|
+
<body>
|
|
20
|
+
<div class='wrapper'>
|
|
21
|
+
<div class='pad1'>
|
|
22
|
+
<h1><a href="../../index.html">All files</a> / <a href="index.html">adapter-mockdevice/utils</a> logger.js</h1>
|
|
23
|
+
<div class='clearfix'>
|
|
24
|
+
|
|
25
|
+
<div class='fl pad1y space-right2'>
|
|
26
|
+
<span class="strong">100% </span>
|
|
27
|
+
<span class="quiet">Statements</span>
|
|
28
|
+
<span class='fraction'>7/7</span>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
<div class='fl pad1y space-right2'>
|
|
33
|
+
<span class="strong">33.33% </span>
|
|
34
|
+
<span class="quiet">Branches</span>
|
|
35
|
+
<span class='fraction'>1/3</span>
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
<div class='fl pad1y space-right2'>
|
|
40
|
+
<span class="strong">100% </span>
|
|
41
|
+
<span class="quiet">Functions</span>
|
|
42
|
+
<span class='fraction'>0/0</span>
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
<div class='fl pad1y space-right2'>
|
|
47
|
+
<span class="strong">100% </span>
|
|
48
|
+
<span class="quiet">Lines</span>
|
|
49
|
+
<span class='fraction'>7/7</span>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
<p class="quiet">
|
|
55
|
+
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
|
56
|
+
</p>
|
|
57
|
+
<template id="filterTemplate">
|
|
58
|
+
<div class="quiet">
|
|
59
|
+
Filter:
|
|
60
|
+
<input type="search" id="fileSearch">
|
|
61
|
+
</div>
|
|
62
|
+
</template>
|
|
63
|
+
</div>
|
|
64
|
+
<div class='status-line high'></div>
|
|
65
|
+
<pre><table class="coverage">
|
|
66
|
+
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
|
67
|
+
<a name='L2'></a><a href='#L2'>2</a>
|
|
68
|
+
<a name='L3'></a><a href='#L3'>3</a>
|
|
69
|
+
<a name='L4'></a><a href='#L4'>4</a>
|
|
70
|
+
<a name='L5'></a><a href='#L5'>5</a>
|
|
71
|
+
<a name='L6'></a><a href='#L6'>6</a>
|
|
72
|
+
<a name='L7'></a><a href='#L7'>7</a>
|
|
73
|
+
<a name='L8'></a><a href='#L8'>8</a>
|
|
74
|
+
<a name='L9'></a><a href='#L9'>9</a>
|
|
75
|
+
<a name='L10'></a><a href='#L10'>10</a>
|
|
76
|
+
<a name='L11'></a><a href='#L11'>11</a>
|
|
77
|
+
<a name='L12'></a><a href='#L12'>12</a>
|
|
78
|
+
<a name='L13'></a><a href='#L13'>13</a>
|
|
79
|
+
<a name='L14'></a><a href='#L14'>14</a>
|
|
80
|
+
<a name='L15'></a><a href='#L15'>15</a>
|
|
81
|
+
<a name='L16'></a><a href='#L16'>16</a>
|
|
82
|
+
<a name='L17'></a><a href='#L17'>17</a>
|
|
83
|
+
<a name='L18'></a><a href='#L18'>18</a>
|
|
84
|
+
<a name='L19'></a><a href='#L19'>19</a>
|
|
85
|
+
<a name='L20'></a><a href='#L20'>20</a>
|
|
86
|
+
<a name='L21'></a><a href='#L21'>21</a>
|
|
87
|
+
<a name='L22'></a><a href='#L22'>22</a>
|
|
88
|
+
<a name='L23'></a><a href='#L23'>23</a>
|
|
89
|
+
<a name='L24'></a><a href='#L24'>24</a>
|
|
90
|
+
<a name='L25'></a><a href='#L25'>25</a>
|
|
91
|
+
<a name='L26'></a><a href='#L26'>26</a>
|
|
92
|
+
<a name='L27'></a><a href='#L27'>27</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
|
93
|
+
<span class="cline-any cline-yes">1x</span>
|
|
94
|
+
<span class="cline-any cline-yes">1x</span>
|
|
95
|
+
<span class="cline-any cline-neutral"> </span>
|
|
96
|
+
<span class="cline-any cline-yes">1x</span>
|
|
97
|
+
<span class="cline-any cline-neutral"> </span>
|
|
98
|
+
<span class="cline-any cline-neutral"> </span>
|
|
99
|
+
<span class="cline-any cline-neutral"> </span>
|
|
100
|
+
<span class="cline-any cline-neutral"> </span>
|
|
101
|
+
<span class="cline-any cline-neutral"> </span>
|
|
102
|
+
<span class="cline-any cline-neutral"> </span>
|
|
103
|
+
<span class="cline-any cline-neutral"> </span>
|
|
104
|
+
<span class="cline-any cline-neutral"> </span>
|
|
105
|
+
<span class="cline-any cline-neutral"> </span>
|
|
106
|
+
<span class="cline-any cline-neutral"> </span>
|
|
107
|
+
<span class="cline-any cline-yes">1x</span>
|
|
108
|
+
<span class="cline-any cline-yes">1x</span>
|
|
109
|
+
<span class="cline-any cline-neutral"> </span>
|
|
110
|
+
<span class="cline-any cline-yes">1x</span>
|
|
111
|
+
<span class="cline-any cline-neutral"> </span>
|
|
112
|
+
<span class="cline-any cline-neutral"> </span>
|
|
113
|
+
<span class="cline-any cline-neutral"> </span>
|
|
114
|
+
<span class="cline-any cline-neutral"> </span>
|
|
115
|
+
<span class="cline-any cline-neutral"> </span>
|
|
116
|
+
<span class="cline-any cline-neutral"> </span>
|
|
117
|
+
<span class="cline-any cline-yes">1x</span>
|
|
118
|
+
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">// utils/logger.js
|
|
119
|
+
const winston = require('winston');
|
|
120
|
+
const { parseArgs } = require('./argParser');
|
|
121
|
+
|
|
122
|
+
const customLevels = {
|
|
123
|
+
spam: 6,
|
|
124
|
+
trace: 5,
|
|
125
|
+
debug: 4,
|
|
126
|
+
info: 3,
|
|
127
|
+
warn: 2,
|
|
128
|
+
error: 1,
|
|
129
|
+
none: 0
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
// Only set global logger if it doesn't already exist (i.e., not provided by app)
|
|
133
|
+
<span class="missing-if-branch" title="else path not taken" >E</span>if (!global.log) {
|
|
134
|
+
const { logLevel = <span class="branch-0 cbranch-no" title="branch not covered" >'info' </span>} = parseArgs();
|
|
135
|
+
|
|
136
|
+
global.log = winston.createLogger({
|
|
137
|
+
level: logLevel,
|
|
138
|
+
levels: customLevels,
|
|
139
|
+
transports: [new winston.transports.Console()]
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
module.exports = global.log;
|
|
144
|
+
</pre></td></tr></table></pre>
|
|
145
|
+
|
|
146
|
+
<div class='push'></div><!-- for sticky footer -->
|
|
147
|
+
</div><!-- /wrapper -->
|
|
148
|
+
<div class='footer quiet pad2 space-top1 center small'>
|
|
149
|
+
Code coverage generated by
|
|
150
|
+
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
151
|
+
at 2025-07-01T16:25:40.172Z
|
|
152
|
+
</div>
|
|
153
|
+
<script src="../../prettify.js"></script>
|
|
154
|
+
<script>
|
|
155
|
+
window.onload = function () {
|
|
156
|
+
prettyPrint();
|
|
157
|
+
};
|
|
158
|
+
</script>
|
|
159
|
+
<script src="../../sorter.js"></script>
|
|
160
|
+
<script src="../../block-navigation.js"></script>
|
|
161
|
+
</body>
|
|
162
|
+
</html>
|
|
163
|
+
|
package/coverage/index.html
CHANGED
|
@@ -23,30 +23,30 @@
|
|
|
23
23
|
<div class='clearfix'>
|
|
24
24
|
|
|
25
25
|
<div class='fl pad1y space-right2'>
|
|
26
|
-
<span class="strong">
|
|
26
|
+
<span class="strong">16.8% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>41/244</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
<div class='fl pad1y space-right2'>
|
|
33
|
-
<span class="strong">
|
|
33
|
+
<span class="strong">10.25% </span>
|
|
34
34
|
<span class="quiet">Branches</span>
|
|
35
|
-
<span class='fraction'>
|
|
35
|
+
<span class='fraction'>8/78</span>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
<div class='fl pad1y space-right2'>
|
|
40
|
-
<span class="strong">
|
|
40
|
+
<span class="strong">11.36% </span>
|
|
41
41
|
<span class="quiet">Functions</span>
|
|
42
|
-
<span class='fraction'>
|
|
42
|
+
<span class='fraction'>5/44</span>
|
|
43
43
|
</div>
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
|
-
<span class="strong">
|
|
47
|
+
<span class="strong">17.01% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
49
|
+
<span class='fraction'>41/241</span>
|
|
50
50
|
</div>
|
|
51
51
|
|
|
52
52
|
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
</tr>
|
|
80
80
|
</thead>
|
|
81
81
|
<tbody><tr>
|
|
82
|
-
<td class="file low" data-value="adapter
|
|
82
|
+
<td class="file low" data-value="adapter-mockdevice"><a href="adapter-mockdevice/index.html">adapter-mockdevice</a></td>
|
|
83
83
|
<td data-value="10.18" class="pic low">
|
|
84
84
|
<div class="chart"><div class="cover-fill" style="width: 10%"></div><div class="cover-empty" style="width: 90%"></div></div>
|
|
85
85
|
</td>
|
|
@@ -93,6 +93,21 @@
|
|
|
93
93
|
<td data-value="213" class="abs low">22/213</td>
|
|
94
94
|
</tr>
|
|
95
95
|
|
|
96
|
+
<tr>
|
|
97
|
+
<td class="file medium" data-value="adapter-mockdevice/utils"><a href="adapter-mockdevice/utils/index.html">adapter-mockdevice/utils</a></td>
|
|
98
|
+
<td data-value="67.85" class="pic medium">
|
|
99
|
+
<div class="chart"><div class="cover-fill" style="width: 67%"></div><div class="cover-empty" style="width: 33%"></div></div>
|
|
100
|
+
</td>
|
|
101
|
+
<td data-value="67.85" class="pct medium">67.85%</td>
|
|
102
|
+
<td data-value="28" class="abs medium">19/28</td>
|
|
103
|
+
<td data-value="33.33" class="pct low">33.33%</td>
|
|
104
|
+
<td data-value="18" class="abs low">6/18</td>
|
|
105
|
+
<td data-value="100" class="pct high">100%</td>
|
|
106
|
+
<td data-value="2" class="abs high">2/2</td>
|
|
107
|
+
<td data-value="67.85" class="pct medium">67.85%</td>
|
|
108
|
+
<td data-value="28" class="abs medium">19/28</td>
|
|
109
|
+
</tr>
|
|
110
|
+
|
|
96
111
|
</tbody>
|
|
97
112
|
</table>
|
|
98
113
|
</div>
|
|
@@ -101,7 +116,7 @@
|
|
|
101
116
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
102
117
|
Code coverage generated by
|
|
103
118
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
104
|
-
at 2025-
|
|
119
|
+
at 2025-07-01T16:25:40.172Z
|
|
105
120
|
</div>
|
|
106
121
|
<script src="prettify.js"></script>
|
|
107
122
|
<script>
|
package/package.json
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itentialopensource/adapter-mockdevice",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "mock implementation of device broker",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
|
+
"wizardVersion": "2.44.7",
|
|
7
|
+
"engineVersion": "1.69.14",
|
|
6
8
|
"repository": {
|
|
7
9
|
"type": "git",
|
|
8
10
|
"url": "git@gitlab.com:itentialopensource/adapters/adapter-mockdevice.git"
|
|
@@ -15,7 +17,6 @@
|
|
|
15
17
|
"npm": ">=7.18.1 <8.0.0"
|
|
16
18
|
},
|
|
17
19
|
"scripts": {
|
|
18
|
-
"artifactize": "npm i && node utils/packModificationScript.js",
|
|
19
20
|
"preinstall": "node utils/setup.js",
|
|
20
21
|
"deinstall": "node utils/removeHooks.js",
|
|
21
22
|
"lint": "node --max_old_space_size=4096 ./node_modules/eslint/bin/eslint.js . --ext .json --ext .js",
|
|
@@ -29,56 +30,52 @@
|
|
|
29
30
|
},
|
|
30
31
|
"keywords": [
|
|
31
32
|
"Itential",
|
|
32
|
-
"
|
|
33
|
+
"Itential Platform",
|
|
33
34
|
"Automation",
|
|
34
35
|
"Integration",
|
|
35
|
-
"App-Artifacts",
|
|
36
36
|
"Adapter",
|
|
37
37
|
"mockdevice",
|
|
38
38
|
"Pre-Release"
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"ajv": "
|
|
42
|
-
"axios": "
|
|
43
|
-
"esprima": "
|
|
44
|
-
"fs-extra": "
|
|
45
|
-
"readline-sync": "
|
|
46
|
-
"
|
|
41
|
+
"ajv": "8.17.1",
|
|
42
|
+
"axios": "1.9.0",
|
|
43
|
+
"esprima": "4.0.1",
|
|
44
|
+
"fs-extra": "11.3.0",
|
|
45
|
+
"readline-sync": "1.4.10",
|
|
46
|
+
"mocha": "10.8.2",
|
|
47
|
+
"semver": "7.7.2",
|
|
48
|
+
"winston": "3.17.0"
|
|
47
49
|
},
|
|
48
50
|
"devDependencies": {
|
|
49
|
-
"chai": "
|
|
50
|
-
"eslint": "
|
|
51
|
-
"eslint-config-airbnb-base": "
|
|
52
|
-
"eslint-plugin-import": "
|
|
53
|
-
"eslint-plugin-json": "
|
|
54
|
-
"eslint-config-airbnb": "
|
|
55
|
-
"eslint-config-prettier": "
|
|
56
|
-
"eslint-plugin-jsdoc": "
|
|
57
|
-
"eslint-plugin-mocha": "
|
|
58
|
-
"eslint-plugin-node": "
|
|
59
|
-
"eslint-plugin-prettier": "
|
|
60
|
-
"eslint-plugin-yaml": "
|
|
61
|
-
"husky": "
|
|
62
|
-
"jsdoc": "
|
|
63
|
-
"lint-staged": "
|
|
64
|
-
"minami": "
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"prettier": "
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"testdouble": "^3.18.0",
|
|
73
|
-
"winston": "^3.14.2"
|
|
51
|
+
"chai": "4.5.0",
|
|
52
|
+
"eslint": "8.57.0",
|
|
53
|
+
"eslint-config-airbnb-base": "15.0.0",
|
|
54
|
+
"eslint-plugin-import": "2.31.0",
|
|
55
|
+
"eslint-plugin-json": "3.1.0",
|
|
56
|
+
"eslint-config-airbnb": "19.0.4",
|
|
57
|
+
"eslint-config-prettier": "8.1.0",
|
|
58
|
+
"eslint-plugin-jsdoc": "50.2.4",
|
|
59
|
+
"eslint-plugin-mocha": "8.1.0",
|
|
60
|
+
"eslint-plugin-node": "11.1.0",
|
|
61
|
+
"eslint-plugin-prettier": "3.3.1",
|
|
62
|
+
"eslint-plugin-yaml": "0.4.1",
|
|
63
|
+
"husky": "4.3.8",
|
|
64
|
+
"jsdoc": "4.0.2",
|
|
65
|
+
"lint-staged": "10.5.4",
|
|
66
|
+
"minami": "1.2.3",
|
|
67
|
+
"mochawesome": "7.1.3",
|
|
68
|
+
"nyc": "15.1.0",
|
|
69
|
+
"prettier": "2.2.1",
|
|
70
|
+
"prettier-plugin-package": "1.3.0",
|
|
71
|
+
"pretty-quick": "3.1.0",
|
|
72
|
+
"shellcheck": "1.0.0",
|
|
73
|
+
"testdouble": "3.18.0"
|
|
74
74
|
},
|
|
75
75
|
"lint-staged": {
|
|
76
76
|
"*.{js,json,jsx,yaml,yml,md}": [
|
|
77
77
|
"./node_modules/.bin/eslint --fix"
|
|
78
78
|
]
|
|
79
79
|
},
|
|
80
|
-
"resolutions": {
|
|
81
|
-
"minimist": "^1.2.8"
|
|
82
|
-
},
|
|
83
80
|
"private": false
|
|
84
81
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const customLevels = {
|
|
2
|
+
spam: 6,
|
|
3
|
+
trace: 5,
|
|
4
|
+
debug: 4,
|
|
5
|
+
info: 3,
|
|
6
|
+
warn: 2,
|
|
7
|
+
error: 1,
|
|
8
|
+
none: 0
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
function parseArgs(argv = process.argv) {
|
|
12
|
+
let properties = null;
|
|
13
|
+
let logLevel = 'none';
|
|
14
|
+
let maxCalls = 5;
|
|
15
|
+
let host = null;
|
|
16
|
+
|
|
17
|
+
argv.forEach((val) => {
|
|
18
|
+
if (val.startsWith('--PROPS=')) {
|
|
19
|
+
// get the properties
|
|
20
|
+
const inputVal = val.split('=')[1];
|
|
21
|
+
properties = JSON.parse(inputVal);
|
|
22
|
+
} else if (val.startsWith('--LOG=')) {
|
|
23
|
+
// get the desired log level
|
|
24
|
+
const level = val.split('=')[1];
|
|
25
|
+
// validate the log level is supported, if so set it
|
|
26
|
+
if (Object.hasOwnProperty.call(customLevels, level)) {
|
|
27
|
+
logLevel = level;
|
|
28
|
+
}
|
|
29
|
+
} else if (val.startsWith('--MAXCALLS=')) {
|
|
30
|
+
const override = parseInt(val.split('=')[1], 10);
|
|
31
|
+
if (!Number.isNaN(override) && override > 0) {
|
|
32
|
+
maxCalls = override;
|
|
33
|
+
}
|
|
34
|
+
} else if (val.startsWith('--HOST=')) {
|
|
35
|
+
[, host] = val.split('=');
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
properties, logLevel, maxCalls, host
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
module.exports = { parseArgs };
|
package/utils/logger.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// utils/logger.js
|
|
2
|
+
const winston = require('winston');
|
|
3
|
+
const { parseArgs } = require('./argParser');
|
|
4
|
+
|
|
5
|
+
const customLevels = {
|
|
6
|
+
spam: 6,
|
|
7
|
+
trace: 5,
|
|
8
|
+
debug: 4,
|
|
9
|
+
info: 3,
|
|
10
|
+
warn: 2,
|
|
11
|
+
error: 1,
|
|
12
|
+
none: 0
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// Only set global logger if it doesn't already exist (i.e., not provided by app)
|
|
16
|
+
if (!global.log) {
|
|
17
|
+
const { logLevel = 'info' } = parseArgs();
|
|
18
|
+
|
|
19
|
+
global.log = winston.createLogger({
|
|
20
|
+
level: logLevel,
|
|
21
|
+
levels: customLevels,
|
|
22
|
+
transports: [new winston.transports.Console()]
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
module.exports = global.log;
|
package/utils/artifactize.js
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/* @copyright Itential, LLC 2019 */
|
|
3
|
-
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const fs = require('fs-extra');
|
|
6
|
-
|
|
7
|
-
async function createBundle(adapterOldDir) {
|
|
8
|
-
// set directories
|
|
9
|
-
const artifactDir = path.join(adapterOldDir, '../artifactTemp');
|
|
10
|
-
const workflowsDir = path.join(adapterOldDir, 'workflows');
|
|
11
|
-
|
|
12
|
-
// read adapter's package and set names
|
|
13
|
-
const adapterPackage = fs.readJSONSync(path.join(adapterOldDir, 'package.json'));
|
|
14
|
-
const originalName = adapterPackage.name.substring(adapterPackage.name.lastIndexOf('/') + 1);
|
|
15
|
-
const shortenedName = originalName.replace('adapter-', '');
|
|
16
|
-
const artifactName = originalName.replace('adapter', 'bundled-adapter');
|
|
17
|
-
|
|
18
|
-
const adapterNewDir = path.join(artifactDir, 'bundles', 'adapters', originalName);
|
|
19
|
-
fs.ensureDirSync(adapterNewDir);
|
|
20
|
-
|
|
21
|
-
const ops = [];
|
|
22
|
-
|
|
23
|
-
// copy old adapterDir to bundled hierarchy location
|
|
24
|
-
ops.push(() => fs.copySync(adapterOldDir, adapterNewDir));
|
|
25
|
-
|
|
26
|
-
// copy readme
|
|
27
|
-
ops.push(() => fs.copySync(path.join(adapterOldDir, 'README.md'), path.join(artifactDir, 'README.md')));
|
|
28
|
-
|
|
29
|
-
// copy changelog
|
|
30
|
-
if (fs.existsSync(path.join(adapterOldDir, 'CHANGELOG.md'))) {
|
|
31
|
-
ops.push(() => fs.copySync(path.join(adapterOldDir, 'CHANGELOG.md'), path.join(artifactDir, 'CHANGELOG.md')));
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// copy license
|
|
35
|
-
if (fs.existsSync(path.join(adapterOldDir, 'LICENSE'))) {
|
|
36
|
-
ops.push(() => fs.copySync(path.join(adapterOldDir, 'LICENSE'), path.join(artifactDir, 'LICENSE')));
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// create package
|
|
40
|
-
const artifactPackage = {
|
|
41
|
-
name: artifactName,
|
|
42
|
-
version: adapterPackage.version,
|
|
43
|
-
description: `A bundled version of the ${originalName} to be used in adapter-artifacts for easy installation`,
|
|
44
|
-
scripts: {
|
|
45
|
-
test: 'echo "Error: no test specified" && exit 1',
|
|
46
|
-
deploy: 'npm publish --registry=http://registry.npmjs.org'
|
|
47
|
-
},
|
|
48
|
-
keywords: [
|
|
49
|
-
'IAP',
|
|
50
|
-
'artifacts',
|
|
51
|
-
'Itential',
|
|
52
|
-
'Pronghorn',
|
|
53
|
-
'Adapter',
|
|
54
|
-
'Adapter-Artifacts',
|
|
55
|
-
shortenedName
|
|
56
|
-
],
|
|
57
|
-
author: 'Itential Artifacts',
|
|
58
|
-
license: 'Apache-2.0',
|
|
59
|
-
repository: adapterPackage.repository,
|
|
60
|
-
private: false,
|
|
61
|
-
devDependencies: {
|
|
62
|
-
r2: '^2.0.1',
|
|
63
|
-
ajv: '6.10.0',
|
|
64
|
-
'better-ajv-errors': '^0.6.1',
|
|
65
|
-
'fs-extra': '^7.0.1'
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
ops.push(() => fs.writeJSONSync(path.join(artifactDir, 'package.json'), artifactPackage, { spaces: 2 }));
|
|
70
|
-
|
|
71
|
-
// create manifest
|
|
72
|
-
const manifest = {
|
|
73
|
-
bundleName: originalName,
|
|
74
|
-
version: adapterPackage.version,
|
|
75
|
-
fingerprint: 'Some verifiable token',
|
|
76
|
-
createdEpoch: '1554836984020',
|
|
77
|
-
artifacts: [
|
|
78
|
-
{
|
|
79
|
-
id: `${shortenedName}-adapter`,
|
|
80
|
-
name: `${shortenedName}-adapter`,
|
|
81
|
-
type: 'adapter',
|
|
82
|
-
location: `/bundles/adapters/${originalName}`,
|
|
83
|
-
description: artifactPackage.description,
|
|
84
|
-
properties: {
|
|
85
|
-
entryPoint: false
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
]
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
// add workflows into artifact
|
|
92
|
-
if (fs.existsSync(workflowsDir)) {
|
|
93
|
-
const workflowFileNames = fs.readdirSync(workflowsDir);
|
|
94
|
-
|
|
95
|
-
// if folder isnt empty and only file is not readme
|
|
96
|
-
if (workflowFileNames.length !== 0 && (!(workflowFileNames.length === 1 && workflowFileNames[0].split('.')[1] === 'md'))) {
|
|
97
|
-
// add workflows to correct location in bundle
|
|
98
|
-
ops.push(() => fs.copySync(workflowsDir, path.join(artifactDir, 'bundles', 'workflows')));
|
|
99
|
-
|
|
100
|
-
// add workflows to manifest
|
|
101
|
-
workflowFileNames.forEach((filename) => {
|
|
102
|
-
const [filenameNoExt, ext] = filename.split('.');
|
|
103
|
-
if (ext === 'json') {
|
|
104
|
-
manifest.artifacts.push({
|
|
105
|
-
id: `workflow-${filenameNoExt}`,
|
|
106
|
-
name: filenameNoExt,
|
|
107
|
-
type: 'workflow',
|
|
108
|
-
location: `/bundles/workflows/${filename}`,
|
|
109
|
-
description: 'Main entry point to artifact',
|
|
110
|
-
properties: {
|
|
111
|
-
entryPoint: false
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
ops.push(() => fs.writeJSONSync(path.join(artifactDir, 'manifest.json'), manifest, { spaces: 2 }));
|
|
120
|
-
|
|
121
|
-
// Run the commands in parallel
|
|
122
|
-
try {
|
|
123
|
-
await Promise.all(ops.map(async (op) => op()));
|
|
124
|
-
} catch (e) {
|
|
125
|
-
throw new Error(e);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
const pathObj = {
|
|
129
|
-
bundlePath: artifactDir,
|
|
130
|
-
bundledAdapterPath: path.join(artifactDir, 'bundles', 'adapters', originalName)
|
|
131
|
-
};
|
|
132
|
-
return pathObj;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
async function artifactize(entryPathToAdapter) {
|
|
136
|
-
const truePath = path.resolve(entryPathToAdapter);
|
|
137
|
-
const packagePath = path.join(truePath, 'package');
|
|
138
|
-
// remove adapter from package and move bundle in
|
|
139
|
-
const pathObj = await createBundle(packagePath);
|
|
140
|
-
const { bundlePath } = pathObj;
|
|
141
|
-
fs.removeSync(packagePath);
|
|
142
|
-
fs.moveSync(bundlePath, packagePath);
|
|
143
|
-
return 'Bundle successfully created and old folder system removed';
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
module.exports = { createBundle, artifactize };
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/* @copyright Itential, LLC 2019 */
|
|
3
|
-
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const { spawnSync } = require('child_process');
|
|
6
|
-
const fs = require('fs-extra');
|
|
7
|
-
const { createBundle } = require('./artifactize');
|
|
8
|
-
|
|
9
|
-
const nodeEntryPath = path.resolve('.');
|
|
10
|
-
createBundle(nodeEntryPath).then((pathObj) => {
|
|
11
|
-
const { bundlePath, bundledAdapterPath } = pathObj;
|
|
12
|
-
const npmIgnorePath = path.join(bundledAdapterPath, '.npmignore');
|
|
13
|
-
const adapterPackagePath = path.join(bundledAdapterPath, 'package.json');
|
|
14
|
-
const artifactPackagePath = path.join(bundlePath, 'package.json');
|
|
15
|
-
|
|
16
|
-
// remove node_modules from .npmIgnore so that node_modules are included in the resulting tar from npm pack
|
|
17
|
-
let npmIgnoreString;
|
|
18
|
-
if (fs.existsSync(npmIgnorePath)) {
|
|
19
|
-
npmIgnoreString = fs.readFileSync(npmIgnorePath, 'utf8');
|
|
20
|
-
npmIgnoreString = npmIgnoreString.replace('node_modules', '');
|
|
21
|
-
npmIgnoreString = npmIgnoreString.replace('\n\n', '\n');
|
|
22
|
-
fs.writeFileSync(npmIgnorePath, npmIgnoreString);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// add files to package so that node_modules are included in the resulting tar from npm pack
|
|
26
|
-
const adapterPackage = fs.readJSONSync(adapterPackagePath);
|
|
27
|
-
adapterPackage.files = ['*'];
|
|
28
|
-
fs.writeJSONSync(artifactPackagePath, adapterPackage, { spaces: 2 });
|
|
29
|
-
const npmResult = spawnSync('npm', ['pack', '-q', bundlePath], { cwd: path.resolve(bundlePath, '..') });
|
|
30
|
-
if (npmResult.status === 0) {
|
|
31
|
-
fs.removeSync(bundlePath);
|
|
32
|
-
console.log('Bundle folder removed');
|
|
33
|
-
}
|
|
34
|
-
console.log('Script successful');
|
|
35
|
-
});
|