This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Only works if github cli is installed and logged in | |
*/ | |
function getPRDetails() { | |
exec("gh pr view").then( | |
stdout => { | |
const response = stdout.toString(); | |
const prDetails = response.match(/into (\S+) from (\S+)/i); | |
const [, baseBranch, targetBranch] = prDetails; | |
console.log("Base branch: ", baseBranch); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Need to add refs and then fetch, as Jenkins does not allow to fetch other barnches | |
*/ | |
async function fetchBaseBranch(baseBranch) { | |
try { | |
console.log("Fetching ${baseBranch} from remote"); | |
const addBaseRefs = `git config --add remote.origin.fetch +refs/heads/${baseBranch}:refs/remotes/origin/${baseBranch}`; | |
const fetchBase = `git fetch --no-tags origin +refs/heads/${baseBranch}:refs/remotes/origin/${baseBranch}`; | |
const command = `${addBaseRefs} && ${fetchBase}`; | |
await exec(command); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const minimist = require("minimist"); | |
const chalk = require("chalk"); | |
const log = console.log; | |
const error = chalk.bold.red; | |
const debug = chalk.bold.green; | |
const info = chalk.rgb(215, 135, 95); | |
/* argv has all the user arguements | |
* Visit https://github.com/substack/minimist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Use spawn instead of exec for large ouput buffer | |
* https://www.hacksparrow.com/nodejs/difference-between-spawn-and-exec-of-node-js-child-rocess.html | |
*/ | |
const liveOuput = (command, args) => { | |
const childProcess = spawn(command, args, { shell: true }); | |
childProcess.stdout.on("data", data => { | |
console.log(data.toString()); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const commonPlugins = require("./commonPlugins"); | |
module.exports = api => { | |
api && api.cache(false); | |
const presets = [ | |
[ | |
"@babel/preset-env", | |
{ | |
targets: { browsers: ["safari >= 7"] }, //To support old browsers | |
useBuiltIns: "usage", | |
corejs: 2, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const commonPlugins = require("./commonPlugins"); | |
module.exports = api => { | |
api && api.cache(false); | |
const presets = [ | |
[ | |
"@babel/preset-env", | |
{ | |
targets: { esmodules: true }, //For ES6 supporting browsers | |
useBuiltIns: "usage", | |
corejs: 2, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require("path"); | |
const legacyBabelConfig = require("babel.legacy.config.js"); | |
module.exports = { | |
context: path.resolve(__dirname, "src"), | |
resolve: { | |
extensions: [".js", ".jsx"], | |
alias: {...}, | |
modules: [ | |
path.resolve(__dirname, "src"), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require("path"); | |
const modernBabelConfig = require("babel.modern.config.js"); | |
module.exports = { | |
context: path.resolve(__dirname, "src"), | |
resolve: { | |
extensions: [".js", ".jsx"], | |
alias: {...}, | |
modules: [ | |
path.resolve(__dirname, "src"), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace PWAUtils | |
{ | |
public static class BrowserDetection | |
{ | |
static readonly Dictionary<string, string> browserMapping = new Dictionary<string, string> | |
{ | |
//For mobile devices | |
{ "Chrome Mobile", "71" }, | |
{ "Firefox Mobile", "64" }, | |
{ "Samsung Browser", "8.2" }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const glob = require("glob"); | |
const path = require("path"); | |
const configs = []; | |
glob.sync("./lh-reports/*.json").forEach(file => { | |
configs.push(require(path.resolve(file))); | |
}); | |
const stats = { | |
FCP: { value: 0, unit: "s" }, |
OlderNewer