Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instructions for people who cannot install the prototype kit on their computers (Issue/70) #152

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 13 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
65 changes: 65 additions & 0 deletions .devcontainer/devcontainer.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t think we need to include this file as this would just enable you to run the documentation website in Codespaces, rather than the kit itself, which is over here: https://github.com/nhsuk/nhsuk-prototype-kit/

But it might be useful to include anyway to allow us to try it out for making changes to the website?

Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"name": "NHS Prototype Kit",
"image": "mcr.microsoft.com/devcontainers/universal:2",
// codespaces seems to have an issue using port 2000 so setting to 2001 for the NHS Prototype Kit
"runArgs": ["--env", "PORT=2001"],
"portsAttributes": {
"3001": {
"label": "Running prototype",
// --------------------------------
// onAutoForward possible options
// --------------------------------
// you can change the value to one of the following possible options:
// 'notify' (shows a prompt),
// 'silent' (does nothing)
// 'openBrowser' (opens the prototype URL in a browser window/tab)
// 'openPrview' (opens the codespaces preview window to present the running prototype to the user)
"onAutoForward": "openPreview"
}
},
// forward the port for the browersync process
"forwardPorts": [3001],
"otherPortsAttributes": { "onAutoForward": "ignore" },
// when created - sets the git merge statergy to rebase to hopefully make easier time of merging
"onCreateCommand": "git config --global pull.rebase true",
// after creation - installs the node packages
"postCreateCommand": "npm install",
// A command to run each time a tool has successfully attached to the container
"postAttachCommand": {
"server": "npm run watch"
},
// codespace customisations
"customizations": {
// Configure properties specific to VS Code web-basde IDE used within codespaces.
"vscode": {
// editor settings
"settings": {
// uncomment the following lines to hide files not needed to update content
// "files.exclude": {
// "{docs,lib,linters,middleware,node_modules,public,tests,NHS111.Shared.Frontend}/": true,
// "*{CHANGELOG,CONTRIBUTING}.md": true,
// "app/{data,assets}/": true,
// "app/*.js": true,
// "*.{js,yml,json}": true,
// ".*": true,
// "LICENSE": true
// },
// make emmet work within nunjucks
"emmet.includeLanguages": {
"njk": "html",
"nunjucks": "html",
"erb": "html",
"jinja": "html",
"jinja-html": "html",
"markdown": "html"
},
"html.suggest.html5": true
},
// bundle the following editor extensions
"extensions": [
// nunjuck syntax highlighting
"douglaszaltron.nunjucks-vscode-extensionpack"
]
}
}
}
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/codespaces/fork-button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion app/views/how-tos/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ <h2 class="nhsuk-heading-s">Download and install</h2>
<a href="/install/advanced">Advanced install guide</a>
</li>
<li>
<a href="/install/nhs-england-windows-laptops">Set up the prototype kit on an NHS England Windows laptop</a>
<a href="/install/nhs-england-windows-laptops">Set up the kit on an NHS England Windows laptop</a>
</li>
<li>
<a href="/install/codespaces/index">Install and use the kit with your web browser</a>
frankieroberto marked this conversation as resolved.
Show resolved Hide resolved
</li>
</ul>
</li>
Expand Down
2 changes: 1 addition & 1 deletion app/views/install/check-it-works.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<div class="nhsuk-grid-column-two-thirds">

<h1>
<span class="nhsuk-caption-l">Step 8 of 8{{[":", operatingSystem ] | join(" ") if operatingSystem }}</span>
<span class="nhsuk-caption-l">Step 8 of 8{{[":", installEnvironment ] | join(" ") if installEnvironment }}</span>
Check it works
</h1>

Expand Down
41 changes: 41 additions & 0 deletions app/views/install/codespace.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{% set installEnvironment = "Codespaces" %}
{% set steps_total = "2" %}

{% extends 'layout.html' %}

{% block beforeContent %}
{{ breadcrumb({
items: [
{
href: "/",
text: "Home"
},
{
href: "/install/",
text: "Get started"
}
],
href: "/install/codespaces/",
text: "Install and use the kit with your web browser"
}) }}
{% endblock %}

{% block content %}
<div class="nhsuk-grid-row">
<div class="nhsuk-grid-column-two-thirds">

<h1>
<span class="nhsuk-caption-l">Step
{{ current_step }}
of
{{ steps_total }}{{[":", installEnvironment ] | join(" ") if installEnvironment }}</span>
{% block stepHeader %}{% endblock %}
</h1>

