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

grunt-configure-firebase

v1.0.2

Published

Configure local directory for firebase deployments

Downloads

9

Readme

grunt-configure-firebase

Configure local directory for firebase deployments

Build Status

NOTE: works with firebase CLI version 3. - if you need 2. use 0.1.2 of this plugin**

Getting Started

This plugin requires Grunt ~0.4.5

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-configure-firebase --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-configure-firebase');

The "configureFirebase" task

The task generates firebase.json and .firebaserc for a basic static web app.

Overview

In your project's Gruntfile, add a section named configureFirebase to the data object passed into grunt.initConfig().

grunt.initConfig({
  configureFirebase: {
    production: 'my-company',
    staging: 'my-company-staging'
  },
});

Options

options.app

Type: String

The firebase app name, if you use the object style notation

app: 'some-company-app', 'default': false, destJson: 'tmp/custom-options.json', destRc: 'tmp/.custom-options-rc', spa: false

options.default

Type: Boolean Default value: true

Whether the current target should be saved in .firebaserc as the default app.

options.spa

Type: Boolean Default value: true

Whether to add default rewrite rule suitable for a single page application (SPA)

options.index

Type: String Default value: index.html

Location for default rewrite rule.

options.destJson

Type: String Default value: 'firebase.json'

Location to write firebase.json file.

options.destRc

Type: String Default value: '.firbaserc'

Location to write .firbaserc file.

options.json

Type: Object Default value:

hosting: {
  public: 'app',
  rewrites: [],
  ignore: [
    'firebase.json',
    'Gruntfile.js',
    'bower.json',
    'package.json',
    '.travis.yml',
    'README.md',
    '*rc',
    '**/node_modules/**'
  ]
}

Contents for firebase.json file to bet written for all targets. This is overwritten by the target-specific info.

Usage Examples

Default Options

This will write to firebase.json

grunt.initConfig({
  configureFirebase: {
    options: {},
    prod: 'my-company',
    stage: 'my-company-staging'
  }
});

configureFirebase:prod results in .firebaserc of:

{
  "projects": {
    "default": "my-company",
    "prod": "my-company"
  }
}

And then running configureFirebase:stage results in .firebaserc of:

{
  "projects": {
    "default": "my-company-staging",
    "prod": "my-company",
    "stage": "my-company-staging"
  }
}

Custom Options

grunt.initConfig({
  configureFirebase: {
    options: {
      dest: 'tmp/firebase.json'
    },
    production: {
      options: {
        app: 'my-company',
        spa: false
      },
      hosting: {        
        public: 'dist',
        ignore: [
          'bower_components'
        ]  
      }
    }
  },
});

Will result in:

{
  "hosting": {
    "public": "dist",
    "rewrites": [],    
    "ignore": [
      "bower_components"
    ]
  }
}

Contributing

Javascript should follow the provided .jsbeautifyrc spec.

  • Run grunt jshint to test your code's quality
  • Run grunt jsbeautifier:test to test your code's format'
  • Run grunt jsbeautifier:fix to format your code according to the spec

Release History

1.0.2

  • [bug] Fix error "Warning: Cannot read property 'push' of undefined"

1.0.1

  • [bug] Fix jshint when using v6.3.1

1.0.0

  • [enhancement] Update to reflect google's new firebase configuration

0.1.2

  • [bug] Remove unsupported option from Gruntfile
  • [docs] Remove erroneous info from README

0.1.1

  • [bug] Fix travis CI config

0.1.0

  • [feature] Add initial working version with test cases
  • [docs] Add documentation