Skip to content

Commit ad9ada3

Browse files
committed
Demo: Drop TypeScript
Svelte/TypeScript is not mature and requires too much config. Importing TypeScript from inside .ts files isn't currently possible.
1 parent 7f497ca commit ad9ada3

File tree

13 files changed

+34
-1376
lines changed

13 files changed

+34
-1376
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,11 @@ jobs:
2525
- uses: actions/checkout@v2
2626
- run: npm install
2727
- run: npm run ava
28+
29+
Demo:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v2
33+
- run: npm install
34+
- run: npm run demo:build
35+
- run: npm run demo:test

.github/workflows/demo.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,8 @@ jobs:
1111
with:
1212
persist-credentials: false
1313
- run: npm install
14-
- run: npm run build
15-
- run: cd demo && npm install
16-
- run: cd demo && npm run build
17-
- run: ls -RF
14+
- run: npm run demo:build
1815
- uses: peaceiris/actions-gh-pages@v3
1916
with:
2017
github_token: ${{ secrets.GITHUB_TOKEN }}
21-
publish_dir: ./demo/public
18+
publish_dir: ./dist

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ logs
1111
cjs
1212
esm/*
1313
!esm/package.json
14+
dist
15+
.cache

demo/.gitignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

demo/src/App.svelte renamed to demo/App.svelte

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
<script lang="ts">
1+
<script>
22
const defaultUrl = 'https://github.com/fregante/github-url-detection';
33
export let url = '';
4-
import * as urlDetection from '../../esm';
4+
import * as urlDetection from '../index';
5+
import collector from '../collector';
56
6-
let isUrlValid: boolean;
7+
const allUrls = new Set([...collector.values()].flat().sort());
8+
allUrls.delete('combinedTestOnly');
9+
10+
let isUrlValid;
711
$: {
812
try {
913
new URL(url || defaultUrl);
@@ -12,13 +16,8 @@
1216
isUrlValid = false;
1317
}
1418
}
15-
interface Detection {
16-
name: string;
17-
detect?: (url: URL) => boolean;
18-
result?: boolean;
19-
}
2019
21-
let detections: Array<Detection | undefined> = [];
20+
let detections = [];
2221
$: {
2322
if (isUrlValid) {
2423
detections = Object.entries(urlDetection)
@@ -27,7 +26,7 @@
2726
return;
2827
}
2928
30-
if (!String(detect).startsWith('()')) {
29+
if (detect.length > 0) {
3130
return {
3231
name,
3332
detect,
@@ -85,11 +84,9 @@
8584
</label>
8685

8786
<datalist id="url-examples">
88-
<option value="https://github.big-corp.com/gist/" />
89-
<option value="https://github.com/marketplace/actions/urlchecker-action" />
90-
<option value="https://github.com/sindresorhus/refined-github/pull/148" />
91-
<option value="https://github.com/sindresorhus/refined-github/edit/master/readme.md" />
92-
<option value="https://github.com/sindresorhus/refined-github/commit/5b614b9035f2035b839f48b4db7bd5c3298d526f" />
87+
{#each [...allUrls] as url}
88+
<option value={url} />
89+
{/each}
9390
</datalist>
9491

9592
{#if isUrlValid}

demo/public/global.css renamed to demo/global.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ label {
3131
}
3232

3333
label span {
34-
margin-right: .5em;
34+
margin-right: 0.5em;
3535
font-size: 1.7em;
3636
font-weight: bold;
3737
}

demo/public/index.html renamed to demo/index.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111
<title>`github-url-detection` npm module testing ground</title>
1212

1313
<link rel="stylesheet" href="global.css" />
14-
<link rel="stylesheet" href="build/bundle.css" />
15-
16-
<script defer src="build/bundle.js"></script>
14+
<script defer src="main.js"></script>
1715
</head>
1816

1917
<body>
File renamed without changes.

0 commit comments

Comments
 (0)