create-quasar
Advanced tools
Comparing version 1.7.0 to 1.8.0
{ | ||
"name": "create-quasar", | ||
"version": "1.7.0", | ||
"version": "1.8.0", | ||
"description": "Scaffolds Quasar Apps, AppExtensions or UI kits", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -32,3 +32,3 @@ import { override } from 'prompts'; | ||
// The defaults | ||
typescriptConfig: 'composition', | ||
sfcStyle: 'composition', | ||
css: 'scss', | ||
@@ -35,0 +35,0 @@ preset: ['lint'], |
@@ -87,7 +87,7 @@ export async function script ({ scope, utils }) { | ||
utils.createTargetDir(scope) | ||
utils.renderTemplate(utils.join(import.meta.url, 'BASE'), scope) | ||
utils.renderTemplate('BASE', scope) | ||
if (scope.preset.prompts) utils.renderTemplate(utils.join(import.meta.url, 'prompts-script'), scope) | ||
if (scope.preset.install) utils.renderTemplate(utils.join(import.meta.url, 'install-script'), scope) | ||
if (scope.preset.uninstall) utils.renderTemplate(utils.join(import.meta.url, 'uninstall-script'), scope) | ||
if (scope.preset.prompts) utils.renderTemplate('prompts-script', scope) | ||
if (scope.preset.install) utils.renderTemplate('install-script', scope) | ||
if (scope.preset.uninstall) utils.renderTemplate('uninstall-script', scope) | ||
@@ -94,0 +94,0 @@ // nothing to install, so we'll skip it |
@@ -57,9 +57,9 @@ export async function script ({ scope, utils }) { | ||
utils.createTargetDir(scope) | ||
utils.renderTemplate(utils.join(import.meta.url, 'BASE'), scope) | ||
utils.renderTemplate(utils.join(import.meta.url, scope.css), scope) | ||
utils.renderTemplate('BASE', scope) | ||
utils.renderTemplate(scope.css, scope) | ||
if (scope.preset.axios) utils.renderTemplate(utils.join(import.meta.url, 'axios'), scope) | ||
if (scope.preset.i18n) utils.renderTemplate(utils.join(import.meta.url, 'i18n'), scope) | ||
if (scope.preset.vuex) utils.renderTemplate(utils.join(import.meta.url, 'vuex'), scope) | ||
if (scope.preset.lint) utils.renderTemplate(utils.join(import.meta.url, 'lint'), scope) | ||
if (scope.preset.axios) utils.renderTemplate('axios', scope) | ||
if (scope.preset.i18n) utils.renderTemplate('i18n', scope) | ||
if (scope.preset.vuex) utils.renderTemplate('vuex', scope) | ||
if (scope.preset.lint) utils.renderTemplate('lint', scope) | ||
} |
@@ -15,3 +15,3 @@ { | ||
"dependencies": { | ||
<% if (typescriptConfig === 'class') { %> | ||
<% if (sfcStyle === 'class') { %> | ||
"vue-class-component": "^7.2.2", | ||
@@ -18,0 +18,0 @@ "vue-property-decorator": "^8.3.0", |
{ | ||
"extends": "@quasar/app/tsconfig-preset", | ||
"compilerOptions": { | ||
"baseUrl": "."<% if (typescriptConfig === 'class') { %>, | ||
"baseUrl": "."<% if (sfcStyle === 'class') { %>, | ||
"experimentalDecorators": true<% } %><% if (preset.ie) { %>, | ||
@@ -6,0 +6,0 @@ "target": "es5"<% } %> |
@@ -5,3 +5,3 @@ export async function script ({ scope, utils }) { | ||
type: 'select', | ||
name: 'typescriptConfig', | ||
name: 'sfcStyle', | ||
message: 'Pick a Vue component style:', | ||
@@ -11,4 +11,4 @@ initial: 0, | ||
{ title: 'Composition API (recommended) (https://github.com/vuejs/composition-api)', value: 'composition' }, | ||
{ title: 'Class-based (recommended) (https://github.com/vuejs/vue-class-component & https://github.com/kaorun343/vue-property-decorator)', value: 'class' }, | ||
{ title: 'Options API', value: 'options' } | ||
{ title: 'Options API', value: 'options' }, | ||
{ title: 'Class-based (https://github.com/vuejs/vue-class-component & https://github.com/kaorun343/vue-property-decorator)', value: 'class' } | ||
] | ||
@@ -70,9 +70,9 @@ }, | ||
utils.createTargetDir(scope) | ||
utils.renderTemplate(utils.join(import.meta.url, 'BASE'), scope) | ||
utils.renderTemplate(utils.join(import.meta.url, scope.css), scope) | ||
utils.renderTemplate('BASE', scope) | ||
utils.renderTemplate(scope.css, scope) | ||
if (scope.preset.axios) utils.renderTemplate(utils.join(import.meta.url, 'axios'), scope) | ||
if (scope.preset.i18n) utils.renderTemplate(utils.join(import.meta.url, 'i18n'), scope) | ||
if (scope.preset.vuex) utils.renderTemplate(utils.join(import.meta.url, 'vuex'), scope) | ||
if (scope.preset.lint) utils.renderTemplate(utils.join(import.meta.url, 'lint'), scope) | ||
if (scope.preset.axios) utils.renderTemplate('axios', scope) | ||
if (scope.preset.i18n) utils.renderTemplate('i18n', scope) | ||
if (scope.preset.vuex) utils.renderTemplate('vuex', scope) | ||
if (scope.preset.lint) utils.renderTemplate('lint', scope) | ||
} |
@@ -9,6 +9,6 @@ export async function script ({ scope, utils }) { | ||
choices: [ | ||
{ title: 'Quasar App CLI with Vite 2 (stable | v1)', value: 'vite', description: 'recommended' }, | ||
{ title: 'Quasar App CLI with Vite 5 (BETA | next major version - v2)', value: 'vite-beta' }, | ||
{ title: 'Quasar App CLI with Webpack (stable | v3)', value: 'webpack' }, | ||
{ title: 'Quasar App CLI with Webpack (BETA | next major version - v4)', value: 'webpack-beta' } | ||
{ title: 'Quasar App CLI with Vite 2 (stable | v1)', value: 'vite-1', description: 'recommended' }, | ||
{ title: 'Quasar App CLI with Vite 5 (BETA | next major version - v2)', value: 'vite-2' }, | ||
{ title: 'Quasar App CLI with Webpack (stable | v3)', value: 'webpack-3' }, | ||
{ title: 'Quasar App CLI with Webpack (BETA | next major version - v4)', value: 'webpack-4' } | ||
] | ||
@@ -27,3 +27,27 @@ }, | ||
utils.commonPrompts.description, | ||
utils.commonPrompts.author | ||
utils.commonPrompts.author, | ||
{ | ||
type: 'select', | ||
name: 'sfcStyle', | ||
message: 'Pick a Vue component style:', | ||
initial: 0, | ||
choices: [ | ||
{ title: 'Composition API with <script setup>', value: 'composition-setup', description: 'recommended' }, | ||
{ title: 'Composition API', value: 'composition', description: 'recommended' }, | ||
{ title: 'Options API', value: 'options' } | ||
] | ||
}, | ||
{ | ||
type: 'select', | ||
name: 'css', | ||
message: 'Pick your CSS preprocessor:', | ||
initial: 0, | ||
choices: [ | ||
{ title: 'Sass with SCSS syntax', value: 'scss' }, | ||
{ title: 'Sass with indented syntax', value: 'sass' }, | ||
{ title: 'None (the others will still be available)', value: 'css' } | ||
] | ||
} | ||
]) | ||
@@ -30,0 +54,0 @@ |
export async function script ({ scope, utils }) { | ||
utils.createTargetDir(scope) | ||
utils.renderTemplate(utils.join(import.meta.url, 'BASE'), scope) | ||
utils.renderTemplate('BASE', scope) | ||
if (scope.features.ae) { | ||
utils.renderTemplate(utils.join(import.meta.url, 'ae'), scope) | ||
if (scope.preset.install) utils.renderTemplate(utils.join(import.meta.url, 'ae-install'), scope) | ||
if (scope.preset.prompts) utils.renderTemplate(utils.join(import.meta.url, 'ae-prompts'), scope) | ||
if (scope.preset.uninstall) utils.renderTemplate(utils.join(import.meta.url, 'ae-uninstall'), scope) | ||
utils.renderTemplate('ae', scope) | ||
if (scope.preset.install) utils.renderTemplate('ae-install', scope) | ||
if (scope.preset.prompts) utils.renderTemplate('ae-prompts', scope) | ||
if (scope.preset.uninstall) utils.renderTemplate('ae-uninstall', scope) | ||
} | ||
if (scope.features.component) utils.renderTemplate(utils.join(import.meta.url, 'ui-component'), scope) | ||
if (scope.features.directive) utils.renderTemplate(utils.join(import.meta.url, 'ui-directive'), scope) | ||
if (scope.features.component) utils.renderTemplate('ui-component', scope) | ||
if (scope.features.directive) utils.renderTemplate('ui-directive', scope) | ||
if (scope.features.ae && (scope.features.component || scope.features.directive)) { | ||
utils.renderTemplate(utils.join(import.meta.url, 'ui-ae'), scope) | ||
utils.renderTemplate('ui-ae', scope) | ||
} | ||
} |
export async function script ({ scope, utils }) { | ||
utils.createTargetDir(scope) | ||
utils.renderTemplate(utils.join(import.meta.url, 'BASE'), scope) | ||
utils.renderTemplate('BASE', scope) | ||
if (scope.features.ae) { | ||
utils.renderTemplate(utils.join(import.meta.url, 'ae'), scope) | ||
if (scope.preset.install) utils.renderTemplate(utils.join(import.meta.url, 'ae-install'), scope) | ||
if (scope.preset.prompts) utils.renderTemplate(utils.join(import.meta.url, 'ae-prompts'), scope) | ||
if (scope.preset.uninstall) utils.renderTemplate(utils.join(import.meta.url, 'ae-uninstall'), scope) | ||
utils.renderTemplate('ae', scope) | ||
if (scope.preset.install) utils.renderTemplate('ae-install', scope) | ||
if (scope.preset.prompts) utils.renderTemplate('ae-prompts', scope) | ||
if (scope.preset.uninstall) utils.renderTemplate('ae-uninstall', scope) | ||
} | ||
if (scope.features.component) utils.renderTemplate(utils.join(import.meta.url, 'ui-component'), scope) | ||
if (scope.features.directive) utils.renderTemplate(utils.join(import.meta.url, 'ui-directive'), scope) | ||
if (scope.features.component) utils.renderTemplate('ui-component', scope) | ||
if (scope.features.directive) utils.renderTemplate('ui-directive', scope) | ||
if (scope.features.ae && (scope.features.component || scope.features.directive)) { | ||
utils.renderTemplate(utils.join(import.meta.url, 'ui-ae'), scope) | ||
utils.renderTemplate('ui-ae', scope) | ||
} | ||
} |
import { readFileSync, writeFileSync, existsSync } from 'node:fs' | ||
import { fileURLToPath } from 'node:url' | ||
import { sep, normalize, join as pathJoin, resolve, extname } from 'node:path' | ||
import { sep, dirname, normalize, join, resolve, extname } from 'node:path' | ||
import { spawn, execSync as exec } from 'node:child_process' | ||
@@ -16,6 +16,2 @@ | ||
function join (importMetaUrl, targetPath) { | ||
return fileURLToPath(new URL('./' + targetPath, importMetaUrl)) | ||
} | ||
async function prompts (scope, questions, opts) { | ||
@@ -57,3 +53,17 @@ const options = opts || { | ||
function renderTemplate (templateDir, scope) { | ||
function getCallerPath () { | ||
const _prepareStackTrace = Error.prepareStackTrace | ||
Error.prepareStackTrace = (_, stack) => stack | ||
const stack = new Error().stack.slice(1) | ||
Error.prepareStackTrace = _prepareStackTrace | ||
const filename = stack[ 1 ].getFileName() | ||
return dirname( | ||
filename.startsWith('file://') | ||
? fileURLToPath(filename) | ||
: filename | ||
) | ||
} | ||
function renderTemplate (relativePath, scope) { | ||
const templateDir = join(getCallerPath(), relativePath) | ||
const files = fglob.sync([ '**/*' ], { cwd: templateDir }) | ||
@@ -222,3 +232,3 @@ | ||
for (const name of quasarConfigFilenameList) { | ||
const filename = pathJoin(dir, name) | ||
const filename = join(dir, name) | ||
if (existsSync(filename)) { | ||
@@ -229,3 +239,3 @@ logger.fatal('Error. This command must NOT be executed inside of a Quasar project folder.') | ||
dir = normalize(pathJoin(dir, '..')) | ||
dir = normalize(join(dir, '..')) | ||
} | ||
@@ -319,3 +329,2 @@ } | ||
join, | ||
prompts, | ||
@@ -322,0 +331,0 @@ createTargetDir, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1433136
9000
3