/
index.js
62 lines (55 loc) · 2.13 KB
/
index.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
const config = require('./config')
const cleanDirectories = require('./utils/cleanDirectories')
const cleanIcons = require('./svgCleaners')
const {
monochromOptim,
colorOptim,
} = require('./svgCleaners/optimizationConfigs')
const generateIconComponent = require('./componentsGenerators')
const generateIconsDatas = require('./generateData')
const copyPDF = require('./copyPDF')
const generateIconsModules = require('./generateIconsJS')
const outputIconSetSize = (monochromSet, colorSet) => `
---------------------------------------
MONOCHROM ICONS : ${monochromSet.length}
COLOR ICONS : ${colorSet.length}
---------------------------------------
`
console.log(`
•••••••••••••••••••••••••••••••••••••••
+ +
+ COMPILING MOZAIC ICON SET +
+ +
•••••••••••••••••••••••••••••••••••••••
`)
cleanDirectories(config)
.then(() => {
console.log('✓ SUCCESS : Icons Directories cleaned and recreated')
return Promise.all([
cleanIcons('svg', monochromOptim),
cleanIcons('svgColor', colorOptim),
cleanIcons('svgColorToGatsby', colorOptim),
])
})
.then((icons) => {
console.log(outputIconSetSize(icons[0], icons[1]))
console.log('✓ SUCCESS : Icons cleaned and saved as SVGs in the package')
return Promise.all([
generateIconComponent('react', icons[0]),
generateIconComponent('vue', icons[0]),
generateIconComponent('svelte', icons[0]),
generateIconsModules(icons[0].concat(icons[1])),
generateIconsDatas(icons),
]).then(() => Promise.resolve())
})
.then(() => {
console.log(
'✓ SUCCESS : Monochrom icons compiled into react and vue components' +
'\n✓ SUCCESS : JSON created to use in gatsby for previewing all icons'
)
return Promise.all([copyPDF('pdf'), copyPDF('pdfColor')])
})
.then(() => {
console.log('✓ SUCCESS : PDF icons copied into packages')
})
.catch((err) => console.error(`✗ ERROR : ${err}`))