Skip to content
Merged
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
28 changes: 12 additions & 16 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,24 +218,20 @@ async function templateDir(from, to, useTS) {
* @param {ConfigOptions} opts
*/
async function installDeps(to, packageManager, opts) {
await installPackage(['preact'], { packageManager, cwd: to });
const dependencies = [];
const devDependencies = [];

if (opts.useTS) {
await installPackage(['typescript'], { packageManager, cwd: to, dev: true });
const installOpts = {
packageManager,
cwd: to,
silent: true,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#16 changed installer, which defaults to non-silent installs. This simply restores the old behavior (and looks much cleaner).

}

if (opts.useRouter || opts.usePrerender) {
await installPackage(['preact-iso', 'preact-render-to-string'], {
packageManager,
cwd: to,
});
}
if (opts.useTS) devDependencies.push('typescript');
if (opts.useRouter) dependencies.push('preact-iso');
if (opts.usePrerender) dependencies.push('preact-iso', 'preact-render-to-string')
if (opts.useESLint) devDependencies.push('eslint', 'eslint-config-preact');

if (opts.useESLint) {
await installPackage(['eslint', 'eslint-config-preact'], {
packageManager,
cwd: to,
dev: true,
});
}
await installPackage(dependencies, { ...installOpts });
devDependencies.length && installPackage(devDependencies, { ...installOpts, dev: true});
}