Skip to content

Commit c8a0dc0

Browse files
committed
remove try-catch from this pull request
1 parent a8e9167 commit c8a0dc0

File tree

1 file changed

+31
-39
lines changed

1 file changed

+31
-39
lines changed

packages/create-email/src/index.js

Lines changed: 31 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -79,46 +79,38 @@ const init = async (name, { tag }) => {
7979
fse.copySync(templatePath, resolvedProjectPath, {
8080
recursive: true,
8181
});
82-
try {
83-
const templatePackageJsonPath = path.resolve(
84-
resolvedProjectPath,
85-
'./package.json',
86-
);
87-
const templatePackageJson = fse.readFileSync(
88-
templatePackageJsonPath,
89-
'utf8',
90-
);
91-
fse.writeFileSync(
92-
templatePackageJsonPath,
93-
templatePackageJson
94-
.replace(
95-
'INSERT_COMPONENTS_VERSION',
96-
await getLatestVersionOfTag('@react-email/components', tag),
97-
)
98-
.replace(
99-
'INSERT_REACT_EMAIL_VERSION',
100-
await getLatestVersionOfTag('react-email', tag),
101-
),
102-
'utf8',
103-
);
82+
const templatePackageJsonPath = path.resolve(
83+
resolvedProjectPath,
84+
'./package.json',
85+
);
86+
const templatePackageJson = fse.readFileSync(templatePackageJsonPath, 'utf8');
87+
fse.writeFileSync(
88+
templatePackageJsonPath,
89+
templatePackageJson
90+
.replace(
91+
'INSERT_COMPONENTS_VERSION',
92+
await getLatestVersionOfTag('@react-email/components', tag),
93+
)
94+
.replace(
95+
'INSERT_REACT_EMAIL_VERSION',
96+
await getLatestVersionOfTag('react-email', tag),
97+
),
98+
'utf8',
99+
);
104100

105-
spinner.stopAndPersist({
106-
symbol: logSymbols.success,
107-
text: 'React Email Starter files ready',
108-
});
109-
110-
// eslint-disable-next-line no-console
111-
console.info(
112-
await tree(resolvedProjectPath, 4, (dirent) => {
113-
return !path
114-
.join(dirent.parentPath, dirent.name)
115-
.includes('node_modules');
116-
}),
117-
);
118-
} catch (exception) {
119-
fse.removeSync(resolvedProjectPath);
120-
throw exception;
121-
}
101+
spinner.stopAndPersist({
102+
symbol: logSymbols.success,
103+
text: 'React Email Starter files ready',
104+
});
105+
106+
// eslint-disable-next-line no-console
107+
console.info(
108+
await tree(resolvedProjectPath, 4, (dirent) => {
109+
return !path
110+
.join(dirent.parentPath, dirent.name)
111+
.includes('node_modules');
112+
}),
113+
);
122114
};
123115

124116
new Command()

0 commit comments

Comments
 (0)