ngx-devkit-stubby-builder
TypeScript icon, indicating that this package has built-in type declarations

1.3.3 • Public • Published

ngx-devkit-stubby-builder

Greenkeeper badge

Build Status NPM

Builder architecture that use a Stubby server for handle http request when the Angular web application was serve using Angular >= 8 @angular-devkit/architect API.

Install it

npm install --save-dev ngx-devkit-stubby-builder

Create Stubby configuration file

Create ./stubs/config.json using the following documentation

Add a new architecture task in your angular.json file

{
    ...
    "projects": {
        "<app-target>": {
            "architect": {
                ...
                "serve": {
                    "builder": "@angular-devkit/build-angular:dev-server",
                    "options": {
                        "browserTarget": "web-app:build"
                    },
                    "configurations": {
                        "production": {
                        "browserTarget": "web-app:build:production"
                        }
                    }
                },
                "serve-with-stubs": {
                    "builder": "ngx-devkit-stubby-builder:serve",
                    "options": {
                        "devServerTarget": "web-app:serve",
                        "stubsConfigFile": "./stubs/config.json"
                    },
                    "configurations": {
                        "production": {
                        "devServerTarget": "web-app:serve:production"
                        }
                    }
                },
                ...
            }
        }
    }
}

Replace your npm start script in your package.json

    ...
    "scripts": {
        "ng": "ng",
        "start": "ng run <app-target>:serve-with-stubs",
    ...

Note: Don't forget that <app-target> should be replaced with your unique target name. Example: "web-app", "my-app"

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.3.3
    0
    • latest

Version History

Package Sidebar

Install

npm i ngx-devkit-stubby-builder

Weekly Downloads

0

Version

1.3.3

License

MIT

Unpacked Size

76.9 kB

Total Files

23

Last publish

Collaborators

  • gpincheiraa