@genesisx/mock-api-server
v4.0.1-beta0.2
Published
Generator package for creating mock-api-server for using mock apis.
Downloads
2
Maintainers
Keywords
Readme
mock-api-server
This is a generator for generating mock server apps created by the Genesis project
Usage
How to use
To install the package in your nx workspace run one of the below command
npm i @genesisx/mock-api-server
- or
yarn add @genesisx/mock-api-server
Creating gql mock type server
Select Generator tool from the NX console as shown in the image in your visual studio
Navigate to NX console > Generate > @genesisx/mock-api-server
And fill in the form as follows;
- appName
Mock Api Server Name that will be under apps folder of your project
-portNumber
Port Number to be changed in file called .env
Serve your mock service created through NX console > Serve > <your_project_name>
via command line
Run the below command from command line (root folder) if nx console doesnt work
nx generate @genesisx/mock-api-server:templates <mockServerName> <portNumber> --no-interactive
Contribution
Running build and lints
Run nx lint mock-api-server
to execute the lint checks on this package.
Run nx build mock-api-server
to build this package.
Run nx test mock-api-server
to execute the unit tests via Jest.
Publish to NPM
To publish the package you must first be logged into NPM (npm login) then run this command from the root of the project.
- Make sure the package name in package.json should start with @genesisx/
- Also use the correct version number in package.json same will be used for the published package.
- Use your NPM js credentials (Publicis Sapient) with publish rights
- Verify the package at https://www.npmjs.com/settings/genesisx/packages
npm publish dist/packages/mock-api-server --access public
Local development and testing
If you're going to locally developm and run/test this package you need to build it and copy into node_modules with every change. You can simply do this by running a bash command below:
yarn nx run mock-api-server:build && cp -R dist/packages/mock-api-server/ <new-wsp>/node_modules/@genesisx