@allganize/sdk
v0.10.214
Published
Alli JavaScript SDK
Downloads
335
Keywords
Readme
@alli/sdk
Pre-requisites
Node
There are many ways to install Node, but nvm
is recommended. Make sure the version is 20 (as of Jan 26, 2024), or whatever matches the latest AWS node runtime version.
Install Dependencies
# npm
$ npm install
# or yarn
$ yarn install
Configs
If you wish to change configuration options, see src/config.ts
file.
It uses penv.macro
to set each options according to your STAGE
environment variable.
If the value is not specified for the given STAGE
variable, it will default to the second argument.
If you're developing locally, your STAGE
variable is most likely not included here.
I recommend either adding your stage key-value pair or changing the default value. For example,
graphqlUri: env(
{
production: 'if STAGE is equal to production, this value is used',
// key value pairs for other stages
// ...
yourstagename: 'will use this value if specified',
},
'this is the default value',
),
If you change the default value, DO NOT COMMIT this change unless you know what you're doing.
Local Development
# npm
$ npm run dev
# or yarn
$ yarn dev
Deploy
STEP.1 see ckeck-list document
https://github.com/allganize/mally/wiki/SDK-deployment-check-list
STEP.2 s3 upload & invalidate
You must specify RELEASE
as a variable.
If the release is a valid semantic version, the javascript assets will also be uploaded to latest
, major, minor folders in S3.
For example, if you release a version 1.2.3
, all compiled assets are uploaded to 1.2.3
folder. Javascript assets are uploaded to the following folders.
latest
1
1.2
So be careful when you are uploading versions that are valid semantic version and yet lower than the actual latest uploaded version.
# npm
$ RELEASE=0.9.59 npm run deploy:staging
or
$ RELEASE=0.9.59 npm run deploy:production
# or yarn
$ RELEASE=0.9.59 yarn deploy:staging
or
$ RELEASE=0.9.59 yarn deploy:production
For non-production environment, the url is https://dev-sdk.alli.ai/(STAGE)/(RELEASE)/alli.js
For production
environment, the url is https://sdk.alli.ai/(RELEASE)/alli.js
.
after deployment you need to flush cache on cloudfront
./bin/invalidate-cdn-staging.sh 0.9.59
STEP.3 npm publish
🔥 This can not be reversed. Please do enough testing and proceed. 🔥 You should have npm token to publish. If you don't, you can make on npmjs with our common account(allganizedev)
Versioning should be done after deployment.
yarn version
Before you publish you should read this npm Unpublish Policy. And then publish to npm registry.
yarn publish
You can also use this URL (https://unpkg.com/@allganize/sdk) for production.
STEP.4 update document
Alli dashboard displays latest SDK version infos in project settings. You can update this information after deployment as follows.
curl -H "api-key:ZYtuyBiG7oki4X5AWiaK" -d ' {"sdk":"web", "latestVersion":"0.9.59"} ' https://backend.alli.ai/private/update_sdk_version
The endpoint is https://staging-backend.alli.ai/private/update_sdk_version
for staging environment. The sdk
parameter can be one of the following values: android
, ios
, web
.
🔥 MAKE SURE THE RELEASE
IS SET CORRECTLY SO IT DOES NOT OVERWRITE EXISTING FILES. 🔥