create-quasar 1.5.6 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/.eslintrc.cjs +10 -2
  2. package/index.js +88 -92
  3. package/package.json +10 -9
  4. package/templates/app/index.js +2 -3
  5. package/templates/app/quasar-v1/index.js +2 -3
  6. package/templates/app/quasar-v1/js/BASE/src/router/routes.js +0 -1
  7. package/templates/app/quasar-v1/js/index.js +8 -9
  8. package/templates/app/quasar-v1/js/lint/_.eslintrc.js +6 -4
  9. package/templates/app/quasar-v1/ts/index.js +8 -9
  10. package/templates/app/quasar-v1/ts/lint/_.eslintrc.js +1 -0
  11. package/templates/app/quasar-v2/index.js +2 -3
  12. package/templates/app/quasar-v2/js-vite/BASE/_package.json +2 -1
  13. package/templates/app/quasar-v2/js-vite/BASE/quasar.config.js +8 -12
  14. package/templates/app/quasar-v2/js-vite/BASE/src/router/routes.js +0 -1
  15. package/templates/app/quasar-v2/js-vite/index.js +12 -13
  16. package/templates/app/quasar-v2/js-vite/lint/_.eslintrc.cjs +2 -2
  17. package/templates/app/quasar-v2/js-vite-beta/BASE/_package.json +2 -1
  18. package/templates/app/quasar-v2/js-vite-beta/BASE/quasar.config.js +8 -13
  19. package/templates/app/quasar-v2/js-vite-beta/BASE/src/router/routes.js +0 -1
  20. package/templates/app/quasar-v2/js-vite-beta/index.js +12 -13
  21. package/templates/app/quasar-v2/js-vite-beta/lint/_.eslintrc.cjs +1 -1
  22. package/templates/app/quasar-v2/js-webpack/BASE/src/router/routes.js +0 -1
  23. package/templates/app/quasar-v2/js-webpack/index.js +12 -13
  24. package/templates/app/quasar-v2/js-webpack/lint/_.eslintrc.cjs +2 -2
  25. package/templates/app/quasar-v2/js-webpack-beta/BASE/_package.json +1 -1
  26. package/templates/app/quasar-v2/js-webpack-beta/BASE/src/router/routes.js +0 -1
  27. package/templates/app/quasar-v2/js-webpack-beta/index.js +12 -13
  28. package/templates/app/quasar-v2/js-webpack-beta/lint/_.eslintrc.cjs +2 -2
  29. package/templates/app/quasar-v2/ts-vite/BASE/_package.json +3 -1
  30. package/templates/app/quasar-v2/ts-vite/BASE/quasar.config.js +11 -12
  31. package/templates/app/quasar-v2/ts-vite/index.js +14 -15
  32. package/templates/app/quasar-v2/ts-vite/lint/_.eslintignore +0 -1
  33. package/templates/app/quasar-v2/ts-vite/lint/_.eslintrc.cjs +2 -2
  34. package/templates/app/quasar-v2/ts-vite/lint/_tsconfig.vue-tsc.json +6 -0
  35. package/templates/app/quasar-v2/ts-vite-beta/BASE/_package.json +4 -2
  36. package/templates/app/quasar-v2/ts-vite-beta/BASE/quasar.config.ts +11 -13
  37. package/templates/app/quasar-v2/ts-vite-beta/index.js +14 -15
  38. package/templates/app/quasar-v2/ts-vite-beta/lint/_.eslintignore +0 -1
  39. package/templates/app/quasar-v2/ts-vite-beta/lint/_.eslintrc.cjs +2 -2
  40. package/templates/app/quasar-v2/ts-vite-beta/lint/_tsconfig.vue-tsc.json +6 -0
  41. package/templates/app/quasar-v2/ts-webpack/index.js +14 -15
  42. package/templates/app/quasar-v2/ts-webpack/lint/_.eslintrc.cjs +2 -2
  43. package/templates/app/quasar-v2/ts-webpack-beta/BASE/_package.json +1 -1
  44. package/templates/app/quasar-v2/ts-webpack-beta/index.js +14 -15
  45. package/templates/app/quasar-v2/ts-webpack-beta/lint/_.eslintrc.cjs +2 -2
  46. package/templates/app-extension/ae-v1/index.js +7 -8
  47. package/templates/app-extension/index.js +2 -2
  48. package/templates/ui-kit/index.js +8 -9
  49. package/templates/ui-kit/quasar-v1/BASE/ui/build/script.app-ext.js +1 -1
  50. package/templates/ui-kit/quasar-v1/BASE/ui/build/script.clean.js +1 -1
  51. package/templates/ui-kit/quasar-v1/BASE/ui/dev/quasar.conf.js +1 -1
  52. package/templates/ui-kit/quasar-v1/index.js +9 -10
  53. package/templates/ui-kit/quasar-v2/index.js +9 -10
  54. package/utils/index.js +67 -46
  55. package/utils/logger.js +66 -43
  56. /package/templates/{.eslintrc.js → .eslintrc.cjs} +0 -0
  57. /package/templates/app/quasar-v1/js/{.eslintrc.js → .eslintrc.cjs} +0 -0
  58. /package/templates/app/quasar-v1/ts/{.eslintrc.js → .eslintrc.cjs} +0 -0
  59. /package/templates/app/quasar-v2/js-vite/{.eslintrc.js → .eslintrc.cjs} +0 -0
  60. /package/templates/app/quasar-v2/js-vite-beta/{.eslintrc.js → .eslintrc.cjs} +0 -0
  61. /package/templates/app/quasar-v2/js-webpack/{.eslintrc.js → .eslintrc.cjs} +0 -0
  62. /package/templates/app/quasar-v2/js-webpack-beta/{.eslintrc.js → .eslintrc.cjs} +0 -0
  63. /package/templates/app/quasar-v2/ts-vite/{.eslintrc.js → .eslintrc.cjs} +0 -0
  64. /package/templates/app/quasar-v2/ts-vite-beta/{.eslintrc.js → .eslintrc.cjs} +0 -0
  65. /package/templates/app/quasar-v2/ts-webpack/{.eslintrc.js → .eslintrc.cjs} +0 -0
  66. /package/templates/app/quasar-v2/ts-webpack-beta/{.eslintrc.js → .eslintrc.cjs} +0 -0
  67. /package/templates/app-extension/ae-v1/{.eslintrc.js → .eslintrc.cjs} +0 -0
  68. /package/templates/ui-kit/{.eslintrc.js → .eslintrc.cjs} +0 -0
  69. /package/templates/ui-kit/quasar-v2/{.eslintrc.js → .eslintrc.cjs} +0 -0
