Run ng g @nx/angular:app my-app to generate an application.
You can use any of the plugins above to generate applications as well.
When using Nx, you can create multiple applications and libraries in the same workspace.
Run ng g @nx/angular:lib my-lib to generate a library.
You can also use any of the plugins above to generate libraries as well.
Libraries are shareable across libraries and applications. They can be imported from @cognizone/mylib.
nx generate @nx/angular:library <LIB_NAME> --buildable --publishable --importPath="@cognizone/<LIB_NAME>"
Chances are, you're adding a feature or resolving a bug for an app, so here is how to "connect" the lib dev to the actual app.
- copy the file
tools\link-lib\start-lib.config.example.jsonand name that copytasks\start-lib.config.json. You can adapt this file as follow:
-
First, make sure to disable cache in your project, under your project's directory, run
ng config cli.cache.enabled false -
Now you can open 2 terminals in the root of the lib, and you will run both
npm run start:buildandnpm run start:sync -
Once the npm run start:build has stabilized, you can run your classic
npm startin your favorite app, it was already running -
make sure to stop/restart your
npm startevery time you need to update your project with latest changes
And there you have it, now make sure to restart your project compiler whenever you make changes in library
Run ng serve my-app for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.
Run ng g component my-component --project=my-app to generate a new component.
Run ng build my-app to build the project. The build artifacts will be stored in the dist/ directory. Use the --prod flag for a production build.
Run ng test my-app to execute the unit tests via Jest.
Run nx affected:test to execute the unit tests affected by a change.
Run ng e2e my-app to execute the end-to-end tests via Cypress.
Run nx affected:e2e to execute the end-to-end tests affected by a change.
Run nx dep-graph to see a diagram of the dependencies of your projects.
Visit the Nx Documentation to learn more.
Nx Cloud pairs with Nx in order to enable you to build and test code more rapidly, by up to 10 times. Even teams that are new to Nx can connect to Nx Cloud and start saving time instantly.
Teams using Nx gain the advantage of building full-stack applications with their preferred framework alongside Nx’s advanced code generation and project dependency graph, plus a unified experience for both frontend and backend developers.
Visit Nx Cloud to learn more.
- Minimal Angular version is now 20
legi-shared,legi-stylesanduser-actionare no longer maintained withing ng-cognizone. If you need them, please:- copy/paste them from their v6 version into your project.
- Then it should mostly be a matter of adapting paths in tsconfig to adapt, for example, the path to
@cognizone/legi-shared. - And adapting some path that import legi-styles too ofc
@cognizone/ng-coreLoggerService: removed the deprecatedextendmethod, please useLoggerFactoryinstead
- Minimal Angular version is now 19
@cognizone/devtools: removed the NgModule, IfDebugDirective is now standalone@cognizone/json-model:- need to use the new
provideJsonModelfunction instead of the old NgModule way DateMapperandDateTimeMapperhave been deprecated but can be manually included if need be through options given toprovideJsonModel. Those mappers will be removed in v7.- The rationale is that the javascript
Dateclass is really not great and we tend to lose information with it (or have wrong information, e.g. the date fix we have on legilux).
- The rationale is that the javascript
- need to use the new
@cognizone/json-model-graph: removed the NgModule, all directives are standalone@cognizone/material-icons: removed the NgModule in favour ofprovideCognizoneMaterialIcons@cognizone/ng-application-profile: removed the NgModule in favour ofprovideNgApplicationProfile@cognizone/ng-core:- deprecated
Logger::extendsin favour of usingLoggerFactory::create. - removed
LoggerModulein favour ofproviderLogger()
- deprecated
@cognizone/ng-yasgui: removed the NgModule, YasguiComponent is now standalone@cognizone/operation: removed the NgModule, components and directives are now standalone@cognizone/permission: removed the NgModule, components and directives are now standalone@cognizone/transloco-langstring: deprecated the library, as @cognizone/i18n is more generic and handle the same cases. Should be removed in v7@cognizone/user-action: replace UserActionModule.withOptions with a dedicated provider functionprovideUserActionModule
- Minimal Angular version is now 18
onDestroy$now usesDestroyRefinstead od hacking into thengOnDestroylifecycle method. This means that all classes that extendsOnDestroy$need to remove their call tosuper.ngOnDestroy(),OnDestroyMixinhas been removed as it was never used as-is in the end, only through theOnDestroy$class.
- Minimal Angular version is now 16
- Transloco has been moved from @ngneat/transloco to @jsverse/transloco. A simple find -and-relace + upgrade to v7 of those libs should be enough. Also the wai the module is setup needs to change, see official docs for the main module and the locale one.
- The
NgModuleof@cognizone/i18n-translocohas been removed in favour of theprovideI18nTranslocofunction that can be imported in a similar way. See that lib's readme for how to import it.
@cognizone/json-ld/core,@cognizone/lod/coreand@cognizone/shacl/corerespectively moved to dedicated packages@cognizone/json-ld-core,@cognizone/lod-coreand@cognizone/shacl-core.- A few duplicate entities from
@cognizone/shaclhave been removed in favour of their@cognizone/shacl-coreequivalent - Removed
Memoizerfrom@cognizone/shacl-core, now it is only available through@cognizone/shacl
- json-ld, lod and shacl libs have new core and/or ng-core sub entry points. This was made it so that */core one don't depend on Angular artifacts, so that they can be used in NodeJs environments. When migrating, it will just require to change a few imports
- json-model:
IdGeneratoras been removed, need to useUriGeneratorfrom@cognizone/lodinstead. Be sure to properly configure thenewUriPrefixoption. - json-model:
PrefixCcServiceas been removed, need to usePrefixServicefrom@cognizone/lodinstead. If you are using json model, you will most likely want to initialize the context of PrefixService with something like this
inject(PrefixService).setContext({ prefix: KNOWN_PREFIXES }); // KNOWN_PREFIXES coming from @cognizone/lod- cz-select: to pass a dedicated ngTemplate to display options, need to give it the #optionTpl identifier to not overlap with cz-label transclusion when used.
- JsonModel and related types, services and utilities have been moved to @cognizone/json-model, so this library need to be added and imports need to be adapted
JsonModel::@contextis now typed asTypedResourceContext, which is completely different from the previous typing. If ever you were usingrootUriorisNew, you will need to find another way to get that info.RootUriDirective::apNamehas been removed and doesn't need to be set anymore. This is because GraphService::setGraph was already taking apName/definition as argument, and so it was redundant to duplicate this information in this directive.RootUriDirective::getWrapperhas been deprecated. Instead, it's advised to injectUrisStoreServiceinstead which has the same method and functionalities.

{ "appPath": "E:/your/project/path/frontend", // absolute path to the root of the frontend app you're working on "libs": ["legi-shared"] // the list of libs you are currently working on, those are the name of the folders inside /projects/libs }