File tree 3 files changed +21
-4
lines changed
src/components/project-create
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) {
272
272
creator . context = targetDir
273
273
274
274
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 )
276
276
277
277
// Answers
278
278
const answers = prompts . getAnswers ( )
Original file line number Diff line number Diff line change 92
92
"stylus" : " ^0.54.5" ,
93
93
"stylus-loader" : " ^5.0.0" ,
94
94
"subscriptions-transport-ws" : " ^0.9.18" ,
95
+ "validate-npm-package-name" : " ^3.0.0" ,
95
96
"vue" : " ^2.6.12" ,
96
97
"vue-apollo" : " ^3.0.7" ,
97
98
"vue-cli-plugin-apollo" : " ^0.22.2" ,
Original file line number Diff line number Diff line change 55
55
class =" vue-ui-text danger banner"
56
56
>
57
57
<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 >
59
62
</div >
60
63
61
64
<ApolloQuery
463
466
464
467
<script >
465
468
import Prompts from ' @/mixins/Prompts'
466
- import { isValidName } from ' @/util/folders '
469
+ import validateNpmPackageName from ' validate-npm-package-name '
467
470
import debounce from ' lodash.debounce'
468
471
469
472
import CWD from ' @/graphql/cwd/cwd.gql'
@@ -534,8 +537,21 @@ export default {
534
537
},
535
538
536
539
computed: {
540
+ folderNameValidationResult () {
541
+ return validateNpmPackageName (this .formData .folder )
542
+ },
543
+
537
544
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 ]
539
555
},
540
556
541
557
detailsValid () {
You can’t perform that action at this time.
0 commit comments