Skip to content

Commit 086bbbb

Browse files
authored
Merge pull request #43 from imagekit-developer/sdk-v2-upgrade
Sdk v2 upgrade
2 parents b23c2e4 + 2d5a537 commit 086bbbb

File tree

218 files changed

+18109
-5130
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

218 files changed

+18109
-5130
lines changed

.github/workflows/nodejs.yml

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Node CI
22

3-
on: [push]
3+
on: [push, pull_request]
44

55
jobs:
66
build:
@@ -9,7 +9,7 @@ jobs:
99

1010
strategy:
1111
matrix:
12-
node-version: [8.x, 10.x, 12.x]
12+
node-version: [14.x]
1313

1414
steps:
1515
- uses: actions/checkout@v1
@@ -22,9 +22,63 @@ jobs:
2222
npm install -g @angular/[email protected]
2323
cd sdk
2424
npm install
25-
npm run test
25+
npm run test:ci
2626
env:
2727
CI: true
2828
PUBLIC_KEY: ${{ secrets.ik_public_key }}
2929
PRIVATE_KEY: ${{ secrets.ik_private_key }}
3030
URL_ENDPOINT: ${{ secrets.ik_url_endopint }}
31+
e2e:
32+
runs-on: ubuntu-latest
33+
34+
strategy:
35+
matrix:
36+
node-version: [14.x]
37+
steps:
38+
- uses: actions/checkout@v3
39+
40+
- name: Use Node.js ${{ matrix.node-version }}
41+
uses: actions/setup-node@v1
42+
with:
43+
node-version: ${{ matrix.node-version }}
44+
45+
- name: Create e2e environment variables
46+
run: |
47+
cd sdk/src/environments
48+
echo export const environment = { > environment.ts;
49+
echo production: false, >> environment.ts;
50+
echo URL_ENDPOINT:\"https://ik.imagekit.io/sdktestingik\", >> environment.ts;
51+
echo PUBLIC_KEY:\"${{ secrets.ik_public_key }}\", >> environment.ts;
52+
echo AUTHENTICATION_ENDPOINT:\"http://localhost:3000/auth\" >> environment.ts;
53+
echo '};' >> environment.ts;
54+
less environment.ts
55+
56+
- name: Start client server
57+
run: |
58+
cd sdk
59+
npm install
60+
npm start &
61+
- name: Start auth server
62+
run: |
63+
cd sdk/tests/test-apps/sample-server
64+
echo PRIVATE_KEY=${{ secrets.ik_private_key }} >> .env;
65+
npm install
66+
npm run server &
67+
env:
68+
CI: true
69+
PUBLIC_KEY: ${{ secrets.ik_public_key }}
70+
PRIVATE_KEY: ${{ secrets.ik_private_key }}
71+
URL_ENDPOINT: https://ik.imagekit.io/sdktestingik
72+
- name: Run E2E tests
73+
uses: cypress-io/github-action@v5
74+
with:
75+
install: false
76+
wait-on: 'http://localhost:4200'
77+
working-directory: sdk
78+
env:
79+
DEBUG: 'cypress:server:browsers:electron'
80+
CI: true
81+
PUBLIC_KEY: ${{ secrets.ik_public_key }}
82+
PRIVATE_KEY: ${{ secrets.ik_private_key }}
83+
URL_ENDPOINT: https://ik.imagekit.io/sdktestingik
84+
AUTHENTICATION_ENDPOINT: 'http://localhost:3000/auth'

.github/workflows/npmpublish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212

1313
strategy:
1414
matrix:
15-
node-version: [8.x, 10.x, 12.x]
15+
node-version: [14.x]
1616

1717
steps:
1818
- uses: actions/checkout@v1
@@ -40,7 +40,7 @@ jobs:
4040
- uses: actions/checkout@v1
4141
- uses: actions/setup-node@v1
4242
with:
43-
node-version: 12
43+
node-version: 14
4444
registry-url: https://registry.npmjs.org/
4545
- name: npm publish
4646
run: |
File renamed without changes.

DEVELOPMENT.md

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## SDK development
22

3-
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.*` before building the package.
3+
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.
44

55
## Building package
66

@@ -12,30 +12,23 @@ npm run build
1212

1313
## Running test cases
1414

15-
The designated directory for tests is `sdk/src/sdk-tests` folder. All tests will be executed once on the Chrome Headless browser.
15+
The designated directory for tests is `sdk/tests/sdk-tests` folder. All tests will be executed once on the Chrome Headless browser.
1616

1717
Execute following command from the `sdk` folder to start testing.
1818
```sh
1919
npm run test
2020
```
2121

22-
## Running sample angular app
22+
## Building custom SDK for sample angular app
23+
24+
Repository to get sample app: https://github.com/imagekit-samples/quickstart
2325

24-
Every sample app requires a different version of Angular CLI. Please refer to the individual sample app `Readme.md` for details.
2526
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.
2627

2728
1. In the `sdk` folder, install dependencies with `npm install`
2829
2. Build library with `npm run build`
2930
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.
30-
4. Go to `samples/imagekitio-angular<x>-sample` folder and use `npm install` to install dependencies.
31-
5. Use `npm install ../../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 ../../sdk/dist/imagekitio-angular/imagekitio-angular-0.0.1.tgz`
31+
4. Go to the Angular sample app's root folder and use `npm install` to install dependencies.
32+
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`
3233
6. Configure sample app with required keys. Use each app's `Readme.md` for exact details.
33-
7. Use npm start from the `samples/imagekitio-angular<x>-sample` folder to run the app for a particular angular version.
34-
35-
## Running sample backend server
36-
37-
Sample server for upload implementation is available at `samples/sample-server`. To run the server, follow these steps
38-
39-
1. Create a `.env` file based on `sample.env` and enter your private key.
40-
2. Use `npm install` to install dependencies.
41-
3. Use `npm run server` to start the server. It will expose the [authentication endpoint](https://docs.imagekit.io/api-reference/upload-file-api/client-side-file-upload#how-to-implement-authenticationendpoint-endpoint) on `http://localhost:3000/auth`
34+
7. Use npm start from the Angular sample app's root folder to run the app

0 commit comments

Comments
 (0)