Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function build (isDevelopment, exitOnError) {
log.info('Building plugin...')
const config = await readConfig()
try {
await buildBundle(config, isDevelopment)
await buildManifest(config)
} catch (error) {
log.error(error)
if (exitOnError === true) {
process.exit(1)
}
return
}
log.success('Done')
}
export async function createFigmaPlugin (options, useDefault) {
if (typeof options.name !== 'undefined') {
await throwIfDirectoryExists(join(process.cwd(), options.name))
}
log.info('Scaffolding a new plugin...')
const config = useDefault
? createDefaultConfig(options)
: await promptForUserInput(options)
const pluginDirectoryPath = join(process.cwd(), config.name)
await throwIfDirectoryExists(pluginDirectoryPath)
log.info('Cloning template...')
await cloneFromTemplate(pluginDirectoryPath, config.template)
await interpolateValuesIntoFiles(pluginDirectoryPath, config)
log.info('Installing dependencies...')
await installDependencies(pluginDirectoryPath)
log.success('Done')
}