Code Monkey home page Code Monkey logo

firebase-admin-node-scripts's Introduction

TS scripts using Firebase Node Admin SDK

This is a template for creating and running admin scripts using the Firebase Node Admin SDK

Written with ES8, Typescript, and Node.js.

Use cases include emergency hotfixes and manual manipulations of your database (edits to your prod db should not be taken lightly)


Get started

  • Run npm install to install firebase-admin, typescript, etc.

  • Add your dev/prod keys (e.g. ) to /keys/

    • Default path options:
      • /keys/dev-service-account-key.json
      • /keys/prod-service-account-key.json
    • If you use a different path instead of /keys, be sure to include it in .gitignore so you don't commit it to your VCS.
    • You can add more options or edit the name in /src/index.ts
    • By default, control flow for prod is commented out. Uncomment to enable
  • Create your script in src

    • Example: /src/templateScript.ts
    • Make sure to make the enclosed function the default export.
    • Note that /src/index.ts recognizes scriptFileName based on the name of the file, not the name of the exported function
  • Run it using npm run script {dev/production} scriptFilename

    • Example: npm run script dev templateScript (if script is named templateScript.ts)
      • If production is used, you must follow up with confirm production {scriptFileName}
    • This compiles using tsc before running. See package.json for details.
  • If you are adding this as a dir in your main repo, you can remove the .git folder in this dir


Other

Issues and Pull requests welcome!

firebase-admin-node-scripts's People

Contributors

brianjychan avatar dependabot[bot] avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.