@alfalab/core-components-switch 3.0.5 → 3.0.7

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/Component.js CHANGED
@@ -14,7 +14,7 @@ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
14
14
  var mergeRefs__default = /*#__PURE__*/_interopDefaultCompat(mergeRefs);
15
15
  var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
16
16
 
17
- var styles = {"component":"switch__component_qryao","start":"switch__start_qryao","center":"switch__center_qryao","addons":"switch__addons_qryao","block":"switch__block_qryao","switch":"switch__switch_qryao","content":"switch__content_qryao","label":"switch__label_qryao","hint":"switch__hint_qryao","reversed":"switch__reversed_qryao","checked":"switch__checked_qryao","disabled":"switch__disabled_qryao","inactive":"switch__inactive_qryao","focused":"switch__focused_qryao"};
17
+ var styles = {"component":"switch__component_vtete","start":"switch__start_vtete","center":"switch__center_vtete","addons":"switch__addons_vtete","block":"switch__block_vtete","switch":"switch__switch_vtete","content":"switch__content_vtete","label":"switch__label_vtete","hint":"switch__hint_vtete","reversed":"switch__reversed_vtete","checked":"switch__checked_vtete","disabled":"switch__disabled_vtete","inactive":"switch__inactive_vtete","focused":"switch__focused_vtete"};
18
18
  require('./index.css')
19
19
 
