|
|
@ -27,31 +27,16 @@ function cp(src, dest) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let manifest = JSON.parse(fs.readFileSync('templates/.fontcustom-manifest.json', 'utf-8')) |
|
|
|
// let manifest = JSON.parse(fs.readFileSync('templates/.fontcustom-manifest.json', 'utf-8'))
|
|
|
|
|
|
|
|
let fcyml = fs.readFileSync('../fontcustom.yml', 'utf-8') |
|
|
|
let desired = fs.readFileSync('../wanted.ini', 'utf-8').split('\n').filter((x) => x.length && x[0] !== '#') |
|
|
|
let desired = fs.readFileSync('../wanted.ini', 'utf-8').split('\n').filter((x) => x.length && x[0] !== '#') |
|
|
|
|
|
|
|
|
|
|
|
// This forces a rebuild
|
|
|
|
|
|
|
|
manifest.checksum.previous = 'asdf' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log('Preparing fontcustom manifest...') |
|
|
|
|
|
|
|
console.log(`Including ${desired.length} icons`) |
|
|
|
console.log(`Including ${desired.length} icons`) |
|
|
|
|
|
|
|
|
|
|
|
const orig_glyphs = manifest.glyphs |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
manifest.glyphs = Object.keys(orig_glyphs) |
|
|
|
|
|
|
|
.filter(key => desired.includes(key)) |
|
|
|
|
|
|
|
.reduce((obj, key) => { |
|
|
|
|
|
|
|
obj[key] = orig_glyphs[key] |
|
|
|
|
|
|
|
return obj |
|
|
|
|
|
|
|
}, {}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log('\x1b[32m[Writing]\x1b[m .fontcustom-manifest.json') |
|
|
|
|
|
|
|
fs.writeFileSync('../Fork-Awesome/src/icons/.fontcustom-manifest.json', JSON.stringify(manifest, null, 2)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log('Preparing icons.yml...') |
|
|
|
console.log('Preparing icons.yml...') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// this would be prettier with some yaml module, but to avoid installing anything...
|
|
|
|
// this would be prettier with some yaml module, but to avoid installing anything...
|
|
|
|
|
|
|
|
|
|
|
|
let iconsy = fs.readFileSync('templates/icons.yml', 'utf-8') |
|
|
|
let iconsy = fs.readFileSync('templates/icons.yml', 'utf-8') |
|
|
@ -60,7 +45,7 @@ let pieces = iconsy.substring(iconsy.indexOf('\n')+1).split(' - name:') |
|
|
|
pieces.shift() // remove first
|
|
|
|
pieces.shift() // remove first
|
|
|
|
// now we have the entries, without leading ' - name'
|
|
|
|
// now we have the entries, without leading ' - name'
|
|
|
|
|
|
|
|
|
|
|
|
let pattern = /id:\s+(\w+)\n/ |
|
|
|
let pattern = /id:\s+([a-z_0-9-]+)\n/ |
|
|
|
|
|
|
|
|
|
|
|
pieces = pieces.filter((x) => { |
|
|
|
pieces = pieces.filter((x) => { |
|
|
|
let ar = pattern.exec(x) |
|
|
|
let ar = pattern.exec(x) |
|
|
@ -69,15 +54,25 @@ pieces = pieces.filter((x) => { |
|
|
|
|
|
|
|
|
|
|
|
let combined = 'icons:\n - name:' + pieces.join(' - name:') |
|
|
|
let combined = 'icons:\n - name:' + pieces.join(' - name:') |
|
|
|
|
|
|
|
|
|
|
|
console.log('\x1b[32m[Writing]\x1b[m icons.yml') |
|
|
|
console.log('\x1b[32m[Writing]\x1b[m FA~icons.yml') |
|
|
|
fs.writeFileSync('../Fork-Awesome/src/icons/icons.yml', combined) |
|
|
|
fs.writeFileSync('../Fork-Awesome/src/icons/icons.yml', combined) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log('\x1b[32m[Writing]\x1b[m FA~fontcustom.yml') |
|
|
|
|
|
|
|
fs.writeFileSync('../Fork-Awesome/src/icons/fontcustom.yml', fcyml) |
|
|
|
|
|
|
|
|
|
|
|
console.log('Deleting files in svg/ ...') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log('Deleting FA~.fontcustom-manifest.json, to force a rebuilt ...') |
|
|
|
|
|
|
|
if (fs.existsSync('../Fork-Awesome/src/icons/.fontcustom-manifest.json')) { |
|
|
|
|
|
|
|
fs.unlinkSync('../Fork-Awesome/src/icons/.fontcustom-manifest.json') |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log('Deleting files in FA~svg/ ...') |
|
|
|
rmInDir('../Fork-Awesome/src/icons/svg') |
|
|
|
rmInDir('../Fork-Awesome/src/icons/svg') |
|
|
|
|
|
|
|
|
|
|
|
console.log('Copying desired files from svg-all/ to svg/ ...') |
|
|
|
|
|
|
|
|
|
|
|
console.log('Copying desired files to FA~svg/ ...') |
|
|
|
for (let a of desired) { |
|
|
|
for (let a of desired) { |
|
|
|
cp(`./templates/svg/${a}.svg`, `../Fork-Awesome/src/icons/svg/${a}.svg`) |
|
|
|
cp(`./templates/svg/${a}.svg`, `../Fork-Awesome/src/icons/svg/${a}.svg`) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|