Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/commands/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Command } from 'commander';
import * as fs from 'node:fs';
import * as path from 'node:path';
import ora from 'ora';
import { stringify as stringifyYaml } from 'yaml';
import { stringify as stringifyYaml, parseDocument } from 'yaml';
import {
getSchemaDir,
getProjectSchemasDir,
Expand Down Expand Up @@ -625,10 +625,10 @@ export function registerSchemaCommand(program: Command): void {
// Update name in schema.yaml
const destSchemaPath = path.join(destinationDir, 'schema.yaml');
const schemaContent = fs.readFileSync(destSchemaPath, 'utf-8');
const schema = parseSchema(schemaContent);
schema.name = destinationName;

fs.writeFileSync(destSchemaPath, stringifyYaml(schema));
const doc = parseDocument(schemaContent);
doc.set('name', destinationName);
fs.writeFileSync(destSchemaPath, doc.toString());

if (spinner) spinner.succeed(`Forked '${source}' to '${destinationName}'`);

Expand Down