Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
await run('git', ['config', 'user.name', 'test'])
await run('git', ['config', 'user.email', 'test@test.com'])
}
const msg = typeof cliOptions.git === 'string' ? cliOptions.git : 'init'
try {
await run('git', ['commit', '-m', msg])
} catch (e) {
gitCommitFailed = true
}
}
// log instructions
stopSpinner()
log()
log(`๐ Successfully created project ${chalk.yellow(name)}.`)
log(
`๐ Get started with the following commands:\n\n` +
(this.context === process.cwd() ? `` : chalk.cyan(` ${chalk.gray('$')} cd ${name}\n`)) +
chalk.cyan(` ${chalk.gray('$')} ${packageManager === 'yarn' ? 'yarn serve' : 'npm run serve'}`)
)
log()
this.emit('creation', { event: 'done' })
if (gitCommitFailed) {
warn(
`Skipped git commit due to missing username and email in git config.\n` +
`You will need to perform the initial commit yourself.\n`
)
}
generator.printExitLogs()
}
await run('git', ['config', 'user.email', 'test@test.com'])
}
const msg = typeof cliOptions.git === 'string' ? cliOptions.git : 'init'
try {
await run('git', ['commit', '-m', msg])
} catch (e) {
gitCommitFailed = true
}
}
// log instructions
stopSpinner()
log()
log(`๐ Successfully created project ${chalk.yellow(name)}.`)
if (!cliOptions.skipGetStarted) {
log(
`๐ Get started with the following commands:\n\n` +
(this.context === process.cwd() ? `` : chalk.cyan(` ${chalk.gray('$')} cd ${name}\n`)) +
chalk.cyan(` ${chalk.gray('$')} ${packageManager === 'yarn' ? 'yarn serve' : packageManager === 'pnpm' ? 'pnpm run serve' : 'npm run serve'}`)
)
}
log()
this.emit('creation', { event: 'done' })
if (gitCommitFailed) {
warn(
`Skipped git commit due to missing username and email in git config.\n` +
`You will need to perform the initial commit yourself.\n`
)
}
generator.printExitLogs()
const getLangs = () => {
const langs = {};
log('Retrieve main langs...');
let langsPath = glob.sync('./src/i18n/*.json');
for (let i = 0; i < langsPath.length; i += 1) {
const lang = langsPath[i].replace('./src/i18n/', '').replace('.json', '');
langs[lang] = require(langsPath[i]); // eslint-disable-line
}
log('Retrieve and filter cards langs...');
const langsName = Object.keys(langs);
langsPath = glob.sync('./src/cards/*/langs/*.json')
.filter((f) => {
const splitted = f.split('/');
return cardsKeys.indexOf(splitted[3]) > -1
&& langsName.indexOf(splitted[5].replace('.json', '')) > -1;
});
for (let i = 0; i < langsPath.length; i += 1) {
const splitted = langsPath[i].split('/');
const cardName = splitted[3];
} catch (e) {
stopSpinner()
error(`Failed fetching remote preset ${chalk.cyan(name)}:`)
throw e
}
}
// use default preset if user has not overwritten it
if (name === 'default' && !preset) {
preset = defaults.presets.default
}
if (!preset) {
error(`preset "${name}" not found.`)
const presets = Object.keys(savedPresets)
if (presets.length) {
log()
log(`available presets:\n${presets.join(`\n`)}`)
} else {
log(`you don't seem to have any saved preset.`)
log(`run vue-cli in manual mode to create a preset.`)
}
exit(1)
}
return preset
}
'@vue/cli-plugin-eslint': [Object]
},
bare: undefined
},
'@vue/cli-plugin-babel': {},
'@vue/cli-plugin-eslint': { config: 'standard', _isPreset: true, lintOn: ['save'] }
} */
const plugins = []
for (const id of Object.keys(rawPlugins)) {
// loadModule('@vue/cli-service/generator', '/Users/../vue-cli/demo')
const apply = loadModule(`${id}/generator`, this.context) || (() => {})
let options = rawPlugins[id] || {}
if (options.prompts) {
const prompts = loadModule(`${id}/prompts`, this.context)
if (prompts) { //
log()
log(`${chalk.cyan(options._isPreset ? `Preset options:` : id)}`)
options = await inquirer.prompt(prompts)
}
}
plugins.push({ id, apply, options })
}
return plugins
}
async resolvePlugins (rawPlugins) {
// ensure cli-service is invoked first
rawPlugins = sortObject(rawPlugins, ['@vue/cli-service'], true)
const plugins = []
for (const id of Object.keys(rawPlugins)) {
const apply = loadModule(`${id}/generator`, this.context) || (() => {})
let options = rawPlugins[id] || {}
if (options.prompts) {
const prompts = loadModule(`${id}/prompts`, this.context)
if (prompts) {
log()
log(`${chalk.cyan(options._isPreset ? `Preset options:` : id)}`)
options = await inquirer.prompt(prompts)
}
}
plugins.push({ id, apply, options })
}
return plugins
}
// Optimize express
const nodeEnv = process.env.NODE_ENV
process.env.NODE_ENV = 'production'
// Dev mode
if (options.dev) {
process.env.VUE_APP_CLI_UI_DEV = true
}
if (!process.env.VUE_CLI_IPC) {
// Prevent IPC id conflicts
process.env.VUE_CLI_IPC = `vue-cli-${shortid()}`
}
if (!options.quiet) log(`๐ Starting GUI...`)
const opts = {
host,
port,
graphqlPath: '/graphql',
subscriptionsPath: '/graphql', // ่ฎข้
enableMocks: false,
enableEngine: false,
cors: '*',
timeout: 1000000,
quiet: true,
paths: {
typeDefs: require.resolve('@vue/cli-ui/apollo-server/type-defs.js'), // schema
resolvers: require.resolve('@vue/cli-ui/apollo-server/resolvers.js'), // resolvers
context: require.resolve('@vue/cli-ui/apollo-server/context.js'), // ๅฏไปฅๅ resolvers ๆณจๅ
ฅไธไธๆๅฏน่ฑก
pubsub: require.resolve('@vue/cli-ui/apollo-server/pubsub.js'), // ่ฎข้
bundle.run((err, stats) => {
stopSpinner(false)
if (err) {
throw err
}
if (stats.hasErrors()) {
error(`Build failed with errors.`)
process.exit(1)
}
const targetDirShort = path.relative(api.service.context, outputDir)
log(formatStats(stats, targetDirShort, api))
launchElectron()
})
} else {
async (args) => {
normalizeKey(args, defaults, shared)
try {
log()
log('publish application start...')
log()
await publishCMD(args)
log()
log('published application successfully!')
log()
} catch (err) {
stopSpinner(false)
log(chalk.red(err))
throw err
}
}
)
async (args) => {
normalizeKey(args, defaults, shared)
try {
log()
log('publish application start...')
log()
await publishCMD(args)
log()
log('published application successfully!')
log()
} catch (err) {
stopSpinner(false)
log(chalk.red(err))
throw err
}
}
)