npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ember-cli-deploy-gcs-index

v1.1.0

Published

Ember CLI Deploy plugin to deploy ember-cli's bootstrap index file to Google Cloud Storage.

Downloads

34

Readme

ember-cli-deploy-gcs-index Build Status

An ember-cli-deploy plugin to deploy ember-cli's bootstrap index file to Google Cloud Storage.

This plugin uploads a file, presumably index.html, to a specified GCS-bucket. It follows the same strategy as ember-cli-deploy-s3-index.

More often than not this plugin will be used in conjunction with the lightning method of deployment where the ember application assets will be served from GCS and the index.html file will also be served from GCS.

What is an ember-cli-deploy plugin?

A plugin is an addon that can be executed as a part of the ember-cli-deploy pipeline. A plugin will implement one or more of the ember-cli-deploy's pipeline hooks.

For more information on what plugins are and how they work, please refer to the Plugin Documentation.

Quick Start

To get up and running quickly, do the following:

$ ember install ember-cli-deploy-gcs-index
  • Place the following configuration into config/deploy.js
ENV['gcs-index'] = {
  projectId: '<your-gcs-project-id>',
  keyFilename: 'path-to-your-JSON-key-file',
  bucket: '<your-bucket-name>'
}
  • Run the pipeline
$ ember deploy

ember-cli-deploy Hooks Implemented

For detailed information on what plugin hooks are and how they work, please refer to the Plugin Documentation.

  • configure
  • upload
  • activate
  • fetchRevisions

Configuration Options

For detailed information on how configuration of plugins works, please refer to the Plugin Documentation.

projectId

The Google Cloud project ID.

Default: undefined

keyFilename

This assumes you are not deploying on Google Compute Engine, so you need to pass your service account JSON credential. See configuring gcloud-node.

Default: undefined

bucket (required)

The GCS bucket that the files will be uploaded to.

Default: undefined

prefix

A directory within the bucket that the files should be uploaded in to.

Default: ''

filePattern

A file matching this pattern will be uploaded to GCS. The active key in GCS will be a combination of the bucket, prefix, filePattern. The versioned keys will have revisionKey appended.

Default: 'index.html'

acl

The ACL to apply to the objects.

Default: 'public-read'

distDir

The root directory where the file matching filePattern will be searched for. By default, this option will use the distDir property of the deployment context.

Default: context.distDir

revisionKey

The unique revision number for the version of the file being uploaded to GCS. The key will be a combination of the keyPrefix and the revisionKey. By default this option will use either the revision passed in from the command line or the revisionData.revisionKey property from the deployment context.

Default: context.commandOptions.revision || context.revisionData.revisionKey

allowOverwrite

A flag to specify whether the revision should be overwritten if it already exists in GCS.

Default: false

makePublic

A flag to make the index.html file public.

Default: true

How do I activate a revision?

A user can activate a revision by either:

  • Passing a command line argument to the deploy command:
$ ember deploy --activate=true
  • Running the deploy:activate command:
$ ember deploy:activate --revision <revision-key>
  • Setting the activateOnDeploy flag in deploy.js
ENV.pipeline = {
  activateOnDeploy: true
}

What does activation do?

When ember-cli-deploy-gcs-index uploads a file to GCS, it uploads it under the key defined by a combination of the four config properties bucket, prefix, filePattern and revisionKey.

So, if the filePattern was configured to be index.html and there had been a few revisons deployed, then your bucket might look something like this:

                           PRE assets/
2015-09-27 07:25:26        585 crossdomain.xml
2015-09-27 07:47:42       1207 index.html
2015-09-27 07:25:51       1207 index.html:a644ba43cdb987288d646c5a97b1c8a9
2015-09-27 07:20:27       1207 index.html:61cfff627b79058277e604686197bbbd
2015-09-27 07:19:11       1207 index.html:9dd26dbc8f3f9a8a342d067335315a63

Activating a revision would copy the content of the passed revision to index.html which is used to host your ember application via the static web hosting feature built into GCS.

$ ember deploy:activate --revision a644ba43cdb987288d646c5a97b1c8a9

When does activation occur?

Activation occurs during the activate hook of the pipeline. By default, activation is turned off and must be explicitly enabled by one of the 3 methods above.

Prerequisites

The following properties are expected to be present on the deployment context object:

  • distDir (provided by ember-cli-deploy-build)
  • project.name() (provided by [ember-cli-deploy][5])
  • revisionKey (provided by [ember-cli-deploy-revision-data][6])
  • commandLineArgs.revisionKey (provided by [ember-cli-deploy][5])
  • deployEnvironment (provided by [ember-cli-deploy][5])

Using History-Location

You can deploy your Ember application to GCS and still use the history-api for pretty URLs. To achieve this set index.html as the error page.

Index and error page

Running Tests

  • npm test

[5]: https://github.com/ember-cli/ember-cli-deploy "ember-cli-deploy"sh1 [6]: https://github.com/ember-cli-deploy/ember-cli-deploy-revision-data "ember-cli-deploy-revision-data"