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 buildThe 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 testEvery 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
sdkfolder, install dependencies withnpm install - Build library with
npm run build - In the
sdk/dist/imagekitio-angularfolder, usenpm packto create a tarball with version mentioned in the current package.json for sdk. - Go to
samples/imagekitio-angular<x>-samplefolder and usenpm installto install dependencies. - Use
npm install ../../sdk/dist/imagekitio-angular/imagekitio-angular-x.x.x.tgzwhere 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.mdfor exact details. - Use npm start from the
samples/imagekitio-angular<x>-samplefolder 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
.envfile based onsample.envand enter your private key. - Use
npm installto install dependencies. - Use
npm run serverto start the server. It will expose the authentication endpoint onhttp://localhost:3000/auth