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">
|
||||
.virtual-list {
|
||||
max-height: calc(100vh - 232px);
|
||||
max-height: calc(100vh - 270px);
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
|
||||
<style scoped lang="scss">
|
||||
.virtual-list {
|
||||
max-height: calc(100vh - 232px);
|
||||
max-height: calc(100vh - 270px);
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
<style scoped lang="scss">
|
||||
.virtual-list {
|
||||
max-height: calc(100vh - 296px);
|
||||
max-height: calc(100vh - 270px);
|
||||
}
|
||||
|
||||
.clamb-3 {
|
||||
|
||||
@@ -217,7 +217,7 @@
|
||||
|
||||
<style scoped lang="scss">
|
||||
.virtual-list {
|
||||
max-height: calc(100vh - 290px);
|
||||
max-height: calc(100vh - 270px);
|
||||
|
||||
[readonly] {
|
||||
cursor: default;
|
||||
|
||||
@@ -1,20 +1,7 @@
|
||||
<template>
|
||||
<footer class="flex-col flex-no-wrap">
|
||||
<footer class="footer">
|
||||
<div class="row-wrapper">
|
||||
<span
|
||||
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>
|
||||
<span class="flex flex-col font-mono md:flex-row" style="align-items: start">
|
||||
<a class="footer-link" href="https://www.netlify.com" target="_blank" rel="noopener">
|
||||
Powered by Netlify
|
||||
</a>
|
||||
@@ -38,23 +25,18 @@
|
||||
Paw
|
||||
</a>
|
||||
</span>
|
||||
<!-- <span v-if="version.hash">
|
||||
-
|
||||
<a
|
||||
:href="'https://github.com/hoppscotch/hoppscotch/commit/' + version.hash"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
>{{version.hash}}</a>
|
||||
</span> -->
|
||||
<!-- <span v-if="version.variant">({{version.variant}})</span> -->
|
||||
<iframe
|
||||
src="https://ghbtns.com/github-btn.html?user=hoppscotch&type=sponsor"
|
||||
frameborder="0"
|
||||
scrolling="0"
|
||||
width="150"
|
||||
height="20"
|
||||
title="GitHub"
|
||||
class="footer-link"
|
||||
loading="lazy"
|
||||
></iframe>
|
||||
</span>
|
||||
<span
|
||||
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>
|
||||
<span class="flex flex-col font-mono md:flex-row" style="align-items: start">
|
||||
<a href="mailto:liyascthomas@gmail.com" target="_blank" rel="noopener">
|
||||
<button class="icon" v-tooltip="$t('contact_us')">
|
||||
<i class="material-icons">email</i>
|
||||
@@ -94,20 +76,7 @@
|
||||
</style>
|
||||
|
||||
<script>
|
||||
import * as version from "../../.hoppscotch/version.json"
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
version: {},
|
||||
}
|
||||
},
|
||||
|
||||
beforeMount() {
|
||||
// Set version data
|
||||
this.version = version.default
|
||||
},
|
||||
|
||||
computed: {
|
||||
availableLocales() {
|
||||
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="show-on-small-screen logo">Hs</h1>
|
||||
</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>
|
||||
<a
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
@apply flex;
|
||||
@apply whitespace-no-wrap;
|
||||
@apply overflow-auto;
|
||||
@apply mt-4;
|
||||
|
||||
ul {
|
||||
@apply flex;
|
||||
|
||||
@@ -5,12 +5,9 @@
|
||||
"author": "liyasthomas",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"predev": "node build.js --dev",
|
||||
"dev": "nuxt",
|
||||
"prebuild": "node build.js",
|
||||
"build": "nuxt build",
|
||||
"start": "nuxt start",
|
||||
"pregenerate": "node build.js",
|
||||
"generate": "nuxt generate --modern",
|
||||
"pretty-quick": "pretty-quick --staged --pattern \"**/*.*(html|js|json|vue)\"",
|
||||
"test": "jest",
|
||||
|
||||
Reference in New Issue
Block a user