20
20
  var Switch = React.forwardRef(function (_a, ref) {
package/esm/Component.js CHANGED
@@ -4,7 +4,7 @@ import mergeRefs from 'react-merge-refs';
4
4
  import cn from 'classnames';
5
5
  import { useFocus } from '@alfalab/hooks';
6
6
 
7
- var styles = {"component":"switch__component_qryao","start":"switch__start_qryao","center":"switch__center_qryao","addons":"switch__addons_qryao","block":"switch__block_qryao","switch":"switch__switch_qryao","content":"switch__content_qryao","label":"switch__label_qryao","hint":"switch__hint_qryao","reversed":"switch__reversed_qryao","checked":"switch__checked_qryao","disabled":"switch__disabled_qryao","inactive":"switch__inactive_qryao","focused":"switch__focused_qryao"};
7
+ var styles = {"component":"switch__component_vtete","start":"switch__start_vtete","center":"switch__center_vtete","addons":"switch__addons_vtete","block":"switch__block_vtete","switch":"switch__switch_vtete","content":"switch__content_vtete","label":"switch__label_vtete","hint":"switch__hint_vtete","reversed":"switch__reversed_vtete","checked":"switch__checked_vtete","disabled":"switch__disabled_vtete","inactive":"switch__inactive_vtete","focused":"switch__focused_vtete"};
8
8
  require('./index.css')
9
9
 
10
10
  var Switch = forwardRef(function (_a, ref) {
package/esm/index.css CHANGED
@@ -1,4 +1,4 @@
1
- /* hash: f2bkn */
1
+ /* hash: 1xgwp */
2
2
  :root {
3
3
  } /* deprecated */ :root {
4
4
  --color-light-border-link: #0072ef;
@@ -47,7 +47,7 @@
47
47
 
48
48
  /* inactive */
49
49
  --switch-inactive-color: var(--color-light-border-underline);
50
- } .switch__component_qryao {
50
+ } .switch__component_vtete {
51
51
  display: inline-flex;
52
52
  align-items: flex-start;
53
53
  margin: 0;
@@ -55,20 +55,20 @@
55
55
  border: 0;
56
56
  cursor: pointer;
57
57
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
58
- } .switch__component_qryao input {
58
+ } .switch__component_vtete input {
59
59
  opacity: 0;
60
60
  position: absolute;
61
- } .switch__start_qryao {
61
+ } .switch__start_vtete {
62
62
  align-items: flex-start;
63
- } .switch__center_qryao {
63
+ } .switch__center_vtete {
64
64
  align-items: center;
65
- } .switch__addons_qryao {
65
+ } .switch__addons_vtete {
66
66
  margin-left: auto;
67
67
  padding-left: var(--gap-m);
68
68
  line-height: 24px;
69
- } .switch__block_qryao {
69
+ } .switch__block_vtete {
70
70
  width: 100%;
71
- } .switch__switch_qryao {
71
+ } .switch__switch_vtete {
72
72
  position: relative;
73
73
  border-radius: var(--border-radius-xl);
74
74
  width: 36px;
@@ -79,7 +79,7 @@
79
79
  border: 2px solid var(--switch-border-color);
80
80
  transition: background-color 0.2s ease, border-color 0.2s ease;
81
81
  box-sizing: border-box;
82
- } .switch__switch_qryao:before {
82
+ } .switch__switch_vtete:before {
83
83
  content: '';
84
84
  position: absolute;
85
85
  top: 0;
@@ -91,56 +91,56 @@
91
91
  background-color: var(--color-static-graphic-light);
92
92
  box-sizing: border-box;
93
93
  transition: transform 0.2s ease;
94
- } .switch__content_qryao {
94
+ } .switch__content_vtete {
95
95
  margin-left: var(--gap-s);
96
96
  flex-grow: 1;
97
- } .switch__label_qryao {
97
+ } .switch__label_vtete {
98
98
  font-size: 16px;
99
99
  line-height: 24px;
100
100
  font-weight: 400;
101
101
  display: block;
102
102
  color: var(--switch-label-color);
103
- } .switch__label_qryao:not(:only-child) {
103
+ } .switch__label_vtete:not(:only-child) {
104
104
  margin-bottom: var(--gap-2xs);
105
- } .switch__hint_qryao {
105
+ } .switch__hint_vtete {
106
106
  font-size: 14px;
107
107
  line-height: 18px;
108
108
  font-weight: 400;
109
109
  display: block;
110
110
  color: var(--switch-hint-color);
111
- } /* Reversed state */ .switch__component_qryao.switch__reversed_qryao {
111
+ } /* Reversed state */ .switch__component_vtete.switch__reversed_vtete {
112
112
  flex-direction: row-reverse;
113
- } .switch__reversed_qryao .switch__content_qryao {
113
+ } .switch__reversed_vtete .switch__content_vtete {
114
114
  margin-right: var(--gap-m);
115
115
  margin-left: 0;
116
- } .switch__reversed_qryao .switch__addons_qryao {
116
+ } .switch__reversed_vtete .switch__addons_vtete {
117
117
  margin-left: 0;
118
118
  padding-left: 0;
119
119
  margin-right: auto;
120
120
  padding-right: var(--gap-m);
121
- } /* Checked state */ .switch__checked_qryao .switch__switch_qryao {
121
+ } /* Checked state */ .switch__checked_vtete .switch__switch_vtete {
122
122
  background-color: var(--switch-checked-bg-color);
123
123
  border-color: var(--switch-checked-border-color);
124
- } .switch__checked_qryao .switch__switch_qryao:before {
124
+ } .switch__checked_vtete .switch__switch_vtete:before {
125
125
  /* ширина компонента(36px + 2*2px) - отступы(2 * 2px) - размер кружка(20px) */
126
126
  transform: translateX(16px);
127
- } /* Disabled state */ .switch__disabled_qryao {
127
+ } /* Disabled state */ .switch__disabled_vtete {
128
128
  cursor: var(--disabled-cursor);
129
- } .switch__disabled_qryao .switch__switch_qryao {
129
+ } .switch__disabled_vtete .switch__switch_vtete {
130
130
  background-color: var(--switch-disabled-bg-color);
131
131
  border-color: var(--switch-disabled-border-color);
132
- } .switch__disabled_qryao .switch__label_qryao {
132
+ } .switch__disabled_vtete .switch__label_vtete {
133
133
  color: var(--switch-disabled-color);
134
- } .switch__disabled_qryao .switch__hint_qryao {
134
+ } .switch__disabled_vtete .switch__hint_vtete {
135
135
  color: var(--switch-disabled-color);
136
- } /* Inactive */ .switch__inactive_qryao {
136
+ } /* Inactive */ .switch__inactive_vtete {
137
137
  cursor: var(--disabled-cursor);
138
- } .switch__inactive_qryao .switch__switch_qryao {
138
+ } .switch__inactive_vtete .switch__switch_vtete {
139
139
  background-color: var(--switch-disabled-bg-color);
140
140
  border-color: var(--switch-disabled-border-color)
141
- } .switch__inactive_qryao .switch__switch_qryao:before {
141
+ } .switch__inactive_vtete .switch__switch_vtete:before {
142
142
  background-color: var(--switch-inactive-color);
143
- } /* Focused state */ .switch__focused_qryao .switch__switch_qryao {
143
+ } /* Focused state */ .switch__focused_vtete .switch__switch_vtete {
144
144
  outline: 2px solid var(--focus-color);
145
145
  outline-offset: 2px;
146
146
  }
package/index.css CHANGED
@@ -1,4 +1,4 @@
1
- /* hash: f2bkn */
1
+ /* hash: 1xgwp */
2
2
  :root {
3
3
  } /* deprecated */ :root {
4
4
  --color-light-border-link: #0072ef;
@@ -47,7 +47,7 @@
47
47
 
48
48
  /* inactive */
49
49
  --switch-inactive-color: var(--color-light-border-underline);
50
- } .switch__component_qryao {
50
+ } .switch__component_vtete {
51
51
  display: inline-flex;
52
52
  align-items: flex-start;
53
53
  margin: 0;
@@ -55,20 +55,20 @@
55
55
  border: 0;
56
56
  cursor: pointer;
57
57
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
58
- } .switch__component_qryao input {
58
+ } .switch__component_vtete input {
59
59
  opacity: 0;
60
60
  position: absolute;
61
- } .switch__start_qryao {
61
+ } .switch__start_vtete {
62
62
  align-items: flex-start;
63
- } .switch__center_qryao {
63
+ } .switch__center_vtete {
64
64
  align-items: center;
65
- } .switch__addons_qryao {
65
+ } .switch__addons_vtete {
66
66
  margin-left: auto;
67
67
  padding-left: var(--gap-m);
68
68
  line-height: 24px;
69
- } .switch__block_qryao {
69
+ } .switch__block_vtete {
70
70
  width: 100%;
71
- } .switch__switch_qryao {
71
+ } .switch__switch_vtete {
72
72
  position: relative;
73
73
  border-radius: var(--border-radius-xl);
74
74
  width: 36px;
@@ -79,7 +79,7 @@
79
79
  border: 2px solid var(--switch-border-color);
80
80
  transition: background-color 0.2s ease, border-color 0.2s ease;
81
81
  box-sizing: border-box;
82
- } .switch__switch_qryao:before {
82
+ } .switch__switch_vtete:before {
83
83
  content: '';
84
84
  position: absolute;
85
85
  top: 0;
@@ -91,56 +91,56 @@
91
91
  background-color: var(--color-static-graphic-light);
92
92
  box-sizing: border-box;
93
93
  transition: transform 0.2s ease;
94
- } .switch__content_qryao {
94
+ } .switch__content_vtete {
95
95
  margin-left: var(--gap-s);
96
96
  flex-grow: 1;
97
- } .switch__label_qryao {
97
+ } .switch__label_vtete {
98
98
  font-size: 16px;
99
99
  line-height: 24px;
100
100
  font-weight: 400;
101
101
  display: block;
102
102
  color: var(--switch-label-color);
103
- } .switch__label_qryao:not(:only-child) {
103
+ } .switch__label_vtete:not(:only-child) {
104
104
  margin-bottom: var(--gap-2xs);
105
- } .switch__hint_qryao {
105
+ } .switch__hint_vtete {
106
106
  font-size: 14px;
107
107
  line-height: 18px;
108
108
  font-weight: 400;
109
109
  display: block;
110
110
  color: var(--switch-hint-color);
111
- } /* Reversed state */ .switch__component_qryao.switch__reversed_qryao {
111
+ } /* Reversed state */ .switch__component_vtete.switch__reversed_vtete {
112
112
  flex-direction: row-reverse;
113
- } .switch__reversed_qryao .switch__content_qryao {
113
+ } .switch__reversed_vtete .switch__content_vtete {
114
114
  margin-right: var(--gap-m);
115
115
  margin-left: 0;
116
- } .switch__reversed_qryao .switch__addons_qryao {
116
+ } .switch__reversed_vtete .switch__addons_vtete {
117
117
  margin-left: 0;
118
118
  padding-left: 0;
119
119
  margin-right: auto;
120
120
  padding-right: var(--gap-m);
121
- } /* Checked state */ .switch__checked_qryao .switch__switch_qryao {
121
+ } /* Checked state */ .switch__checked_vtete .switch__switch_vtete {
122
122
  background-color: var(--switch-checked-bg-color);
123
123
  border-color: var(--switch-checked-border-color);
124
- } .switch__checked_qryao .switch__switch_qryao:before {
124
+ } .switch__checked_vtete .switch__switch_vtete:before {
125
125
  /* ширина компонента(36px + 2*2px) - отступы(2 * 2px) - размер кружка(20px) */
126
126
  transform: translateX(16px);
127
- } /* Disabled state */ .switch__disabled_qryao {
127
+ } /* Disabled state */ .switch__disabled_vtete {
128
128
  cursor: var(--disabled-cursor);
129
- } .switch__disabled_qryao .switch__switch_qryao {
129
+ } .switch__disabled_vtete .switch__switch_vtete {
130
130
  background-color: var(--switch-disabled-bg-color);
131
131
  border-color: var(--switch-disabled-border-color);
132
- } .switch__disabled_qryao .switch__label_qryao {
132
+ } .switch__disabled_vtete .switch__label_vtete {
133
133
  color: var(--switch-disabled-color);
134
- } .switch__disabled_qryao .switch__hint_qryao {
134
+ } .switch__disabled_vtete .switch__hint_vtete {
135
135
  color: var(--switch-disabled-color);
136
- } /* Inactive */ .switch__inactive_qryao {
136
+ } /* Inactive */ .switch__inactive_vtete {
137
137
  cursor: var(--disabled-cursor);
138
- } .switch__inactive_qryao .switch__switch_qryao {
138
+ } .switch__inactive_vtete .switch__switch_vtete {
139
139
  background-color: var(--switch-disabled-bg-color);
140
140
  border-color: var(--switch-disabled-border-color)
141
- } .switch__inactive_qryao .switch__switch_qryao:before {
141
+ } .switch__inactive_vtete .switch__switch_vtete:before {
142
142
  background-color: var(--switch-inactive-color);
143
- } /* Focused state */ .switch__focused_qryao .switch__switch_qryao {
143
+ } /* Focused state */ .switch__focused_vtete .switch__switch_vtete {
144
144
  outline: 2px solid var(--focus-color);
145
145
  outline-offset: 2px;
146
146
  }
@@ -3,7 +3,7 @@ import mergeRefs from 'react-merge-refs';
3
3
  import cn from 'classnames';
4
4
  import { useFocus } from '@alfalab/hooks';
5
5
 
6
- const styles = {"component":"switch__component_qryao","start":"switch__start_qryao","center":"switch__center_qryao","addons":"switch__addons_qryao","block":"switch__block_qryao","switch":"switch__switch_qryao","content":"switch__content_qryao","label":"switch__label_qryao","hint":"switch__hint_qryao","reversed":"switch__reversed_qryao","checked":"switch__checked_qryao","disabled":"switch__disabled_qryao","inactive":"switch__inactive_qryao","focused":"switch__focused_qryao"};
6
+ const styles = {"component":"switch__component_vtete","start":"switch__start_vtete","center":"switch__center_vtete","addons":"switch__addons_vtete","block":"switch__block_vtete","switch":"switch__switch_vtete","content":"switch__content_vtete","label":"switch__label_vtete","hint":"switch__hint_vtete","reversed":"switch__reversed_vtete","checked":"switch__checked_vtete","disabled":"switch__disabled_vtete","inactive":"switch__inactive_vtete","focused":"switch__focused_vtete"};
7
7
  require('./index.css')
8
8
 
9
9
  const Switch = forwardRef(({ reversed = false, checked = false, align = 'start', addons, block, disabled, inactive, label, hint, name, value, className, onChange, dataTestId, ...restProps }, ref) => {
package/modern/index.css CHANGED
@@ -1,4 +1,4 @@
1
- /* hash: f2bkn */
1
+ /* hash: 1xgwp */
2
2
  :root {
3
3
  } /* deprecated */ :root {
4
4
  --color-light-border-link: #0072ef;
@@ -47,7 +47,7 @@
47
47
 
48
48
  /* inactive */
49
49
  --switch-inactive-color: var(--color-light-border-underline);
50
- } .switch__component_qryao {
50
+ } .switch__component_vtete {
51
51
  display: inline-flex;
52
52
  align-items: flex-start;
53
53
  margin: 0;
@@ -55,20 +55,20 @@
55
55
  border: 0;
56
56
  cursor: pointer;
57
57
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
58
- } .switch__component_qryao input {
58
+ } .switch__component_vtete input {
59
59
  opacity: 0;
60
60
  position: absolute;
61
- } .switch__start_qryao {
61
+ } .switch__start_vtete {
62
62
  align-items: flex-start;
63
- } .switch__center_qryao {
63
+ } .switch__center_vtete {
64
64
  align-items: center;
65
- } .switch__addons_qryao {
65
+ } .switch__addons_vtete {
66
66
  margin-left: auto;
67
67
  padding-left: var(--gap-m);
68
68
  line-height: 24px;
69
- } .switch__block_qryao {
69
+ } .switch__block_vtete {
70
70
  width: 100%;
71
- } .switch__switch_qryao {
71
+ } .switch__switch_vtete {
72
72
  position: relative;
73
73
  border-radius: var(--border-radius-xl);
74
74
  width: 36px;
@@ -79,7 +79,7 @@
79
79
  border: 2px solid var(--switch-border-color);
80
80
  transition: background-color 0.2s ease, border-color 0.2s ease;
81
81
  box-sizing: border-box;
82
- } .switch__switch_qryao:before {
82
+ } .switch__switch_vtete:before {
83
83
  content: '';
84
84
  position: absolute;
85
85
  top: 0;
@@ -91,56 +91,56 @@
91
91
  background-color: var(--color-static-graphic-light);
92
92
  box-sizing: border-box;
93
93
  transition: transform 0.2s ease;
94
- } .switch__content_qryao {
94
+ } .switch__content_vtete {
95
95
  margin-left: var(--gap-s);
96
96
  flex-grow: 1;
97
- } .switch__label_qryao {
97
+ } .switch__label_vtete {
98
98
  font-size: 16px;
99
99
  line-height: 24px;
100
100
  font-weight: 400;
101
101
  display: block;
102
102
  color: var(--switch-label-color);
103
- } .switch__label_qryao:not(:only-child) {
103
+ } .switch__label_vtete:not(:only-child) {
104
104
  margin-bottom: var(--gap-2xs);
105
- } .switch__hint_qryao {
105
+ } .switch__hint_vtete {
106
106
  font-size: 14px;
107
107
  line-height: 18px;
108
108
  font-weight: 400;
109
109
  display: block;
110
110
  color: var(--switch-hint-color);
111
- } /* Reversed state */ .switch__component_qryao.switch__reversed_qryao {
111
+ } /* Reversed state */ .switch__component_vtete.switch__reversed_vtete {
112
112
  flex-direction: row-reverse;
113
- } .switch__reversed_qryao .switch__content_qryao {
113
+ } .switch__reversed_vtete .switch__content_vtete {
114
114
  margin-right: var(--gap-m);
115
115
  margin-left: 0;
116
- } .switch__reversed_qryao .switch__addons_qryao {
116
+ } .switch__reversed_vtete .switch__addons_vtete {
117
117
  margin-left: 0;
118
118
  padding-left: 0;
119
119
  margin-right: auto;
120
120
  padding-right: var(--gap-m);
121
- } /* Checked state */ .switch__checked_qryao .switch__switch_qryao {
121
+ } /* Checked state */ .switch__checked_vtete .switch__switch_vtete {
122
122
  background-color: var(--switch-checked-bg-color);
123
123
  border-color: var(--switch-checked-border-color);
124
- } .switch__checked_qryao .switch__switch_qryao:before {
124
+ } .switch__checked_vtete .switch__switch_vtete:before {
125
125
  /* ширина компонента(36px + 2*2px) - отступы(2 * 2px) - размер кружка(20px) */
126
126
  transform: translateX(16px);
127
- } /* Disabled state */ .switch__disabled_qryao {
127
+ } /* Disabled state */ .switch__disabled_vtete {
128
128
  cursor: var(--disabled-cursor);
129
- } .switch__disabled_qryao .switch__switch_qryao {
129
+ } .switch__disabled_vtete .switch__switch_vtete {
130
130
  background-color: var(--switch-disabled-bg-color);
131
131
  border-color: var(--switch-disabled-border-color);
132
- } .switch__disabled_qryao .switch__label_qryao {
132
+ } .switch__disabled_vtete .switch__label_vtete {
133
133
  color: var(--switch-disabled-color);
134
- } .switch__disabled_qryao .switch__hint_qryao {
134
+ } .switch__disabled_vtete .switch__hint_vtete {
135
135
  color: var(--switch-disabled-color);
136
- } /* Inactive */ .switch__inactive_qryao {
136
+ } /* Inactive */ .switch__inactive_vtete {
137
137
  cursor: var(--disabled-cursor);
138
- } .switch__inactive_qryao .switch__switch_qryao {
138
+ } .switch__inactive_vtete .switch__switch_vtete {
139
139
  background-color: var(--switch-disabled-bg-color);
140
140
  border-color: var(--switch-disabled-border-color)
141
- } .switch__inactive_qryao .switch__switch_qryao:before {
141
+ } .switch__inactive_vtete .switch__switch_vtete:before {
142
142
  background-color: var(--switch-inactive-color);
143
- } /* Focused state */ .switch__focused_qryao .switch__switch_qryao {
143
+ } /* Focused state */ .switch__focused_vtete .switch__switch_vtete {
144
144
  outline: 2px solid var(--focus-color);
145
145
  outline-offset: 2px;
146
146
  }
package/package.json CHANGED
@@ -1,15 +1,12 @@
1
1
  {
2
2
  "name": "@alfalab/core-components-switch",
3
- "version": "3.0.5",
3
+ "version": "3.0.7",
4
4
  "description": "",
5
5
  "gitHead": "f054fef20200664c65e2501ef1f916c555cdf05d",
6
6
  "keywords": [],
7
7
  "license": "MIT",
8
8
  "main": "index.js",
9
9
  "module": "./esm/index.js",
10
- "scripts": {
11
- "postinstall": "node -e \"if (require('fs').existsSync('./send-stats.js')){require('./send-stats.js')} \""
12
- },
13
10
  "publishConfig": {
14
11
  "access": "public",
15
12
  "directory": "dist"
@@ -18,7 +15,7 @@
18
15
  "react": "^16.9.0 || ^17.0.1 || ^18.0.0"
19
16
  },
20
17
  "dependencies": {
21
- "@alfalab/hooks": "^1.4.1",
18
+ "@alfalab/hooks": "^1.13.0",
22
19
  "classnames": "^2.3.1",
23
20
  "react-merge-refs": "^1.1.0",
24
21
  "tslib": "^2.4.0"
package/send-stats.js DELETED
@@ -1,82 +0,0 @@
1
- const http = require('http');
2
- const fs = require('fs');
3
- const { promisify } = require('util');
4
- const path = require('path');
5
-
6
- const readFile = promisify(fs.readFile);
7
-
8
- async function main() {
9
- const remoteHost = process.env.NIS_HOST || 'digital';
10
- const remotePort = process.env.NIS_PORT || 80;
11
- const remotePath = process.env.NIS_PATH || '/npm-install-stats/api/install-stats';
12
-
13
- try {
14
- const [_, node, os, arch] =
15
- /node\/v(\d+\.\d+\.\d+) (\w+) (\w+)/.exec(process.env.npm_config_user_agent) || [];
16
- const [__, npm] = /npm\/(\d+\.\d+\.\d+)/.exec(process.env.npm_config_user_agent) || [];
17
- const [___, yarn] = /yarn\/(\d+\.\d+\.\d+)/.exec(process.env.npm_config_user_agent) || [];
18
-
19
- let ownPackageJson, packageJson;
20
-
21
- try {
22
- const result = await Promise.all([
23
- readFile(path.join(process.cwd(), 'package.json'), 'utf-8'),
24
- readFile(path.join(process.cwd(), '../../../package.json'), 'utf-8'),
25
- ]);
26
-
27
- ownPackageJson = JSON.parse(result[0]);
28
- packageJson = JSON.parse(result[1]);
29
- } catch (err) {
30
- ownPackageJson = '';
31
- packageJson = '';
32
- }
33
-
34
- const data = {
35
- node,
36
- npm,
37
- yarn,
38
- os,
39
- arch,
40
- ownPackageJson: JSON.stringify(ownPackageJson),
41
- packageJson: JSON.stringify(packageJson),
42
- };
43
-
44
- const body = JSON.stringify(data);
45
-
46
- const options = {
47
- host: remoteHost,
48
- port: remotePort,
49
- path: remotePath,
50
- method: 'POST',
51
- headers: {
52
- 'Content-Type': 'application/json',
53
- 'Content-Length': body.length,
54
- },
55
- };
56
-
57
- return new Promise((resolve, reject) => {
58
- const req = http.request(options, (res) => {
59
- res.on('end', () => {
60
- resolve();
61
- });
62
- });
63
-
64
- req.on('error', () => {
65
- reject();
66
- });
67
-
68
- req.write(body);
69
- req.end();
70
- });
71
- } catch (error) {
72
- throw error;
73
- }
74
- }
75
-
76
- main()
77
- .then(() => {
78
- process.exit(0);
79
- })
80
- .catch(() => {
81
- process.exit(0);
82
- });