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.
Execute following command from the sdk
folder to build the library. This creates a package in dist/imagekitio-angular
folder.
# run `npm install` for first time
npm run build
The designated directory for tests is sdk/src/sdk-tests
folder. All tests will be executed once on the Chrome Headless browser.
Execute following command from the sdk
folder to start testing.
npm run test
Every sample app requires a different version of Angular CLI. Please refer to the individual sample app Readme.md
for details.
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.
- In the
sdk
folder, install dependencies withnpm install
- Build library with
npm run build
- In the
sdk/dist/imagekitio-angular
folder, usenpm pack
to create a tarball with version mentioned in the current package.json for sdk. - Go to
samples/imagekitio-angular<x>-sample
folder and usenpm install
to install dependencies. - 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 is0.0.1
, then above command becomesnpm install ../../sdk/dist/imagekitio-angular/imagekitio-angular-0.0.1.tgz
- Configure sample app with required keys. Use each app's
Readme.md
for exact details. - Use npm start from the
samples/imagekitio-angular<x>-sample
folder to run the app for a particular angular version.
Sample server for upload implementation is available at samples/sample-server
. To run the server, follow these steps
- Create a
.env
file based onsample.env
and enter your private key. - Use
npm install
to install dependencies. - Use
npm run server
to start the server. It will expose the authentication endpoint onhttp://localhost:3000/auth