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.json
and name that copytasks\start-lib.config.json
. You can adapt this file as follow:
{
"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
}
-
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:build
andnpm run start:sync
-
Once the npm run start:build has stabilized, you can run your classic
npm start
in your favorite app, it was already running -
make sure to stop/restart your
npm start
every 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 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
NgModule
of@cognizone/i18n-transloco
has been removed in favour of theprovideI18nTransloco
function that can be imported in a similar way. See that lib's readme for how to import it.
@cognizone/json-ld/core
,@cognizone/lod/core
and@cognizone/shacl/core
respectively moved to dedicated packages@cognizone/json-ld-core
,@cognizone/lod-core
and@cognizone/shacl-core
.- A few duplicate entities from
@cognizone/shacl
have been removed in favour of their@cognizone/shacl-core
equivalent - Removed
Memoizer
from@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:
IdGenerator
as been removed, need to useUriGenerator
from@cognizone/lod
instead. Be sure to properly configure thenewUriPrefix
option. - json-model:
PrefixCcService
as been removed, need to usePrefixService
from@cognizone/lod
instead. 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::@context
is now typed asTypedResourceContext
, which is completely different from the previous typing. If ever you were usingrootUri
orisNew
, you will need to find another way to get that info.RootUriDirective::apName
has 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::getWrapper
has been deprecated. Instead, it's advised to injectUrisStoreService
instead which has the same method and functionalities.