Skip to content

Commit

Permalink
fix(doc and launching): added a launch script and updated documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
pruneau628 committed Jan 24, 2025
1 parent 44316fe commit 1b5dc85
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 13 deletions.
22 changes: 9 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,29 @@ Now, if you really want to get a preview of the end product insted of a single p

### 1 - Running locally on you workstation

(Inspired from [https://tutorial.docusaurus.io/docs/intro])
(Inspired from [https://tutorial.docusaurus.io/docs/intro]), should run on linux, WSL, and MacOS X.

**Note**: running locally has the advantage of having your modification appear in near-real-time in the navigator
instance that automatically opened by `start-local.sh`, or any modern navigator pointed to your [local instance http://localhost:3000/DTT-Docs-staging/](http://localhost:3000/DTT-Docs-staging/).

You need access to a local command-line, with an recent installation of [Node.js](https://nodejs.org/en/download/), i.e. [something more recent that Node.js 18.0](https://docusaurus.io/docs/installation)

Then, go to the root directory of your DTT-Docs git clone, and run the following commands:
Then, go to the root directory of your DTT-Docs git clone, and run the following command:

```bash
### >>> First time only <<< ###
npm install
# Variables in .env.sample file could be customised
# but this is not necessary for local-only testing
# Note that the `build` step below will fail if the relevant
# environment variables are not set
source .env.sample
# Linux, WSL or MacOS command-line example
npm run build && npm run start
./start-local.sh
```

If everything goes well, your terminal should display:

```bash
(...)
[SUCCESS] Serving "build" directory at: http://localhost:3000/
[SUCCESS] Docusaurus website is running at: http://localhost:3000/DTT-Docs-staging/
(...)
```

And if everything goes even better, your favorite web browser should open the rendered version of you modifications.
And if everything goes even better, your favorite web browser should open the rendered version of you modifications, updated in near-real time as explained above.


### 2 - Testing this directly on the documentation staging web site

Expand Down
24 changes: 24 additions & 0 deletions start-local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#! /usr/bin/env bash
if ! which -s npm; then
echo "Please install Node.js, node version specified here https://docusaurus.io/docs/installation (at least 18.0)"
else
echo "Current node version is [$(node --version)]"
fi

set -e

echo "Sourcing .env.sample"
# Variables in .env.sample file could be customised
# but this is not necessary for local-only testing
# Note that the `build` step below will fail if the relevant
# environment variables are not set
source .env.sample

set -x

# This only really required at the very first run and each time there is
# a modification of either `package.json` or `package-lock.json`
# However running it systematically does not take much time and does no harm
npm install

npm run build && npm run start

0 comments on commit 1b5dc85

Please sign in to comment.