How to use the @uiengine/core/src/core.init function in @uiengine/core

To help you get started, we’ve selected a few @uiengine/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dennisreimann / uiengine / packages / cli / src / commands / component.js View on Github external
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
github dennisreimann / uiengine / packages / cli / src / commands / migrations / entity.yml.js View on Github external
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)}`))
      ])
github dennisreimann / uiengine / packages / cli / src / commands / page.js View on Github external
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)
      }
    }
github dennisreimann / uiengine / packages / cli / src / commands / migrations / data.yml.js View on Github external
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)}`))
      ])
github dennisreimann / uiengine / packages / cli / src / commands / migrations / component.md.js View on Github external
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) {
github dennisreimann / uiengine / packages / cli / src / commands / migrations / page.md.js View on Github external
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 = []

@uiengine/core

Create, document and evolve your design system collaboratively.

MIT
Latest version published 10 days ago

Package Health Score

65 / 100
Full package analysis