Skip to content

Commit e5c9eba

Browse files
committed
feat: angular sdk overhaul
1 parent 5259c99 commit e5c9eba

File tree

79 files changed

+27933
-20174
lines changed

Some content is hidden

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

79 files changed

+27933
-20174
lines changed

.github/workflows/nodejs.yml

Lines changed: 25 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,13 @@ jobs:
2222
npm install -g @angular/[email protected]
2323
cd sdk
2424
npm install
25-
cd tests/test-apps/sample-server
26-
echo PRIVATE_KEY=${{ secrets.ik_private_key }} >> .env;
27-
npm install
28-
npm run server &
29-
cd ../../../
3025
npm run test:ci
3126
npm run build
3227
env:
3328
CI: true
34-
PUBLIC_KEY: ${{ secrets.ik_public_key }}
35-
PRIVATE_KEY: ${{ secrets.ik_private_key }}
36-
URL_ENDPOINT: ${{ secrets.ik_url_endopint }}
3729
e2e:
3830
runs-on: ubuntu-latest
31+
needs: build
3932

4033
strategy:
4134
matrix:
@@ -48,41 +41,37 @@ jobs:
4841
with:
4942
node-version: ${{ matrix.node-version }}
5043

51-
- name: Create e2e environment variables
52-
run: |
53-
cd sdk/src/environments
54-
echo export const environment = { > environment.ts;
55-
echo production: false, >> environment.ts;
56-
echo URL_ENDPOINT:\"https://ik.imagekit.io/sdktestingik\", >> environment.ts;
57-
echo PUBLIC_KEY:\"${{ secrets.ik_public_key }}\", >> environment.ts;
58-
echo '};' >> environment.ts;
59-
less environment.ts
60-
61-
- name: Start client server
44+
- name: Build and pack SDK
6245
run: |
6346
cd sdk
6447
npm install
65-
npm start &
66-
- name: Start auth server
48+
npm run build
49+
npm run pack
50+
51+
- name: Install SDK in test-app
6752
run: |
68-
cd sdk/tests/test-apps/sample-server
69-
echo PRIVATE_KEY=${{ secrets.ik_private_key }} >> .env;
53+
cd test-app
54+
# Get SDK version from sdk/package.json
55+
SDK_VERSION=$(node -p "require('../sdk/package.json').version")
56+
echo "Installing SDK version: $SDK_VERSION"
57+
58+
# Update package.json to use the packed tarball
59+
npm install ../sdk/dist/imagekit-angular/imagekit-angular-${SDK_VERSION}.tgz
7060
npm install
71-
npm run server &
72-
env:
73-
CI: true
74-
PUBLIC_KEY: ${{ secrets.ik_public_key }}
75-
PRIVATE_KEY: ${{ secrets.ik_private_key }}
76-
URL_ENDPOINT: https://ik.imagekit.io/sdktestingik
77-
- name: Run E2E tests
78-
uses: cypress-io/github-action@v5
61+
62+
- name: Start test-app server
63+
run: |
64+
cd test-app
65+
npm start &
66+
npx wait-on http://localhost:4200 --timeout 60000
67+
68+
- name: Run Cypress E2E tests
69+
uses: cypress-io/github-action@v6
7970
with:
8071
install: false
72+
working-directory: test-app
8173
wait-on: 'http://localhost:4200'
82-
working-directory: sdk
74+
wait-on-timeout: 60
8375
env:
8476
DEBUG: 'cypress:server:browsers:electron'
85-
CI: true
86-
PUBLIC_KEY: ${{ secrets.ik_public_key }}
87-
PRIVATE_KEY: ${{ secrets.ik_private_key }}
88-
URL_ENDPOINT: https://ik.imagekit.io/sdktestingik
77+
CI: true

.github/workflows/npmpublish.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,10 @@ jobs:
2525
npm install -g @angular/[email protected]
2626
cd sdk
2727
npm install
28-
cd tests/test-apps/sample-server
29-
echo PRIVATE_KEY=${{ secrets.ik_private_key }} >> .env;
30-
npm install
31-
npm run server &
32-
cd ../../../
3328
npm run test:ci
3429
npm run build
3530
env:
3631
CI: true
37-
PUBLIC_KEY: ${{ secrets.ik_public_key }}
38-
PRIVATE_KEY: ${{ secrets.ik_private_key }}
39-
URL_ENDPOINT: ${{ secrets.ik_url_endopint }}
4032

4133
publish:
4234
needs: build
@@ -53,7 +45,7 @@ jobs:
5345
cd sdk
5446
npm install
5547
npm run build
56-
cd dist/imagekitio-angular
48+
cd dist/imagekit-angular
5749
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
5850
npm publish
5951
env:

sdk/.npmignore

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Source files
2+
src/
3+
tests/
4+
5+
# Config files
6+
angular.json
7+
ng-package.json
8+
tsconfig*.json
9+
karma.conf.js
10+
11+
# Node modules
12+
node_modules/
13+
14+
# IDE
15+
.vscode/
16+
.idea/
17+
*.swp
18+
*.swo
19+
20+
# OS files
21+
.DS_Store
22+
Thumbs.db
23+
24+
# Test coverage
25+
coverage/
26+
27+
# Build artifacts (we only want dist/imagekit-angular)
28+
out-tsc/

sdk/angular.json

Lines changed: 10 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@
33
"version": 1,
44
"newProjectRoot": "projects",
55
"projects": {
6-
"imagekitio-angular": {
6+
"@imagekit/angular": {
77
"projectType": "library",
8-
"root": "projects/imagekitio-angular",
9-
"sourceRoot": "projects/imagekitio-angular/src",
10-
"prefix": "lib",
8+
"root": "",
9+
"sourceRoot": "src",
10+
"prefix": "ik",
1111
"architect": {
1212
"build": {
1313
"builder": "@angular-devkit/build-angular:ng-packagr",
1414
"options": {
15-
"project": "projects/imagekitio-angular/ng-package.json"
15+
"project": "ng-package.json"
1616
},
1717
"configurations": {
1818
"production": {
19-
"tsConfig": "projects/imagekitio-angular/tsconfig.lib.prod.json"
19+
"tsConfig": "tsconfig.lib.prod.json"
2020
},
2121
"development": {
22-
"tsConfig": "projects/imagekitio-angular/tsconfig.lib.json"
22+
"tsConfig": "tsconfig.lib.json"
2323
}
2424
},
2525
"defaultConfiguration": "production"
@@ -34,88 +34,9 @@
3434
}
3535
}
3636
}
37-
},
38-
"app": {
39-
"projectType": "application",
40-
"schematics": {
41-
"@schematics/angular:application": {
42-
"strict": true
43-
}
44-
},
45-
"root": "/",
46-
"sourceRoot": "src",
47-
"prefix": "app",
48-
"architect": {
49-
"build": {
50-
"builder": "@angular-devkit/build-angular:browser",
51-
"options": {
52-
"outputPath": "dist/app",
53-
"index": "src/index.html",
54-
"main": "src/main.ts",
55-
"polyfills": "src/polyfills.ts",
56-
"tsConfig": "src/tsconfig.app.json",
57-
"assets": [
58-
"src/favicon.ico",
59-
"src/assets"
60-
],
61-
"styles": [
62-
"src/styles.css"
63-
],
64-
"scripts": []
65-
},
66-
"configurations": {
67-
"production": {
68-
"budgets": [
69-
{
70-
"type": "initial",
71-
"maximumWarning": "500kb",
72-
"maximumError": "1mb"
73-
},
74-
{
75-
"type": "anyComponentStyle",
76-
"maximumWarning": "2kb",
77-
"maximumError": "4kb"
78-
}
79-
],
80-
"fileReplacements": [
81-
{
82-
"replace": "src/environments/environment.ts",
83-
"with": "src/environments/environment.prod.ts"
84-
}
85-
],
86-
"outputHashing": "all"
87-
},
88-
"development": {
89-
"buildOptimizer": false,
90-
"optimization": false,
91-
"vendorChunk": true,
92-
"extractLicenses": false,
93-
"sourceMap": true,
94-
"namedChunks": true
95-
}
96-
},
97-
"defaultConfiguration": "production"
98-
},
99-
"serve": {
100-
"builder": "@angular-devkit/build-angular:dev-server",
101-
"configurations": {
102-
"production": {
103-
"browserTarget": "app:build:production"
104-
},
105-
"development": {
106-
"browserTarget": "app:build:development"
107-
}
108-
},
109-
"defaultConfiguration": "development"
110-
},
111-
"extract-i18n": {
112-
"builder": "@angular-devkit/build-angular:extract-i18n",
113-
"options": {
114-
"browserTarget": "app:build"
115-
}
116-
}
117-
}
11837
}
11938
},
120-
"defaultProject": "imagekitio-angular"
39+
"cli": {
40+
"analytics": false
41+
}
12142
}

sdk/karma.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ module.exports = function (config) {
2525
suppressAll: true // removes the duplicated traces
2626
},
2727
coverageReporter: {
28-
dir: require('path').join(__dirname, '../../coverage/imagekitio-angular'),
28+
dir: require('path').join(__dirname, './coverage/imagekit-angular'),
2929
subdir: '.',
3030
reporters: [
3131
{ type: 'html' },

sdk/ng-package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"$schema": "./node_modules/ng-packagr/ng-package.schema.json",
3+
"dest": "./dist/imagekit-angular",
4+
"lib": {
5+
"entryFile": "src/public-api.ts",
6+
"umdModuleIds": {
7+
"@imagekit/javascript": "ImageKit"
8+
}
9+
}
10+
}

0 commit comments

Comments
 (0)