diff --git a/.eslintrc.json b/.eslintrc.json
index 7a8475da1..2ca14e032 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -85,6 +85,7 @@
}
],
"@typescript-eslint/no-explicit-any": "off",
+ "@typescript-eslint/no-namespace": ["error", { "allowDeclarations": true }],
"@typescript-eslint/semi": ["error"],
"@typescript-eslint/member-delimiter-style": [
"error",
diff --git a/cypress/e2e/projectCommits.spec.ts b/cypress/e2e/projectCommits.spec.ts
index ec44254dd..294fe6e22 100644
--- a/cypress/e2e/projectCommits.spec.ts
+++ b/cypress/e2e/projectCommits.spec.ts
@@ -1,6 +1,7 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
///
import { MockProvider } from "@rsksmart/mock-web3-provider";
+import { getPath } from "../support/e2e";
const groupedCommits = [
{
@@ -146,7 +147,7 @@ describe("project commits", () => {
it("display commit details", () => {
cy.location().should(location => {
- expect(location.pathname).to.eq(
+ expect(getPath(location)).to.eq(
"/seeds/willow.radicle.garden/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/commits/cbf5df499ab4f4a908f1756fbe2c236a4530516a",
);
});
diff --git a/cypress/e2e/projectHeader.spec.ts b/cypress/e2e/projectHeader.spec.ts
index 46ef31300..c071c911e 100644
--- a/cypress/e2e/projectHeader.spec.ts
+++ b/cypress/e2e/projectHeader.spec.ts
@@ -1,6 +1,7 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
///
import { MockProvider } from "@rsksmart/mock-web3-provider";
+import { getPath } from "../support/e2e";
describe("project header", () => {
beforeEach(() => {
@@ -114,7 +115,7 @@ describe("project header", () => {
"@projectReadme",
]);
cy.location().should(location => {
- expect(location.pathname).to.eq(
+ expect(getPath(location)).to.eq(
"/seeds/willow.radicle.garden/bright-forest-protocol/remotes/hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke/tree",
);
});
@@ -135,7 +136,7 @@ describe("project header", () => {
.click();
cy.wait(["@projectTreecbf5df4", "@projectReadme"]);
cy.location().should(location => {
- expect(location.pathname).to.eq(
+ expect(getPath(location)).to.eq(
"/seeds/willow.radicle.garden/bright-forest-protocol/remotes/hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke/tree/master",
);
});
@@ -149,7 +150,7 @@ describe("project header", () => {
.click();
cy.wait(["@projectCommits"]);
cy.location().should(location => {
- expect(location.pathname).to.eq(
+ expect(getPath(location)).to.eq(
"/seeds/willow.radicle.garden/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/remotes/hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke/history/master",
);
});
@@ -160,7 +161,7 @@ describe("project header", () => {
cy.get('[aria-label="Issue count"]').click();
cy.wait(["@projectIssues"]);
cy.location().should(location => {
- expect(location.pathname).to.eq(
+ expect(getPath(location)).to.eq(
"/seeds/willow.radicle.garden/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/remotes/hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke/issues",
);
});
@@ -171,7 +172,7 @@ describe("project header", () => {
cy.get('[aria-label="Patch count"]').click();
cy.wait(["@projectPatches"]);
cy.location().should(location => {
- expect(location.pathname).to.eq(
+ expect(getPath(location)).to.eq(
"/seeds/willow.radicle.garden/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/remotes/hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke/patches",
);
});
diff --git a/cypress/support/e2e.ts b/cypress/support/e2e.ts
index 742d37992..814e04d3d 100644
--- a/cypress/support/e2e.ts
+++ b/cypress/support/e2e.ts
@@ -5,4 +5,9 @@ declare global {
}
}
-export {};
+function getPath(location: Location): string {
+ const url = location.href.replace(window.origin, "");
+ return process.env.hashRouting ? url.substring(2) : url;
+}
+
+export { getPath };
diff --git a/package.json b/package.json
index 9d57c1185..32d0078d2 100644
--- a/package.json
+++ b/package.json
@@ -2,8 +2,10 @@
"version": "1.0.0",
"scripts": {
"start": "vite",
+ "start:ipfs": "HASH_ROUTING=1 vite --base ./",
"serve": "vite preview",
- "build": "scripts/build",
+ "build": "vite build",
+ "build:ipfs": "HASH_ROUTING=1 vite build --base ./",
"postinstall": "scripts/copy-katex-assets && scripts/install-twemoji-assets",
"check": "scripts/check",
"format": "npx prettier '**/*.@(ts|js|svelte|json|css|html)' --ignore-path .gitignore --write",
diff --git a/_redirects b/public/_redirects
similarity index 100%
rename from _redirects
rename to public/_redirects
diff --git a/scripts/build b/scripts/build
deleted file mode 100755
index 3eb4c95d2..000000000
--- a/scripts/build
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-set -e
-
-vite build
-cp _redirects build/_redirects
diff --git a/src/base/projects/Blob.svelte b/src/base/projects/Blob.svelte
index ac99609c1..c43ccb3bd 100644
--- a/src/base/projects/Blob.svelte
+++ b/src/base/projects/Blob.svelte
@@ -2,18 +2,19 @@
import type { Blob } from "@app/project";
import type { ProjectRoute } from "@app/router/definitions";
- import Readme from "@app/base/projects/Readme.svelte";
import HeaderToggleLabel from "@app/base/projects/HeaderToggleLabel.svelte";
import ProjectLink from "@app/router/ProjectLink.svelte";
+ import Readme from "@app/base/projects/Readme.svelte";
import { isMarkdownPath, scrollIntoView, twemoji } from "@app/utils";
+ import { onMount } from "svelte";
import { updateProjectRoute } from "@app/router";
- export let blob: Blob;
- export let line: string | null;
- export let getImage: (path: string) => Promise;
export let activeRoute: ProjectRoute;
+ export let blob: Blob;
+ export let getImage: (path: string) => Promise;
+ export let line: string | undefined = undefined;
- $: lineNumber = line ? parseInt(line.substring(1)) : null;
+ $: lineNumber = line ? parseInt(line.substring(1)) : undefined;
const lastCommit = blob.info.lastCommit;
const lines = blob.binary ? 0 : (blob.content.match(/\n/g) || []).length;
@@ -25,16 +26,23 @@
?.values()
.next().value;
- $: if (line) {
- scrollIntoView(line);
- }
+ // Waiting onMount, due to the line numbers still loading.
+ onMount(() => {
+ if (line) {
+ scrollIntoView(line);
+ }
+ });
const isMarkdown = isMarkdownPath(blob.path);
// If we have a line number we should show the raw output.
let showMarkdown = line ? false : isMarkdown;
const toggleMarkdown = () => {
- updateProjectRoute({ hash: undefined });
+ updateProjectRoute({ line: undefined });
showMarkdown = !showMarkdown;
};
+
+ $: if (line) {
+ scrollIntoView(line);
+ }