Playground Ads Library
This is a space where plugins for our formats can be built in a reusable, maintainable and component-based fashion.
Get Started
- Clone the Repo in your local machine
git clone https://github.com/playground-xyz/ads-library.git
- Install
NPM
package manager if it hasn't been installed before. https://www.npmjs.com/get-npm - Install required node modules by running
npm install
in your terminal. - Punch
git checkout -b {origin_branch} {new_dev_branch}
to start your own branch for your app. - Punch
npm run start
to start your local development. - Once development is completed, run
npm run build
. It will create a minified bundled JavaScript file in the/dist
folder which will be ready to be used in our ads.
Directory Layout
This library uses a Component Based Architecture(CBA), all components used in the app is indivisual and has its own responsibility. The struture of the top level Application is shown as below, feel free to use whatever structure you want in your sub-applications.
.
├── build # Configuration Files for building the dev enviroment. ie. (Webpack Configs)
├── src # Source files for the top level builder interface
├── router # Navigation thru different Apps
├── apps # Where all the actual application sits
├── dist # Webpack generates the bundled file for each application
└── README.md
Deployment
Check in your code and create a new version using npm version <patch|minor|major>
...
Not sure whether it's a patch / minor / major? From https://semver.org/:
Given a version number MAJOR.MINOR.PATCH, increment the:
MAJOR version when you make incompatible API changes, MINOR version when you add functionality in a backwards-compatible manner, and PATCH version when you make backwards-compatible bug fixes.
Deploy the project in #dev-deploy using
the command hubot deploy ads-library
and your new library will be available at
https://static.playground.xyz/adlib/x.x.x/bundle_name.min.js.
X-Range URLs
The deployment script creates x-range URLs such that e.g. the following URL:
https://static.playground.xyz/adlib/4.x.x/bundle_name.min.js
will resolve to the LATEST published bundle with a major version of 4.
Note that cache headers are currently set to 4 hours, which means that some devices MAY continue to use a stale x-range bundle for up to 4 hours.