Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nx workspace CLI does not allow to create pure typescript library since version 8

Since updating our project to nx workspace 8 the generation of libraries "ng g lib mylib" does not allow to create a pure typescript library only.

Previously the question: "What framework should this library use?" allowed the selection of "TypeScript" to avoid creating UI specific configurations for the library.

Since in version 8 changed (https://nx.dev/guides/nx7-to-nx8) to the schematics have been made i an looking for the correct configuration of the workspace to avoid creating and maintaining a custom schematic.

Thanks in advance for recommendations.

Deleted respective entries in config files manually:

Delete node in tsconfiglib.json ->

  "angularCompilerOptions": {
    "annotateForClosureCompiler": true,
    "skipTemplateCodegen": true,
    "strictMetadataEmit": true,
    "fullTemplateTypeCheck": true,
    "strictInjectionParameters": true,
    "enableResourceInlining": true
  },

Delete node in jest.config.js ->

  snapshotSerializers: [
    'jest-preset-angular/AngularSnapshotSerializer.js',
    'jest-preset-angular/HTMLCommentSerializer.js'
  ]

Change "schematics" in angular.js from "@nrwl/angular:component" to "@nrwl/schematics:component"

like image 214
guybrush Avatar asked Dec 10 '22 02:12

guybrush


1 Answers

You can add a TS library with command below:

ng g @nrwl/node:lib my-ts-lib

If the first time, you should install schematics before :

ng add @nrwl/node

Hope it will help.

like image 126
Thierry Falvo Avatar answered Mar 02 '23 01:03

Thierry Falvo