Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
exports.handler = async argv => {
const componentId = argv._[1]
const variants = argv._.slice(2)
const variantNames = variants.length ? variants : [componentId]
try {
const state = await Core.init(argv)
const { config } = state
const tasks = []
const filesCreated = []
const filesExisted = []
const eventuallyWriteFile = (filePath, content) => {
if (exists(filePath) && !argv.force) {
filesExisted.push(filePath)
} else {
tasks.push(write(filePath, content))
filesCreated.push(filePath)
}
}
// component
task('uiengine', done => {
const opts = {
debug: isDev,
serve: isDev,
watch: isDev
}
UIengine.build(opts)
.then(() => { done() })
.catch(done)
})
exports.handler = async argv => {
try {
const state = await Core.init(argv)
const { config: { source } } = state
const { entities } = source
if (!entities) return
const pattern = crossPlatformPath(join(entities, '**', '*.yml'))
const filePaths = await glob(pattern, { onlyFiles: true })
filePaths.forEach(async ymlPath => {
const entityPath = dirname(ymlPath)
const jsPath = join(entityPath, `${basename(ymlPath, '.yml')}.js`)
const attributes = await YamlUtil.fromFile(ymlPath)
await Promise.all([
write(jsPath, prettier.format(`module.exports = ${JSON.stringify(attributes, null, 2)}`))
])
exports.handler = async argv => {
const pageId = argv._[1]
const additionalPageIds = argv._.slice(2)
const pageIds = additionalPageIds.length ? [pageId, ...additionalPageIds] : [pageId]
try {
const { config } = await Core.init(argv)
const pagesDir = config.source.pages
const docsTemp = getTemplate('page_readme')
const confTemp = getTemplate('page_config')
const tasks = []
const filesCreated = []
const filesExisted = []
const eventuallyWriteFile = (filePath, content) => {
if (exists(filePath) && !argv.force) {
filesExisted.push(filePath)
} else {
tasks.push(write(filePath, content))
filesCreated.push(filePath)
}
}
exports.handler = async argv => {
try {
const state = await Core.init(argv)
const { config: { source } } = state
const { data } = source
if (!data) return
const pattern = crossPlatformPath(join(data, '**', '*.yml'))
const filePaths = await glob(pattern, { onlyFiles: true })
filePaths.forEach(async ymlPath => {
const dataPath = dirname(ymlPath)
const jsPath = join(dataPath, `${basename(ymlPath, '.yml')}.js`)
const attributes = await YamlUtil.fromFile(ymlPath)
await Promise.all([
write(jsPath, prettier.format(`module.exports = ${JSON.stringify(attributes, null, 2)}`))
])
exports.handler = async argv => {
try {
const state = await Core.init(argv)
const { config: { source } } = state
const { components } = source
if (!components) return
const patterns = components.map(componentsPath => crossPlatformPath(join(componentsPath, '**', 'component.md')))
const filePaths = await glob(patterns, { onlyFiles: true })
filePaths.forEach(async componentMdPath => {
const componentPath = dirname(componentMdPath)
const readmePath = join(componentPath, 'README.md')
const configPath = join(componentPath, 'component.config.js')
const { attributes, body } = await FrontmatterUtil.fromFile(componentMdPath, source)
const tasks = []
if (Object.keys(attributes).length > 0) {
exports.handler = async argv => {
try {
const state = await Core.init(argv)
const { config: { source } } = state
const { pages } = source
if (!pages) return
const pattern = crossPlatformPath(join(pages, '**', 'page.md'))
const filePaths = await glob(pattern, { onlyFiles: true })
filePaths.forEach(async pageMdPath => {
const pagePath = dirname(pageMdPath)
const pageReadme = join(pagePath, 'README.md')
const pageConfig = join(pagePath, 'page.config.js')
const { attributes, body } = await FrontmatterUtil.fromFile(pageMdPath, source)
const contentTitle = titleFromContentHeading(body)
const attrsTitle = attributes.title
const tasks = []
exports.handler = argv => {
UIengine.build(argv)
.catch(() => { process.exit(1) })
}
const adapterFilesForComponent = R.map(ext => Connector.filesForComponent(state, ext, componentId), adapters)
const adapterFilesForVariants = []
const filesForVariant = R.map(ext => Connector.filesForVariant(state, ext, componentId, variantName), adapters)
adapterFilesForVariants.push(...filesForVariant)