diff --git a/contributing.md b/contributing.md index 92e05809..0d6efdff 100644 --- a/contributing.md +++ b/contributing.md @@ -1,12 +1,12 @@ -**English** | [Українська](/contributing_ua.md) | [Русский](/contributing_ru.md) | [Türkçe](/contributing_tr.md) | [Deutsch](/contributing_de.md) +**English** | [Українська](docs/contributing/contributing_ua.md) | [Русский](docs/contributing/contributing_ru.md) | [Türkçe](docs/contributing/contributing_tr.md) | [Deutsch](docs/contributing/contributing_de.md) | [Français](docs/contributing/contributing_fr.md) -## Lets make bruno better, together !! +## Let's make bruno better, together !! -I am happy that you are looking to improve bruno. Below are the guidelines to get started bringing up bruno on your computer. +We are happy that you are looking to improve bruno. Below are the guidelines to get started bringing up bruno on your computer. ### Technology Stack -Bruno is built using NextJs and React. We also use electron to ship a desktop version (that supports local collections) +Bruno is built using Next.js and React. We also use electron to ship a desktop version (that supports local collections) Libraries we use @@ -23,9 +23,59 @@ Libraries we use You would need [Node v18.x or the latest LTS version](https://nodejs.org/en/) and npm 8.x. We use npm workspaces in the project -### Lets start coding +## Development -Please reference [development.md](docs/development.md) for instructions on running the local development environment. +Bruno is being developed as a desktop app. You need to load the app by running the Next.js app in one terminal and then run the electron app in another terminal. + +### Dependencies + +- NodeJS v18 + +### Local Development + +```bash +# use nodejs 18 version +nvm use + +# install deps +npm i --legacy-peer-deps + +# build graphql docs +npm run build:graphql-docs + +# build bruno query +npm run build:bruno-query + +# run next app (terminal 1) +npm run dev:web + +# run electron app (terminal 2) +npm run dev:electron +``` + +### Troubleshooting + +You might encounter a `Unsupported platform` error when you run `npm install`. To fix this, you will need to delete `node_modules` and `package-lock.json` and run `npm install`. This should install all the necessary packages needed to run the app. + +```shell +# Delete node_modules in sub-directories +find ./ -type d -name "node_modules" -print0 | while read -d $'\0' dir; do + rm -rf "$dir" +done + +# Delete package-lock in sub-directories +find . -type f -name "package-lock.json" -delete +``` + +### Testing + +```bash +# bruno-schema +npm test --workspace=packages/bruno-schema + +# bruno-lang +npm test --workspace=packages/bruno-lang +``` ### Raising Pull Request diff --git a/contributing_de.md b/contributing_de.md deleted file mode 100644 index e189b6e9..00000000 --- a/contributing_de.md +++ /dev/null @@ -1,37 +0,0 @@ -[English](/contributing.md) | [Українська](/contributing_ua.md) | [Русский](/contributing_ru.md) | [Türkçe](/contributing_tr.md) | **Deutsch** - -## Lass uns Bruno noch besser machen, gemeinsam !! - -Ich freue mich, dass Du Bruno verbessern möchtest. Hier findest Du eine Anleitung, mit der Du Bruno auf Deinem Computer einrichten kannst. - -### Technologie Stack - -Bruno ist mit NextJs und React erstellt. Außerdem benötigen wir electron für die Desktop Version (die lokale Sammlungen unterstützt). - -Bibliotheken die wir benutzen - -- CSS - Tailwind -- Code Editoren - Codemirror -- State Management - Redux -- Icons - Tabler Icons -- Formulare - formik -- Schema Validierung - Yup -- Request Client - axios -- Dateisystem Watcher - chokidar - -### Abhängigkeiten - -Du benötigst [Node v18.x oder die neuste LTS Version](https://nodejs.org/en/) und npm 8.x. Wir benutzen npm workspaces in dem Projekt. - -### Lass uns coden - -Eine Anleitung zum Ausführen einer lokalen Entwicklungsumgebung findest Du in [development.md](docs/development_de.md). - -### Pull Request erstellen - -- Bitte halte die PRs klein und begrenzt auf eine Sache -- Bitte halte Dich beim Erstellen eines Branches an das folgende Format - - feature/[feature name]: Dieser Branch soll Änderungen für ein bestimmtes Feature enthalten - - Beispiel: feature/dark-mode - - bugfix/[bug name]: Dieser Branch soll ausschließlich Bugfixes für einen bestimmten Bug enthalten - - Beispiel: bugfix/bug-1 diff --git a/contributing_ru.md b/contributing_ru.md deleted file mode 100644 index fa8e787c..00000000 --- a/contributing_ru.md +++ /dev/null @@ -1,37 +0,0 @@ -[English](/contributing.md) | [Українська](/contributing_ua.md) | **Русский** | [Türkçe](/contributing_tr.md) | [Deutsch](/contributing_de.md) - -## Давайте вместе сделаем Бруно лучше!!! - -Я рад, что Вы хотите усовершенствовать bruno. Ниже приведены рекомендации по запуску bruno на вашем компьютере. - -### Стек - -Bruno построен с использованием NextJs и React. Мы также используем electron для поставки десктопной версии ( которая поддерживает локальные коллекции ) - -Библиотеки, которые мы используем - -- CSS - Tailwind -- Редакторы кода - Codemirror -- Управление состоянием - Redux -- Иконки - Tabler Icons -- Формы - formik -- Валидация схем - Yup -- Запросы клиента - axios -- Наблюдатель за файловой системой - chokidar - -### Зависимости - -Вам потребуется [Node v18.x или последняя версия LTS](https://nodejs.org/en/) и npm 8.x. В проекте мы используем рабочие пространства npm - -### Приступим к коду - -Пожалуйста, обратитесь к [development_ru.md](docs/development_ru.md) для получения инструкций по запуску локальной среды разработки. - -### Создание Pull Request - -- Пожалуйста, пусть PR будет небольшим и сфокусированным на одной вещи -- Пожалуйста, соблюдайте формат создания веток - - feature/[название функции]: Эта ветка должна содержать изменения для конкретной функции - - Пример: feature/dark-mode - - bugfix/[название ошибки]: Эта ветка должна содержать только исправления для конкретной ошибки - - Пример bugfix/bug-1 diff --git a/contributing_ua.md b/contributing_ua.md deleted file mode 100644 index c3ed9f5f..00000000 --- a/contributing_ua.md +++ /dev/null @@ -1,37 +0,0 @@ -[English](/contributing.md) | **Українська** | [Русский](/contributing_ru.md) | [Türkçe](/contributing_tr.md) | [Deutsch](/contributing_de.md) - -## Давайте зробимо Bruno краще, разом !! - -Я дуже радий що Ви бажаєте покращити Bruno. Нижче наведені вказівки як розпочати розробку Bruno на Вашому комп'ютері. - -### Стек технологій - -Bruno побудований на NextJs та React. Також для десктопної версії (яка підтримує локальні колекції) використовується Electron - -Бібліотеки, які ми використовуємо - -- CSS - Tailwind -- Редактори коду - Codemirror -- Керування станом - Redux -- Іконки - Tabler Icons -- Форми - formik -- Валідація по схемі - Yup -- Клієнт запитів - axios -- Спостерігач за файловою системою - chokidar - -### Залежності - -Вам знадобиться [Node v18.x або остання LTS версія](https://nodejs.org/en/) та npm 8.x. Ми використовуєм npm workspaces в цьому проекті - -### Починаєм писати код - -Будь ласка, зверніться до [development_ua.md](docs/development_ua.md) за інструкціями щодо запуску локального середовища розробки. - -### Створення Pull Request-ів - -- Будь ласка, робіть PR-и маленькими і сфокусованими на одній речі -- Будь ласка, слідуйте формату назв гілок - - feature/[назва feature]: Така гілка має містити зміни лише щодо конкретної feature - - Приклад: feature/dark-mode - - bugfix/[назва баґу]: Така гілка має містити лише виправлення конкретного багу - - Приклад: bugfix/bug-1 diff --git a/docs/contributing/contributing_de.md b/docs/contributing/contributing_de.md new file mode 100644 index 00000000..b0b1b694 --- /dev/null +++ b/docs/contributing/contributing_de.md @@ -0,0 +1,89 @@ +## Lass uns Bruno noch besser machen, gemeinsam !! + +Ich freue mich, dass Du Bruno verbessern möchtest. Hier findest Du eine Anleitung, mit der Du Bruno auf Deinem Computer einrichten kannst. + +### Technologie Stack + +Bruno ist mit Next.js und React erstellt. Außerdem benötigen wir electron für die Desktop Version (die lokale Sammlungen unterstützt). + +Bibliotheken die wir benutzen + +- CSS - Tailwind +- Code Editoren - Codemirror +- State Management - Redux +- Icons - Tabler Icons +- Formulare - formik +- Schema Validierung - Yup +- Request Client - axios +- Dateisystem Watcher - chokidar + +### Abhängigkeiten + +Du benötigst [Node v18.x oder die neuste LTS Version](https://nodejs.org/en/) und npm 8.x. Wir benutzen npm workspaces in dem Projekt. + +### Lass uns coden + +Eine Anleitung zum Ausführen einer lokalen Entwicklungsumgebung findest Du in [development.md](docs/development_de.md). + +### Pull Request erstellen + +- Bitte halte die PRs klein und begrenzt auf eine Sache +- Bitte halte Dich beim Erstellen eines Branches an das folgende Format + - feature/[feature name]: Dieser Branch soll Änderungen für ein bestimmtes Feature enthalten + - Beispiel: feature/dark-mode + - bugfix/[bug name]: Dieser Branch soll ausschließlich Bugfixes für einen bestimmten Bug enthalten + - Beispiel: bugfix/bug-1 + +## Entwicklung + +Bruno wird als Desktop-Anwendung entwickelt. Um die App zu starten, musst Du zuerst die Next.js App in einem Terminal ausführen und anschließend in einem anderen Terminal die Electron-App. + +### Abhängigkeiten + +- NodeJS v18 + +### Lokales Entwickeln + +```bash +# use nodejs 18 version +nvm use + +# install deps +npm i --legacy-peer-deps + +# build graphql docs +npm run build:graphql-docs + +# build bruno query +npm run build:bruno-query + +# run next app (terminal 1) +npm run dev:web + +# run electron app (terminal 2) +npm run dev:electron +``` + +### Troubleshooting + +Es kann sein, dass Du einen `Unsupported platform`-Fehler bekommst, wenn Du `npm install` ausführst. Um dies zu beheben, musst Du `node_modules` und `package-lock.json` löschen und `npm install` erneut ausführen. Dies sollte alle notwendigen Pakete installieren, die zum Ausführen der Anwendung benötigt werden. + +```shell +# Delete node_modules in sub-directories +find ./ -type d -name "node_modules" -print0 | while read -d $'\0' dir; do + rm -rf "$dir" +done + +# Delete package-lock in sub-directories +find . -type f -name "package-lock.json" -delete +``` + +### Testen + +```bash +# bruno-schema +npm test --workspace=packages/bruno-schema + +# bruno-lang +npm test --workspace=packages/bruno-lang +``` diff --git a/docs/contributing/contributing_fr.md b/docs/contributing/contributing_fr.md new file mode 100644 index 00000000..b69260e4 --- /dev/null +++ b/docs/contributing/contributing_fr.md @@ -0,0 +1,89 @@ +## Ensemble, améliorons Bruno ! + +Je suis content de voir que vous envisagez améliorer Bruno. Ci-dessous, vous trouverez les règles et guides pour récupérer Bruno sur votre ordinateur. + +### Technologies utilisées + +Bruno est construit en utilisant NextJs et React. Nous utilisons aussi Electron pour embarquer la version ordinateur (qui permet les collections locales). + +Les bibliothèques que nous utilisons : + +- CSS - Tailwind +- Code Editors - Codemirror +- State Management - Redux +- Icons - Tabler Icons +- Forms - formik +- Schema Validation - Yup +- Request Client - axios +- Filesystem Watcher - chokidar + +### Dépendances + +Vous aurez besoin de [Node v18.x ou la dernière version LTS](https://nodejs.org/en/) et npm 8.x. Nous utilisons aussi les espaces de travail npm (_npm workspaces_) dans ce projet. + +### Commençons à coder + +Veuillez vous référez à la [documentation de développement](docs/development_fr.md) pour les instructions de démarrage de l'environnement de développement local. + +### Ouvrir une Pull Request + +- Merci de conserver les PR petites et focalisées sur un seul objectif +- Merci de suivre le format de nom des branches + - feature/[feature name]: Cette branche devrait contenir une fonctionnalité spécifique + - Exemple: feature/dark-mode + - bugfix/[bug name]: Cette branche devrait contenir seulement une solution pour pour une bogue spécifique + - Exemple: bugfix/bug-1 + +## Développement + +Bruno est développé comme une application de _lourde_. Vous devez charger l'application en démarrant nextjs dans un terminal, puis démarre l'application Electron dans un autre terminal. + +### Dépendances + +- NodeJS v18 + +### Développement local + +```bash +# use nodejs 18 version +nvm use + +# install deps +npm i --legacy-peer-deps + +# build graphql docs +npm run build:graphql-docs + +# build bruno query +npm run build:bruno-query + +# run next app (terminal 1) +npm run dev:web + +# run electron app (terminal 2) +npm run dev:electron +``` + +### Dépannage + +Vous pourriez rencontrer une error `Unsupported platform` pendant le lancement de `npm install`. Pour résoudre cela, veuillez supprimer le répertoire `node_modules`, le fichier `package-lock.json` et lancer à nouveau `npm install`. Cela devrait isntaller tous les paquets nécessaires pour lancer l'application. + +```shell +# Delete node_modules in sub-directories +find ./ -type d -name "node_modules" -print0 | while read -d $'\0' dir; do + rm -rf "$dir" +done + +# Delete package-lock in sub-directories +find . -type f -name "package-lock.json" -delete +``` + +### Tests + +```bash +# bruno-schema +npm test --workspace=packages/bruno-schema + +# bruno-lang +npm test --workspace=packages/bruno-lang +``` diff --git a/docs/contributing/contributing_ru.md b/docs/contributing/contributing_ru.md new file mode 100644 index 00000000..6202c8f3 --- /dev/null +++ b/docs/contributing/contributing_ru.md @@ -0,0 +1,89 @@ +## Давайте вместе сделаем Бруно лучше!!! + +Я рад, что Вы хотите усовершенствовать bruno. Ниже приведены рекомендации по запуску bruno на вашем компьютере. + +### Стек + +Bruno построен с использованием Next.js и React. Мы также используем electron для поставки десктопной версии ( которая поддерживает локальные коллекции ) + +Библиотеки, которые мы используем + +- CSS - Tailwind +- Редакторы кода - Codemirror +- Управление состоянием - Redux +- Иконки - Tabler Icons +- Формы - formik +- Валидация схем - Yup +- Запросы клиента - axios +- Наблюдатель за файловой системой - chokidar + +### Зависимости + +Вам потребуется [Node v18.x или последняя версия LTS](https://nodejs.org/en/) и npm 8.x. В проекте мы используем рабочие пространства npm + +### Приступим к коду + +Пожалуйста, обратитесь к [development_ru.md](docs/development_ru.md) для получения инструкций по запуску локальной среды разработки. + +### Создание Pull Request + +- Пожалуйста, пусть PR будет небольшим и сфокусированным на одной вещи +- Пожалуйста, соблюдайте формат создания веток + - feature/[название функции]: Эта ветка должна содержать изменения для конкретной функции + - Пример: feature/dark-mode + - bugfix/[название ошибки]: Эта ветка должна содержать только исправления для конкретной ошибки + - Пример bugfix/bug-1 + +## Разработка + +Bruno разрабатывается как десктопное приложение. Необходимо загрузить приложение, запустив приложение Next.js в одном терминале, а затем запустить приложение electron в другом терминале. + +### Зависимости + +- NodeJS v18 + +### Локальная разработка + +```bash +# используйте nodejs 18 версии +nvm use + +# установите зависимости +npm i --legacy-peer-deps + +# билд документации по graphql +npm run build:graphql-docs + +# билд bruno query +npm run build:bruno-query + +# запустить next приложение ( терминал 1 ) +npm run dev:web + +# запустить приложение electron ( терминал 2 ) +npm run dev:electron +``` + +### Устранение неисправностей + +При запуске `npm install` может возникнуть ошибка `Unsupported platform`. Чтобы исправить это, необходимо удалить `node_modules` и `package-lock.json` и запустить `npm install`. В результате будут установлены все пакеты, необходимые для работы приложения. + +```shell +# Удаление node_modules в подкаталогах +find ./ -type d -name "node_modules" -print0 | while read -d $'\0' dir; do + rm -rf "$dir" +done + +# Удаление package-lock в подкаталогах +find . -type f -name "package-lock.json" -delete +``` + +### Тестирование + +```bash +# bruno-schema +npm test --workspace=packages/bruno-schema + +# bruno-lang +npm test --workspace=packages/bruno-lang +``` diff --git a/contributing_tr.md b/docs/contributing/contributing_tr.md similarity index 79% rename from contributing_tr.md rename to docs/contributing/contributing_tr.md index c73c21f0..25ff880c 100644 --- a/contributing_tr.md +++ b/docs/contributing/contributing_tr.md @@ -1,12 +1,10 @@ -[English](/readme.md) | [Українська](/contributing_ua.md) | [Русский](/contributing_ru.md) | **Türkçe** | [Deutsch](/contributing_de.md) - ## Bruno'yu birlikte daha iyi hale getirelim !! Bruno'yu geliştirmek istemenizden mutluluk duyuyorum. Aşağıda, bruno'yu bilgisayarınıza getirmeye başlamak için yönergeler bulunmaktadır. ### Kullanılan Teknolojiler -Bruno, NextJs ve React kullanılarak oluşturulmuştur. Ayrıca bir masaüstü sürümü (yerel koleksiyonları destekleyen) göndermek için electron kullanıyoruz +Bruno, Next.js ve React kullanılarak oluşturulmuştur. Ayrıca bir masaüstü sürümü (yerel koleksiyonları destekleyen) göndermek için electron kullanıyoruz Kullandığımız kütüphaneler diff --git a/docs/contributing/contributing_ua.md b/docs/contributing/contributing_ua.md new file mode 100644 index 00000000..329077cd --- /dev/null +++ b/docs/contributing/contributing_ua.md @@ -0,0 +1,89 @@ +## Давайте зробимо Bruno краще, разом !! + +Я дуже радий що Ви бажаєте покращити Bruno. Нижче наведені вказівки як розпочати розробку Bruno на Вашому комп'ютері. + +### Стек технологій + +Bruno побудований на Next.js та React. Також для десктопної версії (яка підтримує локальні колекції) використовується Electron + +Бібліотеки, які ми використовуємо + +- CSS - Tailwind +- Редактори коду - Codemirror +- Керування станом - Redux +- Іконки - Tabler Icons +- Форми - formik +- Валідація по схемі - Yup +- Клієнт запитів - axios +- Спостерігач за файловою системою - chokidar + +### Залежності + +Вам знадобиться [Node v18.x або остання LTS версія](https://nodejs.org/en/) та npm 8.x. Ми використовуєм npm workspaces в цьому проекті + +### Починаєм писати код + +Будь ласка, зверніться до [development_ua.md](docs/development_ua.md) за інструкціями щодо запуску локального середовища розробки. + +### Створення Pull Request-ів + +- Будь ласка, робіть PR-и маленькими і сфокусованими на одній речі +- Будь ласка, слідуйте формату назв гілок + - feature/[назва feature]: Така гілка має містити зміни лише щодо конкретної feature + - Приклад: feature/dark-mode + - bugfix/[назва баґу]: Така гілка має містити лише виправлення конкретного багу + - Приклад: bugfix/bug-1 + +## Розробка + +Bruno розробляється як декстопний застосунок. Вам потрібно запустити Next.js в одній сесії терміналу, та запустити застосунок Electron в іншій сесії терміналу. + +### Залежності + +- NodeJS v18 + +### Локальна розробка + +```bash +# Використовуйте nodejs 18-ї версії +nvm use + +# встановіть залежності +npm i --legacy-peer-deps + +# зберіть документацію graphql +npm run build:graphql-docs + +# зберіть bruno query +npm run build:bruno-query + +# запустіть додаток next (термінал 1) +npm run dev:web + +# запустіть додаток електрон (термінал 2) +npm run dev:electron +``` + +### Усунення несправностей + +Ви можете зтикнутись із помилкою `Unsupported platform` коли запускаєте `npm install`. Щоб усунути цю проблему, вам потрібно видалити `node_modules` та `package-lock.json`, і тоді запустити `npm install`. Це має встановити всі потрібні для запуску додатку пекеджі. + +```shell +# Видаліть node_modules в піддиректоріях +find ./ -type d -name "node_modules" -print0 | while read -d $'\0' dir; do + rm -rf "$dir" +done + +# Видаліть package-lock в піддиректоріях +find . -type f -name "package-lock.json" -delete +``` + +### Тестування + +```bash +# bruno-schema +npm test --workspace=packages/bruno-schema + +# bruno-lang +npm test --workspace=packages/bruno-lang +``` diff --git a/docs/development.md b/docs/development.md deleted file mode 100644 index 0eaedf0c..00000000 --- a/docs/development.md +++ /dev/null @@ -1,55 +0,0 @@ -**English** | [Українська](/docs/development_ua.md) | [Русский](/docs/development_ru.md) | [Deutsch](/docs/development_de.md) - -## Development - -Bruno is being developed as a desktop app. You need to load the app by running the nextjs app in one terminal and then run the electron app in another terminal. - -### Dependencies - -- NodeJS v18 - -### Local Development - -```bash -# use nodejs 18 version -nvm use - -# install deps -npm i --legacy-peer-deps - -# build graphql docs -npm run build:graphql-docs - -# build bruno query -npm run build:bruno-query - -# run next app (terminal 1) -npm run dev:web - -# run electron app (terminal 2) -npm run dev:electron -``` - -### Troubleshooting - -You might encounter a `Unsupported platform` error when you run `npm install`. To fix this, you will need to delete `node_modules` and `package-lock.json` and run `npm install`. This should install all the necessary packages needed to run the app. - -```shell -# Delete node_modules in sub-directories -find ./ -type d -name "node_modules" -print0 | while read -d $'\0' dir; do - rm -rf "$dir" -done - -# Delete package-lock in sub-directories -find . -type f -name "package-lock.json" -delete -``` - -### Testing - -```bash -# bruno-schema -npm test --workspace=packages/bruno-schema - -# bruno-lang -npm test --workspace=packages/bruno-lang -``` diff --git a/docs/development_de.md b/docs/development_de.md deleted file mode 100644 index bb762027..00000000 --- a/docs/development_de.md +++ /dev/null @@ -1,55 +0,0 @@ -[English](/docs/development.md) | [Українська](/docs/development_ua.md) | [Русский](/docs/development_ru.md) | **Deutsch** - -## Entwicklung - -Bruno wird als Desktop-Anwendung entwickelt. Um die App zu starten, musst Du zuerst die NextJs-App in einem Terminal ausführen und anschließend in einem anderen Terminal die Electron-App. - -### Abhängigkeiten - -- NodeJS v18 - -### Lokales Entwickeln - -```bash -# use nodejs 18 version -nvm use - -# install deps -npm i --legacy-peer-deps - -# build graphql docs -npm run build:graphql-docs - -# build bruno query -npm run build:bruno-query - -# run next app (terminal 1) -npm run dev:web - -# run electron app (terminal 2) -npm run dev:electron -``` - -### Troubleshooting - -Es kann sein, dass Du einen `Unsupported platform`-Fehler bekommst, wenn Du `npm install` ausführst. Um dies zu beheben, musst Du `node_modules` und `package-lock.json` löschen und `npm install` erneut ausführen. Dies sollte alle notwendigen Pakete installieren, die zum Ausführen der Anwendung benötigt werden. - -```shell -# Delete node_modules in sub-directories -find ./ -type d -name "node_modules" -print0 | while read -d $'\0' dir; do - rm -rf "$dir" -done - -# Delete package-lock in sub-directories -find . -type f -name "package-lock.json" -delete -``` - -### Testen - -```bash -# bruno-schema -npm test --workspace=packages/bruno-schema - -# bruno-lang -npm test --workspace=packages/bruno-lang -``` diff --git a/docs/development_ru.md b/docs/development_ru.md deleted file mode 100644 index 9ec11e84..00000000 --- a/docs/development_ru.md +++ /dev/null @@ -1,55 +0,0 @@ -[English](/docs/development.md) | [Українська](/docs/development_ua.md) | **Русский** | [Deutsch](/docs/development_de.md) - -## Разработка - -Bruno разрабатывается как десктопное приложение. Необходимо загрузить приложение, запустив приложение nextjs в одном терминале, а затем запустить приложение electron в другом терминале. - -### Зависимости - -- NodeJS v18 - -### Локальная разработка - -```bash -# используйте nodejs 18 версии -nvm use - -# установите зависимости -npm i --legacy-peer-deps - -# билд документации по graphql -npm run build:graphql-docs - -# билд bruno query -npm run build:bruno-query - -# запустить next приложение ( терминал 1 ) -npm run dev:web - -# запустить приложение electron ( терминал 2 ) -npm run dev:electron -``` - -### Устранение неисправностей - -При запуске `npm install` может возникнуть ошибка `Unsupported platform`. Чтобы исправить это, необходимо удалить `node_modules` и `package-lock.json` и запустить `npm install`. В результате будут установлены все пакеты, необходимые для работы приложения. - -```shell -# Удаление node_modules в подкаталогах -find ./ -type d -name "node_modules" -print0 | while read -d $'\0' dir; do - rm -rf "$dir" -done - -# Удаление package-lock в подкаталогах -find . -type f -name "package-lock.json" -delete -``` - -### Тестирование - -```bash -# bruno-schema -npm test --workspace=packages/bruno-schema - -# bruno-lang -npm test --workspace=packages/bruno-lang -``` diff --git a/docs/development_ua.md b/docs/development_ua.md deleted file mode 100644 index d3cfdc5e..00000000 --- a/docs/development_ua.md +++ /dev/null @@ -1,55 +0,0 @@ -[English](/docs/development.md) | **Українська** | [Русский](/docs/development_ru.md) | [Deutsch](/docs/development_de.md) - -## Розробка - -Bruno розробляється як декстопний застосунок. Вам потрібно запустити nextjs в одній сесії терміналу, та запустити застосунок Electron в іншій сесії терміналу. - -### Залежності - -- NodeJS v18 - -### Локальна розробка - -```bash -# Використовуйте nodejs 18-ї версії -nvm use - -# встановіть залежності -npm i --legacy-peer-deps - -# зберіть документацію graphql -npm run build:graphql-docs - -# зберіть bruno query -npm run build:bruno-query - -# запустіть додаток next (термінал 1) -npm run dev:web - -# запустіть додаток електрон (термінал 2) -npm run dev:electron -``` - -### Усунення несправностей - -Ви можете зтикнутись із помилкою `Unsupported platform` коли запускаєте `npm install`. Щоб усунути цю проблему, вам потрібно видалити `node_modules` та `package-lock.json`, і тоді запустити `npm install`. Це має встановити всі потрібні для запуску додатку пекеджі. - -```shell -# Видаліть node_modules в піддиректоріях -find ./ -type d -name "node_modules" -print0 | while read -d $'\0' dir; do - rm -rf "$dir" -done - -# Видаліть package-lock в піддиректоріях -find . -type f -name "package-lock.json" -delete -``` - -### Тестування - -```bash -# bruno-schema -npm test --workspace=packages/bruno-schema - -# bruno-lang -npm test --workspace=packages/bruno-lang -``` diff --git a/readme_de.md b/docs/readme/readme_de.md similarity index 95% rename from readme_de.md rename to docs/readme/readme_de.md index 2454a7ac..a0ef031d 100644 --- a/readme_de.md +++ b/docs/readme/readme_de.md @@ -10,8 +10,6 @@ [![Website](https://img.shields.io/badge/Website-Visit-blue)](https://www.usebruno.com) [![Download](https://img.shields.io/badge/Download-Latest-brightgreen)](https://www.usebruno.com/downloads) -[English](/readme.md) | [Українська](/readme_ua.md) | [Русский](/readme_ru.md) | [Türkçe](/readme_tr.md) | **Deutsch** - Bruno ist ein neuer und innovativer API-Client, der den Status Quo von Postman und ähnlichen Tools revolutionieren soll. Bruno speichert Deine Sammlungen direkt in einem Ordner in Deinem Dateisystem. Wir verwenden eine einfache Textauszeichnungssprache - Bru - um Informationen über API-Anfragen zu speichern. @@ -61,7 +59,7 @@ Bitte [hier](publishing.md) für mehr Informationen lesen. ### Mitmachen 👩‍💻🧑‍💻 -Ich freue mich, dass Du Bruno verbessern willst. Bitte schau Dir den [Leitfaden zum Mitmachen](contributing_de.md) an. +Ich freue mich, dass Du Bruno verbessern willst. Bitte schau Dir den [Leitfaden zum Mitmachen](../contributing/contributing_de.md) an. Auch wenn Du nicht in der Lage bist, einen Beitrag in Form von Code zu leisten, zögere bitte nicht, uns Fehler und Funktionswünsche mitzuteilen, die implementiert werden müssen, um Deinen Anwendungsfall zu unterstützen. diff --git a/docs/readme/readme_fr.md b/docs/readme/readme_fr.md new file mode 100644 index 00000000..97b327bf --- /dev/null +++ b/docs/readme/readme_fr.md @@ -0,0 +1,94 @@ +
+ + +### Bruno - IDE Opensource pour explorer et tester des APIs. + +[![GitHub version](https://badge.fury.io/gh/usebruno%2Fbruno.svg)](https://badge.fury.io/gh/usebruno%bruno) +[![CI](https://github.com/usebruno/bruno/actions/workflows/unit-tests.yml/badge.svg?branch=main)](https://github.com/usebruno/bruno/workflows/unit-tests.yml) +[![Commit Activity](https://img.shields.io/github/commit-activity/m/usebruno/bruno)](https://github.com/usebruno/bruno/pulse) +[![X](https://img.shields.io/twitter/follow/use_bruno?style=social&logo=x)](https://twitter.com/use_bruno) +[![Website](https://img.shields.io/badge/Website-Visit-blue)](https://www.usebruno.com) +[![Download](https://img.shields.io/badge/Download-Latest-brightgreen)](https://www.usebruno.com/downloads) + +Bruno est un nouveau client API, innovant, qui a pour but de révolutionner le _status quo_ que représente Postman et les autres outils. + +Bruno sauvegarde vos collections directement sur votre système de fichiers. Nous utilisons un langage de balise de type texte pour décrire les requêtes API. + +Vous pouvez utiliser git ou tout autre gestionnaire de version pour travailler de manière collaborative sur vos collections d'APIs. + +Bruno ne fonctionne qu'en mode déconnecté. Il n'y a pas de d'abonnement ou de synchronisation avec le cloud Bruno, il n'y en aura jamais. Nous sommes conscients de la confidentialité de vos données et nous sommes convaincus qu'elles doivent rester sur vos appareils. Vous pouvez lire notre vision à long terme [ici (en anglais)](https://github.com/usebruno/bruno/discussions/269). + +![bruno](assets/images/landing-2.png)

