-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
67 lines (59 loc) · 1.9 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
63
64
65
66
67
const StyleDictionary = require('style-dictionary');
const { argv } = require('yargs');
const del = require('del');
const path = require('path');
/*
Initialize all this modules after style dictionary since they
use StyleDictionary's methods
*/
require('./src/transforms');
require('./src/transformGroups');
require('./src/templates');
require('./src/actions');
// Get the config
const config = require('./style-config.json');
const Dictionary = StyleDictionary.extend(config);
/*
Here we are separating the taks so we can run them
separate as needed. This can be simplified but currently
i'm deleting a bunch of folder to dynamically recreate.
*/
switch (argv.platform) {
case 'web':
del(path.join(__dirname, './build/web/')).then(() => {
Dictionary.buildPlatform('web');
});
break;
case 'ios':
del([
path.join(__dirname, './build/ios/Classes/'),
path.join(__dirname, './build/ios/Fonts/'),
path.join(__dirname, './build/ios/Assets/Icons.xcassets/Icons/'),
]).then(() => {
// TODO: merge all these tasks into a single one
Dictionary.buildPlatform('ios-swift');
Dictionary.buildPlatform('ios-fonts');
Dictionary.buildPlatform('ios-icons');
});
break;
case 'android':
del([path.join(__dirname, './build/android/app/src/main/res/')]).then(
() => {
// TODO: merge all these tasks into a single one
Dictionary.buildPlatform('android');
Dictionary.buildPlatform('android-fonts');
Dictionary.buildPlatform('android-icons');
}
);
break;
default:
del([
path.join(__dirname, './build/web/'),
path.join(__dirname, './build/android/app/src/main/res/'),
path.join(__dirname, './build/ios/Classes/'),
path.join(__dirname, './build/ios/Fonts/'),
path.join(__dirname, './build/ios/Assets/Icons.xcassets/Icons/'),
]).then(() => {
Dictionary.buildAllPlatforms();
});
}