Skip to content

Commit c0e4b48

Browse files
committed
feat(generators/app): remove deprecated install(), add Package manager to prompt questions
1 parent c592444 commit c0e4b48

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

generators/app/index.js

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,28 +47,41 @@ module.exports = class extends Generator {
4747
message: 'Author?',
4848
default: `${gitName} <${gitEmail}>`,
4949
},
50+
{
51+
type: 'list',
52+
name: 'elementPM',
53+
message: 'Package manager?',
54+
choices: [
55+
{ name: 'Yarn', value: 'yarn' },
56+
{ name: 'NPM', value: 'npm' },
57+
],
58+
default: 0,
59+
},
5060
];
5161

52-
const props = await this.prompt(prompts);
62+
const { elementPM, ...restProps } = await this.prompt(prompts);
63+
64+
this.env.options.nodePackageManager = elementPM;
5365

5466
this.props = {
55-
...props,
56-
elementName: changeCase.paramCase(props.elementName),
67+
...restProps,
68+
elementName: changeCase.paramCase(restProps.elementName),
5769
elementOrganizationName: changeCase.paramCase(
58-
props.elementOrganizationName,
70+
restProps.elementOrganizationName,
5971
),
6072
};
6173
}
6274

6375
writing() {
6476
this.fs.copyTpl(
65-
[this.templatePath('**/*'), this.templatePath('**/.*')],
77+
[
78+
this.templatePath('**/*'),
79+
this.templatePath('**/.*'),
80+
this.templatePath('**/.husky/*'),
81+
this.templatePath('**/.husky/.*'),
82+
],
6683
this.destinationPath(),
6784
this.props,
6885
);
6986
}
70-
71-
install() {
72-
this.yarnInstall();
73-
}
7487
};

0 commit comments

Comments
 (0)