@@ -16,8 +16,7 @@ module.exports = {
16
16
  env: {
17
17
  browser: true,
18
18
  es2021: true,
19
- node: true,
20
- 'vue/setup-compiler-macros': true
19
+ node: true
21
20
  },
22
21
 
23
22
  // Rules order is important, please avoid shuffling them
@@ -93,6 +92,7 @@ module.exports = {
93
92
  // does not work with type definitions
94
93
  'import/named': 'off',
95
94
  <% } else if (lintConfig === 'airbnb') { %>
95
+ 'no-plusplus': 'off',
96
96
  'no-param-reassign': 'off',
97
97
  'no-void': 'off',
98
98
  'no-nested-ternary': 'off',
@@ -61,7 +61,7 @@
61
61
  "last 5 Opera versions"
62
62
  ],
63
63
  "engines": {
64
- "node": "^24 || ^22 || ^20 || ^18 || ^16",
64
+ "node": "^24 || ^22 || ^20 || ^18",
65
65
  "npm": ">= 6.13.4",
66
66
  "yarn": ">= 1.21.1"
67
67
  }
@@ -1,5 +1,4 @@
1
-
2
- module.exports = async function ({ scope, utils }) {
1
+ export async function script ({ scope, utils }) {
3
2
  await utils.prompts(scope, [
4
3
  {
5
4
  type: 'select',
@@ -7,8 +6,8 @@ module.exports = async function ({ scope, utils }) {
7
6
  message: 'Pick a Vue component style:',
8
7
  initial: 0,
9
8
  choices: [
10
- { title: 'Composition API', value: 'composition', description: 'recommended' },
11
9
  { title: 'Composition API with <script setup>', value: 'composition-setup', description: 'recommended' },
10
+ { title: 'Composition API', value: 'composition', description: 'recommended' },
12
11
  { title: 'Options API', value: 'options' },
13
12
  { title: 'Class-based (DEPRECATED; see https://github.com/quasarframework/quasar/discussions/11204)', value: 'class', disabled: true }
14
13
  ]
@@ -29,11 +28,11 @@ module.exports = async function ({ scope, utils }) {
29
28
  name: 'preset',
30
29
  message: 'Check the features needed for your project:',
31
30
  choices: [
32
- { title: 'ESLint', value: 'lint', description: 'recommended', selected: true },
31
+ { title: 'Linting (ESLint)', value: 'lint', description: 'recommended', selected: true },
33
32
  { title: 'State Management (Pinia)', value: 'pinia', description: 'https://pinia.vuejs.org' },
34
33
  { title: 'State Management (Vuex) [DEPRECATED by Vue Team]', value: 'vuex', description: 'See https://vuejs.org/guide/scaling-up/state-management.html#pinia' },
35
- { title: 'Axios', value: 'axios' },
36
- { title: 'Vue-i18n', value: 'i18n' }
34
+ { title: 'axios', value: 'axios' },
35
+ { title: 'vue-i18n', value: 'i18n' }
37
36
  ],
38
37
  format: values => {
39
38
  let result = values
@@ -50,7 +49,7 @@ module.exports = async function ({ scope, utils }) {
50
49
  }
51
50
  },
52
51
  {
53
- type: (_, { preset }) => preset.lint ? 'select' : null,
52
+ type: (_, { preset }) => (preset.lint ? 'select' : null),
54
53
  name: 'lintConfig',
55
54
  message: 'Pick an ESLint preset:',
56
55
  choices: [
@@ -62,18 +61,18 @@ module.exports = async function ({ scope, utils }) {
62
61
  ])
63
62
 
64
63
  utils.createTargetDir(scope)
65
- utils.renderTemplate(utils.join(__dirname, 'BASE'), scope)
66
- utils.renderTemplate(utils.join(__dirname, scope.css), scope)
64
+ utils.renderTemplate(utils.join(import.meta.url, 'BASE'), scope)
65
+ utils.renderTemplate(utils.join(import.meta.url, scope.css), scope)
67
66
 
68
- if (scope.preset.axios) utils.renderTemplate(utils.join(__dirname, 'axios'), scope)
69
- if (scope.preset.i18n) utils.renderTemplate(utils.join(__dirname, 'i18n'), scope)
67
+ if (scope.preset.axios) utils.renderTemplate(utils.join(import.meta.url, 'axios'), scope)
68
+ if (scope.preset.i18n) utils.renderTemplate(utils.join(import.meta.url, 'i18n'), scope)
70
69
  if (scope.preset.lint) {
71
- utils.renderTemplate(utils.join(__dirname, 'lint'), scope)
70
+ utils.renderTemplate(utils.join(import.meta.url, 'lint'), scope)
72
71
  if (scope.lintConfig === 'prettier') {
73
- utils.renderTemplate(utils.join(__dirname, 'prettier'), scope)
72
+ utils.renderTemplate(utils.join(import.meta.url, 'prettier'), scope)
74
73
  }
75
74
  }
76
75
 
77
- if (scope.preset.pinia) utils.renderTemplate(utils.join(__dirname, 'pinia'), scope)
78
- else if (scope.preset.vuex) utils.renderTemplate(utils.join(__dirname, 'vuex'), scope)
76
+ if (scope.preset.pinia) utils.renderTemplate(utils.join(import.meta.url, 'pinia'), scope)
77
+ else if (scope.preset.vuex) utils.renderTemplate(utils.join(import.meta.url, 'vuex'), scope)
79
78
  }
@@ -16,8 +16,7 @@ module.exports = {
16
16
  env: {
17
17
  browser: true,
18
18
  es2021: true,
19
- node: true,
20
- 'vue/setup-compiler-macros': true
19
+ node: true
21
20
  },
22
21
 
23
22
  // Rules order is important, please avoid shuffling them
@@ -93,6 +92,7 @@ module.exports = {
93
92
  // does not work with type definitions
94
93
  'import/named': 'off',
95
94
  <% } else if (lintConfig === 'airbnb') { %>
95
+ 'no-plusplus': 'off',
96
96
  'no-param-reassign': 'off',
97
97
  'no-void': 'off',
98
98
  'no-nested-ternary': 'off',
@@ -1,5 +1,4 @@
1
-
2
- module.exports = async function ({ scope, utils }) {
1
+ export async function script ({ scope, utils }) {
3
2
  await utils.prompts(scope, [
4
3
  {
5
4
  type: 'confirm',
@@ -8,11 +7,11 @@ module.exports = async function ({ scope, utils }) {
8
7
  message: 'Will you use an organization to publish it? Eg. "@my-org/..."'
9
8
  },
10
9
  {
11
- type: (_, { needOrgName } = {}) => needOrgName ? 'text' : null,
10
+ type: (_, { needOrgName } = {}) => (needOrgName ? 'text' : null),
12
11
  name: 'orgName',
13
12
  message: 'Organization name, eg. "my-org":',
14
13
  validate: val =>
15
- val && val.length > 0 || 'Please type the organization name'
14
+ (val && val.length > 0) || 'Please type the organization name'
16
15
  },
17
16
  {
18
17
  type: 'text',
@@ -85,11 +84,11 @@ module.exports = async function ({ scope, utils }) {
85
84
  ])
86
85
 
87
86
  utils.createTargetDir(scope)
88
- utils.renderTemplate(utils.join(__dirname, 'BASE'), scope)
87
+ utils.renderTemplate(utils.join(import.meta.url, 'BASE'), scope)
89
88
 
90
- if (scope.preset.prompts) utils.renderTemplate(utils.join(__dirname, 'prompts-script'), scope)
91
- if (scope.preset.install) utils.renderTemplate(utils.join(__dirname, 'install-script'), scope)
92
- if (scope.preset.uninstall) utils.renderTemplate(utils.join(__dirname, 'uninstall-script'), scope)
89
+ if (scope.preset.prompts) utils.renderTemplate(utils.join(import.meta.url, 'prompts-script'), scope)
90
+ if (scope.preset.install) utils.renderTemplate(utils.join(import.meta.url, 'install-script'), scope)
91
+ if (scope.preset.uninstall) utils.renderTemplate(utils.join(import.meta.url, 'uninstall-script'), scope)
93
92
 
94
93
  // nothing to install, so we'll skip it
95
94
  scope.skipDepsInstall = true
@@ -1,4 +1,4 @@
1
- module.exports = async function ({ scope, utils }) {
2
- const script = require('./ae-v1')
1
+ export async function script ({ scope, utils }) {
2
+ const { script } = await import('./ae-v1/index.js')
3
3
  await script({ scope, utils })
4
4
  }
@@ -1,5 +1,4 @@
1
-
2
- module.exports = async function ({ scope, utils }) {
1
+ export async function script ({ scope, utils }) {
3
2
  await utils.prompts(scope, [
4
3
  utils.commonPrompts.quasarVersion,
5
4
 
@@ -41,7 +40,7 @@ module.exports = async function ({ scope, utils }) {
41
40
  type: 'text',
42
41
  name: 'packageDescription',
43
42
  message: 'Package description',
44
- initial: 'My awesome component',
43
+ initial: 'My awesome component'
45
44
  },
46
45
 
47
46
  {
@@ -52,7 +51,7 @@ module.exports = async function ({ scope, utils }) {
52
51
  },
53
52
 
54
53
  {
55
- type: (_, { features }) => features.component ? 'text' : null,
54
+ type: (_, { features }) => (features.component ? 'text' : null),
56
55
  name: 'componentName',
57
56
  message: 'Component name (PascalCase)',
58
57
  initial: 'MyComponent',
@@ -60,7 +59,7 @@ module.exports = async function ({ scope, utils }) {
60
59
  },
61
60
 
62
61
  {
63
- type: (_, { features }) => features.directive ? 'text' : null,
62
+ type: (_, { features }) => (features.directive ? 'text' : null),
64
63
  name: 'directiveName',
65
64
  message: 'Directive name (kebab-case, without "v-" prefix)',
66
65
  initial: 'my-directive',
@@ -68,7 +67,7 @@ module.exports = async function ({ scope, utils }) {
68
67
  },
69
68
 
70
69
  {
71
- type: (_, { features }) => features.ae ? 'text' : null,
70
+ type: (_, { features }) => (features.ae ? 'text' : null),
72
71
  name: 'aeDescription',
73
72
  message: 'App Extension description',
74
73
  initial: 'A Quasar App Extension',
@@ -76,7 +75,7 @@ module.exports = async function ({ scope, utils }) {
76
75
  },
77
76
 
78
77
  {
79
- type: (_, { features }) => features.ae ? 'multiselect' : null,
78
+ type: (_, { features }) => (features.ae ? 'multiselect' : null),
80
79
  name: 'preset',
81
80
  message: 'Pick the needed App Extension scripts:',
82
81
  format: utils.convertArrayToObject,
@@ -97,7 +96,7 @@ module.exports = async function ({ scope, utils }) {
97
96
  },
98
97
 
99
98
  {
100
- type: (_, { quasarVersion, features }) => quasarVersion === 'v2' && features.ae ? 'select' : null,
99
+ type: (_, { quasarVersion, features }) => (quasarVersion === 'v2' && features.ae ? 'select' : null),
101
100
  name: 'aeCodeFormat',
102
101
  message: 'Pick the App Extension format:',
103
102
  initial: 0,
@@ -113,7 +112,7 @@ module.exports = async function ({ scope, utils }) {
113
112
  utils.commonPrompts.bugs
114
113
  ])
115
114
 
116
- const script = require(`./quasar-${scope.quasarVersion}`)
115
+ const { script } = await import(`./quasar-${ scope.quasarVersion }/index.js`)
117
116
  await script({ scope, utils })
118
117
 
119
118
  // we don't want to install
@@ -56,5 +56,5 @@ module.exports.syncAppExt = function (both = true) {
56
56
  return
57
57
  }
58
58
 
59
- console.error(` App Extension version and dependency NOT synced.\n`)
59
+ console.error(' App Extension version and dependency NOT synced.\n')
60
60
  }
@@ -3,4 +3,4 @@ var
3
3
  path = require('path')
4
4
 
5
5
  rimraf.sync(path.resolve(__dirname, '../dist/*'))
6
- console.log(` 💥 Cleaned build artifacts.\n`)
6
+ console.log(' 💥 Cleaned build artifacts.\n')
@@ -47,7 +47,7 @@ module.exports = function (ctx) {
47
47
 
48
48
  chainWebpack (chain) {
49
49
  chain.resolve.alias.merge({
50
- 'ui': path.resolve(__dirname, '../src/index.js')
50
+ ui: path.resolve(__dirname, '../src/index.js')
51
51
  })
52
52
  }
53
53
  },
@@ -1,19 +1,18 @@
1
-
2
- module.exports = async function ({ scope, utils }) {
1
+ export async function script ({ scope, utils }) {
3
2
  utils.createTargetDir(scope)
4
- utils.renderTemplate(utils.join(__dirname, 'BASE'), scope)
3
+ utils.renderTemplate(utils.join(import.meta.url, 'BASE'), scope)
5
4
 
6
5
  if (scope.features.ae) {
7
- utils.renderTemplate(utils.join(__dirname, 'ae'), scope)
8
- if (scope.preset.install) utils.renderTemplate(utils.join(__dirname, 'ae-install'), scope)
9
- if (scope.preset.prompts) utils.renderTemplate(utils.join(__dirname, 'ae-prompts'), scope)
10
- if (scope.preset.uninstall) utils.renderTemplate(utils.join(__dirname, 'ae-uninstall'), scope)
6
+ utils.renderTemplate(utils.join(import.meta.url, 'ae'), scope)
7
+ if (scope.preset.install) utils.renderTemplate(utils.join(import.meta.url, 'ae-install'), scope)
8
+ if (scope.preset.prompts) utils.renderTemplate(utils.join(import.meta.url, 'ae-prompts'), scope)
9
+ if (scope.preset.uninstall) utils.renderTemplate(utils.join(import.meta.url, 'ae-uninstall'), scope)
11
10
  }
12
11
 
13
- if (scope.features.component) utils.renderTemplate(utils.join(__dirname, 'ui-component'), scope)
14
- if (scope.features.directive) utils.renderTemplate(utils.join(__dirname, 'ui-directive'), scope)
12
+ if (scope.features.component) utils.renderTemplate(utils.join(import.meta.url, 'ui-component'), scope)
13
+ if (scope.features.directive) utils.renderTemplate(utils.join(import.meta.url, 'ui-directive'), scope)
15
14
 
16
15
  if (scope.features.ae && (scope.features.component || scope.features.directive)) {
17
- utils.renderTemplate(utils.join(__dirname, 'ui-ae'), scope)
16
+ utils.renderTemplate(utils.join(import.meta.url, 'ui-ae'), scope)
18
17
  }
19
18
  }
@@ -1,19 +1,18 @@
1
-
2
- module.exports = async function ({ scope, utils }) {
1
+ export async function script ({ scope, utils }) {
3
2
  utils.createTargetDir(scope)
4
- utils.renderTemplate(utils.join(__dirname, 'BASE'), scope)
3
+ utils.renderTemplate(utils.join(import.meta.url, 'BASE'), scope)
5
4
 
6
5
  if (scope.features.ae) {
7
- utils.renderTemplate(utils.join(__dirname, 'ae'), scope)
8
- if (scope.preset.install) utils.renderTemplate(utils.join(__dirname, 'ae-install'), scope)
9
- if (scope.preset.prompts) utils.renderTemplate(utils.join(__dirname, 'ae-prompts'), scope)
10
- if (scope.preset.uninstall) utils.renderTemplate(utils.join(__dirname, 'ae-uninstall'), scope)
6
+ utils.renderTemplate(utils.join(import.meta.url, 'ae'), scope)
7
+ if (scope.preset.install) utils.renderTemplate(utils.join(import.meta.url, 'ae-install'), scope)
8
+ if (scope.preset.prompts) utils.renderTemplate(utils.join(import.meta.url, 'ae-prompts'), scope)
9
+ if (scope.preset.uninstall) utils.renderTemplate(utils.join(import.meta.url, 'ae-uninstall'), scope)
11
10
  }
12
11
 
13
- if (scope.features.component) utils.renderTemplate(utils.join(__dirname, 'ui-component'), scope)
14
- if (scope.features.directive) utils.renderTemplate(utils.join(__dirname, 'ui-directive'), scope)
12
+ if (scope.features.component) utils.renderTemplate(utils.join(import.meta.url, 'ui-component'), scope)
13
+ if (scope.features.directive) utils.renderTemplate(utils.join(import.meta.url, 'ui-directive'), scope)
15
14
 
16
15
  if (scope.features.ae && (scope.features.component || scope.features.directive)) {
17
- utils.renderTemplate(utils.join(__dirname, 'ui-ae'), scope)
16
+ utils.renderTemplate(utils.join(import.meta.url, 'ui-ae'), scope)
18
17
  }
19
18
  }
package/utils/index.js CHANGED
@@ -1,33 +1,34 @@
1
+ import { readFileSync, writeFileSync, existsSync } from 'node:fs'
2
+ import { fileURLToPath } from 'node:url'
3
+ import { sep, normalize, join as pathJoin, resolve, extname } from 'node:path'
4
+ import { spawn, execSync as exec } from 'node:child_process'
1
5
 
2
- const { readFileSync, writeFileSync, existsSync } = require('fs')
3
- const { sep, normalize, join, resolve, extname } = require('path')
4
- const { emptyDirSync, ensureDirSync, ensureFileSync, copySync } = require('fs-extra')
5
- const prompts = require('prompts')
6
- const compileTemplate = require('lodash/template')
7
- const fglob = require('fast-glob')
8
- const { yellow, green } = require('kolorist')
9
- const exec = require('child_process').execSync
10
- const spawn = require('child_process').spawn
6
+ import { emptyDirSync, ensureDirSync, ensureFileSync, copySync } from 'fs-extra/esm'
7
+ import promptUser from 'prompts'
8
+ import compileTemplate from 'lodash/template.js'
9
+ import fglob from 'fast-glob'
10
+ import { yellow, green } from 'kolorist'
11
11
 
12
- const logger = require('./logger')
12
+ import logger from './logger.js'
13
13
 
14
14
  const TEMPLATING_FILE_EXTENSIONS = [ '', '.json', '.js', '.cjs', '.ts', '.vue', '.md', '.html', '.sass' ]
15
15
 
16
- module.exports.join = join
17
- module.exports.logger = logger
16
+ function join (importMetaUrl, targetPath) {
17
+ return fileURLToPath(new URL('./' + targetPath, importMetaUrl))
18
+ }
18
19
 
19
- module.exports.prompts = async function (scope, questions, opts) {
20
+ async function prompts (scope, questions, opts) {
20
21
  const options = opts || {
21
22
  onCancel: () => {
22
23
  logger.fatal('Scaffolding cancelled')
23
24
  }
24
25
  }
25
26
 
26
- const answers = await prompts(questions, options)
27
+ const answers = await promptUser(questions, options)
27
28
  Object.assign(scope, answers)
28
29
  }
29
30
 
30
- module.exports.createTargetDir = function (scope) {
31
+ function createTargetDir (scope) {
31
32
  console.log()
32
33
  logger.log('Generating files...')
33
34
  console.log()
@@ -36,24 +37,24 @@ module.exports.createTargetDir = function (scope) {
36
37
  fn(scope.projectFolder)
37
38
  }
38
39
 
39
- module.exports.convertArrayToObject = function (arr) {
40
+ function convertArrayToObject (arr) {
40
41
  const acc = {}
41
42
  arr.forEach(key => {
42
- acc[key] = true
43
+ acc[ key ] = true
43
44
  })
44
45
  return acc
45
46
  }
46
47
 
47
- module.exports.runningPackageManager = (() => {
48
+ const runningPackageManager = (() => {
48
49
  const userAgent = process.env.npm_config_user_agent
49
50
 
50
51
  if (userAgent) {
51
- return userAgent.split(' ')[0].split('/')[0]
52
+ return userAgent.split(' ')[ 0 ].split('/')[ 0 ]
52
53
  }
53
54
  })()
54
55
 
55
- module.exports.renderTemplate = function (templateDir, scope) {
56
- const files = fglob.sync(['**/*'], { cwd: templateDir })
56
+ function renderTemplate (templateDir, scope) {
57
+ const files = fglob.sync([ '**/*' ], { cwd: templateDir })
57
58
 
58
59
  for (const rawPath of files) {
59
60
  const targetRelativePath = rawPath.split('/').map(name => {
@@ -72,11 +73,11 @@ module.exports.renderTemplate = function (templateDir, scope) {
72
73
 
73
74
  ensureFileSync(targetPath)
74
75
 
75
- console.log(` ${green('-')} ${targetRelativePath}`)
76
+ console.log(` ${ green('-') } ${ targetRelativePath }`)
76
77
 
77
78
  if (TEMPLATING_FILE_EXTENSIONS.includes(extension)) {
78
79
  const rawContent = readFileSync(sourcePath, 'utf-8')
79
- const template = compileTemplate(rawContent, { 'interpolate': /<%=([\s\S]+?)%>/g })
80
+ const template = compileTemplate(rawContent, { interpolate: /<%=([\s\S]+?)%>/g })
80
81
 
81
82
  const newContent = extension === '.json'
82
83
  ? JSON.stringify(JSON.parse(template(scope)), null, 2)
@@ -90,13 +91,13 @@ module.exports.renderTemplate = function (templateDir, scope) {
90
91
  }
91
92
  }
92
93
 
93
- module.exports.isValidPackageName = function (projectName) {
94
+ function isValidPackageName (projectName) {
94
95
  return /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(
95
96
  projectName
96
97
  )
97
98
  }
98
99
 
99
- module.exports.inferPackageName = function (projectFolder) {
100
+ function inferPackageName (projectFolder) {
100
101
  return projectFolder
101
102
  .trim()
102
103
  .toLowerCase()
@@ -105,7 +106,7 @@ module.exports.inferPackageName = function (projectFolder) {
105
106
  .replace(/[^a-z0-9-~]+/g, '-')
106
107
  }
107
108
 
108
- module.exports.escapeString = function (val) {
109
+ function escapeString (val) {
109
110
  return JSON.stringify(val).slice(1, -1)
110
111
  }
111
112
 
@@ -130,20 +131,20 @@ function getGitUser () {
130
131
  *
131
132
  * @param {Object} scope Data from questionnaire.
132
133
  */
133
- module.exports.printFinalMessage = function (scope) {
134
+ function printFinalMessage (scope) {
134
135
  const verPrefix = scope.quasarVersion ? scope.quasarVersion + '.' : ''
135
136
  const message = `
136
137
  To get started:
137
- ${yellow(`
138
- cd ${scope.projectFolderName}${ scope.skipDepsInstall !== true && scope.packageManager === false ? `
138
+ ${ yellow(`
139
+ cd ${ scope.projectFolderName }${ scope.skipDepsInstall !== true && scope.packageManager === false ? `
139
140
  yarn #or: npm install
140
141
  yarn lint --fix # or: npm run lint -- --fix` : '' }${ scope.skipDepsInstall !== true ? `
141
142
  quasar dev # or: yarn quasar dev # or: npx quasar dev` : '' }
142
- `)}
143
- Documentation can be found at: https://${verPrefix}quasar.dev
143
+ `) }
144
+ Documentation can be found at: https://${ verPrefix }quasar.dev
144
145
 
145
146
  Quasar is relying on donations to evolve. We'd be very grateful if you can
146
- read our manifest on "Why donations are important": https://${verPrefix}quasar.dev/why-donate
147
+ read our manifest on "Why donations are important": https://${ verPrefix }quasar.dev/why-donate
147
148
  Donation campaign: https://donate.quasar.dev
148
149
  Any amount is very welcome.
149
150
  If invoices are required, please first contact Razvan Stoenescu.
@@ -166,7 +167,7 @@ function runCommand (cmd, args, options) {
166
167
  Object.assign({
167
168
  cwd: process.cwd(),
168
169
  stdio: 'inherit',
169
- shell: true,
170
+ shell: true
170
171
  }, options)
171
172
  )
172
173
 
@@ -174,7 +175,7 @@ function runCommand (cmd, args, options) {
174
175
  console.log()
175
176
 
176
177
  if (code) {
177
- console.log(` ${cmd} FAILED...`)
178
+ console.log(` ${ cmd } FAILED...`)
178
179
  console.log()
179
180
  reject()
180
181
  }
@@ -185,7 +186,7 @@ function runCommand (cmd, args, options) {
185
186
  })
186
187
  }
187
188
 
188
- module.exports.installDeps = function (scope) {
189
+ function installDeps (scope) {
189
190
  return runCommand(
190
191
  scope.packageManager,
191
192
  [ 'install' ],
@@ -193,12 +194,12 @@ module.exports.installDeps = function (scope) {
193
194
  )
194
195
  }
195
196
 
196
- module.exports.lintFolder = function (scope) {
197
+ function lintFolder (scope) {
197
198
  return runCommand(
198
199
  scope.packageManager,
199
200
  scope.packageManager === 'npm'
200
- ? ['run', 'lint', '--', '--fix']
201
- : ['run', 'lint', '--fix'],
201
+ ? [ 'run', 'lint', '--', '--fix' ]
202
+ : [ 'run', 'lint', '--fix' ],
202
203
  { cwd: scope.projectFolder }
203
204
  )
204
205
  }
@@ -211,18 +212,18 @@ const quasarConfigFilenameList = [
211
212
  'quasar.conf.js' // legacy
212
213
  ]
213
214
 
214
- module.exports.ensureOutsideProject = function () {
215
+ function ensureOutsideProject () {
215
216
  let dir = process.cwd()
216
217
 
217
- while (dir.length && dir[dir.length - 1] !== sep) {
218
+ while (dir.length && dir[ dir.length - 1 ] !== sep) {
218
219
  for (const name of quasarConfigFilenameList) {
219
- const filename = join(dir, name)
220
+ const filename = pathJoin(dir, name)
220
221
  if (existsSync(filename)) {
221
- logger.fatal(`Error. This command must NOT be executed inside of a Quasar project folder.`)
222
+ logger.fatal('Error. This command must NOT be executed inside of a Quasar project folder.')
222
223
  }
223
224
  }
224
225
 
225
- dir = normalize(join(dir, '..'))
226
+ dir = normalize(pathJoin(dir, '..'))
226
227
  }
227
228
  }
228
229
 
@@ -235,7 +236,7 @@ const SCRIPT_TYPES = [
235
236
  { title: 'Typescript', value: 'ts' }
236
237
  ]
237
238
 
238
- module.exports.commonPrompts = {
239
+ const commonPrompts = {
239
240
  quasarVersion: {
240
241
  type: 'select',
241
242
  name: 'quasarVersion',
@@ -258,7 +259,7 @@ module.exports.commonPrompts = {
258
259
  message: 'Project product name: (must start with letter if building mobile apps)',
259
260
  initial: 'Quasar App',
260
261
  validate: val =>
261
- val && val.length > 0 || 'Invalid product name'
262
+ (val && val.length > 0) || 'Invalid product name'
262
263
  },
263
264
 
264
265
  description: {
@@ -266,7 +267,7 @@ module.exports.commonPrompts = {
266
267
  name: 'description',
267
268
  message: 'Project description:',
268
269
  initial: 'A Quasar Project',
269
- format: module.exports.escapeString,
270
+ format: escapeString,
270
271
  validate: val =>
271
272
  val.length > 0 || 'Invalid project description'
272
273
  },
@@ -307,3 +308,23 @@ module.exports.commonPrompts = {
307
308
  message: 'Issue reporting URL: (eg https://github.com/quasarframework/quasar/issues)'
308
309
  }
309
310
  }
311
+
312
+ export default {
313
+ logger,
314
+
315
+ join,
316
+ prompts,
317
+ createTargetDir,
318
+ convertArrayToObject,
319
+ runningPackageManager,
320
+ renderTemplate,
321
+ isValidPackageName,
322
+ inferPackageName,
323
+
324
+ printFinalMessage,
325
+ installDeps,
326
+ lintFolder,
327
+ ensureOutsideProject,
328
+
329
+ commonPrompts
330
+ }