Code is available to be served from CDN: https://www.npmjs.com/package/@bryanfox/personalized-banners-client-script
npm version <major-version>-dev.<dev-version>
npm publish --access=public --tag dev
Versions can be found here: https://www.npmjs.com/package/@bryanfox/personalized-banners-client-script?activeTab=versions
This create a new version with a dev
tag and version on the CDN and won't affect the latest production code
The dev code will then be available at the new dev version: https://cdn.jsdelivr.net/npm/@bryanfox/personalized-banners-client-script@<major-version>-dev.<dev-version>/index.js
npm version <next-major-version>
Make a new PR for these changes before publishing the new code to the CDN.
Once the new code is in master branch pull from the master branch we need to create a new minified file and publish it to npm.
Make sure Uglify is installed locally: https://www.npmjs.com/package/uglify-js.
uglifyjs -c drop_console -m -o index.min.js index.js
npm publish --access=public
The new production code will then be available under the latest version: https://cdn.jsdelivr.net/npm/@bryanfox/personalized-banners-client-script@latest/index.min.js
const script = document.createElement('script');
script.setAttribute('src', 'https://cdn.jsdelivr.net/npm/@bryanfox/personalized-banners-client-script@latest/index.min.js');
script.setAttribute('async', true);
document.body.appendChild(script);
script.onload = () => {
const fdiPB = new fdiPersonalizedBanners({ make: [], model: ['Camry'], standardBody: [], condition: [], is_service_page: false });
fdiPB.onDelivery(function(personalizedBanners) {
... process personalized banners ...
});
}