-
Notifications
You must be signed in to change notification settings - Fork 24
/
components.js
66 lines (65 loc) · 1.68 KB
/
components.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import fs from 'fs';
import path from 'path';
import glob from 'glob';
import consola from 'consola';
import { camelCase } from 'scule';
let exportComponents = `/* eslint-disable import/prefer-default-export */\n// export local components\n`;
glob('./src/**/*.vue', {}, (err, files) => {
files.forEach(file => {
if (file.indexOf('App.vue') !== -1) return;
const { name } = path.parse(file);
const moduleName = camelCase(name);
exportComponents += `export { default as ${moduleName} } from '${file.replace(
'src/',
''
)}';\n`;
});
let content = `${exportComponents}`;
const icons = [
'PhPause',
'PhArchiveBox',
'PhSpeakerSimpleLow',
'PhSpeakerSimpleHigh',
'PhSpeakerSlash',
'PhArrowClockwise',
'PhBookOpen',
'PhCaretDown',
'PhCaretLeft',
'PhCaretUp',
'PhClockClockwise',
'PhCloudArrowDown',
'PhCrop',
'PhDisc',
'PhFaders',
'PhFolderSimple',
'PhFunnelSimple',
'PhGearSix',
'PhHeart',
'PhHouse',
'PhListPlus',
'PhMicrophone',
'PhMusicNoteSimple',
'PhMusicNotesSimple',
'PhPencilSimple',
'PhPlay',
'PhPlaylist',
'PhQueue',
'PhRepeat',
'PhSelectionBackground',
'PhShuffle',
'PhSkipBack',
'PhSkipForward',
'PhSortAscending',
'PhTrashSimple',
'PhXCircle',
'PhUser',
'PhX'
];
content += '\n// export component icons from phosphor-vue\n';
for (let i = 0; i < icons.length; i += 1) {
content += `export { default as ${icons[i]} } from 'phosphor-vue/src/components/${icons[i]}.vue';\n`;
}
fs.writeFile('./src/flb-components.ts', content, err => {
if (!err) consola.success('Created: ./src/flb-components.ts');
});
});