Socket
Socket
Sign inDemoInstall

firebase-import

Package Overview
Dependencies
26
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.3 to 2.0.0

LICENSE

41

bin/firebase-import.js
#!/usr/bin/env node
var Firebase = require('firebase'),
var firebase = require('firebase'),
optimist = require('optimist'),

@@ -18,6 +18,10 @@ ProgressBar = require('progress'),

.demand('firebase_url')
.describe('firebase_url', 'Firebase database URL (e.g. https://test.firebaseio.com/dest/path).')
.alias('f', 'firebase_url')
.demand('database_url')
.describe('database_url', 'Firebase database URL (e.g. https://databaseName.firebaseio.com).')
.alias('d', 'database_url')
.demand('path')
.describe('path', 'Database path (e.g. /products).')
.alias('p', 'path')
.demand('json')

@@ -34,4 +38,4 @@ .describe('json', 'The JSON file to import.')

.describe('auth', 'Specify an auth token to use (or your Firebase Secret).')
.alias('a', 'auth')
.describe('service_account', 'Path to a JSON file with your service account credentials.')
.alias('s', 'service_account')

@@ -41,3 +45,8 @@ .argv;

function main() {
var ref = new Firebase(argv.firebase_url);
firebase.initializeApp({
databaseURL: argv.database_url,
serviceAccount: argv.service_account,
});
var db = firebase.database();
var ref = db.ref(argv.path);

@@ -54,18 +63,6 @@ var connFailTimeout = setTimeout(function() {

var connFunc = ref.root().child('.info/connected').on('value', function(s) {
var connFunc = db.ref('.info/connected').on('value', function(s) {
if(s.val() === true) {
ref.root().child('.info/connected').off('value', connFunc);
if (argv.auth) {
ref.auth(argv.auth, function(error) {
if (error) {
console.log('Failed to authenticate to Firebase using token:', argv.auth);
process.exit();
} else {
ready();
}
});
} else {
ready();
}
db.ref('.info/connected').off('value', connFunc);
ready();
}

@@ -72,0 +69,0 @@ });

@@ -1,1 +0,3 @@

fixed - Disabled progress bar when piping the output.
feature - Updated for Firebase 3.x support.
changed - The --firebase_url option was replaced with --database_url and --path.
changed - Instead of using --auth you must use --service_account and provide a service account.
{
"name": "firebase-import",
"description": "npm config for Firebase Import",
"version": "1.1.3",
"version": "2.0.0",
"dependencies": {
"firebase": "~1.0.15",
"optimist": "~0.5.2",
"progress": "~0.1.0"
"firebase": "^3.4.0",
"optimist": "^0.6.1",
"progress": "^1.1.8"
},
"devDependencies": {},
"devDependencies": {
"copyfiles": "^1.0.0"
},
"repository": {

@@ -19,7 +21,16 @@ "type": "git",

],
"files": [
"bin/**",
"LICENSE",
"README.md",
"package.json"
],
"author": "Firebase",
"license": "BSD",
"license": "MIT",
"bin": {
"firebase-import": "./bin/firebase-import.js"
},
"scripts": {
"build": "copyfiles -f src/firebase-import.js bin"
}
}

@@ -24,12 +24,13 @@ # Firebase-Import

Options:
--firebase_url, -f Firebase database URL (e.g. https://test.firebaseio.com/dest/path). [required]
--json, -j The JSON file to import. [required]
--merge, -m Write the top-level children without overwriting the whole parent. [boolean]
--force Don't prompt before overwriting data. [boolean]
--auth, -a Specify an auth token to use (e.g. your Firebase Secret).
--database_url Firebase database URL (e.g. https://databaseName.firebaseio.com). [required]
--path Database path (e.g. /products). [required]
--json The JSON file to import. [required]
--merge Write the top-level children without overwriting the whole parent.
--force Don't prompt before overwriting data.
--service_account Path to a JSON file with your service account credentials.
## Example
$ firebase-import --firebase_url https://test.firebaseio-demo.com --json test.json
All data at https://test.firebaseio-demo.com will be overwritten.
$ firebase-import --database_url https://test.firebaseio-demo.com --path / --json test.json
All data at https://test.firebaseio-demo.com/ will be overwritten.
Press <enter> to proceed, Ctrl-C to abort.

@@ -44,4 +45,4 @@

$ firebase-import --firebase_url https://test.firebaseio-demo.com --json test.json --merge
Each top-level child in test.json will be written under https://test.firebaseio-demo.com.
$ firebase-import --database_url https://test.firebaseio-demo.com --path / --json test.json --merge
Each top-level child in test.json will be written under https://test.firebaseio-demo.com/.
If a child already exists, it will be overwritten.

@@ -54,4 +55,1 @@ Press <enter> to proceed, Ctrl-C to abort.

Import completed.
## LICENSE
[MIT](http://firebase.mit-license.org/).
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc