feat: GitHub buttons
This commit is contained in:
56
build.js
56
build.js
@@ -1,56 +0,0 @@
|
|||||||
const axios = require("axios")
|
|
||||||
const fs = require("fs")
|
|
||||||
const { spawnSync } = require("child_process")
|
|
||||||
const runCommand = (command, args) => spawnSync(command, args).stdout.toString().replace(/\n/g, "")
|
|
||||||
|
|
||||||
const FAIL_ON_ERROR = false
|
|
||||||
const PW_BUILD_DATA_DIR = "./.hoppscotch"
|
|
||||||
// const IS_DEV_MODE = process.argv.includes("--dev")
|
|
||||||
|
|
||||||
try {
|
|
||||||
(async () => {
|
|
||||||
// Create the build data directory if it does not exist.
|
|
||||||
if (!fs.existsSync(PW_BUILD_DATA_DIR)) {
|
|
||||||
fs.mkdirSync(PW_BUILD_DATA_DIR)
|
|
||||||
}
|
|
||||||
|
|
||||||
let version = {}
|
|
||||||
// Get the current version name as the tag from Git.
|
|
||||||
version.name =
|
|
||||||
process.env.TRAVIS_TAG || runCommand("git", ["tag --sort=committerdate | tail -1"])
|
|
||||||
|
|
||||||
// FALLBACK: If version.name was unset, let's grab it from GitHub.
|
|
||||||
if (!version.name) {
|
|
||||||
version.name = (
|
|
||||||
await axios
|
|
||||||
.get("https://api.github.com/repos/hoppscotch/hoppscotch/releases")
|
|
||||||
// If we can't get it from GitHub, we'll resort to getting it from package.json
|
|
||||||
.catch((ex) => ({
|
|
||||||
data: [
|
|
||||||
{
|
|
||||||
tag_name: require("./package.json").version,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}))
|
|
||||||
).data[0]["tag_name"]
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the current version hash as the short hash from Git.
|
|
||||||
// version.hash = runCommand("git", ["rev-parse", "--short", "HEAD"])
|
|
||||||
// Get the 'variant' name as the branch, if it's not master.
|
|
||||||
// version.variant =
|
|
||||||
// process.env.TRAVIS_BRANCH ||
|
|
||||||
// runCommand("git", ["branch"])
|
|
||||||
// .split("* ")[1]
|
|
||||||
// .split(" ")[0] + (IS_DEV_MODE ? " - DEV MODE" : "")
|
|
||||||
// if (["", "master"].includes(version.variant)) {
|
|
||||||
// delete version.variant
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Write version data into a file
|
|
||||||
fs.writeFileSync(`${PW_BUILD_DATA_DIR}/version.json`, JSON.stringify(version))
|
|
||||||
})()
|
|
||||||
} catch (ex) {
|
|
||||||
console.error(ex)
|
|
||||||
process.exit(FAIL_ON_ERROR ? 1 : 0)
|
|
||||||
}
|
|
||||||
@@ -81,7 +81,7 @@
|
|||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.virtual-list {
|
.virtual-list {
|
||||||
max-height: calc(100vh - 232px);
|
max-height: calc(100vh - 270px);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@
|
|||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.virtual-list {
|
.virtual-list {
|
||||||
max-height: calc(100vh - 232px);
|
max-height: calc(100vh - 270px);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.virtual-list {
|
.virtual-list {
|
||||||
max-height: calc(100vh - 296px);
|
max-height: calc(100vh - 270px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.clamb-3 {
|
.clamb-3 {
|
||||||
|
|||||||
@@ -217,7 +217,7 @@
|
|||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.virtual-list {
|
.virtual-list {
|
||||||
max-height: calc(100vh - 290px);
|
max-height: calc(100vh - 270px);
|
||||||
|
|
||||||
[readonly] {
|
[readonly] {
|
||||||
cursor: default;
|
cursor: default;
|
||||||
|
|||||||
@@ -1,20 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<footer class="flex-col flex-no-wrap">
|
<footer class="footer">
|
||||||
<div class="row-wrapper">
|
<div class="row-wrapper">
|
||||||
<span
|
<span class="flex flex-col font-mono md:flex-row" style="align-items: start">
|
||||||
v-if="version.name"
|
|
||||||
class="flex flex-col flex-wrap justify-start font-mono md:flex-row"
|
|
||||||
style="align-items: start"
|
|
||||||
>
|
|
||||||
<a
|
|
||||||
class="footer-link"
|
|
||||||
:href="'https://github.com/hoppscotch/hoppscotch/releases/tag/' + version.name"
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener"
|
|
||||||
v-tooltip="'GitHub'"
|
|
||||||
>
|
|
||||||
{{ version.name }}
|
|
||||||
</a>
|
|
||||||
<a class="footer-link" href="https://www.netlify.com" target="_blank" rel="noopener">
|
<a class="footer-link" href="https://www.netlify.com" target="_blank" rel="noopener">
|
||||||
Powered by Netlify
|
Powered by Netlify
|
||||||
</a>
|
</a>
|
||||||
@@ -38,23 +25,18 @@
|
|||||||
Paw
|
Paw
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
<!-- <span v-if="version.hash">
|
<iframe
|
||||||
-
|
src="https://ghbtns.com/github-btn.html?user=hoppscotch&type=sponsor"
|
||||||
<a
|
frameborder="0"
|
||||||
:href="'https://github.com/hoppscotch/hoppscotch/commit/' + version.hash"
|
scrolling="0"
|
||||||
target="_blank"
|
width="150"
|
||||||
rel="noopener"
|
height="20"
|
||||||
>{{version.hash}}</a>
|
title="GitHub"
|
||||||
</span> -->
|
class="footer-link"
|
||||||
<!-- <span v-if="version.variant">({{version.variant}})</span> -->
|
loading="lazy"
|
||||||
|
></iframe>
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span class="flex flex-col font-mono md:flex-row" style="align-items: start">
|
||||||
class="flex flex-col flex-wrap justify-start font-mono md:flex-row"
|
|
||||||
style="align-items: start"
|
|
||||||
>
|
|
||||||
<a href="https://liyasthomas.web.app" target="_blank" rel="noopener">
|
|
||||||
<button class="icon" v-tooltip="'Liyas Thomas'">🦄</button>
|
|
||||||
</a>
|
|
||||||
<a href="mailto:liyascthomas@gmail.com" target="_blank" rel="noopener">
|
<a href="mailto:liyascthomas@gmail.com" target="_blank" rel="noopener">
|
||||||
<button class="icon" v-tooltip="$t('contact_us')">
|
<button class="icon" v-tooltip="$t('contact_us')">
|
||||||
<i class="material-icons">email</i>
|
<i class="material-icons">email</i>
|
||||||
@@ -94,20 +76,7 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import * as version from "../../.hoppscotch/version.json"
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
version: {},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
beforeMount() {
|
|
||||||
// Set version data
|
|
||||||
this.version = version.default
|
|
||||||
},
|
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
availableLocales() {
|
availableLocales() {
|
||||||
return this.$i18n.locales.filter(({ code }) => code !== this.$i18n.locale)
|
return this.$i18n.locales.filter(({ code }) => code !== this.$i18n.locale)
|
||||||
|
|||||||
@@ -6,6 +6,16 @@
|
|||||||
<h1 class="hide-on-small-screen logo">Hoppscotch</h1>
|
<h1 class="hide-on-small-screen logo">Hoppscotch</h1>
|
||||||
<h1 class="show-on-small-screen logo">Hs</h1>
|
<h1 class="show-on-small-screen logo">Hs</h1>
|
||||||
</nuxt-link>
|
</nuxt-link>
|
||||||
|
<iframe
|
||||||
|
src="https://ghbtns.com/github-btn.html?user=hoppscotch&repo=hoppscotch&type=star&count=true"
|
||||||
|
frameborder="0"
|
||||||
|
scrolling="0"
|
||||||
|
width="150"
|
||||||
|
height="20"
|
||||||
|
title="GitHub"
|
||||||
|
class="ml-8"
|
||||||
|
loading="lazy"
|
||||||
|
></iframe>
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
<a
|
<a
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
@apply flex;
|
@apply flex;
|
||||||
@apply whitespace-no-wrap;
|
@apply whitespace-no-wrap;
|
||||||
@apply overflow-auto;
|
@apply overflow-auto;
|
||||||
|
@apply mt-4;
|
||||||
|
|
||||||
ul {
|
ul {
|
||||||
@apply flex;
|
@apply flex;
|
||||||
|
|||||||
@@ -5,12 +5,9 @@
|
|||||||
"author": "liyasthomas",
|
"author": "liyasthomas",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"predev": "node build.js --dev",
|
|
||||||
"dev": "nuxt",
|
"dev": "nuxt",
|
||||||
"prebuild": "node build.js",
|
|
||||||
"build": "nuxt build",
|
"build": "nuxt build",
|
||||||
"start": "nuxt start",
|
"start": "nuxt start",
|
||||||
"pregenerate": "node build.js",
|
|
||||||
"generate": "nuxt generate --modern",
|
"generate": "nuxt generate --modern",
|
||||||
"pretty-quick": "pretty-quick --staged --pattern \"**/*.*(html|js|json|vue)\"",
|
"pretty-quick": "pretty-quick --staged --pattern \"**/*.*(html|js|json|vue)\"",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
|
|||||||
Reference in New Issue
Block a user