Skip to content
This repository was archived by the owner on Jan 19, 2026. It is now read-only.

v4#181

Merged
alvarosabu merged 334 commits into
mainfrom
next
Jun 19, 2025
Merged

v4#181
alvarosabu merged 334 commits into
mainfrom
next

Conversation

@alvarosabu
Copy link
Copy Markdown
Contributor

Brand new fancy Storyblok CLI

BREAKING CHANGE: Generated files will no longer be saved on the root of the project by default, they will be encapsulated inside of a `.storyblok` folder.
BREAKING CHANGE: generated file naming syntax is now standard between all the commands, following the structure `<filename>.<suffix>.json`. Both filename and suffix are customizable and by default would be the command name and the spaceId respectively. Ex: `components.12345.json`
…fault

feat!: `.storyblok` directory default
…syntax

feat!: generated file naming syntax
- Removed the ofetch dependency from multiple files and replaced it with a customFetch utility for better error handling and flexibility.
- Updated API calls in login, pull languages, and user actions to use the new fetch method.
- Introduced a new ResponseError interface for improved error management.
- Added a getStoryblokUrl utility function to centralize URL construction based on region.
- Enhanced error handling in API error management to accommodate the new FetchError class.
- Updated `NetrcMachine` and `SessionState` interfaces to use `RegionCode` for improved type safety.
- Refactored login actions to handle optional chaining for better error handling.
- Enhanced API calls to utilize the new `customFetch` utility with improved type definitions.
- Added tests for `customFetch` to ensure robust error handling and response management.
… update session handling

