Skip to content

Commit d26cc6b

Browse files
committed
feat(create-quasar): simplify prompts; ask for author only if not inferred; remove repositoryType/repositoryURL/homepage/bugs
1 parent ebb2aa2 commit d26cc6b

File tree

15 files changed

+43
-134
lines changed

15 files changed

+43
-134
lines changed

create-quasar/templates/app-extension/ae-js/.eslintrc.cjs

-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ module.exports = {
99
'preset',
1010
'orgName',
1111
'license',
12-
'repositoryType',
13-
'repositoryURL',
14-
'homepage',
15-
'bugs',
1612

1713
'codeFormat'
1814
]

create-quasar/templates/app-extension/ae-js/BASE/_package.json

-6
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@
99
"scripts": {
1010
"test": "echo \"No test specified\" && exit 0"
1111
},
12-
"repository": {
13-
"type": "<%= repositoryType %>",
14-
"url": "<%= repositoryURL %>"
15-
},
16-
"bugs": "<%= bugs %>",
17-
"homepage": "<%= homepage %>",
1812
"engines": {
1913
"node": ">= 12.2.0",
2014
"npm": ">= 5.6.0",

create-quasar/templates/app-extension/ae-js/index.js

+6-23
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,12 @@ export async function script ({ scope, utils }) {
3232
]
3333
},
3434

35-
utils.commonPrompts.description,
36-
utils.commonPrompts.author,
35+
utils.commonPrompts.description
36+
])
37+
38+
await utils.injectAuthor(scope)
39+
40+
await utils.prompts(scope, [
3741
{
3842
type: 'text',
3943
name: 'license',
@@ -59,27 +63,6 @@ export async function script ({ scope, utils }) {
5963
}
6064
],
6165
format: utils.convertArrayToObject
62-
},
63-
{
64-
type: 'text',
65-
name: 'repositoryType',
66-
initial: 'git',
67-
message: 'Repository type:'
68-
},
69-
{
70-
type: 'text',
71-
name: 'repositoryURL',
72-
message: 'Repository URL (eg https://github.com/quasarframework/quasar):'
73-
},
74-
{
75-
type: 'text',
76-
name: 'homepage',
77-
message: 'Homepage URL:'
78-
},
79-
{
80-
type: 'text',
81-
name: 'bugs',
82-
message: 'Issue reporting URL (eg https://github.com/quasarframework/quasar/issues):'
8366
}
8467
])
8568

create-quasar/templates/app-extension/ae-ts/.eslintrc.cjs

-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ module.exports = {
1010
'orgName',
1111
'pkgName',
1212
'license',
13-
'repositoryType',
14-
'repositoryURL',
15-
'homepage',
16-
'bugs',
1713

1814
'packageManagerField',
1915
]

create-quasar/templates/app-extension/ae-ts/BASE/app-extension/_package.json

-6
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@
55
"author": "<%= author %>",
66
"license": "<%= license %>",
77
"type": "module",
8-
"repository": {
9-
"type": "<%= repositoryType %>",
10-
"url": "<%= repositoryURL %>"
11-
},
12-
"bugs": "<%= bugs %>",
13-
"homepage": "<%= homepage %>",
148
"main": "./dist/runtime/index.js",
159
"module": "./dist/runtime/index.js",
1610
"types": "./dist/runtime/index.d.ts",

create-quasar/templates/app-extension/ae-ts/index.js

+5-22
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ export async function script ({ scope, utils }) {
2222
},
2323

2424
utils.commonPrompts.description,
25-
utils.commonPrompts.author,
25+
])
26+
27+
await utils.injectAuthor(scope)
28+
29+
await utils.prompts(scope, [
2630
{
2731
type: 'text',
2832
name: 'license',
@@ -48,27 +52,6 @@ export async function script ({ scope, utils }) {
4852
}
4953
],
5054
format: utils.convertArrayToObject
51-
},
52-
{
53-
type: 'text',
54-
name: 'repositoryType',
55-
initial: 'git',
56-
message: 'Repository type:'
57-
},
58-
{
59-
type: 'text',
60-
name: 'repositoryURL',
61-
message: 'Repository URL (eg https://github.com/quasarframework/quasar):'
62-
},
63-
{
64-
type: 'text',
65-
name: 'homepage',
66-
message: 'Homepage URL:'
67-
},
68-
{
69-
type: 'text',
70-
name: 'bugs',
71-
message: 'Issue reporting URL (eg https://github.com/quasarframework/quasar/issues):'
7255
}
7356
])
7457

create-quasar/templates/app/quasar-v1/index.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ export async function script ({ scope, utils }) {
99
utils.isValidPackageName(val) || 'Invalid package.json name'
1010
},
1111
utils.commonPrompts.productName,
12-
utils.commonPrompts.description,
13-
utils.commonPrompts.author
12+
utils.commonPrompts.description
1413
])
1514

15+
await utils.injectAuthor(scope)
16+
1617
const { script } = await import(`./${ scope.scriptType }/index.js`)
1718
await script({ scope, utils })
1819
}

create-quasar/templates/app/quasar-v2/index.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@ export async function script ({ scope, utils }) {
2323

2424
utils.commonPrompts.productName,
2525
utils.commonPrompts.description,
26-
utils.commonPrompts.author,
26+
])
27+
28+
await utils.injectAuthor(scope)
2729

