This is a generator for generating mock server apps created by the Genesis project
How to use
To install the package in your nx workspace run one of the below command
npm i @genesisx/mock-server
yarn add @genesisx/mock-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-server
And fill in the form as follows;
- appName GQL Api Mock Service 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-server:templates <mockServerName> <portNumber> --no-interactive
Running build and lints
nx lint mock-server to execute the lint checks on this package.
nx build mock-server to build this package.
nx test mock-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-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-server:build && cp -R dist/packages/mock-server/ <new-wsp>/node_modules/@genesisx