- Updated `getCredentials` to create a credentials file if it does not exist, returning an empty object.
- Changed `removeCredentials` to accept a region code instead of a machine name, using the region to determine the machine name.
- Refactored `persistCredentials` to use region code directly.
- Updated tests to reflect changes in credential management and session handling.
alvarosabu added 14 commits May 23, 2025 13:40
…n-the-list (#204)

* fix: call spinner.failed on warning

- Added a spinner failure indication when no languages are found.
- Updated the warning message format in the konsola utility for better readability.

* chore: enable sourcemaps for debugging

* tests: update warning message format in tests
* fix: skip region select if region flag is used

* tests: update tests messages
… Storyblok types (#208)

- Updated the path resolution for the Storyblok types file to use __dirname for better reliability.
- Simplified the type extraction process by directly using the content of the storyblokTypesContent instead of manually collecting type definitions.
- Ensured that the schema handling is more robust by adding a fallback for component.schema.
* fix(creds): get first credential to operate

* fix(creds): update getCredentials to return empty object instead of null

- Modified the getCredentials function to return an empty object when the credentials file does not exist, improving type consistency.
- Updated related tests to reflect this change, ensuring that the expected output aligns with the new implementation.
- Introduced a utility function isEmptyObject to check for empty objects, enhancing code readability and maintainability.

* fix(creds): update getCredentials to return null for empty credentials

- Modified the getCredentials function to return null instead of an empty object when the credentials file is empty or does not exist, improving type consistency.
- Updated related tests to reflect this change, ensuring that the expected output aligns with the new implementation.
- Adjusted session handling to check for null credentials, enhancing the robustness of the session creation process.

* refactor(session): remove unused isEmptyObject import

- Removed the unused import of isEmptyObject from utils, streamlining the session.ts file and improving code clarity.
- This change does not affect the functionality of the session handling.
…210)

* fix(type):  generate single and multi options fields types correctly

* refactor(types): correctly handle camelCase
…ntsFiles (#212)

- Improved error messages in readComponentsFiles to provide clearer instructions for users when no local components are found for a specified space.
- Added a new optional `space` parameter to the ReadComponentsOptions interface to support better context in component operations.
- Updated related tests to ensure the new space parameter is correctly utilized and error messages are formatted with chalk for better readability.
- Included the @storyblok/js package in package.json to enhance Storyblok integration.
- Updated pnpm-lock.yaml to reflect the new dependency and its version.
* fix(type): import ISbStoryData from storyblok-js package

- Added an import statement for the Storyblok type to the generated types file, enhancing type safety and ensuring proper type definitions are utilized in the generated output.

* fix(tests): enhance verification of generated Storyblok types in tests

- Updated the test for `generateStoryblokTypes` to verify the first three lines of the generated content, ensuring that the output includes the correct header comments and the import statement for `ISbStoryData`.
- This change improves the accuracy of the tests by checking specific content rather than relying on a regex match, enhancing maintainability and clarity.
- Introduced a new `handleVerboseError` function to centralize and enhance the logging of different error types (CommandError, APIError, FileSystemError).
- Simplified the `handleError` function by delegating verbose error handling to the new function, improving code readability and maintainability.
- This change ensures that all error types are logged consistently and provides clearer information for debugging.
…ching (#220)

* fix(components): enhance circular dependency handling in resource fetching

- Added a mechanism to track visited components during resource fetching to prevent circular dependencies.
- Updated the `findRelatedResources` function to filter out components that have already been visited, ensuring that only new components are processed.
- Improved error handling by skipping components that would create circular dependencies, enhancing the robustness of the component operations.

* fix(tests): update circular dependency handling tests for improved accuracy

- Mocked successful responses in the test for circular dependency handling to ensure accurate verification of component processing.
- Adjusted assertions to reflect that circular dependencies are now handled by skipping, resulting in no failures and confirming that only valid components are processed.
- This change enhances the robustness of the tests and ensures they align with the updated logic for handling circular dependencies.
…222)

* fix: add pagination control to custom-fetch and fetchStories method

* fix(stories): setting default per_page parameter to 100

* fix(tests): update fetchStories tests to include default per_page parameter in request URLs
alvarosabu and others added 11 commits June 11, 2025 11:51
* feat: wip mapi client with retry mechanism

* feat: freeze mechanism for retry

* feat: wip concurrency limit

* refactor: replaced custom fetch with mapi client with retry mechanism for component internal tags

* refactor: replace customFetch with mapiClient on all component related operations

* refactor: simplify function signatures by removing unnecessary parameters in component handling functions

- Removed `password` and `region` parameters from `handleTags`, `handleComponentGroups`, `handleWhitelists`, and `upsertComponentPreset` functions, streamlining the function calls and improving clarity.
- Updated corresponding tests to reflect the changes in function signatures, ensuring consistency across the codebase.

* refactor(tests): remove unused mock variables in operations tests

- Eliminated `mockPassword` and `mockRegion` constants from `operations.test.ts` as they are no longer necessary, streamlining the test setup.
- Updated `operations.ts` to remove the import of `RegionCode`, reflecting the recent changes in function signatures and improving code clarity.

* chore: remove p-limit dependency from package.json and pnpm-lock.yaml

- Eliminated `p-limit` from `package.json` and corresponding entries in `pnpm-lock.yaml` to streamline dependencies and reduce package size.
* fix: add mapiclient initialization to migrations generate

* chore: add type checking script and refine TypeScript configuration

- Added a new script for type checking in package.json to ensure type safety during development.
- Updated tsconfig.json to include specific TypeScript file patterns and exclude test files, improving the clarity and efficiency of the TypeScript compilation process.
- Enhanced type safety in creds.ts by introducing a type guard for credential keys and ensuring proper checks before accessing credentials.
- Refined error handling in login actions by explicitly typing the error as FetchError for better clarity.
- Updated the loadCustomFieldsParser function to return undefined instead of null, aligning with TypeScript best practices for better type safety.

* refactor: rename and implement removeAllCredentials function

- Replaced the existing removeCredentials function with removeAllCredentials to improve clarity and functionality.
- Updated tests to reflect the new function name and ensure proper behavior when removing all credentials from the specified file.
- Enhanced the code structure by removing unnecessary logic related to specific region handling, streamlining the credential removal process.

* refactor: simplify credential handling in creds.ts

- Removed unnecessary imports and a type guard for credential keys to streamline the code.
- Enhanced clarity by focusing on the essential functionality of the getCredentials function.
- This change improves maintainability and reduces complexity in the credential management logic.
* chore(utils): add requireAuthentication check for login

* chore: add signup command and tests

* fix(konsola): mock konsola for consistent test errors

* test: Remove unused imports in test files

* Update src/commands/components/pull/index.test.ts

* Update src/utils/auth.ts

* fix(tests): correct spelling in error messages for consistency

---------

Co-authored-by: Alvaro Saburido <alvaro.saburido@gmail.com>
* feat: wip mapi client with retry mechanism

* feat: freeze mechanism for retry

* feat: wip concurrency limit

* refactor: replaced custom fetch with mapi client with retry mechanism for component internal tags

* refactor: replace customFetch with mapiClient on all component related operations

* refactor: replace upserting logic with local saved target data and maps lookouts

* refactor: implement graph-based dependency resolution for push

* fix(progress-display): Adds centralized progress tracking and display

* refactor: add optional existingId for efficient upsert operations

* fix(dep-refs): update references after ID changes

* feat(graph-operations): add dependency graph and utils for processing

* refactor(graph-operations): Remove unused processed property

* refactor(graph): implement node classes with reference resolution

* refactor(graph): add preset nodes and dependencies to graph

* fix(resource-processing): handle circular deps via stubs

* chore: add minimatch dependency

* refactor(graph-operations): remove unused imports and code

* refactor(remove): delete obsolete test files

* refactor(utils): fix import of minimatch module

* refactor(comparison-utils): improve array normalization handling

* refactor(constants): add new color constants for groups, tags, and presets; update logging to use chalk for better readability

* refactor(push): use konsola ok

* refactor(progress-display): enhance progress tracking with elapsed time for events

* chore: temporarely log requests made

* fix(push): Remove unused force parameter from functions

* refactor(push): simplify space data filtering logic

* chore: remove deprecated graph-operations.ts file

* chore: update lock file

* refactor: enhance dependency collection for push components

* chore: disable max-statements-per-line rule in ESLint configuration

* fix(push): remove duplicate return statement in updateComponentGroup function

* refactor(dep-graph): add preset dependency handling and resolve preset IDs

---------

Co-authored-by: alvarosabu <alvaro.saburido@gmail.com>
@alvarosabu alvarosabu merged commit 142471e into main Jun 19, 2025
6 checks passed
alvarosabu added a commit that referenced this pull request Aug 22, 2025
This reverts commit 142471e.
alvarosabu added a commit that referenced this pull request Aug 22, 2025
This reverts commit 142471e.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

breaking-change Changes that cause backward compatibility issues and will require a major version. v4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants