Giter Club home page Giter Club logo

nx-toolkits's Introduction

Nx Toolkits

This is a monorepo for the Nx toolkits. It contains the following toolkits:

@nx-toolkits/firebase

This is a toolkit for generating Firebase apps - at the moment, only Firebase Functions apps are supported, but I am working on expanding it to include Firebase hosting.

NX Functions Generator

We generate a Firebase Functions app using the @nx-toolkits/firebase:functions and connect it to the Firebase project using the --project option. This allows for normal firebase cli commands to be used to work, as if it was an app generated using firebase cli.

Installation

Install the generator in an nx workspace:

npm install -D @nx-toolkits/firebase

Generate a Firebase Functions app

Use the generator to generate a Firebase Functions app:

nx g @nx-toolkits/firebase:functions

This will generate a Firebase Functions app in the apps folder.

Generator Options

Option alias Description
--name The name of the nx app to create.
--firebaseProject --project The Firebase project to connect to.
--codebase The codebase to use. Learn more here about Firebase Codebase
--nodeVersion The runtime node version to use on firebase functions.
--directory The directory to create the app in.
--tags Tags to add to the app.
--dry-run Run through without making changes.

Deploy a Firebase Functions app

You can deploy a Firebase Functions app using the nx run deploy command:

nx run my-functions-app:deploy

The above with run linting, building, and then deploy the app to Firebase.

You can also use firebase-tools to deploy the app:

firebase deploy --only functions

Linting a Firebase Functions app

You can lint a Firebase Functions app using the nx run lint command:

nx run my-functions-app:lint

Building a Firebase Functions app

You can build a Firebase Functions app using the nx run build command:

nx run my-functions-app:build

Roadmap

  • Add support for Firebase functions
  • Add support for Firebase hosting

nx-toolkits's People

Contributors

mainawycliffe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nx-toolkits's Issues

If Project isn't setup, setup it for the user by channeling the UI from Firebase CLI

At the moment, the idea i have is to used the firebase projects:list and allow the user to select the project they so desire to use, but I am open to a better implementation of the idea:

Examples code snippet I wrote:

if (!firebaseProjectId) {
  // run in the CLI firebase list to list all firebase projects and let the
  // user choose
  const res = execSync('firebase projects:list');
  console.log(
    res
      ?.toString()
      .split('\n')
      .map((line) =>
        line
          .replace(/-/g, '')
          .split('โ”‚')
          .map((line) => line.trim())
          .filter((content) => content !== '')
      )
      .filter((line) => line.length > 1)
  );
  return;
}

Work on generators for settings apps for firebase deploy

At the moment, the firebase generator is focused on functions, which makes sense. Still, we want to be able to do something like nx g @nx-toolkit/firebase:hosting app-name, and we would use the info available to update the firebase config for hosting for that project. The trick part is going to handle that on the firebase side.

Maybe some inspiration can be got from the angular counterpart that does the same -> https://github.com/angular/angularfire/blob/master/docs/deploy/getting-started.md

Comment on this issue to suggest a framework for SSR

Add e2e Test For Firebase Functions

  • Should generate a firebase functions project
  • Should deploy firebase functions to a demo firebase project
  • This should be done successfully

Work on generators for settings apps for firebase deploy

At the moment, the firebase generator is focused on functions, which makes sense. Still, we want to be able to do something like nx g @nx-toolkit/firebase:hosting app-name, and we would use the info available to update the firebase config for hosting for that project. The trick part is going to handle that on the firebase side.

Maybe some inspiration can be got from the angular counterpart that does the same -> https://github.com/angular/angularfire/blob/master/docs/deploy/getting-started.md

Roadmap

Firebase Project Setup

  • Prompt for Firebase Project (If Firebase project hasn't been initialized)
  • Firebase setup for other types - Firestore, Storage, etc.
  • Firebase Hosting Setup (Multiple Apps and so on)

Lint Target Is Broken With Latest NX

The default target for linting on latest nx 17.0.2 as of opening has changed how they call the linting executor.
Currently:
"executor": "@nx/eslint:eslint",
Does not work but making slight altercation:
Works:
"executor": "@nx/eslint:lint",

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.