{"id":15653742,"url":"https://github.com/doowb/grunt-firebase","last_synced_at":"2025-07-15T16:05:31.686Z","repository":{"id":9823552,"uuid":"11809010","full_name":"doowb/grunt-firebase","owner":"doowb","description":"Grunt task for updating firebase data.","archived":false,"fork":false,"pushed_at":"2019-10-23T17:26:24.000Z","size":18,"stargazers_count":26,"open_issues_count":1,"forks_count":0,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-06-27T09:05:16.147Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/assemble/grunt-firebase","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/doowb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-MIT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-08-01T05:40:59.000Z","updated_at":"2025-02-28T11:07:00.000Z","dependencies_parsed_at":"2022-08-25T21:23:50.868Z","dependency_job_id":null,"html_url":"https://github.com/doowb/grunt-firebase","commit_stats":null,"previous_names":["assemble/grunt-firebase"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/doowb/grunt-firebase","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fgrunt-firebase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fgrunt-firebase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fgrunt-firebase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fgrunt-firebase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doowb","download_url":"https://codeload.github.com/doowb/grunt-firebase/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fgrunt-firebase/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265444391,"owners_count":23766428,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T12:46:51.325Z","updated_at":"2025-07-15T16:05:31.653Z","avatar_url":"https://github.com/doowb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# grunt-firebase\r\n\r\n\u003e Update your firebase data from a Grunt task!\r\n\r\n## Getting Started\r\nThis plugin requires Grunt `~0.4.1`\r\n\r\nIf you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:\r\n\r\n```shell\r\nnpm install grunt-firebase --save-dev\r\n```\r\n\r\nOne the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:\r\n\r\n```js\r\ngrunt.loadNpmTasks('grunt-firebase');\r\n```\r\n\r\n## The \"firebase\" task\r\n\r\n### Overview\r\nIn your project's Gruntfile, add a section named `firebase` to the data object passed into `grunt.initConfig()`.\r\n\r\n```js\r\ngrunt.initConfig({\r\n  firebase: {\r\n      options: {\r\n        //\r\n        // reference to start with (full firebase url)\r\n        //\r\n        reference: 'https://grunt-firebase.firebaseio.com/demo',\r\n\r\n        //\r\n        // token is the secret key used for connecting to firebase from the server\r\n        // this is redacted from the public repo... add a file called ./config/auth.json\r\n        // with your token in it... { \"token\": \"my token here\" }\r\n        //\r\n        token: '\u003c%= authConfig.token %\u003e'\r\n      },\r\n      load: {\r\n        options: {\r\n          data: {\r\n            one: {\r\n              foo: 'bar'\r\n            },\r\n            two: [\r\n              { a: 'A' },\r\n              { b: 'B' },\r\n              { c: 'C' }\r\n            ],\r\n            three: [ 'first', 'second', 'third' ]\r\n          }\r\n        }\r\n      }\r\n  }\r\n});\r\n```\r\n\r\n### Options\r\n\r\n#### options.reference\r\nType: `string`\r\nRequire: true\r\n\r\nreference to start with (full firebase url)\r\n\r\n#### options.token\r\nType: `String`\r\nRequire: true\r\n\r\ntoken is the secret key used for connecting to firebase from the server\r\nthis is redacted from the public repo... add a file called ./config/auth.json\r\nwith your token in it... { \"token\": \"my token here\" }\r\n\r\n#### options.data\r\nType: `String | Object | Array`\r\n\r\nThis is the data that will be loaded into firebase at the specified reference point.\r\n\r\n#### options.mode\r\nType: `String`\r\nRequired: false\r\nDefault: `upload`\r\n\r\nSpecify if you want to upload or download your data from firebase.\r\n\r\n##### Modes\r\n  - `upload`: files in the `files` property will be uploaded to the reference location\r\n  - `download`: add a `dest` to your options to determine where the data file will go.\r\n  - `live`: files in the `files` property will be watched and uploaded to firebase when changed or downloaded from firebase when changed remotely.\r\n\r\n#### options.dest\r\nType: `String`\r\nRequired: false\r\nDefault: `./`\r\n\r\nUsed when `mode: download` is set in the options. This is the base path for\r\nwhich the downloaded file will go.\r\n\r\n### Usage Examples\r\n\r\n```js\r\nvar authConfig = grunt.file.readJSON('./config/auth.json');\r\n\r\ngrunt.initConfig({\r\n  \r\n  authConfig: authConfig,\r\n\r\n  firebase: {\r\n    options: {\r\n      //\r\n      // reference to start with (full firebase url)\r\n      //\r\n      reference: 'https://grunt-firebase.firebaseio.com/demo',\r\n\r\n      //\r\n      // token is the secret key used for connecting to firebase from the server\r\n      // this is redacted from the public repo... add a file called ./config/auth.json\r\n      // with your token in it... { \"token\": \"my token here\" }\r\n      //\r\n      token: '\u003c%= authConfig.token %\u003e'\r\n    },\r\n    load: {\r\n      options: {\r\n        data: {\r\n          one: {\r\n            foo: 'bar'\r\n          },\r\n          two: [\r\n            { a: 'A' },\r\n            { b: 'B' },\r\n            { c: 'C' }\r\n          ],\r\n          three: [ 'first', 'second', 'third' ]\r\n        }\r\n      }\r\n    }\r\n  }\r\n});\r\n```\r\n\r\nYou don't want to put your data in the Gruntfile?!?! Why not?\r\n\r\nOkay... just put it in some `.json` files and tell the task where to find them. We'll handle importing the data and uploading it to firebase for you:\r\n\r\n```js\r\nvar authConfig = grunt.file.readJSON('./config/auth.json');\r\n\r\ngrunt.initConfig({\r\n  \r\n  authConfig: authConfig,\r\n\r\n  firebase: {\r\n    options: {\r\n      //\r\n      // reference to start with (full firebase url)\r\n      //\r\n      reference: 'https://grunt-firebase.firebaseio.com/demo',\r\n\r\n      //\r\n      // token is the secret key used for connecting to firebase from the server\r\n      // this is redacted from the public repo... add a file called ./config/auth.json\r\n      // with your token in it... { \"token\": \"my token here\" }\r\n      //\r\n      token: '\u003c%= authConfig.token %\u003e'\r\n    },\r\n    load: {\r\n      files: [\r\n        { src: './path/to/my/data/**/*.json' }\r\n      ]\r\n    }\r\n  }\r\n});\r\n```\r\n\r\nNow that your file is uploaded, make some changes to it through the [Firebase Forge](https://www.firebase.com/)\r\nand download the updates to your file:\r\n\r\n```js\r\nvar authConfig = grunt.file.readJSON('./config/auth.json');\r\n\r\ngrunt.initConfig({\r\n  \r\n  authConfig: authConfig,\r\n\r\n  firebase: {\r\n    options: {\r\n      //\r\n      // reference to start with (full firebase url)\r\n      // when downloading, the final segment in the path\r\n      // will determine the filename where your data goes\r\n      //\r\n      reference: 'https://grunt-firebase.firebaseio.com/demo',\r\n\r\n      //\r\n      // token is the secret key used for connecting to firebase from the server\r\n      // this is redacted from the public repo... add a file called ./config/auth.json\r\n      // with your token in it... { \"token\": \"my token here\" }\r\n      //\r\n      token: '\u003c%= authConfig.token %\u003e'\r\n    },\r\n    getMyFiles: {\r\n      options: {\r\n        mode: 'download',\r\n        dest: 'path/to/downloaded/files/'\r\n      }\r\n    }\r\n  }\r\n});\r\n```\r\nThis will result in all of your data located at `https://grunt-firebase.firebaseio.com/demo`\r\nto be downloaded and stored in a file located at `path/to/downloaded/files/demo.json`\r\n\r\n\r\nBy now you might be thinking... \"This is all great, but I want to really use Firebase features and collaborate in realtime.\"\r\n\r\nYou can!!! Almost... it all depends on your text editor, but there's now a `live mode`!\r\nJust set the option `mode: live` and tell `grunt-firebase` which files to watch.\r\nEach file in the glob pattern will be uploaded to the reference path when changed locally,\r\nand the local file will be updated when changed remotely.\r\n\r\n```js\r\nvar authConfig = grunt.file.readJSON('./config/auth.json');\r\n\r\ngrunt.initConfig({\r\n  \r\n  authConfig: authConfig,\r\n\r\n  firebase: {\r\n    options: {\r\n      //\r\n      // reference to start with (full firebase url)\r\n      // this is the root path that will be watched for changes\r\n      // and each \"key\" will be it's own file\r\n      //\r\n      reference: 'https://grunt-firebase.firebaseio.com/demo',\r\n\r\n      //\r\n      // token is the secret key used for connecting to firebase from the server\r\n      // this is redacted from the public repo... add a file called ./config/auth.json\r\n      // with your token in it... { \"token\": \"my token here\" }\r\n      //\r\n      token: '\u003c%= authConfig.token %\u003e'\r\n    },\r\n    getMyFiles: {\r\n      options: {\r\n        mode: 'live'\r\n      },\r\n      files: [\r\n        { src: './path/to/my/data/**/*.json' }\r\n      ]\r\n    }\r\n  }\r\n});\r\n```\r\n\r\n## Contributing\r\nIn lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/).\r\n\r\n## Release History\r\n_(Nothing yet)_\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoowb%2Fgrunt-firebase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoowb%2Fgrunt-firebase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoowb%2Fgrunt-firebase/lists"}