Refactor project
This commit is contained in:
1 parent
9c1a2b987b
commit
2f2516eade
115 files changed
+12522
No files matched your search
@@ -0,0 +1,64 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const { convertFile } = require('convert-svg-to-png');
|
||||
|
||||
const logoInput = './src/images/vector/logo.svg';
|
||||
|
||||
logoOutput = {
|
||||
// Logo
|
||||
"splash-screen_fhd.jpg": {
|
||||
width: 1920,
|
||||
height: 1080
|
||||
},
|
||||
"splash-screen_hd.jpg": {
|
||||
width: 1280,
|
||||
height: 720
|
||||
},
|
||||
"splash-screen_sd.jpg": {
|
||||
width: 720,
|
||||
height: 480
|
||||
},
|
||||
"channel-poster_fhd.png": {
|
||||
width: 540,
|
||||
height: 405
|
||||
},
|
||||
"channel-poster_hd.png": {
|
||||
width: 290,
|
||||
height: 218
|
||||
},
|
||||
"channel-poster_sd.png": {
|
||||
width: 214,
|
||||
height: 144
|
||||
},
|
||||
};
|
||||
|
||||
const iconsInput = './src/images/vector/icons';
|
||||
const iconsOutput = './src/images/icons';
|
||||
|
||||
(async () => {
|
||||
|
||||
for (var logo in logoOutput) {
|
||||
await convertFile(logoInput, {
|
||||
outputFilePath: './src/images/' + logo,
|
||||
background: "#242424",
|
||||
height: logoOutput[logo].height,
|
||||
width: logoOutput[logo].width,
|
||||
});
|
||||
|
||||
console.log(`Generated ${logo}`)
|
||||
}
|
||||
|
||||
const iconFiles = fs.readdirSync(iconsInput)
|
||||
for (var i in iconFiles) {
|
||||
const input = path.join(iconsInput, iconFiles[i])
|
||||
const output = path.join(iconsOutput, iconFiles[i].replace('.svg', '.png'))
|
||||
|
||||
await convertFile(input, {
|
||||
outputFilePath: output,
|
||||
width: 64,
|
||||
height: 64,
|
||||
});
|
||||
|
||||
console.log(`Generated ${output}`)
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,21 @@
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const semverParse = require('semver/functions/parse')
|
||||
|
||||
const packageJsonContent = fs.readFileSync("./package.json", {encoding:'utf8', flag:'r'})
|
||||
const packageJson = JSON.parse(packageJsonContent)
|
||||
|
||||
const version = packageJson.version
|
||||
const parsedVersion = semverParse(version)
|
||||
|
||||
let appManifestContent = fs.readFileSync("./src/manifest", {encoding:'utf8', flag:'r'})
|
||||
|
||||
const majorPattern = /major_version=(\d+)/
|
||||
const minorPattern = /minor_version=(\d+)/
|
||||
const buildPattern = /build_version=(\d+)/
|
||||
|
||||
appManifestContent = appManifestContent.replace(majorPattern, `major_version=${parsedVersion.major}`)
|
||||
appManifestContent = appManifestContent.replace(minorPattern, `minor_version=${parsedVersion.minor}`)
|
||||
appManifestContent = appManifestContent.replace(buildPattern, `build_version=${String(parsedVersion.patch).padStart(5, '0')}`)
|
||||
|
||||
fs.writeFileSync("./src/manifest", appManifestContent)
|
||||
Reference in new issue
Block a user