Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function setup (context) {
// Package installation progress events
installProgress.on('progress', value => {
if (progress.get(PROGRESS_ID)) {
progress.set({ id: PROGRESS_ID, progress: value }, context)
}
})
installProgress.on('log', message => {
if (progress.get(PROGRESS_ID)) {
progress.set({ id: PROGRESS_ID, info: message }, context)
}
})
}
function getInstallation (context) {
if (!eventsInstalled) {
eventsInstalled = true
// Package installation progress events
installProgress.on('progress', value => {
if (progress.get(PROGRESS_ID)) {
progress.set({ id: PROGRESS_ID, progress: value }, context)
}
})
installProgress.on('log', message => {
if (progress.get(PROGRESS_ID)) {
progress.set({ id: PROGRESS_ID, info: message }, context)
}
})
}
return {
id: 'plugin-install',
pluginId: currentPluginId,
step: installationStep,
prompts: prompts.list()
}
}
async function initCreator (context) {
const creator = new Creator('', cwd.get(), getPromptModules())
/* Event listeners */
// Creator emits creation events (the project creation steps)
onCreationEvent = ({ event }) => {
progress.set({ id: PROGRESS_ID, status: event, info: null }, context)
}
creator.on('creation', onCreationEvent)
// Progress bar
onInstallProgress = value => {
if (progress.get(PROGRESS_ID)) {
progress.set({ id: PROGRESS_ID, progress: value }, context)
}
}
installProgress.on('progress', onInstallProgress)
// Package manager steps
onInstallLog = message => {
if (progress.get(PROGRESS_ID)) {
progress.set({ id: PROGRESS_ID, info: message }, context)
}
}
installProgress.on('log', onInstallLog)
// Presets
const manualPreset = {
id: '__manual__',
name: 'org.vue.views.project-create.tabs.presets.manual.name',
description: 'org.vue.views.project-create.tabs.presets.manual.description',
link: null,
features: []
}
}
creator.on('creation', onCreationEvent)
// Progress bar
onInstallProgress = value => {
if (progress.get(PROGRESS_ID)) {
progress.set({ id: PROGRESS_ID, progress: value }, context)
}
}
installProgress.on('progress', onInstallProgress)
// Package manager steps
onInstallLog = message => {
if (progress.get(PROGRESS_ID)) {
progress.set({ id: PROGRESS_ID, info: message }, context)
}
}
installProgress.on('log', onInstallLog)
// Presets
const manualPreset = {
id: '__manual__',
name: 'org.vue.views.project-create.tabs.presets.manual.name',
description: 'org.vue.views.project-create.tabs.presets.manual.description',
link: null,
features: []
}
const presetsData = creator.getPresets()
presets = [
...Object.keys(presetsData).map(
key => {
const preset = presetsData[key]
const features = getFeatures(preset).map(
f => toShortPluginId(f)
function getInstallation (context) {
if (!eventsInstalled) {
eventsInstalled = true
// Package installation progress events
installProgress.on('progress', value => {
if (progress.get(PROGRESS_ID)) {
progress.set({ id: PROGRESS_ID, progress: value }, context)
}
})
installProgress.on('log', message => {
if (progress.get(PROGRESS_ID)) {
progress.set({ id: PROGRESS_ID, info: message }, context)
}
})
}
return {
id: 'plugin-install',
pluginId: currentPluginId,
step: installationStep,
prompts: prompts.list()
function setup (context) {
// Package installation progress events
installProgress.on('progress', value => {
if (progress.get(PROGRESS_ID)) {
progress.set({ id: PROGRESS_ID, progress: value }, context)
}
})
installProgress.on('log', message => {
if (progress.get(PROGRESS_ID)) {
progress.set({ id: PROGRESS_ID, info: message }, context)
}
})
}