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

Follow updates on original repository about using nvm #52

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
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@v3
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 Down Expand Up @@ -52,20 +52,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
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v10.22.1
29 changes: 29 additions & 0 deletions README-original.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,38 @@ 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
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,39 @@ Encuentra archivos **PDF** y **EPUB** pregenerados como [artefactos construidos

> ⚠️ La preparación del proyecto es un poco antigua, puedes encontrarte con distintos problemas cuando lo construyas localmente. Recomendamos el uso de node v10.22.1 y la última versión de Calibre si es posible.

### Sobre la versión de nodejs

Dado que la versión de node recomendada (v10.22.1) es algo antigua, es más que probable que no la tengas instalada en tu sistema. Puedes tener instaladas múltiples versiones de nodejs utilizando [nvm](https://github.com/nvm-sh/nvm). Dirígete a este proyecto para instalarlo y entonces podrás:

- Instalar cualquier versión de node que necesites:
```
nvm install 10.22.1
nvm install 20.2.0
```
- Y entonces podrás cambiar entre versiones de node:
```
nvm use 10.22.1
node -v // will show v10.22.1
nvm use 20.2.0
node -v // will show v20.2.0
```

Como este proyecto tiene un archivo .nvmrc puedes ejecutar `nvm install` y `nvm use` sin especificar la versión de node:
```
// estando en cualquier lugar dentro del proyecto
nvm install
node -v // will show v10.22.1
```


### Secuencia de comandos completa

Teniendo en cuenta lo anterior acerca de tener nvm instalado en tu sistema, aquí está la secuencia completa de comandos para generar tú mismo los archivos pdf y epub:

```
git clone https://github.com/MostlyAdequate/mostly-adequate-guide-es.git
cd mostly-adequate-guide-es/
nvm install
npm install
npm run setup
npm run generate-pdf
Expand Down
1 change: 1 addition & 0 deletions ch04-es.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ En caso de preferir hacer los ejercicios directamente en archivos usando tu prop

- clona el repositorio (`git clone [email protected]:MostlyAdequate/mostly-adequate-guide-es.git`)
- ve a la sección *exercises* (`cd mostly-adequate-guide-es/exercises`)
- asegúrate de estar utilizando la versión recomendada de node, la v10.22.1 (por ejemplo con `nvm install`). Más información al respecto en [el readme del libro](./README.md#sobre-la-version-de-nodejs)
- instala lo necesario usando [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) (`npm install`)
- completa las respuestas modificando los archivos llamados *exercise_** dentro del directorio del correspondiente capítulo
- ejecuta la corrección con npm (p. ej. `npm run ch04`)
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-original.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-original.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-original.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
2 changes: 2 additions & 0 deletions exercises/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ tu propuesta puede ser verificada ejecutando:
npm run ch04
```

Recuerda instalar primero las dependencias estando en la versión de node recomendada por el proyecto. Más sobre esto en [el README principal del proyecto](../README.md#sobre-la-version-de-nodejs).

Alternativamente, también puedes echar un vistazo al archivo con la solución que corresponda: en este caso
`solution_a.js`.

Expand Down