{% block page_content %}{% endblock %}

{% block pagination %}{% endblock %}

</div>
</div>
{% endblock %}
87 changes: 87 additions & 0 deletions app/views/install/codespaces/create-a-codespace.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{% set installEnvironment = "Codespaces" %}
{% set current_step = '1' %}

{% block pageTitle %}
Create a codespace - NHS prototype kit
{% endblock %}

{% extends 'install/codespace.html' %}

{% block beforeContent %}
{{ breadcrumb({
items: [
{
href: "/",
text: "Home"
},
{
href: "/install/codespaces/",
text: "Install the kit in your web browser"
}
]
}) }}
{% endblock %}

{% block stepHeader %}
Create a Codespace
{% endblock %}

{% block page_content %}

<p class="nhsuk-lede-text">To use the kit within a Codespace you will first need to create one.</p>

<h2>1. Go to the prototype repository</h2>

<p>Go to the GitHub repository for the prototype you wish to use. For this guide we will be starting a new prototype, using the
<a href="https://github.com/nhsuk/nhsuk-prototype-kit">NHS prototype kit repository</a>.
</p>

<p>If you using an existing prototype, go to step 2.</p>

<p>If you are starting a new prototype: copy the prototype kit files to your GitHub organisation. You can do this by 'forking' the repository.</p>
frankieroberto marked this conversation as resolved.
Show resolved Hide resolved

<p><img class="app-img-guide nhsuk-u-margin-bottom-0" alt="Location of the fork button on the repository page" src="/images/codespaces/fork-button.png"></p>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should avoid recommend using the 'fork' feature as that might cause some unexpected issues - eg if it defaults pull requests to being against the upstream repo instead of the forked one?

That said, the alternative right now would be to download the zip file and re-upload it which isn't ideal either.

Maybe it’s time to start looking at setting up a template repo sooner rather than later? 🤔

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm yes you're right, forking is not right, didn't realise how it maintains a connection to the main repo.

But following the normal way of downloading a zip to you computer then linking that up with a git repo then gets us back to doing stuff on your local machine…

Don't know about templates but sounds like it could be what we're looking for.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll change it to reference the download and re-upload process for now, even if that’s a bit of a pain. It should still be helpful for people who can install Visual Studio or GitHub Desktop, but can't get Node.js running.

Will spin out a separate issue to investigate template repos.

frankieroberto marked this conversation as resolved.
Show resolved Hide resolved

<p>Ask your development team or technical leadership where you should store your prototype and how to get access.</p>

<h2>2. Create a new Codespace</h2>

<p>On every Github repository page is a 'Code' button which is used to get a copy of or to use the code held within the git repository.</p>

<p>Locate the button, click it, a dialogue box will open, at the top of the dialogue click the 'Codespaces' tab.</p>
<p>Next click on the 'Create codespace on main' button. Which will open your new codespace in a new browser tab or window.</p>

<p><img class="app-img-guide nhsuk-u-margin-bottom-0" alt="Screenshot of the location of create a codespace on main button" src="/images/codespaces/create-a-codespace.png"></p>
<p>The 'Create codespace on main' button will either be shown as a large button or a small plus symbol after the label 'your workspaces in the cloud'.</p>

<h2>3. Wait for the Codespace setup to finish</h2>

<p>The Codespace will open in a new tab (or window) and begin the setup process.</p>

<p>You will see an interface building with a progress message showing that the space (known as a 'container') is being created or rebuilt.</p>

<p>This can take between 30 seconds and 5 minutes.</p>

<h2>4. Check that it has worked</h2>

<p>Once the Codespace has been created, you will then see the 'terminal' tab with commands being exectuted to start the prototype kit.</p>
<p>When the prototype has started it will open a preview window displaying the homepage of the prototype.</p>

<!-- <h2>5. Codespace setup complete</h2> -->
frankieroberto marked this conversation as resolved.
Show resolved Hide resolved

<p><img class="app-img-guide nhsuk-u-margin-bottom-0" alt="Screenshot of the running codespace" src="/images/codespaces/running-codespace.png"></p>

<p>You now have a copy of the NHS prototype kit installed and running within a new GitHub Codespace.</p>

<p>This means you can create and edit prototypes entirely in your browser.</p>

{% endblock %}

{% block pagination %}
{{ pagination({
"previousUrl": "/install/codespaces/index",
"previousPage": "Get started",
"nextUrl": "/install/codespaces/working-with-codespaces",
"nextPage": "Step 2: Working with Codespaces"
}) }}
{% endblock %}
65 changes: 65 additions & 0 deletions app/views/install/codespaces/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{% extends 'layout.html' %}

