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

pshregistry-parser

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pshregistry-parser - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

21

lib/registry-parser.js
'use strict';
let fs = require('fs');
let psh = require('./images.js')
let psh = require('./images.js');
let yml = require('js-yaml');

@@ -143,2 +144,16 @@ class InvalidRegistryError extends SyntaxError {

/**
* Duplicates Registry data in a YAML file.
*
* @param {string} registrySource
* A Registry JSON source file name.
*/
writeRegistryYAML(registrySource) {
const registryName = registrySource.split(".");
let registryData = this.parseRegistry(registrySource);
fs.writeFileSync(`${registryName[0]}.yaml`, yml.safeDump(registryData, {noRefs:true}), function (err) {
if (err) throw err;
});
}
/**
* Expands registry images into properties of this instance, returning a list of those properties.

@@ -154,2 +169,6 @@ *

let registry = this.parseRegistry(registrySource);
// For now, make an identical copy of registry data in a YAML file.
this.writeRegistryYAML(registrySource);
// Creates a list of Images.

@@ -156,0 +175,0 @@ let images = {};

5

package.json
{
"name": "pshregistry-parser",
"version": "1.0.1",
"version": "1.0.2",
"description": "Helper for library for accessing image data from the Platform.sh Registry and generating configuration files.",

@@ -35,4 +35,5 @@ "main": "lib/registry-parser.js",

"eslint": "^5.14.1",
"mocha": "^6.0.0"
"mocha": "^6.0.0",
"js-yaml": "^3.13.1"
}
}
'use strict';
let fs = require('fs');
let psh = require('./images.js')
let psh = require('./images.js');
let yml = require('js-yaml');

@@ -143,2 +144,16 @@ class InvalidRegistryError extends SyntaxError {

/**
* Duplicates Registry data in a YAML file.
*
* @param {string} registrySource
* A Registry JSON source file name.
*/
writeRegistryYAML(registrySource) {
const registryName = registrySource.split(".");
let registryData = this.parseRegistry(registrySource);
fs.writeFileSync(`${registryName[0]}.yaml`, yml.safeDump(registryData, {noRefs:true}), function (err) {
if (err) throw err;
});
}
/**
* Expands registry images into properties of this instance, returning a list of those properties.

@@ -154,2 +169,6 @@ *

let registry = this.parseRegistry(registrySource);
// For now, make an identical copy of registry data in a YAML file.
this.writeRegistryYAML(registrySource);
// Creates a list of Images.

@@ -156,0 +175,0 @@ let images = {};

@@ -6,2 +6,3 @@ 'use strict';

const fs = require('fs');
const yaml = require('js-yaml');

@@ -41,2 +42,16 @@ describe('Platform.sh Registry Parser tests', function() {

describe('YAML generation', function() {
it('Test that registry YAML file is generated and data is accessible', function() {
let registrySource = "test/testdata/valid.json";
let cg = new psh.RegistryParser(registrySource);
cg.writeRegistryYAML(registrySource);
let yamlRegistry = yaml.safeLoad(fs.readFileSync('test/testdata/valid.yaml', 'utf8'));
assert.equal(yamlRegistry.elasticsearch.disk, true);
assert.equal(yamlRegistry.elasticsearch.endpoint, "elasticsearch");
assert.equal(yamlRegistry.golang.runtime, true);
});
})
describe('Save directories', function() {

@@ -43,0 +58,0 @@

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