Skip to content

Commit

Permalink
Merge pull request #650 from ferllop/master
Browse files Browse the repository at this point in the history
Rename .nvm to .nvmrc, add explanations about its use in readme and reference to it in ch04 and exercises/readme
  • Loading branch information
KtorZ authored Sep 17, 2024
2 parents a798f30 + b1c5112 commit 239468e
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 5 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout source code
uses: actions/checkout@v2.3.1
uses: actions/checkout@v4

- name: Install Calibre
run: |
Expand All @@ -24,7 +24,7 @@ jobs:
ln -s /opt/calibre/ebook-convert ~/.local/bin/ebook-convert
- name: Setup Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: 10.22.1

Expand All @@ -47,20 +47,20 @@ jobs:
npm run generate-epub
mv book.epub ${BOOK_FILENAME}.epub
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: PDF
path: ${{ env.BOOK_FILENAME }}.pdf

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: EPUB
path: ${{ env.BOOK_FILENAME }}.epub

- run: echo "ID=$(git describe --tags --always)" >> $GITHUB_OUTPUT
id: release-id

- uses: softprops/action-gh-release@v1
- uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.release-id.outputs.ID }}
files: |
Expand Down
File renamed without changes.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,39 @@ Find pre-generated **PDF** and **EPUB** as [build artifacts of the latest releas

> ⚠️ This project setup is now a bit old and thus, you may run into various issues when building this locally. We recommend to use node v10.22.1 and the latest version of Calibre if possible.
### About the nodejs version

As the recommended node version (v10.22.1) is a bit old now, is more than likely that you do not have it installed on your system. You can have multiple versions of nodejs installed on your system using [nvm](https://github.com/nvm-sh/nvm). Refer to that project to install it and then you will be able to:

- Install any node version that you need:
```
nvm install 10.22.1
nvm install 20.2.0
```
- Then you will be able to switch between node versions:
```
nvm use 10.22.1
node -v // will show v10.22.1
nvm use 20.2.0
node -v // will show v20.2.0
```

As this project has a .nvmrc file you can call `nvm install` and `nvm use` without specifying the node version:
```
// being anywhere inside this project
nvm install
node -v // will show v10.22.1
```


### Complete sequence of commands

Considering the above about having nvm installed on your system, here is the complete sequence of commands to generate pdf and epub files by yourself:

```
git clone https://github.com/MostlyAdequate/mostly-adequate-guide.git
cd mostly-adequate-guide/
nvm install
npm install
npm run setup
npm run generate-pdf
Expand Down
1 change: 1 addition & 0 deletions ch04.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ Should you prefer to do exercises directly in files using your own editor:

- clone the repository (`git clone [email protected]:MostlyAdequate/mostly-adequate-guide.git`)
- go in the *exercises* section (`cd mostly-adequate-guide/exercises`)
- be sure to be using the recommended node version v10.22.1 (e.g. `nvm install`). More on this in [the readme of the book](./README.md#about-the-nodejs-version)
- install the necessary plumbing using [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) (`npm install`)
- complete answers by modifying the files named *exercise\_\** in the corresponding chapter's folder
- run the correction with npm (e.g. `npm run ch04`)
Expand Down
2 changes: 2 additions & 0 deletions exercises/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ your proposal can be verified by running:
npm run ch04
```

Remember to first install node dependencies being at the recommended node version of the project. More on this on [the main README of the project](../README.md#about-the-nodejs-version).

Alternatively, you can also have a peak at the corresponding solution file: in this case
`solution_a.js`.

Expand Down

0 comments on commit 239468e

Please sign in to comment.