prismic-ts-codegen icon indicating copy to clipboard operation
prismic-ts-codegen copied to clipboard

Add watch mode

Open angeloashmore opened this issue 3 years ago • 1 comments

  • Only for local files.
  • Regenerate types whenever a watched file is updated.

angeloashmore avatar Jun 24 '22 18:06 angeloashmore

I would really appreciate this feature.

As context: I have a monorepo that has a package slice-library, that is used by multiple websites/apps in this repo.

Therefore I have the following config:

import type { Config } from 'prismic-ts-codegen';

const config: Config = {
  output: './types.generated.ts',
  models: [
    './shared/**/model.json',
    './[app-1]/**/model.json',
    './[app-2]/**/model.json',
    '../../apps/[app-1]/customtypes/**/index.json',
    '../../apps/[app-2]/customtypes/**/index.json',
  ],
};

export default config;

A watch mode that would recompile the types when a model or custom type changes would be nice.

andre-lergier avatar May 19 '23 04:05 andre-lergier