improvements

master
Ondřej Hruška 6 years ago
parent 0b5240ae28
commit e882d50288
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 3
      .gitignore
  2. 21
      README.md
  3. 16
      build.sh
  4. 4
      install.sh
  5. 39
      patcher/apply-filter.js
  6. 11
      patcher/refresh-wanted-templates.js
  7. 1
      refresh-templates.sh
  8. 12
      update-fa.sh
  9. 2
      wanted.full.ini

3
.gitignore vendored

@ -1,3 +1,6 @@
wanted.all.ini wanted.all.ini
wanted.none.ini wanted.none.ini
wanted.ini wanted.ini
fontcustom.yml
fontcustom.default.yml

@ -10,21 +10,12 @@ This is a little hack to let you generate custom Fork-Awesome builds with only a
- You can fix that by running `git submodule init` and `git submodule update` - You can fix that by running `git submodule init` and `git submodule update`
2. Run `./install.sh`. This should prepare the FA submodule for building the font. 2. Run `./install.sh`. This should prepare the FA submodule for building the font.
3. Verify that files `wanted.all.ini` and `wanted.none.ini` have been created. 3. Verify that files `wanted.all.ini` and `wanted.none.ini` have been created.
4. Copy either of the "wanted" template files to `wanted.ini`, and customize it as needed. - You can update Fork-Awesome and these files at any time by running `./install.sh` again.
Lines starting with `#` will be excluded. Use the [FA icons page](https://forkawesome.github.io/Fork-Awesome/icons/) for reference. 4. Copy either of the "wanted" templates to `wanted.ini`, and customize it as needed.
- Lines starting with `#` will be excluded.
- Use the [FA icons page](https://forkawesome.github.io/Fork-Awesome/icons/) for reference.
5. Run `./build.sh` to build your customized font. 5. Run `./build.sh` to build your customized font.
6. Retrieve your output files from the `output/` directory. 6. Retrieve your output files from the `output/` directory.
Note: The "woff" file may fail to build, resulting in the make target in `Fork-Awesome/src/icons` failing, in which case you get no files. Note: The "woff" file may fail to build, resulting in the make target in `Fork-Awesome/src/icons` failing.
A workaround is to comment out that line by prepending it with `#`, and trying to build again. This shouldn't be a problem, as the fonts are already built.
```patch
cp ${FA_FONTCUSTOM_OUTPUT_DIR}/forkawesome.svg ${FA_ROOT_FONTS_DIR}/forkawesome-webfont.svg
cp ${FA_FONTCUSTOM_OUTPUT_DIR}/forkawesome.ttf ${FA_ROOT_FONTS_DIR}/forkawesome-webfont.ttf
- cp ${FA_FONTCUSTOM_OUTPUT_DIR}/forkawesome.woff ${FA_ROOT_FONTS_DIR}/forkawesome-webfont.woff
+ #cp ${FA_FONTCUSTOM_OUTPUT_DIR}/forkawesome.woff ${FA_ROOT_FONTS_DIR}/forkawesome-webfont.woff
cp ${FA_FONTCUSTOM_OUTPUT_DIR}/forkawesome.woff2 ${FA_ROOT_FONTS_DIR}/forkawesome-webfont.woff2
```

@ -20,12 +20,20 @@ if [ ! -d "./Fork-Awesome/node_modules" ]; then
exit exit
fi fi
bash ./refresh-templates.sh
echo "=== Starting a build... ===" echo "=== Starting a build... ==="
(cd patcher && node ./apply-filter.js) (cd patcher && node ./apply-filter.js)
(cd "./Fork-Awesome/src/icons/" && make) (cd "./Fork-Awesome/src/icons/" && make)
echo -e "\x1b[33mIf the make target failed at a \"cp\" statement, that is most likely safe to ignore\x1b[m"
fontname=$(cat fontcustom.yml | head -n1 | sed "s/font_name: //")
if [ ! -f "./Fork-Awesome/src/icons/$fontname/$fontname-preview.html" ]; then
echo -e "\x1b[31;1mBuild failed, output directory is empty.\x1b[m"
exit
fi
cp ./Fork-Awesome/src/icons/forkawesome/* ./output rm ./output/*
cp "./Fork-Awesome/src/icons/$fontname/"* ./output
echo "=== Your font is ready in the output/ directory ===" echo
echo "=== Your font \"$fontname\" is ready in the output/ directory ==="

@ -7,6 +7,9 @@ fi
cd Fork-Awesome cd Fork-Awesome
echo "=== Ensuring FA is up-to-date ==="
git fetch && git reset --hard origin/master
echo "=== Installing ruby dependencies ===" echo "=== Installing ruby dependencies ==="
bundle install --path vendor/bundle bundle install --path vendor/bundle
@ -18,4 +21,5 @@ echo
echo ">>> If no errors occured, FA should be ready to build." echo ">>> If no errors occured, FA should be ready to build."
echo -e "\x1b[90m(npm complaining about vulnerabilities is probably okay)\x1b[m" echo -e "\x1b[90m(npm complaining about vulnerabilities is probably okay)\x1b[m"
cd ..
bash ./refresh-templates.sh bash ./refresh-templates.sh

@ -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`)
} }

@ -2,7 +2,9 @@
const fs = require('fs') const fs = require('fs')
// the manifest file is easier to parse for us, but the actual source file is icons.yml
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('./templates/fontcustom.yml', 'utf-8')
let all_enabled = [] let all_enabled = []
let all_disabled = [] let all_disabled = []
@ -21,3 +23,12 @@ fs.writeFileSync('../wanted.all.ini', all_enabled.join('\n') + '\n')
console.log(`\x1b[32m[Writing]\x1b[m wanted.none.ini`) console.log(`\x1b[32m[Writing]\x1b[m wanted.none.ini`)
fs.writeFileSync('../wanted.none.ini', all_disabled.join('\n') + '\n') fs.writeFileSync('../wanted.none.ini', all_disabled.join('\n') + '\n')
console.log(`\x1b[32m[Writing]\x1b[m fontcustom.default.yml`)
fs.writeFileSync('../fontcustom.default.yml', fcyml)
if (!fs.existsSync('../fontcustom.yml')) {
console.log(`\x1b[32m[Writing]\x1b[m fontcustom.yml (did not exist)`)
fs.writeFileSync('../fontcustom.yml', fcyml)
}

@ -9,6 +9,7 @@ echo "=== Refreshing templates for building a customized font ==="
rm -rf "./patcher/templates/*" rm -rf "./patcher/templates/*"
cp "./Fork-Awesome/src/icons/.fontcustom-manifest.json" "./patcher/templates" cp "./Fork-Awesome/src/icons/.fontcustom-manifest.json" "./patcher/templates"
cp "./Fork-Awesome/src/icons/fontcustom.yml" "./patcher/templates"
cp "./Fork-Awesome/src/icons/icons.yml" "./patcher/templates" cp "./Fork-Awesome/src/icons/icons.yml" "./patcher/templates"
cp -R "./Fork-Awesome/src/icons/svg" "./patcher/templates" cp -R "./Fork-Awesome/src/icons/svg" "./patcher/templates"

@ -1,12 +0,0 @@
#!/bin/bash
if [ ! -f "./Fork-Awesome/.git" ]; then
echo -e "\x1b[31;1mFA submodule is not initialized, exit...\x1b[m"
exit
fi
echo "=== Updating the Fork-Awesome submodule... ==="
(cd Fork-Awesome && git fetch && git reset --hard origin/master)
echo "=== Fork-Awesome updated ==="
bash ./refresh-templates.sh

@ -1,2 +0,0 @@
star
table
Loading…
Cancel
Save