prismicio / prismic-ts-codegen

A Prismic model-to-TypeScript-type generator.
Apache License 2.0
18 stars 6 forks source link

Add watch mode #20

Open angeloashmore opened 2 years ago

angeloashmore commented 2 years ago
andre-lergier commented 1 year ago

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.