+ +### Fonctionne sur de multiples platformes 🖥️ + +![bruno](assets/images/run-anywhere.png)

+ +### Collaborer via Git 👩‍💻🧑‍💻 + +Ou n'importe quel système de gestion de sources + +![bruno](assets/images/version-control.png)

+ +### Liens importants 📌 + +- [Notre vision à long terme (en anglais)](https://github.com/usebruno/bruno/discussions/269) +- [Roadmap](https://github.com/usebruno/bruno/discussions/384) +- [Documentation](https://docs.usebruno.com) +- [Site web](https://www.usebruno.com) +- [Prix](https://www.usebruno.com/pricing) +- [Téléchargement](https://www.usebruno.com/downloads) + +### Showcase 🎥 + +- [Témoignages](https://github.com/usebruno/bruno/discussions/343) +- [Centre de connaissance](https://github.com/usebruno/bruno/discussions/386) +- [Scriptmania](https://github.com/usebruno/bruno/discussions/385) + +### Soutien ❤️ + +Ouaf! Si vous aimez le projet, cliquez sur le bouton ⭐ !! + +### Partage de témoignages 📣 + +Si Bruno vous a aidé dans votre travail, au sein de votre équipe, merci de penser à partager votre témoignage sur la [page discussion Github dédiée](https://github.com/usebruno/bruno/discussions/343) + +### Publier Bruno sur un nouveau gestionnaire de paquets + +Veuillez regarder [ici](publishing.md) pour plus d'information. + +### Contribuer 👩‍💻🧑‍💻 + +Je suis heureux de voir que vous cherchez à améliorer Bruno. Merci de consulter le [guide de contribution](../contributing/contributing_fr.md) + +Même si vous n'êtes pas en mesure de contribuer directement via du code, n'hésitez pas à consigner les bogues et les demandes de nouvelles fonctionnalités pour résoudre vos cas d'usage ! + +### Auteurs + +
+ + + +
+ +### Restons en contact 🌐 + +[Twitter](https://twitter.com/use_bruno)
+[Website](https://www.usebruno.com)
+[Discord](https://discord.com/invite/KgcZUncpjq)
+[LinkedIn](https://www.linkedin.com/company/usebruno) + +### Marque + +**Nom** + +`Bruno` est une marque appartenant à [Anoop M D](https://www.helloanoop.com/) + +**Logo** + +Le logo est issu de [OpenMoji](https://openmoji.org/library/emoji-1F436/). +Licence: CC [BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/) + +### Licence 📄 + +[MIT](license.md) diff --git a/readme_ru.md b/docs/readme/readme_ru.md similarity index 96% rename from readme_ru.md rename to docs/readme/readme_ru.md index 35361765..423ab33b 100644 --- a/readme_ru.md +++ b/docs/readme/readme_ru.md @@ -10,8 +10,6 @@ [![Website](https://img.shields.io/badge/Website-Visit-blue)](https://www.usebruno.com) [![Download](https://img.shields.io/badge/Download-Latest-brightgreen)](https://www.usebruno.com/downloads) -[English](/readme.md) | [Українська](/readme_ua.md) | **Русский** | [Türkçe](/readme_tr.md) | [Deutsch](/readme_de.md) - Bruno - новый и инновационный клиент API, направленный на революцию в установившейся ситуации, представленной Postman и подобными инструментами. Bruno хранит ваши коллекции непосредственно в папке в вашей файловой системе. Для сохранения информации об API-запросах мы используем язык Bru. @@ -56,7 +54,7 @@ Bruno работает только в автономном режиме. Доб ### Внести вклад 👩‍💻🧑‍💻 -Я рад, что Вы хотите улучшить Бруно. Пожалуйста, ознакомьтесь с [этим гайдом](contributing_ru.md) +Я рад, что Вы хотите улучшить Бруно. Пожалуйста, ознакомьтесь с [этим гайдом](../contributing/contributing_ru.md) Даже если вы не можете внести свой вклад с помощью кода, пожалуйста, не стесняйтесь сообщать об ошибках и пожеланиях к функциям, которые необходимо реализовать для решения вашей задачи. diff --git a/readme_tr.md b/docs/readme/readme_tr.md similarity index 94% rename from readme_tr.md rename to docs/readme/readme_tr.md index ffedde5c..74bd8aa5 100644 --- a/readme_tr.md +++ b/docs/readme/readme_tr.md @@ -10,8 +10,6 @@ [![Web Sitesi](https://img.shields.io/badge/Website-Visit-blue)](https://www.usebruno.com) [![İndir](https://img.shields.io/badge/Download-Latest-brightgreen)](https://www.usebruno.com/downloads) -[English](/readme.md) | [Українська](/readme_ua.md) | [Русский](/readme_ru.md) | **Türkçe** | [Deutsch](/readme_de.md) - Bruno, Postman ve benzeri araçlar tarafından temsil edilen statükoda devrim yaratmayı amaçlayan yeni ve yenilikçi bir API istemcisidir. Bruno koleksiyonlarınızı doğrudan dosya sisteminizdeki bir klasörde saklar. API istekleri hakkındaki bilgileri kaydetmek için düz bir metin biçimlendirme dili olan Bru kullanıyoruz. @@ -56,7 +54,7 @@ Bruno işinizde ve ekiplerinizde size yardımcı olduysa, lütfen [github tartı ### Katkıda Bulunun 👩‍💻🧑‍💻 -Bruno'yu geliştirmek istemenize sevindim. Lütfen [katkıda bulunma kılavuzu](contributing.md)'na göz atın +Bruno'yu geliştirmek istemenize sevindim. Lütfen [katkıda bulunma kılavuzu](../contributing/contributing.md)'na göz atın Kod yoluyla katkıda bulunamasanız bile, lütfen kullanım durumunuzu çözmek için uygulanması gereken hataları ve özellik isteklerini bildirmekten çekinmeyin. diff --git a/readme_ua.md b/docs/readme/readme_ua.md similarity index 96% rename from readme_ua.md rename to docs/readme/readme_ua.md index a7dd8919..9b0eb7a0 100644 --- a/readme_ua.md +++ b/docs/readme/readme_ua.md @@ -10,8 +10,6 @@ [![Website](https://img.shields.io/badge/Website-Visit-blue)](https://www.usebruno.com) [![Download](https://img.shields.io/badge/Download-Latest-brightgreen)](https://www.usebruno.com/downloads) -[English](/readme.md) | **Українська** | [Русский](/readme_ru.md) | [Türkçe](/readme_tr.md) | [Deutsch](/readme_de.md) - Bruno це новий та іноваційний API клієнт, націлений на революційну зміну статус кво, запровадженого інструментами на кшталт Postman. Bruno зберігає ваші колекції напряму у теці на вашому диску. Він використовує текстову мову розмітки Bru для збереження інформації про ваші API запити. @@ -56,7 +54,7 @@ Bruno є повністю автономним. Немає жодних план ### Зробити свій внесок 👩‍💻🧑‍💻 -Я радий що ви бажаєте покращити Bruno. Будь ласка переглянте [інструкцію по контрибуції](contributing_ua.md) +Я радий що ви бажаєте покращити Bruno. Будь ласка переглянте [інструкцію по контрибуції](../contributing/contributing_ua.md) Навіть якщо ви не можете зробити свій внесок пишучи програмний код, будь ласка не соромтесь рапортувати про помилки і писати запити на новий функціонал, який потрібен вам у вашій роботі. diff --git a/package-lock.json b/package-lock.json index 5dddfd54..79f3de50 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16630,7 +16630,7 @@ }, "packages/bruno-electron": { "name": "bruno", - "version": "v0.27.1", + "version": "v0.27.2", "dependencies": { "@aws-sdk/credential-providers": "^3.425.0", "@usebruno/js": "0.9.1", @@ -16641,6 +16641,7 @@ "axios": "^1.5.1", "chai": "^4.3.7", "chokidar": "^3.5.3", + "content-disposition": "^0.5.4", "decomment": "^0.9.5", "dotenv": "^16.0.3", "electron-is-dev": "^2.0.0", @@ -16656,6 +16657,7 @@ "is-valid-path": "^0.1.1", "js-yaml": "^4.1.0", "lodash": "^4.17.21", + "mime-types": "^2.1.35", "mustache": "^4.2.0", "nanoid": "3.3.4", "node-machine-id": "^1.1.12", @@ -21519,6 +21521,7 @@ "axios": "^1.5.1", "chai": "^4.3.7", "chokidar": "^3.5.3", + "content-disposition": "^0.5.4", "decomment": "^0.9.5", "dmg-license": "^1.0.11", "dotenv": "^16.0.3", @@ -21538,6 +21541,7 @@ "is-valid-path": "^0.1.1", "js-yaml": "^4.1.0", "lodash": "^4.17.21", + "mime-types": "^2.1.35", "mustache": "^4.2.0", "nanoid": "3.3.4", "node-machine-id": "^1.1.12", diff --git a/packages/bruno-app/package.json b/packages/bruno-app/package.json index b23d7459..c3f82569 100644 --- a/packages/bruno-app/package.json +++ b/packages/bruno-app/package.json @@ -3,7 +3,7 @@ "version": "0.3.0", "private": true, "scripts": { - "dev": "cross-env ENV=dev next dev", + "dev": "cross-env ENV=dev next dev -p 3000", "build": "next build && next export", "start": "next start", "lint": "next lint", diff --git a/packages/bruno-app/src/components/CodeEditor/index.js b/packages/bruno-app/src/components/CodeEditor/index.js index 6ad999e6..b1a115c9 100644 --- a/packages/bruno-app/src/components/CodeEditor/index.js +++ b/packages/bruno-app/src/components/CodeEditor/index.js @@ -70,6 +70,35 @@ export default class CodeEditor extends React.Component { 'Ctrl-F': 'findPersistent', Tab: function (cm) { cm.replaceSelection(' ', 'end'); + }, + 'Ctrl-Y': 'foldAll', + 'Cmd-Y': 'foldAll', + 'Ctrl-I': 'unfoldAll', + 'Cmd-I': 'unfoldAll' + }, + foldOptions: { + widget: (from, to) => { + var count = undefined; + var internal = this.editor.getRange(from, to); + if (this.props.mode == 'application/ld+json') { + if (this.editor.getLine(from.line).endsWith('[')) { + var toParse = '[' + internal + ']'; + } else var toParse = '{' + internal + '}'; + try { + count = Object.keys(JSON.parse(toParse)).length; + } catch (e) {} + } else if (this.props.mode == 'application/xml') { + var doc = new DOMParser(); + try { + //add header element and remove prefix namespaces for DOMParser + var dcm = doc.parseFromString( + ' ' + internal.replace(/(?<=\<|<\/)\w+:/g, '') + '', + 'application/xml' + ); + count = dcm.documentElement.children.length; + } catch (e) {} + } + return count ? `\u21A4${count}\u21A6` : '\u2194'; } } })); diff --git a/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentVariables/StyledWrapper.js b/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentVariables/StyledWrapper.js index 64b11b25..7eec1394 100644 --- a/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentVariables/StyledWrapper.js +++ b/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentVariables/StyledWrapper.js @@ -13,10 +13,12 @@ const Wrapper = styled.div` padding: 4px 10px; &:nth-child(1), - &:nth-child(4), - &:nth-child(5) { + &:nth-child(4) { width: 70px; } + &:nth-child(5) { + width: 40px; + } &:nth-child(2) { width: 25%; diff --git a/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentVariables/index.js b/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentVariables/index.js index 74862676..dfd93be3 100644 --- a/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentVariables/index.js +++ b/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentVariables/index.js @@ -1,68 +1,79 @@ -import React, { useReducer } from 'react'; +import React from 'react'; import toast from 'react-hot-toast'; import cloneDeep from 'lodash/cloneDeep'; import { IconTrash } from '@tabler/icons'; import { useTheme } from 'providers/Theme'; import { useDispatch } from 'react-redux'; import { saveEnvironment } from 'providers/ReduxStore/slices/collections/actions'; -import reducer from './reducer'; import SingleLineEditor from 'components/SingleLineEditor'; import StyledWrapper from './StyledWrapper'; +import { useFormik } from 'formik'; +import * as Yup from 'yup'; +import { uuid } from 'utils/common'; const EnvironmentVariables = ({ environment, collection }) => { const dispatch = useDispatch(); const { storedTheme } = useTheme(); - const [state, reducerDispatch] = useReducer(reducer, { hasChanges: false, variables: environment.variables || [] }); - const { variables, hasChanges } = state; - const saveChanges = () => { - dispatch(saveEnvironment(cloneDeep(variables), environment.uid, collection.uid)) - .then(() => { - toast.success('Changes saved successfully'); - reducerDispatch({ - type: 'CHANGES_SAVED' - }); + const formik = useFormik({ + enableReinitialize: true, + initialValues: environment.variables || [], + validationSchema: Yup.array().of( + Yup.object({ + enabled: Yup.boolean(), + name: Yup.string() + .required('Name cannot be empty') + .matches(/^(?!\d)\w*$/, 'Name contains invalid characters') + .trim(), + secret: Yup.boolean(), + type: Yup.string(), + uid: Yup.string(), + value: Yup.string().trim() }) - .catch(() => toast.error('An error occurred while saving the changes')); + ), + onSubmit: (values) => { + if (!formik.dirty) { + toast.error('Nothing to save'); + return; + } + + dispatch(saveEnvironment(cloneDeep(values), environment.uid, collection.uid)) + .then(() => { + toast.success('Changes saved successfully'); + formik.resetForm({ values }); + }) + .catch(() => toast.error('An error occurred while saving the changes')); + } + }); + + const ErrorMessage = ({ name }) => { + const meta = formik.getFieldMeta(name); + console.log(name, meta); + if (!meta.error) { + return null; + } + + return ( + + ); }; const addVariable = () => { - reducerDispatch({ - type: 'ADD_VAR' - }); + const newVariable = { + uid: uuid(), + name: '', + value: '', + type: 'text', + secret: false, + enabled: true + }; + formik.setFieldValue(formik.values.length, newVariable, false); }; - const handleVarChange = (e, _variable, type) => { - const variable = cloneDeep(_variable); - switch (type) { - case 'name': { - variable.name = e.target.value; - break; - } - case 'value': { - variable.value = e.target.value; - break; - } - case 'enabled': { - variable.enabled = e.target.checked; - break; - } - case 'secret': { - variable.secret = e.target.checked; - break; - } - } - reducerDispatch({ - type: 'UPDATE_VAR', - variable - }); - }; - - const handleRemoveVars = (variable) => { - reducerDispatch({ - type: 'DELETE_VAR', - variable - }); + const handleRemoveVar = (id) => { + formik.setValues(formik.values.filter((variable) => variable.uid !== id)); }; return ( @@ -78,55 +89,57 @@ const EnvironmentVariables = ({ environment, collection }) => { - {variables && variables.length - ? variables.map((variable, index) => { - return ( - - - handleVarChange(e, variable, 'enabled')} - /> - - - handleVarChange(e, variable, 'name')} - /> - - - handleVarChange({ target: { value: newValue } }, variable, 'value')} - collection={collection} - /> - - - handleVarChange(e, variable, 'secret')} - /> - - - - - - ); - }) - : null} + {formik.values.map((variable, index) => ( + + + + + + + + + + formik.setFieldValue(`${index}.value`, newValue, true)} + /> + + + + + + + + + ))} @@ -137,12 +150,7 @@ const EnvironmentVariables = ({ environment, collection }) => {
-
diff --git a/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentVariables/reducer.js b/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentVariables/reducer.js deleted file mode 100644 index a5aa3e0c..00000000 --- a/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentVariables/reducer.js +++ /dev/null @@ -1,52 +0,0 @@ -import produce from 'immer'; -import find from 'lodash/find'; -import filter from 'lodash/filter'; -import { uuid } from 'utils/common'; - -const reducer = (state, action) => { - switch (action.type) { - case 'ADD_VAR': { - return produce(state, (draft) => { - draft.variables.push({ - uid: uuid(), - name: '', - value: '', - type: 'text', - secret: false, - enabled: true - }); - draft.hasChanges = true; - }); - } - - case 'UPDATE_VAR': { - return produce(state, (draft) => { - const variable = find(draft.variables, (v) => v.uid === action.variable.uid); - variable.name = action.variable.name; - variable.value = action.variable.value; - variable.enabled = action.variable.enabled; - variable.secret = action.variable.secret; - draft.hasChanges = true; - }); - } - - case 'DELETE_VAR': { - return produce(state, (draft) => { - draft.variables = filter(draft.variables, (v) => v.uid !== action.variable.uid); - draft.hasChanges = true; - }); - } - - case 'CHANGES_SAVED': { - return produce(state, (draft) => { - draft.hasChanges = false; - }); - } - - default: { - return state; - } - } -}; - -export default reducer; diff --git a/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/StyledWrapper.js b/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/StyledWrapper.js index d6639b7d..330ae082 100644 --- a/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/StyledWrapper.js +++ b/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/StyledWrapper.js @@ -10,6 +10,7 @@ const StyledWrapper = styled.div` background-color: ${(props) => props.theme.collection.environment.settings.sidebar.bg}; border-right: solid 1px ${(props) => props.theme.collection.environment.settings.sidebar.borderRight}; min-height: 400px; + height: 100%; max-height: 85vh; overflow-y: auto; } @@ -44,10 +45,8 @@ const StyledWrapper = styled.div` border-bottom: none; color: ${(props) => props.theme.textLink}; - &:hover { - span { - text-decoration: underline; - } + span:hover { + text-decoration: underline; } } diff --git a/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/index.js b/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/index.js index dd7ac4f7..9886b54b 100644 --- a/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/index.js +++ b/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/index.js @@ -1,12 +1,11 @@ import React, { useEffect, useState, forwardRef, useRef } from 'react'; import { findEnvironmentInCollection } from 'utils/collections'; -import toast from 'react-hot-toast'; -import { toastError } from 'utils/common/error'; import usePrevious from 'hooks/usePrevious'; import EnvironmentDetails from './EnvironmentDetails'; import CreateEnvironment from '../CreateEnvironment'; -import { IconDownload } from '@tabler/icons'; +import { IconDownload, IconShieldLock } from '@tabler/icons'; import ImportEnvironment from '../ImportEnvironment'; +import ManageSecrets from '../ManageSecrets'; import StyledWrapper from './StyledWrapper'; const EnvironmentList = ({ collection }) => { @@ -14,6 +13,7 @@ const EnvironmentList = ({ collection }) => { const [selectedEnvironment, setSelectedEnvironment] = useState(null); const [openCreateModal, setOpenCreateModal] = useState(false); const [openImportModal, setOpenImportModal] = useState(false); + const [openManageSecretsModal, setOpenManageSecretsModal] = useState(false); const envUids = environments ? environments.map((env) => env.uid) : []; const prevEnvUids = usePrevious(envUids); @@ -54,6 +54,7 @@ const EnvironmentList = ({ collection }) => { {openCreateModal && setOpenCreateModal(false)} />} {openImportModal && setOpenImportModal(false)} />} + {openManageSecretsModal && setOpenManageSecretsModal(false)} />}
@@ -72,9 +73,15 @@ const EnvironmentList = ({ collection }) => { + Create
-
setOpenImportModal(true)}> - - Import +
+
setOpenImportModal(true)}> + + Import +
+
setOpenManageSecretsModal(true)}> + + Managing Secrets +
diff --git a/packages/bruno-app/src/components/Environments/EnvironmentSettings/ManageSecrets/index.js b/packages/bruno-app/src/components/Environments/EnvironmentSettings/ManageSecrets/index.js new file mode 100644 index 00000000..6c71493f --- /dev/null +++ b/packages/bruno-app/src/components/Environments/EnvironmentSettings/ManageSecrets/index.js @@ -0,0 +1,31 @@ +import React from 'react'; +import Portal from 'components/Portal'; +import Modal from 'components/Modal'; + +const ManageSecrets = ({ onClose }) => { + return ( + + +
+

In any collection, there are secrets that need to be managed.

+

These secrets can be anything such as API keys, passwords, or tokens.

+

Bruno offers two approaches to manage secrets in collections.

+

+ Read more about it in our{' '} + + docs + + . +

+
+
+
+ ); +}; + +export default ManageSecrets; diff --git a/packages/bruno-app/src/components/RequestPane/GraphQLRequestPane/index.js b/packages/bruno-app/src/components/RequestPane/GraphQLRequestPane/index.js index 98845b55..288e66a8 100644 --- a/packages/bruno-app/src/components/RequestPane/GraphQLRequestPane/index.js +++ b/packages/bruno-app/src/components/RequestPane/GraphQLRequestPane/index.js @@ -1,8 +1,7 @@ -import React, { useEffect } from 'react'; +import React, { useEffect, useState } from 'react'; import find from 'lodash/find'; import get from 'lodash/get'; import classnames from 'classnames'; -import { IconRefresh, IconLoader2, IconBook, IconDownload } from '@tabler/icons'; import { useSelector, useDispatch } from 'react-redux'; import { updateRequestPaneTab } from 'providers/ReduxStore/slices/tabs'; import QueryEditor from 'components/RequestPane/QueryEditor'; @@ -16,10 +15,9 @@ import Tests from 'components/RequestPane/Tests'; import { useTheme } from 'providers/Theme'; import { updateRequestGraphqlQuery } from 'providers/ReduxStore/slices/collections'; import { sendRequest, saveRequest } from 'providers/ReduxStore/slices/collections/actions'; -import { findEnvironmentInCollection } from 'utils/collections'; -import useGraphqlSchema from './useGraphqlSchema'; import StyledWrapper from './StyledWrapper'; import Documentation from 'components/Documentation/index'; +import GraphQLSchemaActions from '../GraphQLSchemaActions/index'; const GraphQLRequestPane = ({ item, collection, leftPaneWidth, onSchemaLoad, toggleDocs, handleGqlClickReference }) => { const dispatch = useDispatch(); @@ -29,25 +27,11 @@ const GraphQLRequestPane = ({ item, collection, leftPaneWidth, onSchemaLoad, tog const variables = item.draft ? get(item, 'draft.request.body.graphql.variables') : get(item, 'request.body.graphql.variables'); - const url = item.draft ? get(item, 'draft.request.url') : get(item, 'request.url'); const { storedTheme } = useTheme(); - - const environment = findEnvironmentInCollection(collection, collection.activeEnvironmentUid); - - const request = item.draft ? item.draft.request : item.request; - - let { schema, loadSchema, isLoading: isSchemaLoading } = useGraphqlSchema(url, environment, request, collection); - - const loadGqlSchema = () => { - if (!isSchemaLoading) { - loadSchema(); - } - }; + const [schema, setSchema] = useState(null); useEffect(() => { - if (onSchemaLoad) { - onSchemaLoad(schema); - } + onSchemaLoad(schema); }, [schema]); const onQueryChange = (value) => { @@ -163,18 +147,7 @@ const GraphQLRequestPane = ({ item, collection, leftPaneWidth, onSchemaLoad, tog
selectTab('docs')}> Docs
-
-
- {isSchemaLoading ? : null} - {!isSchemaLoading && !schema ? : null} - {!isSchemaLoading && schema ? : null} - Schema -
-
- - Docs -
-
+
{getTabPanel(focusedTab.requestPaneTab)}
diff --git a/packages/bruno-app/src/components/RequestPane/GraphQLRequestPane/useGraphqlSchema.js b/packages/bruno-app/src/components/RequestPane/GraphQLRequestPane/useGraphqlSchema.js deleted file mode 100644 index c824c575..00000000 --- a/packages/bruno-app/src/components/RequestPane/GraphQLRequestPane/useGraphqlSchema.js +++ /dev/null @@ -1,60 +0,0 @@ -import { useState } from 'react'; -import toast from 'react-hot-toast'; -import { buildClientSchema } from 'graphql'; -import { fetchGqlSchema } from 'utils/network'; -import { simpleHash } from 'utils/common'; - -const schemaHashPrefix = 'bruno.graphqlSchema'; - -const useGraphqlSchema = (endpoint, environment, request, collection) => { - const localStorageKey = `${schemaHashPrefix}.${simpleHash(endpoint)}`; - const [error, setError] = useState(null); - const [isLoading, setIsLoading] = useState(false); - const [schema, setSchema] = useState(() => { - try { - const saved = localStorage.getItem(localStorageKey); - if (!saved) { - return null; - } - return buildClientSchema(JSON.parse(saved)); - } catch { - localStorage.setItem(localStorageKey, null); - return null; - } - }); - - const loadSchema = () => { - setIsLoading(true); - fetchGqlSchema(endpoint, environment, request, collection) - .then((res) => { - if (!res || res.status !== 200) { - return Promise.reject(new Error(res.statusText)); - } - return res.data; - }) - .then((s) => { - if (s && s.data) { - setSchema(buildClientSchema(s.data)); - setIsLoading(false); - localStorage.setItem(localStorageKey, JSON.stringify(s.data)); - toast.success('GraphQL Schema loaded successfully'); - } else { - return Promise.reject(new Error('An error occurred while introspecting schema')); - } - }) - .catch((err) => { - setIsLoading(false); - setError(err); - toast.error(`Error occurred while loading GraphQL Schema: ${err.message}`); - }); - }; - - return { - isLoading, - schema, - loadSchema, - error - }; -}; - -export default useGraphqlSchema; diff --git a/packages/bruno-app/src/components/RequestPane/GraphQLSchemaActions/index.js b/packages/bruno-app/src/components/RequestPane/GraphQLSchemaActions/index.js new file mode 100644 index 00000000..954efebf --- /dev/null +++ b/packages/bruno-app/src/components/RequestPane/GraphQLSchemaActions/index.js @@ -0,0 +1,70 @@ +import React, { useEffect, useRef, forwardRef } from 'react'; +import useGraphqlSchema from './useGraphqlSchema'; +import { IconBook, IconDownload, IconLoader2, IconCheckmark } from '@tabler/icons'; +import get from 'lodash/get'; +import { findEnvironmentInCollection } from 'utils/collections'; +import Dropdown from '../../Dropdown'; + +const GraphQLSchemaActions = ({ item, collection, onSchemaLoad, toggleDocs }) => { + const url = item.draft ? get(item, 'draft.request.url') : get(item, 'request.url'); + const environment = findEnvironmentInCollection(collection, collection.activeEnvironmentUid); + const request = item.draft ? item.draft.request : item.request; + + let { + schema, + schemaSource, + loadSchema, + isLoading: isSchemaLoading + } = useGraphqlSchema(url, environment, request, collection); + + useEffect(() => { + if (onSchemaLoad) { + onSchemaLoad(schema); + } + }, [schema]); + + const schemaDropdownTippyRef = useRef(); + const onSchemaDropdownCreate = (ref) => (schemaDropdownTippyRef.current = ref); + + const MenuIcon = forwardRef((props, ref) => { + return ( +
+ {isSchemaLoading && } + {!isSchemaLoading && schema && } + {!isSchemaLoading && !schema && } + Schema +
+ ); + }); + + return ( +
+
+ + Docs +
+ } placement="bottom-start"> +
{ + schemaDropdownTippyRef.current.hide(); + loadSchema('introspection'); + }} + > + {schema && schemaSource === 'introspection' ? 'Refresh from Introspection' : 'Load from Introspection'} +
+
{ + schemaDropdownTippyRef.current.hide(); + loadSchema('file'); + }} + > + Load from File +
+
+
+ ); +}; + +export default GraphQLSchemaActions; diff --git a/packages/bruno-app/src/components/RequestPane/GraphQLSchemaActions/useGraphqlSchema.js b/packages/bruno-app/src/components/RequestPane/GraphQLSchemaActions/useGraphqlSchema.js new file mode 100644 index 00000000..0a5f2bd0 --- /dev/null +++ b/packages/bruno-app/src/components/RequestPane/GraphQLSchemaActions/useGraphqlSchema.js @@ -0,0 +1,89 @@ +import { useState } from 'react'; +import toast from 'react-hot-toast'; +import { buildClientSchema } from 'graphql'; +import { fetchGqlSchema } from 'utils/network'; +import { simpleHash } from 'utils/common'; + +const schemaHashPrefix = 'bruno.graphqlSchema'; + +const useGraphqlSchema = (endpoint, environment, request, collection) => { + const { ipcRenderer } = window; + const localStorageKey = `${schemaHashPrefix}.${simpleHash(endpoint)}`; + const [error, setError] = useState(null); + const [isLoading, setIsLoading] = useState(false); + const [schemaSource, setSchemaSource] = useState(''); + const [schema, setSchema] = useState(() => { + try { + const saved = localStorage.getItem(localStorageKey); + if (!saved) { + return null; + } + return buildClientSchema(JSON.parse(saved)); + } catch { + localStorage.setItem(localStorageKey, null); + return null; + } + }); + + const loadSchemaFromIntrospection = async () => { + const response = await fetchGqlSchema(endpoint, environment, request, collection); + if (!response) { + throw new Error('Introspection query failed'); + } + if (response.status !== 200) { + throw new Error(response.statusText); + } + const data = response.data?.data; + if (!data) { + throw new Error('No data returned from introspection query'); + } + setSchemaSource('introspection'); + return data; + }; + + const loadSchemaFromFile = async () => { + const schemaContent = await ipcRenderer.invoke('renderer:load-gql-schema-file'); + if (!schemaContent) { + setIsLoading(false); + return; + } + setSchemaSource('file'); + return schemaContent.data; + }; + + const loadSchema = async (schemaSource) => { + if (isLoading) { + return; + } + + setIsLoading(true); + + try { + let data; + if (schemaSource === 'file') { + data = await loadSchemaFromFile(); + } else { + // fallback to introspection if source is unknown + data = await loadSchemaFromIntrospection(); + } + setSchema(buildClientSchema(data)); + localStorage.setItem(localStorageKey, JSON.stringify(data)); + toast.success('GraphQL Schema loaded successfully'); + } catch (err) { + setError(err); + toast.error(`Error occurred while loading GraphQL Schema: ${err.message}`); + } + + setIsLoading(false); + }; + + return { + isLoading, + schema, + schemaSource, + loadSchema, + error + }; +}; + +export default useGraphqlSchema; diff --git a/packages/bruno-app/src/components/RequestPane/Vars/VarsTable/index.js b/packages/bruno-app/src/components/RequestPane/Vars/VarsTable/index.js index 6ee76097..77785e47 100644 --- a/packages/bruno-app/src/components/RequestPane/Vars/VarsTable/index.js +++ b/packages/bruno-app/src/components/RequestPane/Vars/VarsTable/index.js @@ -8,6 +8,7 @@ import { sendRequest, saveRequest } from 'providers/ReduxStore/slices/collection import SingleLineEditor from 'components/SingleLineEditor'; import Tooltip from 'components/Tooltip'; import StyledWrapper from './StyledWrapper'; +import toast from 'react-hot-toast'; const VarsTable = ({ item, collection, vars, varType }) => { const dispatch = useDispatch(); @@ -29,7 +30,19 @@ const VarsTable = ({ item, collection, vars, varType }) => { const _var = cloneDeep(v); switch (type) { case 'name': { - _var.name = e.target.value; + const value = e.target.value; + + if (/^(?!\d).*$/.test(value) === false) { + toast.error('Variable names must not start with a number!'); + return; + } + + if (/^\w*$/.test(value) === false) { + toast.error('Variable contains invalid character! Variables must only contain alpha-numeric characters.'); + return; + } + + _var.name = value; break; } case 'value': { @@ -88,7 +101,7 @@ const VarsTable = ({ item, collection, vars, varType }) => { {vars && vars.length - ? vars.map((_var, index) => { + ? vars.map((_var) => { return ( diff --git a/packages/bruno-app/src/components/RequestPane/Vars/index.js b/packages/bruno-app/src/components/RequestPane/Vars/index.js index b63c0880..500ebb25 100644 --- a/packages/bruno-app/src/components/RequestPane/Vars/index.js +++ b/packages/bruno-app/src/components/RequestPane/Vars/index.js @@ -1,42 +1,12 @@ import React from 'react'; import get from 'lodash/get'; -import { useDispatch } from 'react-redux'; -import { updateRequestScript, updateResponseScript } from 'providers/ReduxStore/slices/collections'; -import { sendRequest, saveRequest } from 'providers/ReduxStore/slices/collections/actions'; -import { useTheme } from 'providers/Theme'; import VarsTable from './VarsTable'; import StyledWrapper from './StyledWrapper'; const Vars = ({ item, collection }) => { - const dispatch = useDispatch(); const requestVars = item.draft ? get(item, 'draft.request.vars.req') : get(item, 'request.vars.req'); const responseVars = item.draft ? get(item, 'draft.request.vars.res') : get(item, 'request.vars.res'); - const { storedTheme } = useTheme(); - - const onRequestScriptEdit = (value) => { - dispatch( - updateRequestScript({ - script: value, - itemUid: item.uid, - collectionUid: collection.uid - }) - ); - }; - - const onResponseScriptEdit = (value) => { - dispatch( - updateResponseScript({ - script: value, - itemUid: item.uid, - collectionUid: collection.uid - }) - ); - }; - - const onRun = () => dispatch(sendRequest(item, collection.uid)); - const onSave = () => dispatch(saveRequest(item.uid, collection.uid)); - return (
diff --git a/packages/bruno-app/src/components/ResponsePane/QueryResult/StyledWrapper.js b/packages/bruno-app/src/components/ResponsePane/QueryResult/StyledWrapper.js index 5429ef44..07f51b8b 100644 --- a/packages/bruno-app/src/components/ResponsePane/QueryResult/StyledWrapper.js +++ b/packages/bruno-app/src/components/ResponsePane/QueryResult/StyledWrapper.js @@ -23,6 +23,10 @@ const StyledWrapper = styled.div` color: ${(props) => props.theme.colors.text.yellow}; } } + + .muted { + color: ${(props) => props.theme.colors.text.muted}; + } `; export default StyledWrapper; diff --git a/packages/bruno-app/src/components/ResponsePane/QueryResult/index.js b/packages/bruno-app/src/components/ResponsePane/QueryResult/index.js index 18b9ec2c..b5508ba1 100644 --- a/packages/bruno-app/src/components/ResponsePane/QueryResult/index.js +++ b/packages/bruno-app/src/components/ResponsePane/QueryResult/index.js @@ -85,7 +85,16 @@ const QueryResult = ({ item, collection, data, dataBuffer, width, disableRunEven {tabs}
{error ? ( - {error} +
+
{error}
+ + {error && typeof error === 'string' && error.toLowerCase().includes('self signed certificate') ? ( +
+ You can disable SSL verification in the Preferences.
+ To open the Preferences, click on the gear icon in the bottom left corner. +
+ ) : null} +
) : ( props.theme.requestTabPanel.responseStatus}; +`; + +export default StyledWrapper; diff --git a/packages/bruno-app/src/components/ResponsePane/ResponseSave/index.js b/packages/bruno-app/src/components/ResponsePane/ResponseSave/index.js new file mode 100644 index 00000000..9af5e73a --- /dev/null +++ b/packages/bruno-app/src/components/ResponsePane/ResponseSave/index.js @@ -0,0 +1,32 @@ +import React from 'react'; +import StyledWrapper from './StyledWrapper'; +import toast from 'react-hot-toast'; +import get from 'lodash/get'; +import { IconDownload } from '@tabler/icons'; + +const ResponseSave = ({ item }) => { + const { ipcRenderer } = window; + const response = item.response || {}; + + const saveResponseToFile = () => { + return new Promise((resolve, reject) => { + console.log(item); + ipcRenderer + .invoke('renderer:save-response-to-file', response, item.requestSent.url) + .then(resolve) + .catch((err) => { + toast.error(get(err, 'error.message') || 'Something went wrong!'); + reject(err); + }); + }); + }; + + return ( + + + + ); +}; +export default ResponseSave; diff --git a/packages/bruno-app/src/components/ResponsePane/StatusCode/index.js b/packages/bruno-app/src/components/ResponsePane/StatusCode/index.js index 2917634a..9287899b 100644 --- a/packages/bruno-app/src/components/ResponsePane/StatusCode/index.js +++ b/packages/bruno-app/src/components/ResponsePane/StatusCode/index.js @@ -6,7 +6,7 @@ import StyledWrapper from './StyledWrapper'; // Todo: text-error class is not getting pulled in for 500 errors const StatusCode = ({ status }) => { const getTabClassname = (status) => { - return classnames('', { + return classnames('ml-2', { 'text-ok': status >= 100 && status < 200, 'text-ok': status >= 200 && status < 300, 'text-error': status >= 300 && status < 400, diff --git a/packages/bruno-app/src/components/ResponsePane/index.js b/packages/bruno-app/src/components/ResponsePane/index.js index dbae1550..fb5aab04 100644 --- a/packages/bruno-app/src/components/ResponsePane/index.js +++ b/packages/bruno-app/src/components/ResponsePane/index.js @@ -14,6 +14,7 @@ import Timeline from './Timeline'; import TestResults from './TestResults'; import TestResultsLabel from './TestResultsLabel'; import StyledWrapper from './StyledWrapper'; +import ResponseSave from 'src/components/ResponsePane/ResponseSave'; const ResponsePane = ({ rightPaneWidth, item, collection }) => { const dispatch = useDispatch(); @@ -112,6 +113,7 @@ const ResponsePane = ({ rightPaneWidth, item, collection }) => { {!isLoading ? (
+ diff --git a/packages/bruno-app/src/components/Sidebar/index.js b/packages/bruno-app/src/components/Sidebar/index.js index 89076197..a6df7141 100644 --- a/packages/bruno-app/src/components/Sidebar/index.js +++ b/packages/bruno-app/src/components/Sidebar/index.js @@ -7,7 +7,7 @@ import Preferences from 'components/Preferences'; import { useState, useEffect } from 'react'; import { useSelector, useDispatch } from 'react-redux'; import { IconSettings } from '@tabler/icons'; -import { updateLeftSidebarWidth, updateIsDragging } from 'providers/ReduxStore/slices/app'; +import { updateLeftSidebarWidth, updateIsDragging, showPreferences } from 'providers/ReduxStore/slices/app'; import { useTheme } from 'providers/Theme'; const MIN_LEFT_SIDEBAR_WIDTH = 222; @@ -15,7 +15,7 @@ const MAX_LEFT_SIDEBAR_WIDTH = 600; const Sidebar = () => { const leftSidebarWidth = useSelector((state) => state.app.leftSidebarWidth); - const [preferencesOpen, setPreferencesOpen] = useState(false); + const preferencesOpen = useSelector((state) => state.app.showPreferences); const [asideWidth, setAsideWidth] = useState(leftSidebarWidth); @@ -78,7 +78,7 @@ const Sidebar = () => {