From 699246f411379569dac1d80861eb22ea43e4eff1 Mon Sep 17 00:00:00 2001
From: Jonathan Weth <git@jonathanweth.de>
Date: Tue, 9 Jan 2024 19:59:04 +0100
Subject: [PATCH] Init Yarn with a package.json before installing

Necessary to make django-yarnpkg it compatible with Yarn 4.x
---
 CHANGELOG.rst          | 5 +++++
 django_yarnpkg/yarn.py | 1 +
 2 files changed, 6 insertions(+)

diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 6088610..6baeefe 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -1,3 +1,8 @@
+Version 6.1.1 (2024-02-09)
+=====================================================
+
+* Fix compatibility with Yarn 4.x
+
 Version 6.1.0 (2023-02-19)
 =====================================================
 
diff --git a/django_yarnpkg/yarn.py b/django_yarnpkg/yarn.py
index c252dc0..f87af02 100644
--- a/django_yarnpkg/yarn.py
+++ b/django_yarnpkg/yarn.py
@@ -35,6 +35,7 @@ class YarnAdapter(object):
 
     def install(self, packages, *options):
         """Install packages from yarn"""
+        self.call_yarn(["init", "--yes"])
         return self.call_yarn(['add'] + list(options) + list(packages))
 
     def _accumulate_dependencies(self, data):
-- 
GitLab