New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

grunt-wysknd-aws-cf-generator

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-wysknd-aws-cf-generator - npm Package Compare versions

Comparing version 2.1.0 to 3.0.0

2

package.json
{
"name": "grunt-wysknd-aws-cf-generator",
"version": "2.1.0",
"version": "3.0.0",
"description": "Grunt task for the generation of code driven cloud formation templates using wysknd-aws-cf-generator",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

'use strict';
const _fs = require('fs');
const _path = require('path');
const _clone = require('clone');
const DirInfo = require('wysknd-aws-cf-generator').DirInfo;

@@ -12,3 +10,3 @@ const TemplateBuilder = require('wysknd-aws-cf-generator').TemplateBuilder;

grunt.log.debug(`Loading task: [${taskName}]`);
grunt.registerTask(taskName, function() {
grunt.registerMultiTask(taskName, function(target) {
const done = this.async();

@@ -26,23 +24,33 @@ const options = this.options({

});
if (typeof options.output.dir !== 'string' ||
options.output.dir.length <= 0) {
throw new Error('Invalid output directory specified (options.output.dir)');
const tokens = Object.assign({}, options.tokens, this.data.tokens);
const input = Object.assign({}, options.input, this.data.input);
const output = Object.assign({}, options.output, this.data.output);
const description = options.description || this.data.description || 'na';
if (typeof output.dir !== 'string' || output.dir.length <= 0) {
throw new Error('Invalid output directory specified (output.dir)');
}
if (typeof options.output.fileName !== 'string' ||
options.output.fileName.length <= 0) {
throw new Error('Invalid output file name specified (options.output.fileName)');
if (typeof output.fileName !== 'string' || output.fileName.length <= 0) {
throw new Error('Invalid output file name specified (output.fileName)');
}
grunt.log.debug('Task options:\n', JSON.stringify(options, null, 4));
const tokens = _clone(options.tokens);
const rootDir = options.input.rootDir;
const templateDir = options.input.templateDir;
grunt.verbose.debug('Task options: ', JSON.stringify(options, null, 4));
grunt.verbose.debug('Target options: ', JSON.stringify(this.data, null, 4));
grunt.verbose.subhead('Consolidated Inputs:');
const dirInfo = new DirInfo(rootDir, templateDir);
grunt.log.debug('Description: ', description);
grunt.log.debug('Tokens: ', JSON.stringify(tokens, null, 4));
grunt.log.debug('Input: ', JSON.stringify(input, null, 4));
grunt.log.debug('Outuput: ', JSON.stringify(output, null, 4));
const dirInfo = new DirInfo(input.rootDir, input.templateDir);
const builder = new TemplateBuilder(dirInfo);
grunt.log.writeln('Compiling cloud formation resources');
grunt.verbose.subhead('Compiling cloud formation resources');
builder.build().then((resources) => {
grunt.log.ok(`Resources compiled successfully`);
const resourceMap = {};
grunt.log.writeln(`Extracting exported properties`);
grunt.verbose.subhead(`Extracting exported properties`);
let propCount = 0;
resources.forEach((resource) => {

@@ -52,6 +60,9 @@ for (let prop in resource.exportedProperties) {

tokens[prop] = propValue;
propCount++;
grunt.verbose.debug(`Extracted property: [${prop} = ${propValue}]`);
}
});
grunt.log.ok(`Extracted property count: [${propCount}]`);
grunt.log.writeln('Finalizing templates');
grunt.verbose.subhead('Finalizing templates');
resources.forEach((resource) => {

@@ -62,15 +73,14 @@ grunt.log.debug(`${resource.key} (${resource.type})`);

grunt.log.writeln('Generating template payload');
grunt.verbose.subhead('Generating template payload');
const payload = JSON.stringify({
Description: options.description,
Description: description,
Resources: resourceMap
}, null, 4);
grunt.log.ok('Template payload generated')
const filePath = _path.join(options.output.dir,
options.output.fileName);
grunt.log.writeln(`Writing template to file: [${filePath}]`);
grunt.file.mkdir(options.output.dir);
const filePath = _path.join(output.dir, output.fileName);
grunt.verbose.subhead(`Writing template to file: [${filePath}]`);
grunt.file.mkdir(output.dir);
grunt.file.write(filePath, payload);
grunt.log.ok('Done');
grunt.log.ok(`Template written to file: [${filePath}]`);
}).catch((ex) => {

@@ -77,0 +87,0 @@ grunt.log.error(`Error generating template. Details: [${ex}]`);

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