Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ng-packagr-lite throws when validating https json schema #21636

Closed
4 tasks
marleypowell opened this issue Feb 6, 2024 · 3 comments · Fixed by #21642
Closed
4 tasks

ng-packagr-lite throws when validating https json schema #21636

marleypowell opened this issue Feb 6, 2024 · 3 comments · Fixed by #21642
Assignees
Labels
outdated scope: storybook Issues related to Storybook support in Nx type: docs

Comments

@marleypowell
Copy link

marleypowell commented Feb 6, 2024

Current Behavior

After this #19534 PR ng-packagr-lite seems to be playing up when running storybook against a buildable angular lib. (yarn nx storybook <project>)

Error: no schema with key or ref "https://json-schema.org/schema"
    at Ajv.validate (C:\repo\node_modules\ajv\lib\core.ts:359:21)
    at Ajv.validateSchema (C:\repo\node_modules\ajv\lib\core.ts:515:24)
    at Ajv._addSchema (C:\repo\node_modules\ajv\lib\core.ts:721:30)
    at Ajv.compile (C:\repo\node_modules\ajv\lib\core.ts:384:22)
    at CoreSchemaRegistry._compile (C:\repo\node_modules\@angular-devkit\core\src\json\schema\registry.js:246:35)
    at CoreSchemaRegistry.compile (C:\repo\node_modules\@angular-devkit\core\src\json\schema\registry.js:231:37)
    at name (C:\repo\node_modules\@angular-devkit\architect\src\architect.js:224:43)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

image

This is the schema it doesn't like - https://github.com/beeman/nx/blob/65c448727d2b6b00fea27f7f374989712cff8cec/packages/angular/src/executors/ng-packagr-lite/schema.json

image

Expected Behavior

yarn nx storybook <project> run without any errors.

GitHub Repo

https://github.com/mandarini/storybook-nx-17.3.1

Steps to Reproduce

  1. Create a buildable lib and point the storybook browser target to build instead of build-storybook.
  2. Run yarn nx storybook <project>

Nx Report

Node   : 18.18.2
   OS     : win32-x64
   yarn   : 1.22.19
   
   nx                 : 17.3.1
   @nx/js             : 17.3.1
   @nx/jest           : 17.3.1
   @nx/linter         : 17.3.1
   @nx/eslint         : 17.3.1
   @nx/workspace      : 17.3.1
   @nx/angular        : 17.3.1
   @nx/cypress        : 17.3.1
   @nx/devkit         : 17.3.1
   @nx/eslint-plugin  : 17.3.1
   @nx/plugin         : 17.3.1
   @nx/storybook      : 17.3.1
   @nrwl/tao          : 17.3.1
   @nx/web            : 17.3.1
   @nx/webpack        : 17.3.1
   typescript         : 5.2.2
   ---------------------------------------
   Community plugins:
   @nx-dotnet/core              : 2.2.0
   @storybook/angular           : 7.6.12
   @trumbitta/nx-plugin-openapi : 1.12.1
   ng-mocks                     : 14.12.1
   ---------------------------------------

Failure Logs

Error: no schema with key or ref "https://json-schema.org/schema"
    at Ajv.validate (C:\repo\node_modules\ajv\lib\core.ts:359:21)
    at Ajv.validateSchema (C:\repo\node_modules\ajv\lib\core.ts:515:24)
    at Ajv._addSchema (C:\repo\node_modules\ajv\lib\core.ts:721:30)
    at Ajv.compile (C:\repo\node_modules\ajv\lib\core.ts:384:22)
    at CoreSchemaRegistry._compile (C:\repo\node_modules\@angular-devkit\core\src\json\schema\registry.js:246:35)
    at CoreSchemaRegistry.compile (C:\repo\node_modules\@angular-devkit\core\src\json\schema\registry.js:231:37)
    at name (C:\repo\node_modules\@angular-devkit\architect\src\architect.js:224:43)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

More discussion can be found in this thread #19534 (comment).

@mandarini mandarini self-assigned this Feb 6, 2024
@mandarini mandarini added the scope: storybook Issues related to Storybook support in Nx label Feb 6, 2024
@mandarini
Copy link
Member

@marleypowell thanks for filing this issue.

Yeah, it's a known issue that @nx/angular:ng-packagr-lite does not support build, so we have to use build-storybook, so this is why we generate with build-storybook instead of storybook in the first place:

https://github.com/nrwl/nx/blob/master/packages/storybook/src/utils/utilities.ts#L161

I will add a note about this in the docs!

@mandarini
Copy link
Member

Hmm @marleypowell I just remembered that we do write this in the docs: https://nx.dev/deprecated/storybook/angular-browser-target#setting-up

"If your project is buildable (it has a build target, and uses the main Angular builder - @angular-devkit/build-angular:browser) the browserTarget for Storybook will use the build target"

I will add the update these docs and make them more prominent!

Copy link

github-actions bot commented Mar 8, 2024

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: storybook Issues related to Storybook support in Nx type: docs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants