Skip to content

Commit 2edb54c

Browse files
authored
Merge pull request #210 from n0th1ng-else/dotenv
2 parents e99ee98 + be25ac1 commit 2edb54c

File tree

12 files changed

+164
-32
lines changed

12 files changed

+164
-32
lines changed

.env.dev

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
DIST_ROOT=
2+
NODE_ENV=
3+
SELF_URL=
4+
COMMIT_HASH=
5+
APP_VERSION=
6+
GH_AUTHOR_LOGIN=
7+
GH_AUTHOR_LINKED_IN=
8+
GH_AUTHOR_TELEGRAM=
9+
GH_AUTHOR_MEDIUM=
10+
GH_AUTHOR_HABR=
11+
GH_AUTHOR_NPM=
12+
GH_AUTHOR_TWITTER=
13+
GH_AUTHOR_DEVTO=

.github/workflows/release.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,18 @@ jobs:
8282
tags: |
8383
ghcr.io/${{ github.actor }}/n0th1ng-else.github.io/n0th1ng-else-blog:latest
8484
ghcr.io/${{ github.actor }}/n0th1ng-else.github.io/n0th1ng-else-blog:${{ github.sha }}
85-
build-args: APP_VERSION=${{ needs.version.outputs.version }},COMMIT_HASH=${{ env.APP_VERSION }},SELF_URL=${{ secrets.SELF_URL }},GH_AUTHOR_LOGIN=${{ secrets.GH_AUTHOR_LOGIN }},GH_AUTHOR_LINKED_IN=${{ secrets.GH_AUTHOR_LINKED_IN }},GH_AUTHOR_TELEGRAM=${{ secrets.GH_AUTHOR_TELEGRAM }},GH_AUTHOR_MEDIUM=${{ secrets.GH_AUTHOR_MEDIUM }},GH_AUTHOR_HABR=${{ secrets.GH_AUTHOR_HABR }},GH_AUTHOR_NPM=${{ secrets.GH_AUTHOR_NPM }},GH_AUTHOR_TWITTER=${{ secrets.GH_AUTHOR_TWITTER }},GH_AUTHOR_DEVTO=${{ secrets.GH_AUTHOR_DEVTO }}
85+
build-args: |
86+
APP_VERSION=${{ needs.version.outputs.version }}
87+
COMMIT_HASH=${{ github.sha }}
88+
SELF_URL=${{ secrets.SELF_URL }}
89+
GH_AUTHOR_LOGIN=${{ secrets.GH_AUTHOR_LOGIN }}
90+
GH_AUTHOR_LINKED_IN=${{ secrets.GH_AUTHOR_LINKED_IN }}
91+
GH_AUTHOR_TELEGRAM=${{ secrets.GH_AUTHOR_TELEGRAM }}
92+
GH_AUTHOR_MEDIUM=${{ secrets.GH_AUTHOR_MEDIUM }}
93+
GH_AUTHOR_HABR=${{ secrets.GH_AUTHOR_HABR }}
94+
GH_AUTHOR_NPM=${{ secrets.GH_AUTHOR_NPM }}
95+
GH_AUTHOR_TWITTER=${{ secrets.GH_AUTHOR_TWITTER }}
96+
GH_AUTHOR_DEVTO=${{ secrets.GH_AUTHOR_DEVTO }}
8697
8798
production:
8899
runs-on: ubuntu-latest

package-lock.json

Lines changed: 58 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"@typescript-eslint/eslint-plugin": "5.39.0",
1919
"@typescript-eslint/parser": "5.39.0",
2020
"cross-spawn": "7.0.3",
21+
"dotenv-cli": "^6.0.0",
2122
"eslint": "8.24.0",
2223
"eslint-config-prettier": "8.5.0",
2324
"eslint-plugin-svelte3": "4.0.0",
@@ -48,14 +49,15 @@
4849
},
4950
"scripts": {
5051
"meta": "node links.js",
52+
"meta:dev": "dotenv npm run meta",
5153
"version": "node version.js",
5254
"format": "prettier --write",
5355
"format:check": "prettier --check .",
5456
"lint": "eslint",
5557
"lint:all": "eslint .",
5658
"build": "vite build",
5759
"validate": "svelte-check",
58-
"dev": "vite dev",
60+
"dev": "dotenv vite dev",
5961
"preview": "vite preview",
6062
"start": "node dist"
6163
},

src/lib/browser/components/Arrow.svelte

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,16 @@
1616
1717
const icon = type === 'up' ? iconUp : iconLeft;
1818
19+
const control = false;
20+
1921
let isDark = isDarkTheme(defaultTheme);
2022
2123
const unsubscribeTheme = onThemeChange(th => (isDark = isDarkTheme(th)));
2224
2325
onDestroy(() => unsubscribeTheme());
2426
</script>
2527

26-
<Button secondary on:click="{onClick}">
28+
<Button secondary on:click="{onClick}" control="{control}">
2729
<img class="btn-logo {size}" class:l="{!isDark}" class:d="{isDark}" src="{icon}" alt="" />
2830
</Button>
2931

src/lib/browser/components/ArticlePreview.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
const host = getServiceTitle(article.service);
1818
const image = article.meta.image;
1919
20-
const btnText = host ? `Read more on ${host}` : 'Read More';
20+
const btnText = host ? `Read more on ${host}` : 'Read more';
2121
</script>
2222

2323
<section>
@@ -40,7 +40,7 @@
4040
</SubTitle>
4141
</div>
4242
<p class="action">
43-
<Button hint="Read more" href="{url}" disabled="{readonly}">{btnText}</Button>
43+
<Button hint="Read more" href="{url}" disabled="{readonly}" external>{btnText}</Button>
4444
</p>
4545
</div>
4646
</section>

src/lib/browser/ui/Button.svelte

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script lang="ts">
22
import { onDestroy, createEventDispatcher } from 'svelte';
33
import { onThemeChange, isDarkTheme, defaultTheme } from '$lib/browser/stores/theme';
4+
import Link from './Link.svelte';
45
56
let isDark = isDarkTheme(defaultTheme);
67
@@ -20,41 +21,49 @@
2021
2122
export let icon = '';
2223
23-
export let hint = '';
24+
export let hint: string | undefined = undefined;
2425
2526
export let disabled = false;
2627
2728
export let href = '';
29+
30+
export let external = false;
31+
32+
export let control = true;
2833
</script>
2934

