Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Add ignore packages option #67

Open
ricokahler opened this issue Jan 22, 2021 · 1 comment
Open

Add ignore packages option #67

ricokahler opened this issue Jan 22, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@ricokahler
Copy link
Owner

From #59, it seems like the best option is to allow the ability to no-op packages while executing schema extraction.

The config might look like this:

import { SanityCodegenConfig } from 'sanity-codegen';

const config: SanityCodegenConfig = {
  // 👇 this will prevent errors from importing this package during schema extraction
  ignorePackages: ['sanity-plugin-tabs'],
  // ...
};


export default config;

This issue is a todo item for myself.

@ricokahler ricokahler added the enhancement New feature or request label May 14, 2021
refactorized pushed a commit to refactorized/sanity-codegen that referenced this issue Dec 9, 2021
* Export props and component for use in ErrorLayout

* Created Layout for Error pages

* Created 404 and 500 pages

* Changed contact us slug

* Injects styled component styles into header for SSR
@mfanuzzi
Copy link

One issue with this approach is that if you're no-oping a package that's used in generation of a type, you can't then use any functions from that package. eg, with orderable-document-list:

import { orderRankField } from '@sanity/orderable-document-list';

export const projectDoc = {
  // ...
  fields: [
    name,
    orderRankField({ type: 'project' }),
  ],
} as const;

Which then results in the Cannot convert object to primitive value thrown from validatePropertyName because the sanityTypeName is indeed a function, and it can't be called to resolve it because it's no-op 😢

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants