npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

armval

v1.0.131

Published

A validation CLI for Azure Resource Manager (ARM) templates

Downloads

21

Readme

ARM Validation CLI

Build Status

About

Unmaintained for reference only.

The aim is to create a simple CLI which can be run during CI to validate ARM templates and catch issues early.

Usage

To install use: (Note: Node v8 or higher is required)

    npm install -g armval

To validate ARM templates armval in a folder structure containing azuredeploy.json files.

You can specify a custom glob to match you file naming convention like this armval "**/*mytemplate.json"

If you have errors which you want to ignore add an armvalconfig.json with the following structure in the directory:

{
    "ignore": {
        "global": [ // These issues are skipped in all files
            {
                "message": "Unrecognized function name 'nonfunction'.",
                "jsonPath": "resources.1.dependsOn.1",
                "reason": "optional reason for the ignore"
            },
            {
                "message": ".*",
                "resource": { // You can match a resource by providing the values for `name`, `apiVersion` and `type`
                    "name":".*",
                    "apiVersion":".*",
                    "type":"Microsoft.Storage/storageAccounts"
                }
            }
        ],
        "test/testdata/azuredeploy.schema.1error.json": [
            {
                "message": ".*",
                "resource": {
                    "name":"[variables('storageAccountName')]",
                    "apiVersion":"2017-10-05",
                    "type":"Microsoft.Storage/storageAccounts"
                },
                "reason": "Schema is out of data for this resource type" // You can provide reasons which show in the CLI when these rules trigger
            }
        ],
        "test/testdata/azuredeploy.arm.repeatederror.json": [ // The path of the file 
            {
                "message": "Unrecognized function name 'nonfunction'.", // The message to skip. (This accepts a regex)
                "jsonPath": "resources.1.dependsOn.1" // The JSONPath to the location of the error. (This accepts a regex)
            },
            {   // Using the Regex this will skip this error  
                // in any children/properties of `resources.1`
                "message": "Unrecognized function name 'nonfunction'.",
                "jsonPath": "resources.1.*" 
            },
            {
                "message": ".*", // This would skip everthing 
                "jsonPath": ".*" // in this file
            }
        ]
    }
}

Note: Why the complicated ignore process? As JSON doesn't allow comments the standard //ignorethis style isn't doable and I didn't want to rely on linenumbers as file changes would mean edits to the ignore file.

Sample output

The tool will highlight JSON Language, ARM syntax and schema issues. The output is as follows:

Using default glob '**/*azuredeploy*.json' as none provided
-----------------------------
Files to be checked based on Glob '**/*azuredeploy*.json'
[ 'test/testdata/azuredeploy.arm.1error.json',
  'test/testdata/azuredeploy.json',
  'test/testdata/azuredeploy.json.1error.json',
  'test/testdata/azuredeploy.schema.1error.json',
  'test/testdata/azuredeploy.schema.invalid.json',
  'test/testdata/azuredeploy.schema.nonjson.json' ]
-----------------------------

 --> Checking file test/testdata/azuredeploy.arm.1error.json 

Found 1 issues 

Error: Unrecognized function name 'nonfunction'. 
 Location: { line: 60 char: 11 } 
 Type: Error 
 From: VSCodeARMValidation 
 File: test/testdata/azuredeploy.arm.1error.json 
 JsonPath: resources.1.dependsOn.1


-----------------------------

 --> Checking file test/testdata/azuredeploy.json 

Found 0 issues 

-----------------------------

 --> Checking file test/testdata/azuredeploy.json.1error.json 

Found 1 issues 

Error: Expected comma 
 Location: { line: 17 char: 5 } 
 Type: Error 
 From: VSCodeJSONLanguageServer 
 File: test/testdata/azuredeploy.json.1error.json 
 JsonPath: parameters.containerInstanceLocation


-----------------------------

 --> Checking file test/testdata/azuredeploy.schema.1error.json 

Found 1 issues 

Error: Value is not accepted. Valid values: "2017-06-01". 
 Location: { line: 45 char: 23 } 
 Type: Warning 
 From: VSCodeJSONLanguageServer 
 File: test/testdata/azuredeploy.schema.1error.json 
 JsonPath: resources.0.apiVersion


-----------------------------

 --> Checking file test/testdata/azuredeploy.schema.invalid.json 

Found 1 issues 

Error: JSON Document may not be an ARM template, it's missing the '$schema' field of the value in invalid 
 Location: { line: 1 char: 1 } 
 Type: Error 
 From: SchemaValidation 
 File: test/testdata/azuredeploy.schema.invalid.json 
 JsonPath: undefined


-----------------------------

 --> Checking file test/testdata/azuredeploy.schema.nonjson.json 

Found 1 issues 

Error: JSON Document may not be an ARM template, it's missing the '$schema' field of the value in invalid 
 Location: { line: 1 char: 1 } 
 Type: Error 
 From: SchemaValidation 
 File: test/testdata/azuredeploy.schema.nonjson.json 
 JsonPath: undefined


-----------------------------

Dev

First clone the repository using --recurse-submodules to ensure the nested repositories are restored. Then:

  1. npm install && npm build && nodejs ./index.js