Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ jobs:
Lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version-file: package.json
- run: npm ci
Expand All @@ -18,8 +18,8 @@ jobs:
Test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version-file: package.json
- run: npm ci
Expand All @@ -28,7 +28,10 @@ jobs:
Build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version-file: package.json
- run: npm ci
- run: npm run build
- name: Ensure that test URLs aren't included in the built file
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,18 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version-file: package.json
- run: npm ci
- run: npm run build:demo
- run: npm run test:demo
- run: grep -rq "/fregante/" ./demo/dist
# https://github.com/refined-github/github-url-detection/pull/161
name: Ensure that the demo is built correctly
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
uses: actions/upload-pages-artifact@v4
with:
path: demo/dist/

Expand Down
47 changes: 36 additions & 11 deletions .github/workflows/esm-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,32 @@ jobs:
Pack:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- run: npm install
- run: npm run build --if-present
- run: npm pack --dry-run
- run: npm pack | tail -1 | xargs -n1 tar -xzf
- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v6
with:
name: package
path: package
Publint:
runs-on: ubuntu-latest
needs: Pack
steps:
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v7
with:
name: package
path: artifact
- run: npx publint ./artifact
Webpack:
runs-on: ubuntu-latest
needs: Pack
steps:
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v7
with:
name: package
path: artifact
- run: npm install --omit=dev ./artifact
- run: echo "$IMPORT_STATEMENT" > index.js
- run: webpack --entry ./index.js
Expand All @@ -45,7 +52,10 @@ jobs:
runs-on: ubuntu-latest
needs: Pack
steps:
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v7
with:
name: package
path: artifact
- run: npm install --omit=dev ./artifact
- run: echo "$IMPORT_STATEMENT" > index.js
- run: >
Expand All @@ -57,15 +67,21 @@ jobs:
runs-on: ubuntu-latest
needs: Pack
steps:
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v7
with:
name: package
path: artifact
- run: npm install --omit=dev ./artifact rollup@4 @rollup/plugin-json @rollup/plugin-node-resolve
- run: echo "$IMPORT_STATEMENT" > index.js
- run: npx rollup -p node-resolve -p @rollup/plugin-json index.js
Vite:
runs-on: ubuntu-latest
needs: Pack
steps:
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v7
with:
name: package
path: artifact
- run: npm install --omit=dev ./artifact
- run: echo '<script type="module">$IMPORT_STATEMENT</script>' > index.html
- run: npx vite build
Expand All @@ -74,7 +90,10 @@ jobs:
runs-on: ubuntu-latest
needs: Pack
steps:
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v7
with:
name: package
path: artifact
- run: echo '{}' > package.json
- run: echo "$IMPORT_STATEMENT" > index.js
- run: npm install --omit=dev ./artifact
Expand All @@ -83,7 +102,10 @@ jobs:
runs-on: ubuntu-latest
needs: Pack
steps:
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v7
with:
name: package
path: artifact
- run: echo '{"type":"module"}' > package.json
- run: npm install --omit=dev ./artifact @sindresorhus/tsconfig
- run: echo "$IMPORT_STATEMENT" > index.ts
Expand All @@ -96,8 +118,11 @@ jobs:
runs-on: ubuntu-latest
needs: Pack
steps:
- uses: actions/download-artifact@v4
- uses: actions/setup-node@v4
- uses: actions/download-artifact@v7
with:
name: package
path: artifact
- uses: actions/setup-node@v6
with:
node-version-file: artifact/package.json
- run: echo "$IMPORT_STATEMENT" > index.mjs
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ jobs:
NPM:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version-file: package.json
registry-url: https://registry.npmjs.org
Expand Down
2 changes: 1 addition & 1 deletion demo/Index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@

<datalist id="url-examples">
{#each [...allUrls] as url}
<option value={url} />
<option value={url}></option>
{/each}
</datalist>

Expand Down
8 changes: 3 additions & 5 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,13 +369,11 @@ TEST: addTests('hasWikiPageEditor', combinedTestOnly);

export const isRepo = (url: URL | HTMLAnchorElement | Location = location): boolean => {
const [user, repo, extra] = getCleanPathname(url).split('/');
return Boolean(
user
return Boolean(user
&& repo
&& !reservedNames.includes(user)
&& !url.hostname.startsWith('gist.')
&& extra !== 'generate', // Like isNewRepoTemplate but inlined for performance
);
&& extra !== 'generate'); // Like isNewRepoTemplate but inlined for performance
};

TEST: addTests('isRepo', [
Expand Down Expand Up @@ -778,7 +776,7 @@ TEST: addTests('isRepoGitObject', [
/** Covers blob, trees and blame pages */
export const isRepoGitObject = (url: URL | HTMLAnchorElement | Location = location): boolean =>
isRepo(url)
&& [undefined, 'blob', 'tree', 'blame'].includes(getCleanPathname(url).split('/')[2]);
&& [undefined, 'blob', 'tree', 'blame'].includes(getCleanPathname(url).split('/')[2]);

TEST: addTests('hasFiles', combinedTestOnly);
/** Has a list of files */
Expand Down
Loading