3035
{#if href}
31-
<a
32-
class:l="{!isDark}"
33-
class:d="{isDark}"
34-
class:secondary
35-
class:inline
36-
class="ui-button"
36+
<Link
3737
on:click="{onClick}"
38-
title="{hint}"
39-
href="{href}"
38+
external="{external}"
39+
url="{href}"
40+
hint="{hint}"
41+
raw
42+
inline
43+
control="{control}"
4044
>
41-
<span class="ui-button__text">
42-
<slot />
45+
<span class:l="{!isDark}" class:d="{isDark}" class:secondary class:inline class="ui-button">
46+
<span class="ui-button__text">
47+
<slot />
48+
</span>
49+
{#if icon}
50+
<img src="{icon}" class="ui-button__icon" alt="{hint}" />
51+
{/if}
4352
</span>
44-
{#if icon}
45-
<img src="{icon}" class="ui-button__icon" alt="{hint}" />
46-
{/if}
47-
</a>
53+
</Link>
4854
{:else}
4955
<button
56+
class="ui-button"
5057
class:l="{!isDark}"
5158
class:d="{isDark}"
5259
class:secondary
5360
class:inline
54-
class="ui-button"
61+
class:no-print="{!control}"
5562
on:click="{onClick}"
5663
title="{hint}"
5764
disabled="{disabled}"
65+
aria-hidden="{control ? undefined : 'true'}"
66+
tabindex="{control ? undefined : -1}"
5867
>
5968
<span class="ui-button__text">
6069
<slot />
@@ -99,6 +108,12 @@
99108
padding: 0;
100109
}
101110
111+
@media print {
112+
&.no-print {
113+
display: none;
114+
}
115+
}
116+
102117
&.l {
103118
@include button-style($l-primary, $l-accent);
104119
}
@@ -110,7 +125,6 @@
110125
&__text {
111126
@include set-font();
112127
font-size: $font-size-small;
113-
text-transform: capitalize;
114128
}
115129
116130
&__icon {

src/lib/browser/ui/Card.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,17 @@
3838
<div class="ui-card__actions ui-card__section">
3939
{#if item.url}
4040
<div class="ui-card__action">
41-
<Button href="{item.url}" disabled="{readonly}">Web</Button>
41+
<Button href="{item.url}" disabled="{readonly}" external>Website</Button>
4242
</div>
4343
{/if}
4444
{#if item.source}
4545
<div class="ui-card__action">
46-
<Button href="{item.source}" disabled="{readonly}">Source</Button>
46+
<Button href="{item.source}" disabled="{readonly}" external>Source</Button>
4747
</div>
4848
{/if}
4949
{#if item.registry}
5050
<div class="ui-card__action">
51-
<Button href="{item.registry}" disabled="{readonly}">Package</Button>
51+
<Button href="{item.registry}" disabled="{readonly}" external>Package</Button>
5252
</div>
5353
{/if}
5454
</div>

src/lib/browser/ui/Link.svelte

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
11
<script lang="ts">
2-
import { onDestroy } from 'svelte';
2+
import { createEventDispatcher, onDestroy } from 'svelte';
33
import { onThemeChange, isDarkTheme, defaultTheme } from '$lib/browser/stores/theme';
44
55
export let external = false;
6+
67
export let inline = false;
8+
79
export let url = 'javascript:void(0);';
810
11+
export let hint: string | undefined = undefined;
12+
13+
export let raw = false;
14+
15+
export let control = true;
16+
17+
const dispatch = createEventDispatcher();
18+
19+
const onClick = (): void => {
20+
dispatch('click');
21+
};
22+
923
let isDark = isDarkTheme(defaultTheme);
1024
1125
const unsubscribeTheme = onThemeChange(th => (isDark = isDarkTheme(th)));
@@ -16,17 +30,32 @@
1630
{#if external}
1731
<a
1832
class="ui-link"
33+
class:filled="{!raw}"
1934
class:inline
2035
class:l="{!isDark}"
2136
class:d="{isDark}"
37+
on:click="{onClick}"
38+
aria-hidden="{control ? undefined : 'true'}"
39+
tabindex="{control ? undefined : -1}"
2240
href="{url}"
41+
title="{hint}"
2342
target="_blank"
2443
rel="noreferrer noopener"
2544
>
2645
<slot />
2746
</a>
2847
{:else}
29-
<a class="ui-link" class:inline class:l="{!isDark}" class:d="{isDark}" href="{url}">
48+
<a
49+
class="ui-link"
50+
class:filled="{!raw}"
51+
class:l="{!isDark}"
52+
class:d="{isDark}"
53+
class:inline
54+
class:no-print="{!control}"
55+
on:click="{onClick}"
56+
href="{url}"
57+
title="{hint}"
58+
>
3059
<slot />
3160
</a>
3261
{/if}
@@ -57,7 +86,14 @@
5786
&.inline {
5887
margin: 0;
5988
}
89+
@media print {
90+
&.no-print {
91+
display: none;
92+
}
93+
}
94+
}
6095
96+
.filled {
6197
&.l {
6298
@include link-style($l-tertiary, $l-accent);
6399
}

src/routes/about/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
<List>
8383
<ListItem>Blazing fast with Svelte</ListItem>
8484
<ListItem>Tricky deployment workflow to make it working</ListItem>
85-
<ListItem>Baking stuff on my MacBook Pro 2020</ListItem>
85+
<ListItem>Baking stuff on my MacBook Pro 2021</ListItem>
8686
</List>
8787
</article>
8888

0 commit comments

Comments
 (0)