diff --git a/.github/scripts/build_assets/SeleniumRunner.py b/.github/scripts/build_assets/SeleniumRunner.py index 3124cff309..eaab2de9bc 100644 --- a/.github/scripts/build_assets/SeleniumRunner.py +++ b/.github/scripts/build_assets/SeleniumRunner.py @@ -78,7 +78,7 @@ def set_options(self, geckodriver_path: str, headless: bool): def upload_icomoon(self): """ - Upload the icomoon_test.json to icomoon.io. + Upload the icomoon.json to icomoon.io. :raises TimeoutException: happens when elements are not found. """ print("Uploading JSON file...") @@ -100,8 +100,8 @@ def upload_icomoon(self): confirm_btn.click() except SeleniumTimeoutException as e: print(e.stacktrace) - print("Cannot find the confirm button when uploading the icomoon_test.json", - "Ensure that the icomoon_test.json is in the correct format for Icomoon.io", + print("Cannot find the confirm button when uploading the icomoon.json", + "Ensure that the icomoon.json is in the correct format for Icomoon.io", sep='\n') self.close() diff --git a/.github/scripts/build_assets/geckodriver-v0.27.0-win64/README.md b/.github/scripts/build_assets/geckodriver-v0.27.0-win64/README.md new file mode 100644 index 0000000000..c907e4be54 --- /dev/null +++ b/.github/scripts/build_assets/geckodriver-v0.27.0-win64/README.md @@ -0,0 +1 @@ +This folder was taken from: https://github.com/mozilla/geckodriver/releases/tag/v0.27.0 diff --git a/.github/scripts/build_assets/geckodriver-v0.27.0-win64/geckodriver.exe b/.github/scripts/build_assets/geckodriver-v0.27.0-win64/geckodriver.exe new file mode 100644 index 0000000000..4ce451bc5b Binary files /dev/null and b/.github/scripts/build_assets/geckodriver-v0.27.0-win64/geckodriver.exe differ diff --git a/.github/scripts/build_assets/geckodriver.exe b/.github/scripts/build_assets/geckodriver.exe deleted file mode 100644 index 9fae8e0eb9..0000000000 Binary files a/.github/scripts/build_assets/geckodriver.exe and /dev/null differ diff --git a/.github/workflows/build_icons.yml b/.github/workflows/build_icons.yml index 78cd0fc12a..ffb96bd8c5 100644 --- a/.github/workflows/build_icons.yml +++ b/.github/workflows/build_icons.yml @@ -25,7 +25,8 @@ jobs: pip install -r ./.github/scripts/requirements.txt - name: Run icomoon_upload.py run: > - python ./.github/scripts/icomoon_upload.py ./.github/scripts/build_assets/geckodriver.exe + python ./.github/scripts/icomoon_upload.py + ./.github/scripts/build_assets/geckodriver-v0.27.0-win64/geckodriver.exe ./icomoon.json ./devicon.json ./icons ./built_files --headless - name: Commit changes uses: stefanzweifel/git-auto-commit-action@v4 diff --git a/.gitignore b/.gitignore index e731d9ad8f..0b2ceb9b24 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ node_modules .DS_Store .idea -geckodriver.log \ No newline at end of file +geckodriver.log +__pycache__ \ No newline at end of file diff --git a/upgrade_assets/deviconColorsParser.js b/upgrade_assets/deviconColorsParser.js deleted file mode 100644 index cf0bf49d01..0000000000 --- a/upgrade_assets/deviconColorsParser.js +++ /dev/null @@ -1,39 +0,0 @@ -/* Parse the devicon-colors.css and convert it to devicon-colors.json*/ -const fs = require("fs"); -const path = require('path'); - -function main() { - let filePath = path.join(__dirname, "..", "css", "devicon-colors.css"); - fs.readFile(filePath, "utf8", (err, css) => { - if (err) { - console.log(err); - return; - } - - let key = null; - let deviconColors = {}; - css.split("\n").forEach(line => { - if (key) { - // since have key, now look for line - // that contains color: ### - if (line.match(/color: /)) { - deviconColors[key] = line.match(/#\w+/)[0]; - key = null; - } - return; - } - - if (line.match(/devicon/)) { - key = line.match(/-\w+/)[0].slice(1); - } - }); - - let deviconColorsFile = path.join(__dirname, "deviconColors.json"); - fs.writeFile(deviconColorsFile, JSON.stringify(deviconColors), err => { - console.log(err ? err : "File successfully created"); - }) - }); - -} - -main(); \ No newline at end of file diff --git a/upgrade_assets/parseInput.js b/upgrade_assets/parseInput.js deleted file mode 100644 index 531f737fcb..0000000000 --- a/upgrade_assets/parseInput.js +++ /dev/null @@ -1,74 +0,0 @@ -const path = require("path"); -const fs = require("fs"); - -/** - * Parse through the input.json and get all the - * svg files within the new folder(s) as listed. - * @param {{ - * folderName: string, - * "originalSameAsPlain": boolean, - "color": string - }[]} input, an array of icon objects - */ -async function parseInput(input) { - let svgFontFilePaths = []; - let colors = []; - - input.forEach(async iconObj => { - let {folderName, originalSameAsPlain, color} = iconObj; - colors.push(color); - - // if original is same as plain (aka true), we use - // the original version. else, we use plain. - let allowedFontVers = [ - parseInt(originalSameAsPlain) ? "original" : "plain", - "line", - ]; - - await getFolderFontFiles(folderName, allowedFontVers, svgFontFilePaths) - }) - - return { - svgFontFilePaths, - colors - }; -} - - -/** - * Get the eligible SVG files from the folder. - * @param {String} folderName, the name of the folder - * @param {String[]} allowedFontVers, an array of allowed - * font version. This makes sure that we only add the - * appropriate files to the svgFilePaths. - * @param {String[]} svgFilePaths, an array of filepaths - * to eligible svg files that can be used as fonts. - */ -async function getFolderFontFiles(folderName, allowedFontVers, svgFilePaths) { - // the new folder(s) must be in the icons folder - let folderPath = path.join(__dirname, "icons", folderName); - let dir = await new Promise((resolve, reject) => { - fs.opendir(folderPath, (err, dir) => { - if (err) reject(err); - else resolve(dir); - }); - }); - - - let dirEntry; - while (dirEntry = await dir.read()) { - // check if it's an SVG file - let entryName = dirEntry.name; - if (dirEntry.isFile() && entryName.match(/\.svg$/)) { - // check if it has the correct type to use as a font - if (allowedFontVers.some(allowedVer => - entryName.match(new RegExp(allowedVer)))) { - - svgFilePaths.push(path.join(folderPath, dirEntry.name)); - } - } - } -} - - -module.exports = parseInput; \ No newline at end of file