How to use @architect/parser - 4 common examples

To help you get started, we’ve selected a few @architect/parser 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 architect / architect / src / util / read-arc.js View on Github external
raw = read(arcDefaultPath)
      arc = parse(raw)
    }
    else if (exists(appDotArcPath)) {
      raw = read(appDotArcPath)
      arc = parse(raw)
    }
    else if (exists(arcYamlPath)) {
      raw = read(arcYamlPath)
      arc = parse.yaml(raw)
      // HACK
      raw = parse.yaml.stringify(raw)
    }
    else if (exists(arcJsonPath)) {
      raw = read(arcJsonPath)
      arc = parse.json(raw)
      // HACK
      raw = parse.json.stringify(raw)
    }
    else {
      throw Error('.arc, app.arc, arc.yaml, or arc.json not found')
    }
  }
  catch(e) {
    err('invalid arcfile in ' + cwd)
    process.exit(1)
  }

  return {raw, arc}
}
github architect / architect / src / util / read-arc.js View on Github external
let arcJsonPath = join(cwd, 'arc.json')

  let raw
  let arc
  try {
    if (exists(arcDefaultPath)) {
      raw = read(arcDefaultPath)
      arc = parse(raw)
    }
    else if (exists(appDotArcPath)) {
      raw = read(appDotArcPath)
      arc = parse(raw)
    }
    else if (exists(arcYamlPath)) {
      raw = read(arcYamlPath)
      arc = parse.yaml(raw)
      // HACK
      raw = parse.yaml.stringify(raw)
    }
    else if (exists(arcJsonPath)) {
      raw = read(arcJsonPath)
      arc = parse.json(raw)
      // HACK
      raw = parse.json.stringify(raw)
    }
    else {
      throw Error('.arc, app.arc, arc.yaml, or arc.json not found')
    }
  }
  catch(e) {
    err('invalid arcfile in ' + cwd)
    process.exit(1)
github architect / functions / src / tables / read-local-arc.js View on Github external
function read(filepath, type) {
  let arc = fs.readFileSync(filepath).toString()
  try {
    if (type === 'arc')
      return parse(arc)
    if (type === 'json')
      return parse.json(arc)
    if (type === 'yaml')
      return parse.yaml(arc)
  }
  catch(err) {
    throw Error(err)
  }
}
github architect / functions / src / tables / read-local-arc.js View on Github external
function read(filepath, type) {
  let arc = fs.readFileSync(filepath).toString()
  try {
    if (type === 'arc')
      return parse(arc)
    if (type === 'json')
      return parse.json(arc)
    if (type === 'yaml')
      return parse.yaml(arc)
  }
  catch(err) {
    throw Error(err)
  }
}

@architect/parser

Architect Parser accepts plaintext, JSON, or YAML .arc manifests and returns a plain JavaScript Object

Apache-2.0
Latest version published 8 months ago

Package Health Score

67 / 100
Full package analysis

Popular @architect/parser functions