CDN vs NPM

Both have their pros and cons and it ultimately depends on the app’s requirements.

CDN pros

NPM pros

- Quick setup without any build tools

- End user’s browsers can cache SDX

- Less disk space needed

To use CDN, please see the VanillaJS Example.

- SDX comes with TypeScript types

- Offline capability

 

NPM usage

The package @swisscom/sdx is available on both https://artifactory.swisscom.com/artifactory/api/npm/swisscom-npm-virtual/ (corpnet only) and https://bin.swisscom.com/artifactory/api/npm/swisscom-npm-virtual/ (outside corpnet).


                                                        
                                                        
                                                            $ npm config set registry https://bin.swisscom.com/artifactory/api/npm/swisscom-npm-virtual/
                                                        $ npm login
                                                        $ npm install @swisscom/sdx --save
                                                        
                                                            

The installation can also be done from outside corpnet, but a corproot account needs to be created. More info can be found on the wiki.


If there are troubles using the Artifactory, for example with the login, a service desk ticket can be opened at INI Help Center (choose "Enabling Services – Request tool or process support").

 

Why not simply host SDX publicly?

Admittedly, if SDX was hosted on the public NPM registry, it’d require less effort by developers to create a new app. However, there are some caveats:

  • Packages hosted on npmjs.org can’t be unpublished easily because of their rules
  • Swisscom cannot detect and respond to security incidents
  • Artifactory packages are being scanned regularly