2021-12-06 20:06:07 +00:00
|
|
|
const fs = require('fs');
|
|
|
|
const https = require('https');
|
|
|
|
|
|
|
|
function run() {
|
|
|
|
palette();
|
|
|
|
logo('large');
|
|
|
|
logo('small');
|
|
|
|
}
|
|
|
|
|
|
|
|
function palette() {
|
|
|
|
const options = {
|
2021-12-06 21:05:20 +00:00
|
|
|
hostname: 'git.jojodev.com',
|
2021-12-06 20:06:07 +00:00
|
|
|
port: 443,
|
|
|
|
path: '/Canopy/branding/raw/branch/main/palette.json',
|
|
|
|
method: 'GET'
|
|
|
|
}
|
|
|
|
const req = https.request(options, res => {
|
|
|
|
res.on('data', data => {
|
|
|
|
const palette = JSON.parse(data);
|
|
|
|
fs.writeFileSync('src/assets/sass/_palette.scss', `$palette1: #${palette[4]};
|
|
|
|
$palette2: #${palette[3]};
|
|
|
|
$palette3: #${palette[2]};
|
|
|
|
$palette4: #${palette[1]};
|
|
|
|
$palette5: #${palette[0]};`);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
req.end();
|
|
|
|
}
|
|
|
|
|
|
|
|
function logo(size) {
|
|
|
|
fs.truncateSync(`src/images/${size}.svg`)
|
|
|
|
const options = {
|
2021-12-06 21:05:20 +00:00
|
|
|
hostname: 'git.jojodev.com',
|
2021-12-06 20:06:07 +00:00
|
|
|
port: 443,
|
|
|
|
path: `/Canopy/branding/raw/branch/main/${size}.svg`,
|
|
|
|
method: 'GET'
|
|
|
|
}
|
|
|
|
const req = https.request(options, res => {
|
|
|
|
res.on('data', data => {
|
|
|
|
fs.appendFileSync(`src/images/${size}.svg`, data);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
req.end();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Run the h*ckin' thing
|
|
|
|
if (require.main === module) {
|
|
|
|
run();
|
|
|
|
}
|