Create an Angular Project with Cumulocity Cockpit

Hi everyone.
I’m trying to create a web app with angular, but i want to use cockpit as a base for my app. If I create the app using c8y/cli I don’t have any kind of problem, everything is fine. But, if I want to create the app project with ng (following the Web SDK guide) and then adding @c8y/cli and using c8ycli to make it a cokpit, I am unable to build the project and I get lots of cascading errors that in the end I cannot mange to solve.
I’m using Angular 8.2.13 and c8y 1006.6.22.
Does anyone know a possible solution? Or can anyone show me step-by-step how to create a cockpit application as an Angular project? Maybe I’m doing something wrong.

What you are trying to do is not really supported and not an actual use case we had in mind when adding integration into angular cli.
You have already generated a project via angular cli so you cannot create another project via c8ycli inside your angular project. You can only do one or the other.

When you add c8ycli to your angular project it will only overwrite the dev-server and build commands of angular cli to use instead the ones of c8ycli.
The idea behind that is that you have an angular project and as part of that want to use for example the c8y client library and then use the development tooling to test and build against Cumulocity IoT.

If you want to extend Cumulocity IoT applications like Cockpit, this is what c8ycli was created for.

What you can try is to create both projects and then move generated source code and dependencies from the package.json from your c8y project to your angular project. Technically that should work. You might need to adjust the angular.json as well as in Cumulocity projects the entry point is index.ts and not main.ts.

2 Likes