A travel booking application using master data provided by capire/xflights.
git clone https://github.com/capire/xtravels
cd xtravels
npm install
The package has dependencies to other @capire
packages, including @capire/xflights-data
, that can be pulled from GitHub Packages or from a local workspace setup as follows...
Reuse packages among the capire samples are published to the GitHub Packages registry, which requires you to npm login
once like that:
npm login --scope=@capire --registry=https://npm.pkg.github.com
When prompted for a password enter a Personal Access Token (classic) with read:packages
scope.
Learn more about that in Authenticating to GitHub Packages.
A successfull npm login
adds entries like that to your local ~/.npmrc
file, which allow you to npm install @capire packages subsequently using npm add
or npm install
as usual:
@capire:registry=https://npm.pkg.github.com/
//npm.pkg.github.com/:_authToken=<generated token>
Alternatively you can work with related packages in local workspace setups like so:
-
Create a workspace root, e.g. at
cap/samples
:mkdir -p cap/samples && cd cap/samples echo '{"workspaces":["*","*/apis/*"]}' > package.json
-
Add related projects:
git clone https://github.com/capire/xtravels git clone https://github.com/capire/xflights git clone https://github.com/capire/common
-
Install dependencies:
npm install
This will install all dependencies of all cloned projects, with cross dependencies between them being symlinked automatically by npm install
. We can inspect this using npm list
:
npm ls @capire/xflights-data
... which should display something like this:
samples@ ~/cap/samples
├── @capire/[email protected] -> ./xflights/apis/data-service
└─┬ @capire/[email protected] -> ./xtravels
└── @capire/[email protected] deduped -> ./xflights/apis/data-service
cds watch
Which should print something like that:
...
[cds] - server listening on { url: 'http://localhost:4004' }
[cds] - server v9.4.0 launched in 444 ms
[cds] - [ terminate with ^C ]
Cmd-click
the http://localhost:4004 link in the terminal to open the app in a browser.
Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, version 2.0 except as noted otherwise in the LICENSE file.