From 8dd7d7181f750fbc5a6d3f65468b85053c4625a7 Mon Sep 17 00:00:00 2001 From: Onni Hakala Date: Wed, 30 Oct 2024 20:52:55 +0200 Subject: [PATCH 1/2] Document how to get the project up and running with correct dependencies using mise --- .mise.toml | 18 ++++++++++++++++++ contributing.md | 25 +++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 .mise.toml diff --git a/.mise.toml b/.mise.toml new file mode 100644 index 000000000..72dce6e31 --- /dev/null +++ b/.mise.toml @@ -0,0 +1,18 @@ +[tools] +# node-gyp has issues with newer python versions: +# 'ValueError: invalid mode: 'rU' while trying to load binding.gyp' +# These should be fixed by downgrading python to 3.10 +# Source: https://stackoverflow.com/a/74732671 +python = ['3.10'] + +# The node-gyp module doesn't work properly when using node 20 +# TypeError: Cannot assign to read only property 'cflags' of object '#' +# This is the reason we need to stay with node 18 +# See more: https://stackoverflow.com/a/77910474/1337062 +node = ['18'] + +# Installing with npm doesn't seem to work out, use yarn everywhere +"npm:yarn" = "latest" + +# To be able to build the packages in the monorepo workspace +"npm:lerna" = "^4.0.0" diff --git a/contributing.md b/contributing.md index 6154c567f..d68b73a5b 100644 --- a/contributing.md +++ b/contributing.md @@ -3,10 +3,31 @@ Suggestions and pull requests are highly encouraged. Have a look at the [open issues](https://github.com/NotionX/react-notion-x/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22+sort%3Areactions-%2B1-desc), especially [the easy ones](https://github.com/NotionX/react-notion-x/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22+sort%3Areactions-%2B1-desc). ## Development +### Installing and using mise +This project has a few aging dependencies like `node-gyp` and `lerna`. -To develop the project locally, you'll need a recent version of Node.js and `yarn` v1 installed globally. +Getting the project up and running was a bit hard so we defined the environment using [mise](https://github.com/jdx/mise). Mise is a tool like `nvm` or `asdf` and allows locking up both `python` and `nodejs` versions and ensures you have `yarn` installed as well. -To get started, clone the repo and run `yarn` from the root directory: +We would love to see contributions which would help updating the aging dependencies ❤️. + +If you are using MacOS you can install mise with `homebrew`: +```sh +brew install mise +``` +Otherwise please check [mise installation docs](https://mise.jdx.dev/getting-started.html). + +Then activate mise. This depends on your shell. You can either run one of the following or copy them to your shell configs: +```sh +# Bash +eval "$(mise activate bash)" +# ZSH +eval "$(mise activate zsh)" +# Fish +mise activate fish | source +``` + +### Cloning the repo and installing packages +After installing `mise` you can proceed to clone the repo and run `yarn` from the root directory: ```bash git clone https://github.com/NotionX/react-notion-x.git From 5c3596a62d5e634c2550fc947919be4fc339e524 Mon Sep 17 00:00:00 2001 From: Onni Hakala Date: Wed, 30 Oct 2024 22:27:44 +0200 Subject: [PATCH 2/2] Downgrade node version to 16.X and start using .tool-versions so that we can use same version in GH runner --- .github/workflows/test.yml | 24 ++++++++++++------------ .mise.toml | 7 ++++--- .tool-versions | 7 +++++++ 3 files changed, 23 insertions(+), 15 deletions(-) create mode 100644 .tool-versions diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 288c6bc09..758be059d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,11 +6,11 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: - node-version: 16 + node-version-file: .tool-versions cache: yarn - run: yarn install --frozen-lockfile @@ -19,11 +19,11 @@ jobs: build-minimal: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: - node-version: 16 + node-version-file: .tool-versions cache: yarn - run: yarn install --frozen-lockfile @@ -37,11 +37,11 @@ jobs: build-full: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: - node-version: 16 + node-version-file: .tool-versions cache: yarn - run: yarn install --frozen-lockfile @@ -57,11 +57,11 @@ jobs: # build-full-official-api: # runs-on: ubuntu-latest # steps: - # - uses: actions/checkout@v3 + # - uses: actions/checkout@v4 - # - uses: actions/setup-node@v3 + # - uses: actions/setup-node@v4 # with: - # node-version: 16 + # node-version-file: .tool-versions # cache: yarn # - run: yarn install --frozen-lockfile diff --git a/.mise.toml b/.mise.toml index 72dce6e31..4add900ba 100644 --- a/.mise.toml +++ b/.mise.toml @@ -5,11 +5,12 @@ # Source: https://stackoverflow.com/a/74732671 python = ['3.10'] -# The node-gyp module doesn't work properly when using node 20 +# Node 20.X breaks the node-gyp module: # TypeError: Cannot assign to read only property 'cflags' of object '#' -# This is the reason we need to stay with node 18 # See more: https://stackoverflow.com/a/77910474/1337062 -node = ['18'] +# Node 18.X breaks ava test runner doesn't seem to work in package/notion-utils tests +# node = ['16'] +# We read this value from .tool-versions file instead # Installing with npm doesn't seem to work out, use yarn everywhere "npm:yarn" = "latest" diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 000000000..0e9155d36 --- /dev/null +++ b/.tool-versions @@ -0,0 +1,7 @@ +# FIXME: Remove this file when actions/setup-node supports .mise.toml +# See more: https://github.com/actions/setup-node/issues/787 +nodejs 16.20.2 + +# node-gyp has issues with newer python versions. +# This is the latest version of 3.10.x as of October 2024 +python 3.10.13