-
Notifications
You must be signed in to change notification settings - Fork 22
feat: angular sdk overhaul #132
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
SwarnimDoegar
wants to merge
11
commits into
imagekit-developer:master
Choose a base branch
from
SwarnimDoegar:angular-sdk-overhaul
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
e5c9eba
feat: angular sdk overhaul
SwarnimDoegar 901e9a0
chore: Add sdk install script in test-app
SwarnimDoegar 196ce69
chore: update documentation
SwarnimDoegar 4d7bdf2
feat: add provideImageKit for standalone angular apps
SwarnimDoegar 7a45362
chore: update README for standalone app specific instructions
SwarnimDoegar f0c899b
Rename SDK module
SwarnimDoegar 85def5a
chore: Update READMEs
SwarnimDoegar 4dc0e1b
chore: Remove unwanted imports
SwarnimDoegar 96c1f9e
fix: Resolve AI review comments
SwarnimDoegar bf79dea
fix: Resolve AI review comment
SwarnimDoegar a15bc81
fix: Resolve SDK comments
SwarnimDoegar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,34 +1,80 @@ | ||
| ## SDK development | ||
|
|
||
| SDK is build in angular 4 for forward compatibilty and `ng-packagr` is used to create final package. Make sure `@angular/cli` is at `v1.4.*` and node ver `14.x` before building the package. | ||
| SDK is built using Angular 12.x and `ng-packagr` for packaging. The project is located in the `sdk/` directory. | ||
|
|
||
| **Prerequisites:** | ||
| - Node.js v14.x | ||
| - Angular CLI compatible with Angular 12.x | ||
|
|
||
| ## Building package | ||
|
|
||
| Execute following command from the `sdk` folder to build the library. This creates a package in `dist/imagekitio-angular` folder. | ||
| Execute the following command from the `sdk` folder to build the library. This creates a package in `dist/imagekit-angular` folder. | ||
| ```sh | ||
| # run `npm install` for first time | ||
| # Install dependencies (first time) | ||
| npm install | ||
|
|
||
| # Build the SDK | ||
| npm run build | ||
| ``` | ||
|
|
||
| ## Running test cases | ||
|
|
||
| The designated directory for the tests is `sdk/tests/sdk-tests` folder. All tests will be executed once on the Chrome Headless browser. | ||
| ### Unit Tests | ||
|
|
||
| The designated directory for the tests is `sdk/tests/sdk-tests` folder. All tests are executed on Chrome Headless browser. | ||
|
|
||
| Execute following command from the `sdk` folder to start testing. | ||
| Execute the following command from the `sdk` folder to run unit tests: | ||
| ```sh | ||
| # Run tests in watch mode | ||
| npm run test | ||
|
|
||
| # Run tests once for CI | ||
| npm run test:ci | ||
| ``` | ||
|
|
||
| ### E2E Tests | ||
|
|
||
| E2E tests are located in the `test-app/` directory and use Cypress for browser automation. | ||
|
|
||
| To run E2E tests: | ||
| ```sh | ||
| # Navigate to test-app directory | ||
| cd test-app | ||
|
|
||
| # Install the SDK | ||
| ./install_sdk.sh | ||
|
|
||
| # Install dependencies | ||
| npm install | ||
|
|
||
| # Start the dev server in one terminal | ||
| npm start | ||
|
|
||
| # Run Cypress tests in another terminal | ||
| npm run e2e | ||
|
|
||
| # Or open Cypress UI | ||
| npm run e2e:open | ||
| ``` | ||
|
|
||
| ## Building custom SDK for sample angular app | ||
|
|
||
| Repository to get sample app: https://github.com/imagekit-samples/quickstart | ||
|
|
||
| Before sample apps can be used, `imagekitio-angular` library needs to be packed and installed using the file system within the sample apps. Use the following steps to run any sample app. | ||
| Before sample app can be used, `@imagekit/angular` library needs to be packed and installed using the file system within the sample app. Use the following steps to run any sample app: | ||
|
|
||
| 1. Navigate to the `test-app` directory | ||
| 2. Run ./install_sdk.sh. This will build and pack the sdk and install it in the `test-app` project | ||
|
|
||
| 7. Use `npm start` from the `test-app` folder to run the app | ||
|
|
||
| ## Testing with the test-app | ||
|
|
||
| The repository includes a `test-app/` directory that demonstrates SDK usage: | ||
|
|
||
| 1. In the `sdk` folder, install dependencies with `npm install` | ||
| 2. Build library with `npm run build` | ||
| 3. In the `sdk/dist/imagekitio-angular` folder, use `npm pack` to create a tarball with version mentioned in the current package.json for sdk. | ||
| 4. Go to the Angular sample app's root folder and use `npm install` to install dependencies. | ||
| 5. Use `npm install <path to this SDK>/sdk/dist/imagekitio-angular/imagekitio-angular-x.x.x.tgz` where x.x.x needs to be replaced with the current version. For example, SDK version is `0.0.1`, then above command becomes `npm install <path to this SDK>/sdk/dist/imagekitio-angular/imagekitio-angular-2.0.0.tgz` | ||
| 6. Configure sample app with required keys. Use each app's `Readme.md` for exact details. | ||
| 7. Use npm start from the Angular sample app's root folder to run the app | ||
| 1. Build the SDK as described above | ||
| 2. Navigate to `test-app/` directory | ||
| 3. Install the built SDK: `./install_sdk.sh` | ||
| 4. Configure environment variables in `test-app/src/environments/` | ||
| 5. Run the app: `npm start` | ||
| 6. Access the demo at `http://localhost:4200` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| MIT License | ||
|
|
||
| Copyright (c) 2025 ImageKit Private Limited | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using Node.js 14.x which reached End-of-Life on April 30, 2023.