refactor: fix colors, remove old code
This commit is contained in:
32
.github/workflows/main.yaml
vendored
32
.github/workflows/main.yaml
vendored
@@ -40,23 +40,31 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0 # to fetch tags
|
||||
|
||||
- name: Extract latest tag and set filename
|
||||
- name: Extract tag and set filename
|
||||
id: meta
|
||||
run: |
|
||||
# Last stable tag.
|
||||
LAST_TAG=$(git tag --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1)
|
||||
# Проверяем, указывает ли HEAD на тег (релиз)
|
||||
RELEASE_TAG=$(git tag --points-at HEAD | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1)
|
||||
|
||||
# Fallback
|
||||
if [ -z "$LAST_TAG" ]; then
|
||||
LAST_TAG="v0.0.0"
|
||||
if [ -n "$RELEASE_TAG" ]; then
|
||||
echo "Это полноценный релиз"
|
||||
TAG="$RELEASE_TAG"
|
||||
FILENAME="oc_telegram_shop_${TAG}.ocmod.zip"
|
||||
IS_RELEASE=true
|
||||
else
|
||||
echo "Это dev-сборка"
|
||||
LAST_TAG=$(git tag --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1)
|
||||
[ -z "$LAST_TAG" ] && LAST_TAG="v0.0.0"
|
||||
SHORT_SHA=$(git rev-parse --short=7 HEAD)
|
||||
DATE=$(date +%Y%m%d%H%M)
|
||||
TAG="${LAST_TAG}-dev.${DATE}+${SHORT_SHA}"
|
||||
FILENAME="oc_telegram_shop_${TAG}.ocmod.zip"
|
||||
IS_RELEASE=false
|
||||
fi
|
||||
|
||||
echo "Last Tag: $LAST_TAG"
|
||||
SHORT_SHA=$(git rev-parse --short=7 HEAD)
|
||||
DATE=$(date +%Y%m%d%H%M)
|
||||
TAG="${LAST_TAG}-dev.${DATE}+${SHORT_SHA}"
|
||||
echo "is_release=$IS_RELEASE" >> $GITHUB_OUTPUT
|
||||
echo "tag=$TAG" >> $GITHUB_OUTPUT
|
||||
echo "filename=oc_telegram_shop_${TAG}.ocmod.zip" >> $GITHUB_OUTPUT
|
||||
echo "filename=$FILENAME" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Download build artifact
|
||||
uses: actions/download-artifact@v4
|
||||
@@ -79,7 +87,7 @@ jobs:
|
||||
- name: Create GitHub Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
draft: true
|
||||
draft: ${{ steps.meta.outputs.is_release == 'false' }}
|
||||
tag_name: ${{ steps.meta.outputs.tag }}
|
||||
files: ./build/${{ steps.meta.outputs.filename }}
|
||||
generate_release_notes: true
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
<template>
|
||||
<div
|
||||
v-if="logs.length"
|
||||
ref="logContainer"
|
||||
class="fixed bottom-0 left-0 right-0 max-h-60 overflow-y-auto bg-white text-sm font-mono border-t border-gray-300 shadow-lg z-[9999] p-4 space-y-2"
|
||||
>
|
||||
<div
|
||||
v-for="(log, idx) in logs"
|
||||
:key="idx"
|
||||
:class="colorClass(log.type)"
|
||||
class="whitespace-pre-wrap"
|
||||
>
|
||||
[{{ log.type.toUpperCase() }}] {{ log.message }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {ref, onMounted, nextTick} from 'vue'
|
||||
|
||||
const logs = ref([])
|
||||
const logContainer = ref(null)
|
||||
|
||||
function pushLog(type, input) {
|
||||
let message = ''
|
||||
let details = ''
|
||||
|
||||
if (input instanceof Error) {
|
||||
message = input.message
|
||||
details = input.stack
|
||||
} else if (typeof input === 'string') {
|
||||
message = input
|
||||
} else {
|
||||
try {
|
||||
message = JSON.stringify(input, null, 2)
|
||||
} catch {
|
||||
message = String(input)
|
||||
}
|
||||
}
|
||||
|
||||
logs.value.push({ type, message, details })
|
||||
|
||||
nextTick(() => {
|
||||
const el = logContainer.value
|
||||
if (el) el.scrollTop = el.scrollHeight
|
||||
});
|
||||
}
|
||||
|
||||
function colorClass(type) {
|
||||
switch (type) {
|
||||
case 'error': return 'text-red-700'
|
||||
case 'warn': return 'text-yellow-700'
|
||||
case 'info': return 'text-blue-700'
|
||||
default: return 'text-gray-800'
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
if (import.meta.env.PROD) return
|
||||
|
||||
// Backup originals
|
||||
const orig = {
|
||||
log: console.log,
|
||||
warn: console.warn,
|
||||
error: console.error,
|
||||
info: console.info,
|
||||
}
|
||||
|
||||
Object.entries(orig).forEach(([type, fn]) => {
|
||||
console[type] = (...args) => {
|
||||
pushLog(type, args.map(toText).join(' '))
|
||||
fn.apply(console, args)
|
||||
}
|
||||
})
|
||||
|
||||
window.addEventListener('error', (e) => {
|
||||
pushLog('error', e.error?.stack || `${e.message} at ${e.filename}:${e.lineno}:${e.colno}`)
|
||||
})
|
||||
|
||||
window.addEventListener('unhandledrejection', (e) => {
|
||||
pushLog('error', e.reason?.stack || e.reason?.message || String(e.reason))
|
||||
})
|
||||
})
|
||||
|
||||
function toText(v) {
|
||||
try {
|
||||
if (typeof v === 'string') return v
|
||||
return JSON.stringify(v, null, 2)
|
||||
} catch {
|
||||
return String(v)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="flex flex-col items-center justify-center text-center py-16 text-gray-500">
|
||||
<div class="flex flex-col items-center justify-center text-center py-16">
|
||||
<span class="text-5xl mb-4">🛒</span>
|
||||
<h2 class="text-xl font-semibold mb-2">Здесь пока пусто</h2>
|
||||
<p class="text-sm mb-4">Мы уже выехали на склад, чтобы найти что-нибудь подходящее.</p>
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
<template>
|
||||
<div class="grid grid-cols-1 gap-x-6 gap-y-10 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 xl:gap-x-8">
|
||||
<a v-for="product in products" :key="product.id" :href="product.href" class="group">
|
||||
<img :src="product.imageSrc" :alt="product.imageAlt" class="aspect-square w-full rounded-lg bg-gray-200 object-cover group-hover:opacity-75 xl:aspect-7/8" />
|
||||
<h3 class="mt-4 text-sm text-gray-700">{{ product.name }}</h3>
|
||||
<p class="mt-1 text-lg font-medium text-gray-900">{{ product.price }}</p>
|
||||
</a>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
</script>
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<h3 class="text-sm mb-2">
|
||||
{{ name }} <span v-if="required" class="text-red-500">*</span>
|
||||
{{ name }} <span v-if="required" class="text-error">*</span>
|
||||
</h3>
|
||||
|
||||
<fieldset>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
<div
|
||||
v-if="productsStore.hasMore === false"
|
||||
class="text-gray-500 text-xs text-center mt-4 pt-4 mb-2 border-t"
|
||||
class="text-xs text-center mt-4 pt-4 mb-2 border-t"
|
||||
>
|
||||
{{ settings.noMoreProductsMessage }}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user