Sign app for publishing (#38)
* Sign app for publishing * update gitignore * refactor input args * Change instance api sorting * Better instance sorting * Instance filter * remove hardcoded instance * script cleanups * Unused function
This commit is contained in:
1 parent
4640a34863
commit
7a155c689e
15 files changed
+636
-252
No files matched your search
+10
-11
@@ -1,11 +1,11 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { convertFile } = require('convert-svg-to-png');
|
||||
|
||||
const logoPoster = './src/images/vector/logo-light.svg';
|
||||
const logoSplash = './src/images/vector/logo-dark.svg';
|
||||
|
||||
logoOutput = {
|
||||
const logoOutput = {
|
||||
// Logo
|
||||
"splash-screen_fhd.jpg": {
|
||||
width: 1920,
|
||||
@@ -38,8 +38,8 @@ logoOutput = {
|
||||
from: logoPoster
|
||||
},
|
||||
"channel-poster_sd.png": {
|
||||
width: 214,
|
||||
height: 144,
|
||||
width: 246,
|
||||
height: 140,
|
||||
background: "#FFFFFF",
|
||||
from: logoPoster
|
||||
},
|
||||
@@ -49,7 +49,6 @@ const iconsInput = './src/images/vector/icons';
|
||||
const iconsOutput = './src/images/icons';
|
||||
|
||||
(async () => {
|
||||
|
||||
for (var logo in logoOutput) {
|
||||
await convertFile(logoOutput[logo].from, {
|
||||
outputFilePath: './src/images/' + logo,
|
||||
@@ -58,13 +57,13 @@ const iconsOutput = './src/images/icons';
|
||||
width: logoOutput[logo].width,
|
||||
});
|
||||
|
||||
console.log(`Generated ${logo}`)
|
||||
console.log(`Generated ${logo}`);
|
||||
}
|
||||
|
||||
const iconFiles = fs.readdirSync(iconsInput)
|
||||
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'))
|
||||
const input = path.join(iconsInput, iconFiles[i]);
|
||||
const output = path.join(iconsOutput, iconFiles[i].replace('.svg', '.png'));
|
||||
|
||||
await convertFile(input, {
|
||||
outputFilePath: output,
|
||||
@@ -72,6 +71,6 @@ const iconsOutput = './src/images/icons';
|
||||
height: 64,
|
||||
});
|
||||
|
||||
console.log(`Generated ${output}`)
|
||||
console.log(`Generated ${output}`);
|
||||
}
|
||||
})();
|
||||
+17
-11
@@ -1,23 +1,29 @@
|
||||
const rokuDeploy = require('roku-deploy');
|
||||
const dotenv = require('dotenv')
|
||||
const dotenv = require('dotenv');
|
||||
const fs = require('fs');
|
||||
const { exit } = require('process');
|
||||
|
||||
if(process.argv.length !== 3) {
|
||||
console.error("Invalid usage! usage: npm run screenshot -- filename")
|
||||
exit(-1)
|
||||
console.error("Invalid usage! usage: npm run screenshot -- filename");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
const filename = process.argv[2]
|
||||
const config = dotenv.parse(fs.readFileSync('.vscode/.env'))
|
||||
const filename = process.argv[2];
|
||||
const config = dotenv.parse(fs.readFileSync('.vscode/.env'));
|
||||
|
||||
rokuDeploy.takeScreenshot({
|
||||
const options = {
|
||||
host: config.ROKU_DEV_TARGET,
|
||||
password: config.ROKU_DEVPASSWORD,
|
||||
outDir: '.',
|
||||
outFile: filename
|
||||
}).then(function(filename){
|
||||
console.log(`${filename} created`)
|
||||
}, function(error) {
|
||||
console.error(error);
|
||||
});
|
||||
};
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
await rokuDeploy.takeScreenshot(options);
|
||||
console.log(`${filename} created`);
|
||||
}
|
||||
catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,28 @@
|
||||
const dotenv = require('dotenv');
|
||||
const fs = require('fs');
|
||||
const rokuDeploy = require('roku-deploy');
|
||||
|
||||
const config = dotenv.parse(fs.readFileSync('.vscode/.env'));
|
||||
|
||||
const options = {
|
||||
host: config.ROKU_DEV_TARGET,
|
||||
password: config.ROKU_DEVPASSWORD,
|
||||
outDir: 'release',
|
||||
outFile: 'playlet.zip',
|
||||
failOnCompileError: true,
|
||||
stagingDir: 'dist/build',
|
||||
retainStagingDir: true,
|
||||
signingPassword: config.ROKU_SIGN_PASSWORD,
|
||||
};
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
await rokuDeploy.publish(options);
|
||||
const remotePkgPath = await rokuDeploy.signExistingPackage(options);
|
||||
const localPkgFilePath = await rokuDeploy.retrieveSignedPackage(remotePkgPath, options);
|
||||
console.log(`Created signed package: ${localPkgFilePath}`)
|
||||
}
|
||||
catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
})();
|
||||
@@ -1,33 +1,33 @@
|
||||
const fs = require('fs');
|
||||
|
||||
if (process.argv.length < 3) {
|
||||
console.error("Invalid usage! usage: npm run manifest-symbols -- SYMBOL1=true [SYMBOL2=false]")
|
||||
exit(-1)
|
||||
console.error("Invalid usage! usage: npm run manifest-symbols -- SYMBOL1=true [SYMBOL2=false]");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
function argsToSymbolsObject(arr) {
|
||||
return arr.reduce(function (acc, value) {
|
||||
keyValue = value.split("=")
|
||||
acc[keyValue[0]] = keyValue[1]
|
||||
return acc
|
||||
}, {})
|
||||
keyValue = value.split("=");
|
||||
acc[keyValue[0]] = keyValue[1];
|
||||
return acc;
|
||||
}, {});
|
||||
}
|
||||
|
||||
const newSymbols = argsToSymbolsObject(process.argv.slice(2))
|
||||
const newSymbols = argsToSymbolsObject(process.argv.slice(2));
|
||||
let currentSymbols = {}
|
||||
|
||||
const appManifestLines = fs.readFileSync("./src/manifest", { encoding: 'utf8', flag: 'r' }).split('\n')
|
||||
const bsConstIndex = appManifestLines.findIndex(line => line.startsWith("bs_const="))
|
||||
const appManifestLines = fs.readFileSync("./src/manifest", { encoding: 'utf8', flag: 'r' }).split('\n');
|
||||
const bsConstIndex = appManifestLines.findIndex(line => line.startsWith("bs_const="));
|
||||
if (bsConstIndex !== -1) {
|
||||
let bsConst = appManifestLines[bsConstIndex]
|
||||
bsConst = bsConst.substring("bs_const=".length)
|
||||
let bsConst = appManifestLines[bsConstIndex];
|
||||
bsConst = bsConst.substring("bs_const=".length);
|
||||
currentSymbols = argsToSymbolsObject(bsConst.split(";"))
|
||||
}
|
||||
|
||||
mergedSymbols = {...currentSymbols, ...newSymbols}
|
||||
mergedSymbols = { ...currentSymbols, ...newSymbols };
|
||||
|
||||
bsConst = "bs_const=" + Object.keys(mergedSymbols).map(key => `${key}=${mergedSymbols[key]}`).join(";")
|
||||
bsConst = "bs_const=" + Object.keys(mergedSymbols).map(key => `${key}=${mergedSymbols[key]}`).join(";");
|
||||
|
||||
appManifestLines[bsConstIndex] = bsConst
|
||||
appManifestLines[bsConstIndex] = bsConst;
|
||||
|
||||
fs.writeFileSync("./src/manifest", appManifestLines.join("\n"))
|
||||
fs.writeFileSync("./src/manifest", appManifestLines.join("\n"));
|
||||
@@ -2,24 +2,24 @@ const path = require('path');
|
||||
const fs = require('fs');
|
||||
const { execSync } = require("child_process");
|
||||
|
||||
const semverParse = require('semver/functions/parse')
|
||||
const semverParse = require('semver/functions/parse');
|
||||
|
||||
const packageJsonContent = fs.readFileSync("./package.json", { encoding: 'utf8', flag: 'r' })
|
||||
const packageJson = JSON.parse(packageJsonContent)
|
||||
const packageJsonContent = fs.readFileSync("./package.json", { encoding: 'utf8', flag: 'r' });
|
||||
const packageJson = JSON.parse(packageJsonContent);
|
||||
|
||||
const version = packageJson.version
|
||||
const parsedVersion = semverParse(version)
|
||||
const version = packageJson.version;
|
||||
const parsedVersion = semverParse(version);
|
||||
|
||||
let appManifestContent = fs.readFileSync("./src/manifest", { encoding: 'utf8', flag: 'r' })
|
||||
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+)/
|
||||
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')}`)
|
||||
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)
|
||||
fs.writeFileSync("./src/manifest", appManifestContent);
|
||||
|
||||
execSync(`npm version ${version} --allow-same-version`, { cwd: 'playlet-web' })
|
||||
execSync(`npm version ${version} --allow-same-version`, { cwd: 'playlet-web' });
|
||||
+16
-11
@@ -1,14 +1,19 @@
|
||||
var rokuDeploy = require('roku-deploy');
|
||||
const rokuDeploy = require('roku-deploy');
|
||||
|
||||
const zip_name = 'playlet.zip'
|
||||
|
||||
rokuDeploy.zipPackage({
|
||||
const options = {
|
||||
outDir: 'release',
|
||||
outFile: zip_name,
|
||||
outFile: 'playlet.zip',
|
||||
//BUG: rokuDeploy does not read stagingDir properly fron config
|
||||
stagingDir: 'dist/build'
|
||||
}).then(function(){
|
||||
console.log(`${zip_name} created`)
|
||||
}, function(error) {
|
||||
console.error(error);
|
||||
});
|
||||
stagingDir: 'dist/build',
|
||||
retainStagingDir: true
|
||||
};
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
await rokuDeploy.zipPackage(options);
|
||||
console.log(`${options.outFile} created`);
|
||||
}
|
||||
catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
})();
|
||||
Reference in new issue
Block a user