Skip to content

Previewing and Deploying

Chris Wilson edited this page Aug 20, 2021 · 2 revisions

Local hosting

You'll want to be constantly reloading the project as you go, so you'll want a mini-server.

HTTP

If you're not making any external calls that require https, a vanilla localhost like http-server should work fine:

npm install http-server -g
http-server -p 8081 -a 127.0.0.1

HTTPS

If you needs to simulate an HTTPS environment, use https-localhost

sudo serve ./apps # or whatever directory above the interactive you prefer

If calling any assets from the time.com assets pipeline, you'll need to route your localhost to https://local.time.com, but updating your /etc/hosts to map localhost to local.time.com:

`127.0.0.1	local.time.com`

Building and deploying

The package.json has several shortcuts for building and deploying. You'll need the AWS CLI for your local environment for the later commands, as well as the private keys for our S3 buckets.

  • npm run build will compile debug.js with source mapping to script.js, viewable in index.html
  • npm run watch will compile debug.js with source mapping to script.js whenever a file is modified
  • npm run minify will compile the minified script-min.js for embed.html
  • npm run dryrun will mock deploy your project. Always run this first.
  • npm run stage will push to the AWS staging directory.
  • npm run upload will push to AWS.
  • npm run deploy will minify and upload

So How Do I Get it On the Page?

Once the short-code is in place, you just need to deploy the minified script file. This uploads both to our static S3 bucket and, sometimes after a few minutes, to \\assets.time.com/interactives/my_awesome_app_2021/script-min.js. If you made a mistake and need a fix to propagate quickly, ask Chris Wilson, who still has the secret key from Fred Cooper.

Next: Safety First!

Clone this wiki locally