Skip to content

Commit

Permalink
feat: make sure platform isn't already initalized
Browse files Browse the repository at this point in the history
  • Loading branch information
szymonrybczak committed Feb 16, 2024
1 parent b370a26 commit 53de944
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/cli/src/commands/addPlatform/addPlatform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
} from '../init/template';
import {tmpdir} from 'os';
import {mkdtempSync} from 'graceful-fs';
import {existsSync} from 'fs';

type Options = {
packageName: string;
Expand Down Expand Up @@ -175,6 +176,15 @@ async function addPlatform(
}

for (const platform of templateConfig.platforms) {
if (existsSync(join(root, platform))) {
throw new CLIError(
`Platform ${platform} already exists in the project. Directory ${join(
root,
platform,
)} is not empty.`,
);
}

await copyTemplate(
templateName,
templateConfig.templateDir,
Expand Down

0 comments on commit 53de944

Please sign in to comment.