Skip to content

Strapi ImageKit Provider #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open

Strapi ImageKit Provider #2

wants to merge 19 commits into from

Conversation

ahnv
Copy link
Member

@ahnv ahnv commented Apr 3, 2025

This pull request introduces several improvements to the repository, including configuration updates, build setup enhancements, and documentation additions. The most important changes include the addition of ESLint configurations, a Rollup-based build system, and detailed documentation for contributors and users. Below is a categorized summary of the key updates:

Configuration and Workflow Enhancements:

  • Added .eslintrc.js with TypeScript and RxJS linting configurations to enforce code quality and consistency. Several rules are customized or disabled to align with the project's needs. (.eslintrc.js)
  • Introduced a GitHub Actions workflow (.github/workflows/publish.yml) to automate the build, test, and publish process upon release events. (.github/workflows/publish.yml)
  • Added .eslintignore to exclude unnecessary files and directories such as node_modules and build artifacts from linting. (.eslintignore)

Build System Setup:

  • Implemented a Rollup configuration (rollup.config.mjs) for building the project with support for TypeScript, dynamic imports, and other modern features. (rollup.config.mjs)
  • Updated package.json with build scripts, peer dependencies, and metadata for publishing the package. (package.json)

Documentation Improvements:

  • Added a comprehensive README.md with installation, configuration, and usage instructions for the ImageKit Strapi Upload Provider. It also includes troubleshooting tips and links to resources. (README.md)
  • Added a CONTRIBUTING.md file to guide contributors on how to get started, follow code style guidelines, and submit pull requests. (CONTRIBUTING.md)

Miscellaneous Updates:

  • Added .gitattributes to ensure consistent line endings and define handling for various file types. (.gitattributes)
  • Added .npmignore to exclude unnecessary files from the published package, such as logs, tests, and OS-specific files. (.npmignore)

These changes collectively enhance the development workflow, improve code quality, and provide clear documentation for contributors and users.

@ahnv ahnv requested a review from Copilot April 4, 2025 10:40
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • package.json: Language not supported
Comments suppressed due to low confidence (1)

src/index.ts:26

  • The assignment to file.provider_metadata is duplicated. The object set on line 22 is immediately overwritten; consider merging the assignments into one to avoid potential confusion.
file.provider_metadata = { fileId: fileId, ...uploadOptions };

@ahnv ahnv requested a review from Copilot April 28, 2025 11:27
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request adds a new ImageKit provider for Strapi by introducing new upload utilities, updated types and interfaces, a robust build system using Rollup, improved ESLint configurations, and comprehensive documentation to guide both contributors and users.

  • Added utility functions and type definitions for file uploads
  • Implemented the main provider class with image upload, deletion, and signed URL generation methods
  • Enhanced build configuration, linting rules, CI/CD workflows, and documentation

Reviewed Changes

Copilot reviewed 14 out of 22 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/utils.ts Adds helper functions for parameter transformation and error handling.
src/interfaces/ProviderOptions.ts Introduces types for provider options to enforce configuration.
src/interfaces.ts Defines core interfaces and types for the provider.
src/index.ts Implements the primary provider functionality including upload and deletion.
rollup.config.mjs Provides the Rollup build configuration setup for module bundling.
README.md Improves user documentation with installation and configuration instructions.
LICENSE Adds the MIT license to the repository.
CONTRIBUTING.md Contains guidelines for contributing to the project.
.github/workflows/publish.yml Automates build, test, and publish actions on release events.
.eslintrc.js Updates ESLint settings with custom rules specific to the project.
Files not reviewed (8)
  • .eslintignore: Language not supported
  • .gitattributes: Language not supported
  • .npmignore: Language not supported
  • .nvmrc: Language not supported
  • nodemon.json: Language not supported
  • package.json: Language not supported
  • tsconfig.build.json: Language not supported
  • tsconfig.eslint.json: Language not supported
Comments suppressed due to low confidence (2)

rollup.config.mjs:13

  • The function name 'isExernal' appears to be a typographical error. Consider renaming it to 'isExternal' for improved clarity.
const isExernal = (id) => !path.isAbsolute(id) && !id.startsWith('.');

README.md:140

  • The word 'bellow' in this line appears to be a typo. It should be corrected to 'below'.
You should replace `strapi::security` string with the object bellow instead as explained in the [middleware configuration](https://docs.strapi.io/developer-docs/latest/setup-deployment-guides/configurations/required/middlewares.html#loading-order).

@ahnv ahnv requested a review from Copilot April 28, 2025 11:31
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces enhancements to the ImageKit Strapi Upload Provider by adding configuration improvements, a Rollup-based build system, and comprehensive documentation to aid contributors and users.

  • Adds utility functions and updated type definitions for robust upload parameter handling.
  • Implements the core ImageKitProvider with improved error handling and logging.
  • Sets up ESLint, GitHub Actions workflows, and detailed documentation for development and usage.

Reviewed Changes

Copilot reviewed 14 out of 22 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/utils.ts Adds utility functions including parameter filtering and error handling.
src/interfaces/ProviderOptions.ts Defines provider options, though contains interface modifiers that should be removed.
src/interfaces.ts Extends type definitions for upload operations and error/result handling.
src/index.ts Implements the main ImageKitProvider class with upload, delete, and URL signing functionalities.
rollup.config.mjs Configures Rollup for building the project with modern plugins and settings.
README.md, CONTRIBUTING.md, LICENSE Enhance project documentation and legal clarity.
.github/workflows/publish.yml Automates build, test, and publish processes via GitHub Actions.
.eslintrc.js Introduces ESLint configuration with custom rules tailored to the project.
Files not reviewed (8)
  • .eslintignore: Language not supported
  • .gitattributes: Language not supported
  • .npmignore: Language not supported
  • .nvmrc: Language not supported
  • nodemon.json: Language not supported
  • package.json: Language not supported
  • tsconfig.build.json: Language not supported
  • tsconfig.eslint.json: Language not supported

@abhinavr4
Copy link
Collaborator

Issue with cached images loom

@ahnv
Copy link
Member Author

ahnv commented May 2, 2025

Issue with cached images loom

This has been resolved

@ahnv ahnv requested a review from abhinavr4 May 2, 2025 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants