Skip to content

Commit 1e09753

Browse files
committed
Move schema-info and fuzzyScore to @datocms/cli-utils
These utilities have no CLI-specific deps and are useful outside the CLI (e.g. remote-mcp, which should not have to depend on the full `datocms` package). Moving them into `@datocms/cli-utils` keeps the install footprint small for library consumers while the CLI re-uses them via the top-level `@datocms/cli-utils` export. The `schema-info` module now imports types from `@datocms/cma-client-node` directly instead of going through the `CmaClient` namespace re-export, which would have been a self-import from inside `cli-utils`.
1 parent cbae7a9 commit 1e09753

5 files changed

Lines changed: 20 additions & 9 deletions

File tree

packages/cli-utils/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ export * from './config';
1111
export * from './credentials';
1212
export * from './dato-config-command';
1313
export * from './dato-profile-config-command';
14+
export * from './fuzzyScore';
1415
export * from './oauth';
16+
export * from './schema-info';
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
import type { CmaClient } from '@datocms/cli-utils';
1+
import type {
2+
ApiTypes,
3+
SchemaRepository as SchemaRepositoryClass,
4+
} from '@datocms/cma-client-node';
25
import { fuzzyScore } from './fuzzyScore';
36

4-
type ItemType = CmaClient.ApiTypes.ItemType;
5-
type Field = CmaClient.ApiTypes.Field;
6-
type Fieldset = CmaClient.ApiTypes.Fieldset;
7-
type SchemaRepository = InstanceType<typeof CmaClient.SchemaRepository>;
7+
type ItemType = ApiTypes.ItemType;
8+
type Field = ApiTypes.Field;
9+
type Fieldset = ApiTypes.Fieldset;
10+
type SchemaRepository = InstanceType<typeof SchemaRepositoryClass>;
811

912
export type SchemaFilterType = 'all' | 'models_only' | 'blocks_only';
1013

packages/cli/src/commands/projects/list.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
import { BaseCommand, oclif, readCredentials } from '@datocms/cli-utils';
1+
import {
2+
BaseCommand,
3+
fuzzyScore,
4+
oclif,
5+
readCredentials,
6+
} from '@datocms/cli-utils';
27
import { type Client, buildClient } from '@datocms/dashboard-client';
38
import chalk from 'chalk';
4-
import { fuzzyScore } from '../../utils/fuzzyScore';
59

610
type WorkspaceInfo = {
711
type: 'personal_account' | 'organization';

packages/cli/src/commands/schema/inspect.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
import { CmaClient, CmaClientCommand, oclif } from '@datocms/cli-utils';
21
import {
2+
CmaClient,
3+
CmaClientCommand,
34
type FieldDetailsOption,
45
type FieldsDetails,
56
type SchemaFilterType,
67
collectSchemaInfo,
7-
} from '../../utils/schema-info';
8+
oclif,
9+
} from '@datocms/cli-utils';
810

911
export default class Command extends CmaClientCommand {
1012
static description =

0 commit comments

Comments
 (0)