The pm2 package needs to be available for tests. You can install the same by executing
npm install -g pm2
This microservice needs library assets and configuration file. Please see README for this information.
yarn install # Install dependencies for the microservice
yarn syntax # Analyze code for errors and style issues
yarn format #format .ts[x] and .js[x] files with prettier
yarn graph # Generate dependency graphs in the code
yarn build # Compile ES6 to ES5 and copy JS files to build/ directory
yarn test:unit # Run unit tests
yarn test:int # Run integration tests
yarn test:e2e # Run end-to-end tests
yarn test:http # Run tests for HTTP file service provided by cloudcmd
yarn test:all # Run all tests except http tests
yarn start -h # List of all the CLI commands
yarn start # Start the application
yarn start:pm2 # Start the application with process manager 2
yarn stop:pm2 # Stop the application managed by process manager 2
yarn clean # Deletes "build", "coverage", "dist" and other temp files
NOTE: The integration, end-to-end and http tests require a valid
configuration. This configuration is already set in libms.test.yaml
file.
The URL endpoint for this microservice is located at: localhost:PORT/lib
The API page shows sample queries and responses.
As of now, some features require manual testing or attention.
Due to how CloudCMD works,
it is required to manually run yarn test:http
with LOCAL_PATH
both as an
absolute path and local path. For example, the manual tests
need to be done with the following LOCAL_PATH
values.
OS | Absolute Path | Relative Path |
---|---|---|
Windows | C:\DTaaS\files | ....\files |
Linux | /Users/<Username>/DTaaS/files | ../../files |
the pm2 might not close spawned processes correctly,
therefore please use the following command to kill a process.
pm2 del <id>
.
NOTE: to see the processes spawned by pm2 use pm2 list
The docker version of lib microservice is packaged with the DTaaS application release. Please see publishing page for more information publishing docker images.
The default registry for npm packages is npmjs.
npm install -g @into-cps-association/libms
The steps for publishing the package to npmjs are listed in npm packages page.
The libms is also published on this registry, usually per release of the DTaaS application. The package on npmjs is more stable than the package on github npm registry.
The Github actions workflow of lib microservice publishes the libms into packages.
A new libmspackage is published to github packages for each version of libms microservice.
Use the instructions in publish npm package for help with publishing libms npm package in local computer.
Application of the advice given on that page for libms will require running the following commands.
The microservices require configuration and the docker version
of the microservices uses the configuration
file available in config/libms.dev.yaml
.
For more see configuration documentation.
The config/libms.dev.yaml
file is used for configuration of the container.
A new directory named files
is created in servers/lib
directory and
files are saved and served from the files
directory.
The commands to start and stop the appliation are:
NOTE: the docker compose file is located in the servers/lib
directory.
docker compose -f compose.lib.dev.yml up -d
This command brings up the lib docker container and makes
the website available at http://localhost:4001.
The config/libms.dev.yaml
file is used as the microservice configuration.
If the configuration values are changed, please restart the container.
docker compose -f compose.lib.dev.yml down
docker compose -f compose.lib.dev.yml up -d
yarn install
yarn build #the dist/ directory is needed for publishing step
yarn publish --no-git-tag-version #increments version and publishes to registry
yarn publish #increments version, publishes to registry and adds a git tag
npm unpublish --registry http://localhost:4873/ @into-cps-association/[email protected]