@semcore/ui 11.0.0 → 11.1.0
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/CHANGELOG.md +62 -211
- package/README.md +1 -0
- package/generate.ts +170 -0
- package/icon/Casual/l/index.d.ts +2 -0
- package/icon/Casual/l/index.js +2 -0
- package/icon/Casual/m/index.d.ts +2 -0
- package/icon/Casual/m/index.js +2 -0
- package/icon/Formal/l/index.d.ts +2 -0
- package/icon/Formal/l/index.js +2 -0
- package/icon/Formal/m/index.d.ts +2 -0
- package/icon/Formal/m/index.js +2 -0
- package/icon/MathMinusAlt/l/index.d.ts +2 -0
- package/icon/MathMinusAlt/l/index.js +2 -0
- package/icon/MathMinusAlt/m/index.d.ts +2 -0
- package/icon/MathMinusAlt/m/index.js +2 -0
- package/icon/QuestionSerp/l/index.d.ts +2 -0
- package/icon/QuestionSerp/l/index.js +2 -0
- package/icon/QuestionSerp/m/index.d.ts +2 -0
- package/icon/QuestionSerp/m/index.js +2 -0
- package/package.json +69 -69
- package/yarn-error.log +0 -20720
package/CHANGELOG.md
CHANGED
|
@@ -1,296 +1,152 @@
|
|
|
1
|
-
## [11.
|
|
1
|
+
## [11.1.0] - 2022-03-30
|
|
2
2
|
|
|
3
|
-
### @semcore/
|
|
3
|
+
### @semcore/babel-plugin-react-semcore
|
|
4
4
|
|
|
5
|
-
- **Added** Added
|
|
5
|
+
- **Added** Added export function `getColorVars`.
|
|
6
6
|
|
|
7
|
-
### @semcore/
|
|
7
|
+
### @semcore/babel-plugin-shadow
|
|
8
8
|
|
|
9
|
-
- **
|
|
9
|
+
- **Fixed** Fixed old node versions support.
|
|
10
10
|
|
|
11
|
-
### @semcore/
|
|
11
|
+
### @semcore/babel-plugin-styles
|
|
12
12
|
|
|
13
|
-
- **
|
|
13
|
+
- **Fixed** Fixed old node versions support.
|
|
14
|
+
- **Added** Added export function `postcss` from main js file `@semcore/babel-plugin-styles`.
|
|
15
|
+
- **Added** Added `PLACEHOLDER_REPLACER` property for function `postcss`.
|
|
14
16
|
|
|
15
17
|
### @semcore/base-trigger
|
|
16
18
|
|
|
17
|
-
- **
|
|
18
|
-
- **Fixed** Fixed LinkTrigger hovered text color.
|
|
19
|
+
- **Fixed** Improved keyboard focus styles.
|
|
19
20
|
|
|
20
|
-
### @semcore/
|
|
21
|
+
### @semcore/chart
|
|
21
22
|
|
|
22
|
-
- **
|
|
23
|
+
- **Fixed** Rewrite file colors from tsx to js, for normal parsing in `babel-plugin-react-semcore`.
|
|
23
24
|
|
|
24
|
-
### @semcore/
|
|
25
|
+
### @semcore/d3-chart
|
|
25
26
|
|
|
26
|
-
- **
|
|
27
|
+
- **Fixed** Left and bottom plot titles now do not overlap axis ticks.
|
|
28
|
+
- **Fixed** Fixed figure cut on right or bottom edges when left or top margin is positive.
|
|
27
29
|
|
|
28
|
-
### @semcore/
|
|
30
|
+
### @semcore/dropdown-menu
|
|
29
31
|
|
|
30
|
-
- **
|
|
32
|
+
- **Fixed** Fixed enter space in input trigger for `DropdownMenu.Trigger`.
|
|
31
33
|
|
|
32
|
-
### @semcore/
|
|
34
|
+
### @semcore/flags
|
|
33
35
|
|
|
34
|
-
- **BREAK** Card was divided into Header and Body
|
|
35
36
|
- **Added** Added repository field to package.json file.
|
|
36
|
-
- **Added** Background was added
|
|
37
|
-
|
|
38
|
-
### @semcore/carousel
|
|
39
37
|
|
|
40
|
-
|
|
38
|
+
### @semcore/icon
|
|
41
39
|
|
|
42
|
-
|
|
40
|
+
- **Added** Added icons `Formal, Casual, QuestionSerp, MathMinusAlt`.
|
|
43
41
|
|
|
44
|
-
|
|
42
|
+
### @semcore/modal
|
|
45
43
|
|
|
46
|
-
|
|
44
|
+
- **Fixed** Fixed jumping content, when modal inside modal and body don't have `box-sizing`.
|
|
47
45
|
|
|
48
|
-
-
|
|
46
|
+
### @semcore/side-panel
|
|
49
47
|
|
|
50
|
-
|
|
48
|
+
- **Fixed** Fixed jumping content, when body don't have `box-sizing`.
|
|
51
49
|
|
|
52
|
-
|
|
50
|
+
### @semcore/skeleton
|
|
53
51
|
|
|
54
|
-
|
|
52
|
+
- **Fixed** Fixed `viewBox` for `BarChartSkeleton`.
|
|
55
53
|
|
|
56
|
-
|
|
54
|
+
### @semcore/spin
|
|
57
55
|
|
|
58
|
-
|
|
56
|
+
- **Changed** Rewrite the component to svg.
|
|
57
|
+
- **Added** Rounded corners.
|
|
59
58
|
|
|
60
|
-
-
|
|
61
|
-
- **Fixed** Fixed animation display when resizing.
|
|
59
|
+
### @semcore/super-publisher
|
|
62
60
|
|
|
63
|
-
|
|
61
|
+
- **Changed** Added slack notifications.
|
|
62
|
+
- **Changed** Rewritten to typescript.
|
|
64
63
|
|
|
65
|
-
|
|
64
|
+
### @semcore/tag
|
|
66
65
|
|
|
67
|
-
|
|
66
|
+
- **Fixed** Fixed previously lost overflowed text ellipsis.
|
|
68
67
|
|
|
69
|
-
|
|
68
|
+
### @semcore/utils
|
|
70
69
|
|
|
71
|
-
|
|
70
|
+
- **Fixed** Fixed set property in body (when window inside window and body don't have `box-sizing`) in `usePreventScroll`.
|
|
72
71
|
|
|
73
|
-
|
|
74
|
-
- **Fixed** Fixed explicit default theme
|
|
72
|
+
## [11.0.0] - 2022-02-25
|
|
75
73
|
|
|
76
|
-
###
|
|
74
|
+
### Global
|
|
77
75
|
|
|
78
76
|
- **Added** Added repository field to package.json file.
|
|
79
77
|
|
|
80
|
-
### @semcore/
|
|
78
|
+
### @semcore/slider
|
|
81
79
|
|
|
82
|
-
- **
|
|
80
|
+
- **BREAK** Remove props background/color/interaction, use theme instead.
|
|
81
|
+
- **BREAK** Refactored component to handle extreme values.
|
|
83
82
|
|
|
84
|
-
### @semcore/
|
|
83
|
+
### @semcore/card
|
|
85
84
|
|
|
86
|
-
- **
|
|
85
|
+
- **BREAK** Card was divided into Header and Body
|
|
86
|
+
- **Added** Background was added
|
|
87
87
|
|
|
88
|
-
### @semcore/
|
|
88
|
+
### @semcore/spin-container
|
|
89
89
|
|
|
90
|
-
- **
|
|
90
|
+
- **BREAK** Add new children components `SpinContainer.Content` when using advanced mode along with `SpinContainer.Overlay`.
|
|
91
91
|
|
|
92
|
-
### @semcore/
|
|
92
|
+
### @semcore/base-trigger
|
|
93
93
|
|
|
94
|
-
- **
|
|
94
|
+
- **Fixed** Fixed LinkTrigger hovered text color.
|
|
95
95
|
|
|
96
|
-
### @semcore/
|
|
96
|
+
### @semcore/d3-chart
|
|
97
97
|
|
|
98
|
-
- **
|
|
98
|
+
- **Fixed** Fixed animation display when resizing.
|
|
99
99
|
|
|
100
|
-
### @semcore/
|
|
100
|
+
### @semcore/divider
|
|
101
101
|
|
|
102
|
-
- **
|
|
102
|
+
- **Fixed** Fixed explicit default theme
|
|
103
103
|
|
|
104
|
-
### @semcore/
|
|
104
|
+
### @semcore/errors
|
|
105
105
|
|
|
106
|
-
- **
|
|
106
|
+
- **Fixed** Fixed Static files were missing in release 10.2.0
|
|
107
107
|
|
|
108
108
|
### @semcore/flex-box
|
|
109
109
|
|
|
110
110
|
- **Added** Added gap, rowGap and columnGap css properties support for Flex component.
|
|
111
111
|
|
|
112
|
-
### @semcore/format-text
|
|
113
|
-
|
|
114
|
-
- **Added** Added repository field to package.json file.
|
|
115
|
-
|
|
116
|
-
### @semcore/fullscreen-modal
|
|
117
|
-
|
|
118
|
-
- **Added** Added repository field to package.json file.
|
|
119
|
-
|
|
120
|
-
### @semcore/grid
|
|
121
|
-
|
|
122
|
-
- **Added** Added repository field to package.json file.
|
|
123
|
-
|
|
124
112
|
### @semcore/icon
|
|
125
113
|
|
|
126
|
-
- **Added** Added repository field to package.json file.
|
|
127
114
|
- **Fixed** Fixed sizes for a few icons.
|
|
128
115
|
- **Fixed** Fixed color setting for LightningFilled, MailOpenFilled.
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
- **Added** Added repository field to package.json file.
|
|
133
|
-
|
|
134
|
-
### @semcore/input-mask
|
|
135
|
-
|
|
136
|
-
- **Added** Added repository field to package.json file.
|
|
137
|
-
|
|
138
|
-
### @semcore/input-number
|
|
139
|
-
|
|
140
|
-
- **Added** Added repository field to package.json file.
|
|
141
|
-
|
|
142
|
-
### @semcore/input-tags
|
|
143
|
-
|
|
144
|
-
- **Added** Added repository field to package.json file.
|
|
145
|
-
|
|
146
|
-
### @semcore/link
|
|
147
|
-
|
|
148
|
-
- **Added** Added repository field to package.json file.
|
|
149
|
-
|
|
150
|
-
### @semcore/modal
|
|
151
|
-
|
|
152
|
-
- **Added** Added repository field to package.json file.
|
|
153
|
-
|
|
154
|
-
### @semcore/neighbor-location
|
|
155
|
-
|
|
156
|
-
- **Added** Added repository field to package.json file.
|
|
157
|
-
|
|
158
|
-
### @semcore/notice
|
|
159
|
-
|
|
160
|
-
- **Added** Added repository field to package.json file.
|
|
161
|
-
|
|
162
|
-
### @semcore/notice-bubble
|
|
163
|
-
|
|
164
|
-
- **Added** Added repository field to package.json file.
|
|
165
|
-
|
|
166
|
-
### @semcore/outside-click
|
|
167
|
-
|
|
168
|
-
- **Added** Added repository field to package.json file.
|
|
169
|
-
|
|
170
|
-
### @semcore/pagination
|
|
171
|
-
|
|
172
|
-
- **Added** Added repository field to package.json file.
|
|
173
|
-
|
|
174
|
-
### @semcore/pills
|
|
175
|
-
|
|
176
|
-
- **Added** Added repository field to package.json file.
|
|
177
|
-
|
|
178
|
-
### @semcore/popper
|
|
179
|
-
|
|
180
|
-
- **Added** Added repository field to package.json file.
|
|
181
|
-
|
|
182
|
-
### @semcore/portal
|
|
183
|
-
|
|
184
|
-
- **Added** Added repository field to package.json file.
|
|
185
|
-
|
|
186
|
-
### @semcore/product-head
|
|
187
|
-
|
|
188
|
-
- **Added** Added repository field to package.json file.
|
|
189
|
-
|
|
190
|
-
### @semcore/progress-bar
|
|
191
|
-
|
|
192
|
-
- **Added** Added repository field to package.json file.
|
|
193
|
-
|
|
194
|
-
### @semcore/project-create
|
|
195
|
-
|
|
196
|
-
- **Added** Added repository field to package.json file.
|
|
197
|
-
|
|
198
|
-
### @semcore/radio
|
|
199
|
-
|
|
200
|
-
- **Added** Added repository field to package.json file.
|
|
201
|
-
|
|
202
|
-
### @semcore/scroll-area
|
|
203
|
-
|
|
204
|
-
- **Added** Added repository field to package.json file.
|
|
205
|
-
|
|
206
|
-
### @semcore/select
|
|
207
|
-
|
|
208
|
-
- **Added** Added repository field to package.json file.
|
|
209
|
-
|
|
210
|
-
### @semcore/side-panel
|
|
211
|
-
|
|
212
|
-
- **Added** Added repository field to package.json file.
|
|
116
|
+
- **Added** Added `Hubspot` icon.
|
|
117
|
+
- **Changed** Changed image `SortAsc` and `SortDesc` icons.
|
|
213
118
|
|
|
214
119
|
### @semcore/skeleton
|
|
215
120
|
|
|
216
|
-
- **Added** Added repository field to package.json file.
|
|
217
121
|
- **Fixed** Added export type for Bubble, ScatterPlot, Venn charts
|
|
218
122
|
|
|
219
|
-
### @semcore/slider
|
|
220
|
-
|
|
221
|
-
- **BREAK** Remove props background/color/interaction, use theme instead.
|
|
222
|
-
- **BREAK** Refactoring component to handle extreme values.
|
|
223
|
-
- **Added** Added repository field to package.json file.
|
|
224
|
-
|
|
225
|
-
### @semcore/spin
|
|
226
|
-
|
|
227
|
-
- **Added** Added repository field to package.json file.
|
|
228
|
-
|
|
229
|
-
### @semcore/spin-container
|
|
230
|
-
|
|
231
|
-
- **BREAK** Add new children component SpinContainer.Content when using advanced mode along with SpinContainer.Overlay.
|
|
232
|
-
- **Added** Added repository field to package.json file.
|
|
233
|
-
|
|
234
|
-
### @semcore/sticky
|
|
235
|
-
|
|
236
|
-
- **Added** Added repository field to package.json file.
|
|
237
|
-
|
|
238
123
|
### @semcore/switch
|
|
239
124
|
|
|
240
|
-
- **
|
|
241
|
-
- **Fixed** Remove react warning when not clearing timer.
|
|
125
|
+
- **Fixed** Removed react warning about uncontrolled timer.
|
|
242
126
|
|
|
243
127
|
### @semcore/tab-line
|
|
244
128
|
|
|
245
|
-
- **Added** Added repository field to package.json file.
|
|
246
129
|
- **Fixed** Add missed ts type defaultValue.
|
|
247
130
|
|
|
248
131
|
### @semcore/tab-panel
|
|
249
132
|
|
|
250
|
-
- **Added** Added repository field to package.json file.
|
|
251
133
|
- **Fixed** Add missed ts type defaultValue.
|
|
252
134
|
|
|
253
|
-
### @semcore/table
|
|
254
|
-
|
|
255
|
-
- **Added** Added repository field to package.json file.
|
|
256
|
-
|
|
257
135
|
### @semcore/tag
|
|
258
136
|
|
|
259
|
-
- **Added** Added repository field to package.json file.
|
|
260
137
|
- **Fixed** Fixed colors for primary-warning.
|
|
261
138
|
|
|
262
139
|
### @semcore/textarea
|
|
263
140
|
|
|
264
|
-
- **Added** Added repository field to package.json file.
|
|
265
141
|
- **Fixed** Auto change rows now works in controlled mode.
|
|
266
142
|
|
|
267
|
-
### @semcore/time-picker
|
|
268
|
-
|
|
269
|
-
- **Added** Added repository field to package.json file.
|
|
270
|
-
|
|
271
|
-
### @semcore/tooltip
|
|
272
|
-
|
|
273
|
-
- **Added** Added repository field to package.json file.
|
|
274
|
-
|
|
275
143
|
### @semcore/typography
|
|
276
144
|
|
|
277
|
-
- **
|
|
278
|
-
- **Fixed** Remove css specificity for props lineHeight/fontSize for Text.
|
|
279
|
-
|
|
280
|
-
### @semcore/ui
|
|
281
|
-
|
|
282
|
-
- **@semcore/errors** Fixed Static files were missing in release 10.2.0
|
|
283
|
-
- **@semcore/icon** Added icon Hubspot.
|
|
284
|
-
- **@semcore/icon** Changed svg for SortAsc, SortDesc.
|
|
285
|
-
|
|
286
|
-
### @semcore/utils
|
|
287
|
-
|
|
288
|
-
- **Added** Added repository field to package.json file.
|
|
145
|
+
- **Fixed** Removed css specificity of props lineHeight/fontSize in `Text` component
|
|
289
146
|
|
|
290
147
|
### @semcore/widget-empty
|
|
291
148
|
|
|
292
|
-
- **
|
|
293
|
-
- **Changed** Remove don't use dependency @semcore/link, @semcore/button.
|
|
149
|
+
- **Changed** Removed unused dependencies `@semcore/link`, `@semcore/button`.
|
|
294
150
|
|
|
295
151
|
## [10.2.1] - 2022-02-10
|
|
296
152
|
|
|
@@ -298,11 +154,6 @@
|
|
|
298
154
|
|
|
299
155
|
- **Fixed** Static files were missing in release 10.2.0
|
|
300
156
|
|
|
301
|
-
### @semcore/icon
|
|
302
|
-
|
|
303
|
-
- **Added** Add icon Hubspot.
|
|
304
|
-
- **Changed** Changed svg for SortAsc, SortDesc.
|
|
305
|
-
|
|
306
157
|
## [10.2.0] - 2022-02-08
|
|
307
158
|
|
|
308
159
|
### @semcore/card
|
|
@@ -413,7 +264,7 @@
|
|
|
413
264
|
|
|
414
265
|
### @semcore/errors
|
|
415
266
|
|
|
416
|
-
- **Changed**
|
|
267
|
+
- **Changed** Removed unused dependencies @semcore/icon.
|
|
417
268
|
|
|
418
269
|
### @semcore/feature-popover
|
|
419
270
|
|
|
@@ -478,7 +329,7 @@
|
|
|
478
329
|
|
|
479
330
|
### @semcore/tooltip
|
|
480
331
|
|
|
481
|
-
- **Changed**
|
|
332
|
+
- **Changed** Removed unused dependencies @semcore/icon.
|
|
482
333
|
|
|
483
334
|
### @semcore/typography
|
|
484
335
|
|
|
@@ -487,7 +338,7 @@
|
|
|
487
338
|
|
|
488
339
|
### @semcore/widget-empty
|
|
489
340
|
|
|
490
|
-
- **Changed**
|
|
341
|
+
- **Changed** Removed unused dependencies @semcore/icon.
|
|
491
342
|
|
|
492
343
|
## [10.0.1] - 2021-12-24
|
|
493
344
|
|
package/README.md
CHANGED
|
@@ -7,5 +7,6 @@ CLI commands should be run in repo root dir.
|
|
|
7
7
|
- Run `yarn build`
|
|
8
8
|
- Add new components to `./semcore/ui/components.json`
|
|
9
9
|
- `yarn workspace @semcore/ui generate`
|
|
10
|
+
- `yarn update-release-changelog`
|
|
10
11
|
- Check out CHANGELOG.md and fix if needed
|
|
11
12
|
- Run `yarn pub --package ui --no-check-changelog`
|
package/generate.ts
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import fs from 'fs-extra';
|
|
4
|
+
import glob from 'glob';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
6
|
+
import { createRequire } from 'module';
|
|
7
|
+
|
|
8
|
+
const filename = fileURLToPath(import.meta.url);
|
|
9
|
+
const dirname = path.resolve(filename, '..');
|
|
10
|
+
|
|
11
|
+
const components = fs.readJSONSync(path.resolve(dirname, './components.json'));
|
|
12
|
+
|
|
13
|
+
const REGISTRY_URL = 'https://registry.npmjs.org/';
|
|
14
|
+
const EXPORT_DEFAULT_REG = /export ({ default }|default)/gm;
|
|
15
|
+
|
|
16
|
+
const removeDirectory = async () => {
|
|
17
|
+
const toRemove = [...glob.sync('!(*.*|__tests__)'), 'yarn.lock'];
|
|
18
|
+
try {
|
|
19
|
+
await Promise.all(toRemove.map((filePath) => fs.remove(path.resolve(dirname, filePath))));
|
|
20
|
+
} catch (e) {}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const installComponents = (packages: string[]) => {
|
|
24
|
+
execSync(`npm_config_registry=${REGISTRY_URL} yarn add ${packages.join(' ')} -E`, {
|
|
25
|
+
stdio: 'inherit',
|
|
26
|
+
cwd: dirname,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const node_modules = execSync(
|
|
30
|
+
'mkdir -p ./node_modules/@semcore && find ./node_modules/@semcore -name "node_modules" -type d',
|
|
31
|
+
{
|
|
32
|
+
cwd: dirname,
|
|
33
|
+
},
|
|
34
|
+
).toString();
|
|
35
|
+
|
|
36
|
+
if (node_modules) throw new Error(`DUPLICATES FOUND ${node_modules}`);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const hasExportDefault = async (dependency: string) => {
|
|
40
|
+
const require = createRequire(import.meta.url);
|
|
41
|
+
|
|
42
|
+
try {
|
|
43
|
+
const resolved = require(dependency);
|
|
44
|
+
return Object.hasOwnProperty.call(resolved, 'default');
|
|
45
|
+
} catch (e) {
|
|
46
|
+
// fallback resolver
|
|
47
|
+
const dependencyPkgJson = require.resolve(dependency + '/package.json');
|
|
48
|
+
const { module } = fs.readJsonSync(dependencyPkgJson);
|
|
49
|
+
|
|
50
|
+
if (!module) return true;
|
|
51
|
+
|
|
52
|
+
const dependencyES6EntryPath = require.resolve(dependency + `/${module}`);
|
|
53
|
+
const ES6EntryContent = fs.readFileSync(dependencyES6EntryPath, 'utf8');
|
|
54
|
+
return ES6EntryContent.match(EXPORT_DEFAULT_REG) !== null;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const EXPORT_TEMPLATES = {
|
|
59
|
+
LIB_DEFAULT: (lib: string, component: string) =>
|
|
60
|
+
`export { default } from '${lib}/lib/${component}';\nexport * from '${lib}/lib/${component}';`,
|
|
61
|
+
LIB_NAMED: (lib: string, component: string) => `export * from '${lib}/lib/${component}';`,
|
|
62
|
+
DEFAULT: (lib: string) => `export { default } from '${lib}';\nexport * from '${lib}';`,
|
|
63
|
+
NAMED: (lib: string) => `export * from '${lib}';`,
|
|
64
|
+
} as const;
|
|
65
|
+
|
|
66
|
+
const GENERATOR = {
|
|
67
|
+
UTILS: async (dependency: string, name: string) => {
|
|
68
|
+
const require = createRequire(import.meta.url);
|
|
69
|
+
const utilsMain = require.resolve(dependency);
|
|
70
|
+
const utilsPath = path.join(utilsMain, '..');
|
|
71
|
+
const utils = glob.sync('**/*.+(js|ts)', { cwd: utilsPath });
|
|
72
|
+
for (const util of utils) {
|
|
73
|
+
const utilsModule = `${utilsPath}/${util.replace('.d.ts', '.js')}`;
|
|
74
|
+
|
|
75
|
+
// index.js of utils throws & useless, so we copy it
|
|
76
|
+
if (util.replace('.d.ts', '.js') === 'index.js') {
|
|
77
|
+
await fs.copy(`${utilsPath}/${util}`, `./${name}/lib/${util}`);
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const TEMPLATE = (await hasExportDefault(utilsModule))
|
|
82
|
+
? EXPORT_TEMPLATES.LIB_DEFAULT
|
|
83
|
+
: EXPORT_TEMPLATES.LIB_NAMED;
|
|
84
|
+
await fs.outputFile(
|
|
85
|
+
`./${name}/lib/${util}`,
|
|
86
|
+
TEMPLATE(dependency, util.replace('.d.ts', '').replace('.js', '')),
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
ICONS: async (dependency: string, name: string) => {
|
|
91
|
+
const require = createRequire(import.meta.url);
|
|
92
|
+
const iconPath = require.resolve(dependency);
|
|
93
|
+
|
|
94
|
+
const oldIconsDir = path.join(iconPath, '../..');
|
|
95
|
+
const newIconsDir = path.join(iconPath, '../../..');
|
|
96
|
+
|
|
97
|
+
const isIconDir = (dir) =>
|
|
98
|
+
fs.statSync(dir).isDirectory() &&
|
|
99
|
+
!['__tests__', 'src', 'svg', 'svg-new', 'node_modules'].includes(path.basename(dir));
|
|
100
|
+
const oldIcons = fs
|
|
101
|
+
.readdirSync(oldIconsDir)
|
|
102
|
+
.filter((iconDir) => isIconDir(path.join(oldIconsDir, iconDir)));
|
|
103
|
+
|
|
104
|
+
const newIcons = fs
|
|
105
|
+
.readdirSync(newIconsDir)
|
|
106
|
+
.filter((iconDir) => isIconDir(path.join(newIconsDir, iconDir)));
|
|
107
|
+
|
|
108
|
+
for (const icon of oldIcons) {
|
|
109
|
+
const subDirs = glob
|
|
110
|
+
.sync('./**/*.[tj]s', {
|
|
111
|
+
cwd: path.resolve(oldIconsDir, icon),
|
|
112
|
+
})
|
|
113
|
+
.map(path.dirname);
|
|
114
|
+
for (const subFile of subDirs) {
|
|
115
|
+
await fs.outputFile(
|
|
116
|
+
path.resolve(`./${name}/lib/${icon}/${subFile}`, `index.js`),
|
|
117
|
+
EXPORT_TEMPLATES.LIB_DEFAULT(dependency, `${icon}/${subFile}`),
|
|
118
|
+
);
|
|
119
|
+
await fs.outputFile(
|
|
120
|
+
path.resolve(`./${name}/lib/${icon}/${subFile}`, `index.d.ts`),
|
|
121
|
+
EXPORT_TEMPLATES.LIB_DEFAULT(dependency, `${icon}/${subFile}`),
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
for (const icon of newIcons) {
|
|
126
|
+
const subFiles = glob
|
|
127
|
+
.sync('./**/*.[tj]s', {
|
|
128
|
+
cwd: path.resolve(newIconsDir, icon),
|
|
129
|
+
})
|
|
130
|
+
.map(path.dirname);
|
|
131
|
+
|
|
132
|
+
for (const subFile of subFiles) {
|
|
133
|
+
await fs.outputFile(
|
|
134
|
+
`./${name}/${icon}/${subFile}/index.js`,
|
|
135
|
+
EXPORT_TEMPLATES.DEFAULT(`${dependency}/${icon}/${subFile}`),
|
|
136
|
+
);
|
|
137
|
+
await fs.outputFile(
|
|
138
|
+
`./${name}/${icon}/${subFile}/index.d.ts`,
|
|
139
|
+
EXPORT_TEMPLATES.DEFAULT(`${dependency}/${icon}/${subFile}`),
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
OTHER: async (dependency: string, name: string) => {
|
|
145
|
+
const TEMPLATE = (await hasExportDefault(dependency))
|
|
146
|
+
? EXPORT_TEMPLATES.DEFAULT
|
|
147
|
+
: EXPORT_TEMPLATES.NAMED;
|
|
148
|
+
await fs.outputFile(`./${name}/index.js`, TEMPLATE(dependency));
|
|
149
|
+
await fs.outputFile(`./${name}/index.d.ts`, TEMPLATE(dependency));
|
|
150
|
+
},
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const generateFiles = async (packages: string[]) => {
|
|
154
|
+
for (const dep of packages) {
|
|
155
|
+
const [, name] = dep.split('/');
|
|
156
|
+
|
|
157
|
+
if (name === 'utils') await GENERATOR.UTILS(dep, name);
|
|
158
|
+
if (name === 'icon') await GENERATOR.ICONS(dep, name);
|
|
159
|
+
await GENERATOR.OTHER(dep, name);
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
await removeDirectory();
|
|
164
|
+
await installComponents(components.packages);
|
|
165
|
+
await generateFiles(components.packages);
|
|
166
|
+
|
|
167
|
+
execSync('yarn test', {
|
|
168
|
+
stdio: 'inherit',
|
|
169
|
+
cwd: dirname,
|
|
170
|
+
});
|