-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.js
56 lines (42 loc) · 1.96 KB
/
build.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
const StyleDictionaryPackage = require('style-dictionary');
const env = require("./env.json")
const config = require('./config/config.js');
const getStyleDictionaryConfig = require('./config/config_v1.js')
const { fsDirectories } = require('./utilities')
const registerTransforms = require('./lib/transforms');
const registerFilters = require('./lib/filters');
const registerFormats = require('./lib/formats');
registerTransforms();
registerFilters();
registerFormats();
// Loop through all brand directories which contain tokens...
const platforms = env.PLATFORMS
const brands = fsDirectories(env.TOKENS_DIR)
brands.map(brand => {
console.log('\n==============================================');
console.log(`\nProcessing: [${brand}]`);
platforms.map(platform => {
const StyleDictionary = StyleDictionaryPackage.extend(config(brand, platform));
StyleDictionary.buildPlatform(platform);
});
});
console.log('\n==============================================');
console.log('\nBuild completed!');
console.log('Build started...');
// PROCESS THE DESIGN TOKENS FOR THE DIFFERENT BRANDS AND PLATFORMS
['wsj', 'noted'].map(function (brand) {
['mercury', 'android', 'ios', 'web', 'flutter', 'compose'].map(function (platform) {
console.log('\n==============================================');
console.log(`\nProcessing: [${platform}] [${brand}]`);
const StyleDictionary = StyleDictionaryPackage.extend(getStyleDictionaryConfig(brand, platform));
StyleDictionary.buildPlatform(platform);
console.log('\nEnd processing');
});
console.log('\n==============================================');
console.log(`\nProcessing: [js] [${brand}] with [web] property defintions`);
const StyleDictionary = StyleDictionaryPackage.extend(getStyleDictionaryConfig(brand, 'web'))
StyleDictionary.buildPlatform('js');
console.log('\nEnd processing');
})
console.log('\n==============================================');
console.log('\nBuild completed!');