Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI: Fix copyTemplate failures on init #22375

Merged
merged 14 commits into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
11 changes: 9 additions & 2 deletions code/lib/cli/src/generators/ANGULAR/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,15 @@ const generator: Generator<{ projectName: string }> = async (
});
}

const templateDir = join(getCliDir(), 'templates', 'angular', projectType || 'application');
copyTemplate(templateDir, root || undefined);
let projectTypeValue = projectType || 'application';
if (projectTypeValue !== 'application' && projectTypeValue !== 'library') {
projectTypeValue = 'application';
}

const templateDir = join(getCliDir(), 'templates', 'angular', projectTypeValue);
if (templateDir) {
copyTemplate(templateDir, root || undefined);
}

return {
projectName: angularProjectName,
Expand Down
5 changes: 4 additions & 1 deletion code/lib/cli/src/generators/AURELIA/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ const generator: Generator = async (packageManager, npmOptions, options) => {
await baseGenerator(packageManager, npmOptions, options, 'aurelia', {
extraPackages: ['aurelia'],
});

const templateDir = join(getCliDir(), 'templates', 'aurelia');
copyTemplate(templateDir);
if (templateDir) {
copyTemplate(templateDir);
}
};

export default generator;
4 changes: 3 additions & 1 deletion code/lib/cli/src/generators/SERVER/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ const generator: Generator = async (packageManager, npmOptions, options) => {
});

const templateDir = join(getCliDir(), 'templates', 'server');
Copy link
Member

Choose a reason for hiding this comment

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

We can just get rid of this block of code entirely. I just tested it out on a sample project and will be adding a telescoping PR to do it.

copyTemplate(templateDir);
if (templateDir) {
copyTemplate(templateDir);
}
};

export default generator;