Skip to content

Commit 53de944

Browse files
committed
feat: make sure platform isn't already initalized
1 parent b370a26 commit 53de944

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

packages/cli/src/commands/addPlatform/addPlatform.ts

+10
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
} from '../init/template';
2525
import {tmpdir} from 'os';
2626
import {mkdtempSync} from 'graceful-fs';
27+
import {existsSync} from 'fs';
2728

2829
type Options = {
2930
packageName: string;
@@ -175,6 +176,15 @@ async function addPlatform(
175176
}
176177

177178
for (const platform of templateConfig.platforms) {
179+
if (existsSync(join(root, platform))) {
180+
throw new CLIError(
181+
`Platform ${platform} already exists in the project. Directory ${join(
182+
root,
183+
platform,
184+
)} is not empty.`,
185+
);
186+
}
187+
178188
await copyTemplate(
179189
templateName,
180190
templateConfig.templateDir,

0 commit comments

Comments
 (0)