JSPM

  • Created
  • Published
  • Downloads 402
  • Score
    100M100P100Q104247F
  • License MIT

Serverless schematics for nx workspace

Package Exports

  • @flowaccount/nx-serverless

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@flowaccount/nx-serverless) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@flowaccount/nx-serverless

Angular CLI Builders for Serverless Framework projects, designed for use alongside nx

License NPM Version

Why

nx superpowers the angular CLI, to add support for a range of backend project types.

However, what if your backend uses Serverless?

This project includes toolsets for generating building, testing and deploying for that.

  • ng build api - builds your functions and layers
  • ng serve api - runs your serverless application offline for debugging and development
  • ng deploy api - deploys your serverless api
ng g @flowaccount/nx-serverless:api

This will Add the following to your angular.json

{
    "api": "root": "api",
      "sourceRoot": "api/src",
      "projectType": "application",
      "prefix": "frontend-flowaccount-landing-ssr",
      "schematics": {},
      "architect": {
        "build": {
          "builder": "@flowaccount/nx-serverless:build",
          "options": {
            "outputPath": "dist/ap",
            "serverlessConfig": "api/serverless.yml",
            "servicePath": "api",
            "tsConfig": "api/tsconfig.app.json",
            "provider": "aws",
            "watch": true,
            "progress": true
          },
          "configurations": {
            "dev": {
              "optimization": false,
              "sourceMap": false,
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "2mb",
                  "maximumError": "5mb"
                }
              ]
            },
            "production": {
              "optimization": true,
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "extractLicenses": true,
              "vendorChunk": false,
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "2mb",
                  "maximumError": "5mb"
                }
              ],
              "fileReplacements": [
                {
                  "replace": "api/environment.ts",
                  "with": "api/environment.prod.ts"
                }
              ]
            }
          }
        },
        "serve": {
          "builder": "@flowaccount/nx-serverless:offline",
          "options": {
            "waitUntilTargets": [  "frontend-flowaccount-landing:build", "frontend-flowaccount-landing:server"],
            "buildTarget": "frontend-flowaccount-landing-ssr:build",
            "config": "api/serverless.yml",
            "location": "dist/ap"
          },
          "configurations": {
            "dev": {
              "buildTarget": "frontend-flowaccount-landing-ssr:build:dev"
            },
            "production": {
              "buildTarget": "frontend-flowaccount-landing-ssr:build:production"
            }
          }
        },
        "deploy": {
          "builder": "@flowaccount/nx-serverless:deploy",
          "options": {
            "buildTarget": "frontend-flowaccount-landing-ssr:build:production",
            "config": "api/serverless.yml",
            "location": "dist/ap",
            "package": "dist/ap"
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "api/tsconfig.app.json",
              "api/tsconfig.spec.json"
            ],
            "exclude": [
              "**/node_modules/**",
              "!api/**"
            ]
          }
        },
        "test": {
          "builder": "@nrwl/jest:jest",
          "options": {
            "jestConfig": "api/jest.config.js",
            "tsConfig": "api/tsconfig.spec.json"
          }
        }
      }
    }
}