Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@architect/parser

Package Overview
Dependencies
Maintainers
5
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@architect/parser

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

  • 2.3.0-RC.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6.2K
increased by72.37%
Maintainers
5
Weekly downloads
 
Created
Source

@architect/parser GitHub CI status

OpenJS Architect is an Infrastructure as Code (IaC) solution. The critical insight of Infastructure as Code is determinism. Infrastructure resources are defined in a declarative manifest file with the code that depends on them. This ensures deployment artifacts alway have the exact runtime resources expected for every version of the code.

Architect looks in the following places for the primary definition/configuration manifest file:

The .arc format is unique to Architect with many readability advantages; but is not required


.arc

.arc is a text format for storing structured configuration data; it is not for serializing or transporting data

The .arc format:

  • Comments follow # symbols
  • Top level keys start with @ (example: @pragma)
  • Pragmas contain: scalar values or complex values
  • Scalar values are: string, number and boolean
  • Complex values are: array, vector and map
  • Whitespace is significant

Example

Consider a file some-arc-file.txt with the following contents:

# this is a comment
@section-one
simple-string-value # String
another-value
4.2 # Number
true # Boolean

@section-of-arrays
vector of values
vector tuple

@vectors-section
named
  vector
  of
  values

@this-section-has-a-map
hello-world
  name some-value

Parsing the file with the following code:

#!/usr/bin/env node
const parser = require('@architect/parser')
const fs = require('fs')
const text = fs.readFileSync('./some-arc-file.txt').toString()
const result = parse(text)

console.log(result)

Prints the following plain object to the console:

{
  "section-one": [
    "simple-string-value",
    "another-value",
    4.2,
    true
  ],
  "section-of-arrays": [
    ["vector", "of", "values"],
    ["vector", "tuple"]
  ],
  "vectors-section": [
    {named: ["vector", "of", "values"]},
  ],
  "this-section-has-a-map": [{
    "hello-world": {
      "name": "some-value"
    }
  }]
}

Things to notice:

  • array values are space seperated scalar values on a single line
  • vector is a named array with scalar values indented two spaces on newlines
  • map is a named value followed by keys and values indented two spaces

FAQs

Package last updated on 02 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc