From 3313b6a0a5a8fafae0479b8513859e0201d62ff0 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Tue, 1 Nov 2022 17:57:31 +0000 Subject: [PATCH] Download hugo submodule and its deps when running npm i This commit adds a bit of helper code to the top-level package.json to always ensure that the `themes/docsy` submodule is checked out and that its nodejs dependencies are installed. Thus, we can remove the need to download git submodules directly. Instead they will be loaded when running `npm i`. We also don't need to load submodules recursively anymore, as docsy has removed any submodules from its repo since the last time we updated the theme. The `--depth 1` bit of `git submodule update --init --depth 1` tells git to only check out the latest commit of any submodules - saving bandwidth and space. --- .github/workflows/main.yml | 4 ---- README.md | 9 ++++----- package.json | 3 +++ 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8e83a3e7..0c8301f3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -115,8 +115,6 @@ jobs: extended: true - name: "📥 Source checkout" uses: actions/checkout@v2 - with: - submodules: 'recursive' - name: "⚙️ npm" run: | npm i @@ -161,8 +159,6 @@ jobs: extended: true - name: "📥 Source checkout" uses: actions/checkout@v2 - with: - submodules: 'recursive' - name: "⚙️ npm" run: | npm i diff --git a/README.md b/README.md index 29028e01..b5b1436e 100644 --- a/README.md +++ b/README.md @@ -65,15 +65,14 @@ place after an MSC has been accepted, not as part of a proposal itself. Alternatively, use the Docker image at https://hub.docker.com/r/klakegg/hugo/. (The "extended edition" is required to process the SCSS.) -2. Run `git submodule update --init --recursive` for good measure. -3. Run `npm i` to install the dependencies. Note that this will require NodeJS to be installed. -4. Run `npm run get-proposals` to seed proposal data. This is merely for populating the content of the "Spec Change Proposals" +2. Run `npm i` to install the dependencies. Note that this will require NodeJS to be installed. +3. Run `npm run get-proposals` to seed proposal data. This is merely for populating the content of the "Spec Change Proposals" page and is not required. -5. Run `hugo serve` (or `docker run --rm -it -v $(pwd):/src -p 1313:1313 +4. Run `hugo serve` (or `docker run --rm -it -v $(pwd):/src -p 1313:1313 klakegg/hugo:ext serve`) to run a local webserver which builds whenever a file change is detected. If watching doesn't appear to be working for you, try adding `--disableFastRender` to the commandline. -6. Edit the specification 🙂 +5. Edit the specification 🙂 We use a highly customized [Docsy](https://www.docsy.dev/) theme for our generated site, which uses Bootstrap and Font Awesome. If you're looking at making design-related changes to the spec site, please coordinate with us in diff --git a/package.json b/package.json index 4e277d28..f023a750 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,9 @@ "main": "none.js", "scripts": { "get-proposals": "node ./scripts/proposals.js", + "get:submodule": "git submodule update --init --depth 1", + "_prepare:docsy": "cd themes/docsy && npm install", + "prepare": "npm run get:submodule && npm run _prepare:docsy", "test": "echo \"Error: no test specified\" && exit 1" }, "repository": {