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

arm-template-merge

v1.1.5

Published

Azure Resource Manager (ARM) Template Merge

Downloads

930

Readme

arm-template-merge

npm package Node.js version

Azure Resource Manager (ARM) Template Merge

This tool merges multiple Azure Resource Manager (ARM) template files into a single template file.

Although linked templates may be used for combining multiple resources into a single deployment, they have some drawbacks:

  • All linked templates must be accessible via a public URL so Azure Resource Manager can reach them during deployment, which may not be possible or cumbersome on some scenarios.
  • Each linked template is resolved as a separate deployment, which may not be desired.
  • Only the incremental deployment mode is allowed for linked templates.

Prerequisites

How to use

Install the CLI globally:

npm install -g arm-template-merge

Then run arm-template-merge without any arguments for details on its utilization.

Alternatively, you can execute the CLI without installing it by running:

npx arm-template-merge

Adding it as a dependency

You may add it to your project as a dependency:

npm install arm-template-merge

And use the merge functionality from your code:

const fs = require('fs');
const mergeARMTemplates = require('arm-template-merge');

let template1 = JSON.parse(fs.readFileSync('template1.json', 'utf8'));
let template2 = JSON.parse(fs.readFileSync('template2.json', 'utf8'));

let merged = {};
merged = mergeARMTemplates(merged, template1);
merged = mergeARMTemplates(merged, template2);

fs.writeFileSync('merged-template.json', JSON.stringify(merged), 'utf8');

Rules

The following rules are used for merging ARM template files:

  • All files MUST share the same exact values for the following fields:

    • $schema
    • contentVersion
    • apiProfile (if present)
  • All files' functions and resources collections will each be combined into a single collection. Objects within a collection that are exact copies will yield a single object in the merged collection:

    [                    |    [                    |    [
      { <object-A> },  --|-------------------------|-->   { <object-A> },
                         |      { <object-B> },  --|-->   { <object-B> },
      { <object-C> },    |      { <object-C> },    |      { <object-C> }
    ]                    |    ]                    |    ]
  • All files' parameters, variables and outputs objects will each be combined into a single object. Files declaring the same key within an object MUST have the same exact value, or an error will be thrown:

    {                    |    {                    |    {
      "A": <value-A>,  --|-------------------------|-->   "A": <value-A>,
                         |      "B": <value-B>,  --|-->   "B": <value-B>,
      "C": <value-C>,    |      "C": <value-C>,    |      "C": <value-C>
      "D": <value-D1>    |      "D": <value-D2>    |      <<< ERROR >>>
    }                    |    }                    |    }
  • Value and object equality follows Node.js' assert.deepStrictEqual() rules.