Skip to content

Commit

Permalink
fix: 优化常见依赖选项
Browse files Browse the repository at this point in the history
  • Loading branch information
CaoMeiYouRen committed Sep 22, 2023
1 parent 1a34a90 commit ceb47e1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
5 changes: 4 additions & 1 deletion src/plopfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { NodePlopAPI, ActionType } from 'plop'
import { QuestionCollection } from 'inquirer'
import { __DEV__ } from './env'
import { InitAnswers } from './interfaces'
import { COMMON_DEPENDENCIES, getGitUserName, initProject, VUE2_DEPENDENCIES, VUE3_DEPENDENCIES, kebabCase, loadTemplateCliConfig } from './utils'
import { COMMON_DEPENDENCIES, getGitUserName, initProject, VUE2_DEPENDENCIES, VUE3_DEPENDENCIES, kebabCase, loadTemplateCliConfig, WEB_DEPENDENCIES } from './utils'

module.exports = function (plop: NodePlopAPI) {
plop.setActionType('initProject', initProject)
Expand Down Expand Up @@ -89,6 +89,9 @@ module.exports = function (plop: NodePlopAPI) {
} else if (/(vue|vite)/.test(answers.template)) {
choices.push(...Object.keys(VUE3_DEPENDENCIES.dependencies))
}
if (/(vue|vite|react|nuxt)/.test(answers.template)) {
choices.push(...Object.keys(WEB_DEPENDENCIES.dependencies))
}
return choices
},
},
Expand Down
20 changes: 10 additions & 10 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,15 @@ export const COMMON_DEPENDENCIES = {
'lodash-es': '^4.17.21',
md5: '^2.3.0',
'push-all-in-one': '^2.2.0',
// rimraf: '^5.0.0',
// dotenv: '^16.3.1',
'leancloud-storage': '^4.15.0',
},
}

export const VUE2_DEPENDENCIES = {
devDependencies: {},
dependencies: {
// 'vite-plugin-fast-cdn-import': '^1.1.0',
'@smallwei/avue': '2.9.4',
'@vueuse/core': '^10.4.1',
'element-ui': '^2.15.7',
Expand All @@ -85,22 +87,20 @@ export const VUE2_DEPENDENCIES = {
export const VUE3_DEPENDENCIES = {
devDependencies: {},
dependencies: {
// 'vite-plugin-fast-cdn-import': '^1.1.0',
'@smallwei/avue': '^3.2.20',
'@vueuse/core': '^10.4.1',
'element-plus': '^2.3.14',
vuetify: '^3.3.14',
},
}

// export const WEB_DEPENDENCIES = {
// devDependencies: {},
// dependencies: {
// 'animate.css': '^4.1.1',
// 'normalize.css': '^8.0.1',
// nprogress: '^0.2.0',
// },
// }
export const WEB_DEPENDENCIES = {
devDependencies: {},
dependencies: {
'animate.css': '^4.1.1',
'normalize.css': '^8.0.1',
},
}

type TemplateCliConfig = {
GITHUB_TOKEN: string
Expand Down

0 comments on commit ceb47e1

Please sign in to comment.