30+
await utils.prompts(scope, [
2831
{
2932
type: 'select',
3033
name: 'sfcStyle',

create-quasar/templates/ui-kit/.eslintrc.cjs

+1-5
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,7 @@ module.exports = {
1717
'componentName',
1818
'directiveName',
1919

20-
'license',
21-
'repositoryType',
22-
'repositoryURL',
23-
'homepage',
24-
'bugs'
20+
'license'
2521
]
2622
},
2723

create-quasar/templates/ui-kit/index.js

+6-8
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ export async function script ({ scope, utils }) {
88
message: 'Project name (npm name, kebab-case, without "quasar-ui" prefix)',
99
validate: (val) =>
1010
utils.isValidPackageName(val) || 'Invalid package.json name'
11-
},
11+
}
12+
])
13+
14+
await utils.injectAuthor(scope)
1215

13-
utils.commonPrompts.author,
16+
await utils.prompts(scope, [
1417
utils.commonPrompts.license,
1518

1619
{
@@ -104,12 +107,7 @@ export async function script ({ scope, utils }) {
104107
{ title: 'ESM (q/app-vite >= 1.5, q/app-webpack >= 3.10)', value: 'esm', description: 'recommended' },
105108
{ title: 'CommonJS', value: 'commonjs' }
106109
]
107-
},
108-
109-
utils.commonPrompts.repositoryType,
110-
utils.commonPrompts.repositoryURL,
111-
utils.commonPrompts.homepage,
112-
utils.commonPrompts.bugs
110+
}
113111
])
114112

115113
const { script } = await import(`./quasar-${ scope.quasarVersion }/index.js`)

create-quasar/templates/ui-kit/quasar-v1/BASE/ui/_package.json

-6
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@
1717
"build:js": "node build/script.javascript.js",
1818
"build:css": "node build/script.css.js"
1919
},
20-
"repository": {
21-
"type": "<%= repositoryType %>",
22-
"url": "<%= repositoryURL %>"
23-
},
24-
"bugs": "<%= bugs %>",
25-
"homepage": "<%= homepage %>",
2620
"devDependencies": {
2721
"autoprefixer": "^10.0.2",
2822
"cssnano": "^4.1.10",

create-quasar/templates/ui-kit/quasar-v1/ae/app-extension/_package.json

-6
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@
55
"author": "<%= author %>",
66
"license": "<%= license %>",
77
"main": "src/index.js",
8-
"repository": {
9-
"type": "<%= repositoryType %>",
10-
"url": "<%= repositoryURL %>"
11-
},
12-
"bugs": "<%= bugs %>",
13-
"homepage": "<%= homepage %>",
148
"dependencies": {
159
"quasar-ui-<%= name %>": "latest"
1610
},

create-quasar/templates/ui-kit/quasar-v2/BASE/ui/_package.json

-6
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@
1717
"build:js": "node build/script.javascript.js",
1818
"build:css": "node build/script.css.js"
1919
},
20-
"repository": {
21-
"type": "<%= repositoryType %>",
22-
"url": "<%= repositoryURL %>"
23-
},
24-
"bugs": "<%= bugs %>",
25-
"homepage": "<%= homepage %>",
2620
"devDependencies": {
2721
"autoprefixer": "^10.0.2",
2822
"cssnano": "^4.1.10",

create-quasar/templates/ui-kit/quasar-v2/ae/app-extension/_package.json

-6
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@
55
"author": "<%= author %>",
66
"license": "<%= license %>",
77
"type": "<%= aeCodeFormat === 'esm' ? 'module' : 'commonjs' %>",
8-
"repository": {
9-
"type": "<%= repositoryType %>",
10-
"url": "<%= repositoryURL %>"
11-
},
12-
"bugs": "<%= bugs %>",
13-
"homepage": "<%= homepage %>",
148
"dependencies": {
159
"quasar-ui-<%= name %>": "latest"
1610
},

create-quasar/utils/index.js

+18-29
Original file line numberDiff line numberDiff line change
@@ -337,41 +337,29 @@ const commonPrompts = {
337337
val.length > 0 || 'Invalid project description'
338338
},
339339

340-
author: {
341-
type: 'text',
342-
name: 'author',
343-
initial: () => getGitUser(),
344-
message: 'Author:'
345-
},
346-
347340
license: {
348341
type: 'text',
349342
name: 'license',
350343
message: 'License type',
351344
initial: 'MIT'
352-
},
345+
}
346+
}
353347

354-
repositoryType: {
355-
type: 'text',
356-
name: 'repositoryType',
357-
message: 'Repository type:',
358-
initial: 'git'
359-
},
360-
repositoryURL: {
361-
type: 'text',
362-
name: 'repositoryURL',
363-
message: 'Repository URL: (eg https://github.com/quasarframework/quasar)'
364-
},
365-
homepage: {
366-
type: 'text',
367-
name: 'homepage',
368-
message: 'Homepage URL:'
369-
},
370-
bugs: {
371-
type: 'text',
372-
name: 'bugs',
373-
message: 'Issue reporting URL: (eg https://github.com/quasarframework/quasar/issues)'
348+
export async function injectAuthor (scope) {
349+
const author = getGitUser()
350+
351+
if (author) {
352+
scope.author = author
353+
return
374354
}
355+
356+
await prompts(scope, [
357+
{
358+
type: 'text',
359+
name: 'author',
360+
message: 'Author:'
361+
}
362+
])
375363
}
376364

377365
export default {
@@ -391,5 +379,6 @@ export default {
391379
ensureOutsideProject,
392380
initializeGit,
393381

394-
commonPrompts
382+
commonPrompts,
383+
injectAuthor
395384
}

0 commit comments

Comments
 (0)