From cee86b68b146d831f4b76bd1e0f31c5a843704e5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 8 Jan 2025 05:52:28 +0000 Subject: [PATCH 1/4] Bump node in /{{cookiecutter.project_slug}}/compose/local/node Bumps node from 22.12-bookworm-slim to 22.13-bookworm-slim. --- updated-dependencies: - dependency-name: node dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- {{cookiecutter.project_slug}}/compose/local/node/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/compose/local/node/Dockerfile b/{{cookiecutter.project_slug}}/compose/local/node/Dockerfile index 87e22c4f60..64ef9758b9 100644 --- a/{{cookiecutter.project_slug}}/compose/local/node/Dockerfile +++ b/{{cookiecutter.project_slug}}/compose/local/node/Dockerfile @@ -1,4 +1,4 @@ -FROM docker.io/node:22.12-bookworm-slim +FROM docker.io/node:22.13-bookworm-slim WORKDIR /app From bb7bffec6312da4d333b2ea3f23b8be75d4ecf29 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Thu, 9 Jan 2025 21:13:55 +0000 Subject: [PATCH 2/4] Add script to automatically keep node version up-to-date --- scripts/node_version.py | 55 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 scripts/node_version.py diff --git a/scripts/node_version.py b/scripts/node_version.py new file mode 100644 index 0000000000..6264f8ee69 --- /dev/null +++ b/scripts/node_version.py @@ -0,0 +1,55 @@ +import json +from pathlib import Path + +ROOT = Path(__file__).parent.parent +TEMPLATED_ROOT = ROOT / "{{cookiecutter.project_slug}}" +DOCKERFILE = TEMPLATED_ROOT / "compose" / "local" / "node" / "Dockerfile" +PACKAGE_JSON = TEMPLATED_ROOT / "package.json" +CI_YML = ROOT / ".github" / "workflows" / "ci.yml" + + +def main(): + new_version = get_version_from_dockerfile() + old_version = get_version_from_package_json() + if old_version != new_version: + update_package_json_version(old_version, new_version) + update_ci_node_version(old_version, new_version) + + +def get_version_from_dockerfile(): + # Extract version out of base image name: + # FROM docker.io/node:22.13-bookworm-slim + # -> 22.13 + with DOCKERFILE.open("r") as f: + for line in f: + if "FROM docker.io/node:" in line: + _, _, docker_tag = line.partition(":") + version_str, _, _ = docker_tag.partition("-") + return version_str + + +def get_version_from_package_json(): + package_json = json.loads(PACKAGE_JSON.read_text()) + return package_json["engines"]["node"] + + +def update_package_json_version(old_version, new_version): + package_json_text = PACKAGE_JSON.read_text() + package_json_text = package_json_text.replace( + f'"node": "{old_version}"', + f'"node": "{new_version}"', + ) + PACKAGE_JSON.write_text(package_json_text) + + +def update_ci_node_version(old_version, new_version): + yml_content = CI_YML.read_text() + yml_content = yml_content.replace( + f'node-version: "{old_version}"', + f'node-version: "{new_version}"', + ) + CI_YML.write_text(yml_content) + + +if __name__ == "__main__": + main() From d39bb8ae161323e73cdad7720c8430669bc5326e Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Thu, 9 Jan 2025 21:22:21 +0000 Subject: [PATCH 3/4] Add pre-commit hook to keep node version up to date --- .pre-commit-config.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9cb8e4b36e..87c828ba19 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -53,6 +53,14 @@ repos: hooks: - id: pyproject-fmt + - repo: local + hooks: + - id: node-version-checker + name: node-version-checker + entry: python scripts/node_version.py + language: python + files: . + ci: autoupdate_schedule: weekly skip: [] From 2d54690d349d8344aafc78ad531463b9e534138a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 9 Jan 2025 21:24:10 +0000 Subject: [PATCH 4/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .github/workflows/ci.yml | 2 +- {{cookiecutter.project_slug}}/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c09c49ffde..dd22fb512f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,6 +103,6 @@ jobs: run: uv sync - uses: actions/setup-node@v4 with: - node-version: "22.12" + node-version: "22.13" - name: Bare Metal ${{ matrix.script.name }} run: sh tests/test_bare.sh ${{ matrix.script.args }} diff --git a/{{cookiecutter.project_slug}}/package.json b/{{cookiecutter.project_slug}}/package.json index 832428fec0..11c41cc71d 100644 --- a/{{cookiecutter.project_slug}}/package.json +++ b/{{cookiecutter.project_slug}}/package.json @@ -35,7 +35,7 @@ "webpack-merge": "^6.0.1" }, "engines": { - "node": "22.12" + "node": "22.13" }, "browserslist": [ "last 2 versions"