File tree Expand file tree Collapse file tree 3 files changed +21
-4
lines changed
src/components/project-create Expand file tree Collapse file tree 3 files changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -272,7 +272,7 @@ async function create (input, context) {
272272 creator . context = targetDir
273273
274274 const inCurrent = input . folder === '.'
275- const name = creator . name = ( inCurrent ? path . relative ( '../' , process . cwd ( ) ) : input . folder ) . toLowerCase ( )
275+ const name = creator . name = ( inCurrent ? path . relative ( '../' , process . cwd ( ) ) : input . folder )
276276
277277 // Answers
278278 const answers = prompts . getAnswers ( )
Original file line number Diff line number Diff line change 9292 "stylus" : " ^0.54.5" ,
9393 "stylus-loader" : " ^5.0.0" ,
9494 "subscriptions-transport-ws" : " ^0.9.18" ,
95+ "validate-npm-package-name" : " ^3.0.0" ,
9596 "vue" : " ^2.6.12" ,
9697 "vue-apollo" : " ^3.0.7" ,
9798 "vue-cli-plugin-apollo" : " ^0.22.2" ,
Original file line number Diff line number Diff line change 5555 class =" vue-ui-text danger banner"
5656 >
5757 <VueIcon icon =" error" class =" big" />
58- <span >{{ $t('org.vue.views.project-create.tabs.details.form.folder.folder-name-invalid') }}</span >
58+ <span >
59+ {{ $t('org.vue.views.project-create.tabs.details.form.folder.folder-name-invalid') }}:
60+ {{ folderNameValidationMessage }}
61+ </span >
5962 </div >
6063
6164 <ApolloQuery
463466
464467<script >
465468import Prompts from ' @/mixins/Prompts'
466- import { isValidName } from ' @/util/folders '
469+ import validateNpmPackageName from ' validate-npm-package-name '
467470import debounce from ' lodash.debounce'
468471
469472import CWD from ' @/graphql/cwd/cwd.gql'
@@ -534,8 +537,21 @@ export default {
534537 },
535538
536539 computed: {
540+ folderNameValidationResult () {
541+ return validateNpmPackageName (this .formData .folder )
542+ },
543+
537544 folderNameValid () {
538- return isValidName (this .formData .folder )
545+ return this .folderNameValidationResult .validForNewPackages
546+ },
547+
548+ folderNameValidationMessage () {
549+ const messages = [
550+ ... (this .folderNameValidationResult .errors || []),
551+ ... (this .folderNameValidationResult .warnings || [])
552+ ]
553+
554+ return messages[0 ]
539555 },
540556
541557 detailsValid () {
You can’t perform that action at this time.
0 commit comments