CDS Commands
We will see most common commands which are used to create, build and deploy the cap app.
Creating a CAP App -
Terminal
cds init <Project_Name>Now, go inside the Folder, and install the dependencies -
Terminal
cd <Project_Name>
npm installGenerate csv file to store sample data for Schema in db -
Terminal
cds add dataDeploy the db data in SQLite server -
add the below line of code in package.json file below the script object
package.json
"cds" : { "requires" : {
"db" : {
"kind" : "sqlite",
"credentials: " : { "url" : "db/managementCAP.sqlite" }
}
}
} Once added, Use the below line of command to deploy it -
Terminal
cds deploy --to sqlite:./db.sqliteTo add Hana, mta file, xsuaa and approuter file -
Terminal
cds add hana,mta,xsuaa,approuter --for productionCommand to update and lock the package lock file -
Terminal
npm update --package-lock-onlyTo Build and generate Build File -
Terminal
mbt build -t gen --mtar mta.tarTo Deploy the Build File -
Terminal
cf deploy gen/mta.tarTo Un-Deploy the Project -
Terminal
cf undeploy <project-name> --delete-services --delete-service-keysYou can modify the scripts of your package.json and add all the required commands like below -
package.json
"scripts" : {
"start" : "cds-serve",
"dev" : "cds-serve",
"build" : "mbt build -t gen --mtar mta.tar",
"deploy" : "cf deploy gen/mta.tar",
"undeploy" : "cf undeploy <project-name> --delete-services --delete-service-keys"
}