[PR #3380] [MERGED] feat: introduces ability to export single environment variables and allow CLI to accept the export format used by the app #4362

Closed
opened 2026-03-17 01:54:22 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/3380
Author: @joeljstephen
Created: 9/21/2023
Status: Merged
Merged: 10/6/2023
Merged by: @AndrewBastin

Base: release/2023.8.2Head: fix/cli-environment-export


📝 Commits (10+)

  • a7fd1dd feat: add ability to export a single environment
  • aff21b8 refactor: export environment without id
  • f226974 feat: introducing zod for checking json format for environment variables
  • 5142ca4 refactor: new zod specific type for HoppEnvPair
  • f14b67a feat: add ability to export single environment in team environment
  • 1496797 refactor: moved zod as a dependency to devDependency
  • acf9e21 refactor: separated repeating logic to helper file
  • 29c160a refactor: removed unnecessary to string operation
  • fc3f8ce chore: rearranged smart item placement
  • 269c173 refactor: introduced error type when a bulk environment export is used in cli

📊 Changes

11 files changed (+196 additions, -258 deletions)

View changed files

📝 packages/hoppscotch-cli/package.json (+3 -2)
📝 packages/hoppscotch-cli/src/handlers/error.ts (+6 -1)
📝 packages/hoppscotch-cli/src/options/test/env.ts (+30 -12)
📝 packages/hoppscotch-cli/src/types/errors.ts (+1 -0)
📝 packages/hoppscotch-cli/src/types/request.ts (+17 -0)
📝 packages/hoppscotch-common/locales/en.json (+1 -0)
📝 packages/hoppscotch-common/src/components/environments/my/Environment.vue (+22 -0)
📝 packages/hoppscotch-common/src/components/environments/teams/Environment.vue (+21 -0)
packages/hoppscotch-common/src/helpers/import-export/export/environment.ts (+48 -0)
📝 packages/hoppscotch-sh-admin/src/components.d.ts (+1 -0)
📝 pnpm-lock.yaml (+46 -243)

📄 Description

Ticket

Closes HFE-203

Description

This PR introduces the following features and fixes to the Hoppscotch App and Hoppscotch CLI

Features Added:

  • Added the ability to export single environment variables from the Hoppscotch App
  • CLI can now accept environment variables from the format in which the Hoppscotch App exports.
  • Introduced Zod package into the Hoppscotch CLI to check the validity of the formats for the Environment variables.
  • CLI now informs the user that bulk environment export is not supported by the CLI when the file matches the bulk export format.

Issues Fixes:

  • Fix the malformed environments error when importing a environment file that was exported from the Hoppscotch App to the CLI.
  • Fix the issue when there are are no error messages being given when it is a malformed environment error

Objectives

  • Add ability to export single environment variables
  • On export of environment variables, remove id from environment and send only the name and variables.
  • The CLI should be able to receive the format that is exported when exporting environment variables from the Hoppscotch App.
  • Fix the malformed environments error when importing a environment file that was exported from the app to the CLI.
  • CLI should inform the user that bulk environment export is not supported by the CLI when the file matches the bulk export format.

Note

Requires changes to the Documentation as the CLI can now accept the format that the Hoppscotch App uses to export environment variables. The new format must be mentioned in the documentation. Also need to mention that bulk environment export is not supported by the CLI.

Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hoppscotch/hoppscotch/pull/3380 **Author:** [@joeljstephen](https://github.com/joeljstephen) **Created:** 9/21/2023 **Status:** ✅ Merged **Merged:** 10/6/2023 **Merged by:** [@AndrewBastin](https://github.com/AndrewBastin) **Base:** `release/2023.8.2` ← **Head:** `fix/cli-environment-export` --- ### 📝 Commits (10+) - [`a7fd1dd`](https://github.com/hoppscotch/hoppscotch/commit/a7fd1dda6f9b2a79007f30530bbd91b613222df3) feat: add ability to export a single environment - [`aff21b8`](https://github.com/hoppscotch/hoppscotch/commit/aff21b8f7324d2c962cf604d5640837bf92fcfb0) refactor: export environment without id - [`f226974`](https://github.com/hoppscotch/hoppscotch/commit/f226974101f618b9c9e4f19b7a49fc5b452bc5eb) feat: introducing zod for checking json format for environment variables - [`5142ca4`](https://github.com/hoppscotch/hoppscotch/commit/5142ca4a5463bf4288d58fa1e2734697425c42b6) refactor: new zod specific type for HoppEnvPair - [`f14b67a`](https://github.com/hoppscotch/hoppscotch/commit/f14b67a07e27b88e5ddf32967f77f588eec406b9) feat: add ability to export single environment in team environment - [`1496797`](https://github.com/hoppscotch/hoppscotch/commit/14967976910b36da09615302fcdf5ee53d25de16) refactor: moved zod as a dependency to devDependency - [`acf9e21`](https://github.com/hoppscotch/hoppscotch/commit/acf9e21595f4dba2354ffc4e7b21ca2ff1955c4c) refactor: separated repeating logic to helper file - [`29c160a`](https://github.com/hoppscotch/hoppscotch/commit/29c160a49bce059673c42a046faced81d7f4ecbb) refactor: removed unnecessary to string operation - [`fc3f8ce`](https://github.com/hoppscotch/hoppscotch/commit/fc3f8ce67874a1d34c854b23958033d98016ccff) chore: rearranged smart item placement - [`269c173`](https://github.com/hoppscotch/hoppscotch/commit/269c173628565ad2fbfb7c377cf60fcf7cc31644) refactor: introduced error type when a bulk environment export is used in cli ### 📊 Changes **11 files changed** (+196 additions, -258 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-cli/package.json` (+3 -2) 📝 `packages/hoppscotch-cli/src/handlers/error.ts` (+6 -1) 📝 `packages/hoppscotch-cli/src/options/test/env.ts` (+30 -12) 📝 `packages/hoppscotch-cli/src/types/errors.ts` (+1 -0) 📝 `packages/hoppscotch-cli/src/types/request.ts` (+17 -0) 📝 `packages/hoppscotch-common/locales/en.json` (+1 -0) 📝 `packages/hoppscotch-common/src/components/environments/my/Environment.vue` (+22 -0) 📝 `packages/hoppscotch-common/src/components/environments/teams/Environment.vue` (+21 -0) ➕ `packages/hoppscotch-common/src/helpers/import-export/export/environment.ts` (+48 -0) 📝 `packages/hoppscotch-sh-admin/src/components.d.ts` (+1 -0) 📝 `pnpm-lock.yaml` (+46 -243) </details> ### 📄 Description ### Ticket Closes HFE-203 ### Description This PR introduces the following features and fixes to the `Hoppscotch App` and `Hoppscotch CLI` **Features Added:** - Added the ability to export single environment variables from the `Hoppscotch App` - CLI can now accept environment variables from the format in which the `Hoppscotch App` exports. - Introduced `Zod` package into the `Hoppscotch CLI` to check the validity of the formats for the Environment variables. - CLI now informs the user that bulk environment export is not supported by the CLI when the file matches the bulk export format. **Issues Fixes:** - Fix the malformed environments error when importing a environment file that was exported from the `Hoppscotch App` to the CLI. - Fix the issue when there are are no error messages being given when it is a malformed environment error ### Objectives - [x] Add ability to export single environment variables - [x] On export of environment variables, remove id from environment and send only the name and variables. - [x] The CLI should be able to receive the format that is exported when exporting environment variables from the Hoppscotch App. - [x] Fix the malformed environments error when importing a environment file that was exported from the app to the CLI. - [x] CLI should inform the user that bulk environment export is not supported by the CLI when the file matches the bulk export format. ### Note > Requires changes to the Documentation as the CLI can now accept the format that the `Hoppscotch App` uses to export environment variables. The new format must be mentioned in the documentation. Also need to mention that bulk environment export is not supported by the CLI. ### Checks <!-- Make sure your pull request passes the CI checks and do check the following fields as needed - --> - [x] My pull request adheres to the code style of this project - [x] My code requires changes to the documentation - [ ] I have updated the documentation as required - [x] All the tests have passed --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-17 01:54:22 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#4362
No description provided.