🏡 index : ~doyle/chartered.git

author Jordan Doyle <jordan@doyle.la> 2022-09-17 3:24:56.0 +01:00:00
committer Jordan Doyle <jordan@doyle.la> 2022-09-17 3:24:56.0 +01:00:00
commit
d3e0003dab534b072152d7bdecf0bd40644ac068 [patch]
tree
8484c0286c46cf694e710bcd14e6ba328c2b54b1
parent
77d1a49605cf78248fb555aef6cec5fcbd549016
download
d3e0003dab534b072152d7bdecf0bd40644ac068.tar.gz

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(-)

diff --git a/chartered-frontend/Dockerfile b/chartered-frontend/Dockerfile
index de0b066..571a682 100644
--- a/chartered-frontend/Dockerfile
+++ a/chartered-frontend/Dockerfile
@@ -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
diff --git a/book/src/getting-started/user-guide.md b/book/src/getting-started/user-guide.md
index 4623393..ef4890b 100644
--- a/book/src/getting-started/user-guide.md
+++ a/book/src/getting-started/user-guide.md
@@ -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)
diff --git a/chartered-frontend/src/routes/(authed)/crates/[organisation]/[crate]/+page.svelte b/chartered-frontend/src/routes/(authed)/crates/[organisation]/[crate]/+page.svelte
index 501024e..aa173ee 100644
--- a/chartered-frontend/src/routes/(authed)/crates/[organisation]/[crate]/+page.svelte
+++ a/chartered-frontend/src/routes/(authed)/crates/[organisation]/[crate]/+page.svelte
@@ -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>

diff --git a/chartered-frontend/src/routes/(authed)/crates/[organisation]/[crate]/DependencyDefinition.svelte b/chartered-frontend/src/routes/(authed)/crates/[organisation]/[crate]/DependencyDefinition.svelte
new file mode 100644
index 0000000..c91a69b 100644
--- /dev/null
+++ a/chartered-frontend/src/routes/(authed)/crates/[organisation]/[crate]/DependencyDefinition.svelte
@@ -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}" }`}
diff --git a/chartered-frontend/src/routes/(authed)/crates/[organisation]/[crate]/RegistryDefinition.svelte b/chartered-frontend/src/routes/(authed)/crates/[organisation]/[crate]/RegistryDefinition.svelte
new file mode 100644
index 0000000..5ba6f6e 100644
--- /dev/null
+++ a/chartered-frontend/src/routes/(authed)/crates/[organisation]/[crate]/RegistryDefinition.svelte
@@ -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}" }`}