{% block pageTitle %}
Install and use the kit with your web browser - NHS prototype kit
{% endblock %}

{% block beforeContent %}
{{ breadcrumb({
items: [
{
href: "/",
text: "Home"
},
{
href: "/install/",
text: "Get started"
}
]
}) }}
{% endblock %}

{% block content %}
<div class="nhsuk-grid-row">
<div class="nhsuk-grid-column-two-thirds">

<h1 class="nhsuk-heading-xl">Install and use the kit with your web browser</h1>

<p class="nhsuk-body-l">If you cannot install the kit on your computer (for example, beause you are not allowed to install Node.js) you can use an online service to edit and run code using your web browser.</p>

<p>Services that you can use include:<p>

<ul>
<li>
<a href="https://github.com/features/codespaces">GitHub Codespaces</a> – free for around 60 hours per month
</li>
<li>
<a href="https://www.gitpod.io/">Gitpod</a> – free for around 50 hours per month
</li>
</ul>

<p>For this guide we are using GitHub Codespaces.</p>

<h2 class="nhsuk-heading-l">Before you begin</h2>

<p>You do not need any technical knowledge to use this guide.</p>

<p>You will need a
<a href="https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out">GitHub account</a>.
</p>

<p>We will show you how to:</p>
<ul class="nhsuk-list nhsuk-list--bullet">
<li>set up the Codespace
</li>
<li>work with the Codespace</li>
</ul>
<p>
Installation usually takes up to 5 minutes.
</p>

{{ actionLink({ text: "Start guide for using the kit in a web browser", href: "/install/codespaces/create-a-codespace", classes: "nhsuk-u-margin-top-x nhsuk-heading-l" }) }}

</div>
</div>
{% endblock %}
66 changes: 66 additions & 0 deletions app/views/install/codespaces/working-with-codespaces.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{% set installEnvironment = "Codespaces" %}
{% set current_step = 2 %}

{% block pageTitle %}
Editing the kit with Codespaces - NHS prototype kit
{% endblock %}

{% extends 'install/codespace.html' %}

{% block beforeContent %}
{{ breadcrumb({
items: [
{
href: "/",
text: "Home"
},
{
href: "/install/codespaces/",
text: "Install the kit in your web browser"
}
]
}) }}
{% endblock %}

{% block stepHeader %}
Editing the kit with Codespaces
{% endblock %}

{% block page_content %}

<p class="nhsuk-lede-text">If you are using the browser to edit the kit, you need to manage changes in Codespaces.</p>

<h2>Save changes</h2>

<p>Any changes you make are not shared with anybody else until you commit them to Git and push them to the repository.</p>

<p>You can use the Codespace code editor and user interface to manage changes with GitHub. You can use the
<a href="https://docs.github.com/en/codespaces/getting-started/quickstart">quickstart guide to working with Codespaces</a>
frankieroberto marked this conversation as resolved.
Show resolved Hide resolved
</p>

<h2>Manage prototypes</h2>

<p>When a Codespace is deleted, you will lose any uncommitted and unpushed changes.</p>
<p>GitHub Codespaces are automatically deleted after they have been stopped and have remained inactive for a defined number of days, by default this is 30 days.</p>



<h2>Publish prototypes online</h2>

<p>Codespaces are temporary and do not usually have passwords. Do not use them to <a href='/how-tos/publish-your-prototype-online'>publish your prototypes online</a>.</p>

<h2>Get going</h2>

<p>
<a href="/how-tos/build-basic-prototype/index">Build a basic prototype</a>
or
<a href="/how-tos/index">view other guides</a>.</p>

{% endblock %}

{% block pagination %}
{{ pagination({
"previousUrl": "/install/codespaces/create-a-codespace",
"previousPage": "Step 1: Create a Codespace"
}) }}
{% endblock %}
2 changes: 1 addition & 1 deletion app/views/install/download.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<div class="nhsuk-grid-column-two-thirds">

<h1>
<span class="nhsuk-caption-l">Step 4 of 8{{[":", operatingSystem ] | join(" ") if operatingSystem }}</span>
<span class="nhsuk-caption-l">Step 4 of 8{{[":", installEnvironment ] | join(" ") if installEnvironment }}</span>
Download and decide where to keep your prototypes
</h1>

Expand Down
Loading
Loading