0.0.12 • Published 2 years ago

nx-loopback-new v0.0.12

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

nx-loopback-new

Create a Loopback 4 application within your Nx Monorepo. This is more of a proof of concept, and may not be production ready. My hope is that Nrwl adds official support for Loopback within Nx. Pull requests are more than welcome.

Install package

With Yarn:

yarn add nx-loopback-new

With NPM:

npm i nx-loopback-new --save

Github:

npm i https://github.com/me-marcel/nx-loopback-new.git --save

And then you must build the contents in your node_modules/nx-loopback-new with yarn build.

Create a new application

With Nrwl CLI:

nx g nx-loopback-new:app

With Angular CLI:

ng g nx-loopback-new:app

Schematics

Init

Initializes the Nx monorepo to have dependencies for Loopback 4. This is a hidden schematic and should not ever need to be called.

Schema

NameTypeRequiredDescription
skipFormatbooleanfalseNot actually being used yet

Application

Generates a new Loopback 4 application.

Schema

NameTypeRequiredDescription
namestringyesName of the new application
tagsstringnoComma separated tags used for linting
skipFormatbooleanfalseNot actually being used yet

Builders

Build

Builds the application using lb-tsc.

With Nx CLI:

nx build application-name

With Angular CLI:

ng build application-name

Schema

NameTypeDefaultRequiredDescription
appPathstringyesPath the application. ie. apps/backend
tsConfigstringyesPath to the tsConfig.json file for Loopback
outputPathstringnoPath the dist target folder (set to use dist/apps/{project_name} by default)
cleanbooleanfalsenoDelete dist files prior to build
watchbooleanfalsenoWatch for code changes and automatically re-build when needed

Execute

Runs the build application with Node.js.

With Nx CLI:

nx serve application-name

With Angular CLI:

ng serve application-name

Schema

NameTypeDefaultRequiredDescription
appPathstringyesPath the application. ie. apps/backend
NODE_ENVstringdevelopmentnoNode environment for the application
argsstring[][]noArguments to add to the command
buildTargetstringyesThe Nx build command for the new application
runOnlybooleantruenoSkip the build before running
cleanbooleanfalsenoDelete dist files prior to build

Features still missing

I would like to see the following features added to the project.

  • Execute with watch
  • Unit tests

Shoutouts and Credit

I couldn't have built this without the following resources and wanted to make sure to note them: