Include setup instructions on crate overview
Diff
chartered-frontend/Dockerfile | 2 ++
book/src/getting-started/user-guide.md | 2 +-
chartered-frontend/src/routes/(authed)/crates/[organisation]/[crate]/+page.svelte | 26 ++++++++++++++++++++++++++
chartered-frontend/src/routes/(authed)/crates/[organisation]/[crate]/DependencyDefinition.svelte | 16 ++++++++++++++++
chartered-frontend/src/routes/(authed)/crates/[organisation]/[crate]/RegistryDefinition.svelte | 9 +++++++++
5 files changed, 54 insertions(+), 1 deletion(-)
@@ -1,6 +1,8 @@
FROM node AS builder
ARG VITE_CHARTERED_WEB_URL
ARG VITE_CHARTERED_SSH_URL
RUN ["/bin/bash", "-c", ": ${VITE_CHARTERED_WEB_URL:?VITE_CHARTERED_WEB_URL must be set to the public URL that chartered-web can be reached by passing --build-arg to docker build.}"]
RUN ["/bin/bash", "-c", ": ${VITE_CHARTERED_SSH_URL:?VITE_CHARTERED_SSH_URL must be set to the SSH URL that chartered-git can be reached by passing --build-arg to docker build.}"]
WORKDIR /app
COPY . /app
RUN npm install -D && npm run build
@@ -49,7 +49,7 @@
```toml
[registries]
my-organisation = { index = "ssh://ssh.your.instance.of.chart.rs/my-organisation" }
my-organisation = { index = "ssh://ssh.chart.rs/my-organisation" }
```
(You should create this file if it doesn't already exist)
@@ -8,6 +8,8 @@
import Dependency from './Dependency.svelte';
import VersionTab from './VersionTab.svelte';
import MemberTab from './MemberTab.svelte';
import RegistryDefinition from './RegistryDefinition.svelte';
import DependencyDefinition from './DependencyDefinition.svelte';
// lookup the crate currently requested by the user based on the URL
let cratePromise: Promise<Crate>;
@@ -203,6 +205,30 @@
</div>
<div class="col-span-full lg:col-span-3">
{#if import.meta.env.VITE_CHARTERED_SSH_URL}
<div class="card p-0 mb-6">
<h1 class="text-xl p-3 border-b border-gray-200 dark:border-gray-700 font-medium">Get Started</h1>
<div class="divide-y divide-gray-200 dark:divide-gray-700">
<div class="p-3 pb-0">
<strong class="text-xs pointer-events-none select-none">.cargo/config.toml</strong>
<div class="overflow-scroll pb-3">
<pre><code><RegistryDefinition /></code></pre>
</div>
</div>
<div class="p-3 pb-0">
<strong class="text-xs pointer-events-none select-none">Cargo.toml</strong>
<div class="overflow-scroll pb-3">
<pre><code><DependencyDefinition {cratePromise} /></code></pre>
</div>
</div>
</div>
</div>
{/if}
<div class="card p-0">
<h1 class="text-xl p-3 border-b border-gray-200 dark:border-gray-700 font-medium">Dependencies</h1>
@@ -1,0 +1,16 @@
<script type="typescript">
import type { Crate } from '../../../../../types/crate';
import { page } from '$app/stores';
let version = '*';
const updateVersion = (vers: string) => (version = vers || '*');
export let cratePromise: Promise<Crate>;
$: {
updateVersion('*');
cratePromise.then((crate) => updateVersion(crate?.versions[0]?.vers));
}
</script>
[dependencies]
{$page.params.crate} = {`{ version = "${version}", registry = "${$page.params.organisation}" }`}
@@ -1,0 +1,9 @@
<script type="typescript">
import { page } from '$app/stores';
let indexUri = '';
$: indexUri = `${import.meta.env.VITE_CHARTERED_SSH_URL}${$page.params.organisation}`;
</script>
[registries]
{$page.params.organisation} = {`{ index = "${indexUri}" }`}