Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
@architect/utils
Advanced tools
@architect/utils
@architect/utils are common utilities for the @architect suite of projects.
npm i @architect/utils
utils.banner(params)
Reads a project's the Architect manifest and prints out: app name, AWS region, AWS profile, version, and current working directory, in addition to loading basic environment variables and necessary AWS credentials.
params
is an object which can provide the following properties to customize this behaviour:
disableRegion
: don't print the AWS regiondisableProfile
: don't print the AWS profileversion
: the version to print oututils.getLambdaName(fn)
Returns a valid AWS Lambda function name based on its URL (route).
utils.getLayers(arc)
Returns Lambda layers defined in an Architect project manifest. arc
is an object returned by the @architect/parser
, parsed from an Architect project manifest file.
utils.getRuntime(arc)
Returns the Lambda runtime defined in an Architect project manifest. arc
is an object returned by the @architect/parser
, parsed from an Architect project manifest file.
utils.getRuntime.allowed(runtime)
Takes a runtime
string and returns the same string if it' iss' a runtime allowed in Architect. Otherwise, returns a default runtime which Architect will use (currently nodejs10.x
).
utils.initEnv(callback)
Populates the runtime environment with variables from a .arc-env
if present. Details about this functionality can be found in the @architect/env project (pending resolution of architect/env#2).
utils.inventory(arc)
Returns an object containing:
restapis
, websocketapis
, lambdas
,
types
, iamroles
, snstopics
, sqstopics
, s3buckets
, cwerules
and
tables
localPaths
mapping inventory code (where applicable) to paths on
the local filesystemThe returned object is based on the provided arc
, which is an object returned by the @architect/parser
, parsed from an Architect project manifest file. (If no arc
object is passed, it will attempt to parse one itself.)
utils.pathToUnix(pathString)
Converts any path to a Unix style path, with /
as the seperator. This works around Windows issues where /
is assumed across other parts of Architect.
utils.portInUse(port, callback)
Tests that the port specified by port
is available to be used. If an error is raised attempting to listen on the specified port, callback
will be invoked with an error argument. If it is available, callback
will be invoked with no arguments.
utils.readArc(params={})
Returns an object containing the following properties:
raw
: the raw string contents of the arc project filearc
: the parsed (via @architect/parser) contents of the Architect project manifestThe project file is attempted to be parsed, in order, from .arc
, app.arc
, arc.yaml
, and arc.json
.
utils.toLogicalID(str)
Converts str
into PascalCase.
utils.validate(arc, raw, callback)
Validates a parsed arc file. Parameters to this function are:
arc
: an object returned by the @architect/parser
, parsed from an Architect project manifest fileraw
: the raw Architect project manifest file textcallback
: will be invoked with an error as its first argument if validation fails; otherwise will invoke passing null as the first argument and the parsed arc
object as the second argument[2.0.3] 2020-12-19
inv.static
FAQs
Common utility functions
The npm package @architect/utils receives a total of 3,675 weekly downloads. As such, @architect/utils popularity was classified as popular.
We found that @architect/utils demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
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.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.