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

@pega/custom-ui-components

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pega/custom-ui-components - npm Package Compare versions

Comparing version

to
0.0.6

{
"name": "@pega/custom-ui-components",
"version": "0.0.5",
"version": "0.0.6",
"description": "Utility for building custom UI components",

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

@@ -17,5 +17,6 @@ import path from 'path';

const compileMustacheTemplates = (componentDirectory, componentName) => {
const compileMustacheTemplates = (componentDirectory, { componentName, module, version, type, subtype }) => {
const files = fs.readdirSync(componentDirectory);
const organisation = require(path.resolve('package.json')).organisation;
files.forEach((file) => {

@@ -25,2 +26,7 @@ const filePath = path.join(componentDirectory, file);

COMPONENT_NAME: componentName,
ORGANISATION: organisation,
VERSION: version,
MODULE: module,
TYPE: type,
SUB_TYPE: subtype,
});

@@ -32,3 +38,3 @@ fs.writeFileSync(filePath, output);

const validateCompile = async (componentName, options) => {
const validateCompile = async ({ componentName, module, version, type, subtype }, options) => {
const fullPathName = new URL(import.meta.url).pathname;

@@ -50,3 +56,3 @@ const templateDirectory = path.resolve(fullPathName.substr(fullPathName.indexOf('/')), '../template');

if (components.includes(componentName)) {
console.log('%s', chalk.red(`${componentName} Component is already exists in ${targetDirectory}`));
console.log('%s', chalk.red(`${componentName} component already exists in ${targetDirectory}`));
return;

@@ -60,5 +66,5 @@ }

});
compileMustacheTemplates(targetDirectory, componentName);
compileMustacheTemplates(targetDirectory, { componentName, module, version, type, subtype });
console.log('%s', chalk.green(`${componentName} Component is created in ${targetDirectory}`));
console.log('%s', chalk.green(`${componentName} component is created in ${targetDirectory}`));
}

@@ -71,3 +77,7 @@

let componentName = options.params[3];
await validateCompile(componentName, options);
let module = options.params[4];
let version = options.params[5];
let type = options.params[6];
let subtype = options.params[7];
await validateCompile({ componentName, module, version, type, subtype }, options);

@@ -80,6 +90,22 @@ } else {

},
{
name: "module",
message: "Enter module name",
},
{
name: "version",
message: "Enter version number",
},
{
name: "type",
message: "Enter type of component",
},
{
name: "subtype",
message: "Enter subtype of component",
},
];
await inquirer.prompt(questions).then(async (answers) => {
let componentName = answers.componentName;
await validateCompile(componentName, options);
let { componentName, module, version, type, subtype } = answers;
await validateCompile({ componentName, module, version, type, subtype }, options);

@@ -86,0 +112,0 @@ });

@@ -6,2 +6,6 @@ export const getInitProjectQuestions = () => {

message: 'Enter Project name',
},
{
name: 'organisation',
message: 'Enter Organisation name',
},

@@ -8,0 +12,0 @@ {

{
"baseComponentName": "pxTextInput",
"componentName": "DemoTextInput",
"componentName": "Organisation_Module_DemoTextInput",
"name": "DemoTextInput",
"description":"DemoTextInput",
"description":"DemoTextInput description",
"organisation":"Organisation",
"version":"0.0.1",
"module":"Module",
"type": "Field",

@@ -7,0 +10,0 @@ "subtype": "DATA_CAPTURE",

@@ -67,3 +67,3 @@ import fs from 'fs';

const zip = new AdmZip();
zip.addLocalFolder(srcDirectory,'src/');
zip.addLocalFolder(srcDirectory, 'src/');
zip.addLocalFile(configJson);

@@ -74,3 +74,3 @@ zip.addLocalFolder(buildDirectory);

const configContent = Buffer.from(fs.readFileSync(`${srcDirectory}/config.json`)).toString();
return { zipContent, configContent };

@@ -92,6 +92,7 @@ }

const apiBody = {
configContent,
zipContent,
componentName,
componentName: JSON.parse(configContent).componentName,
publishFor: 'constellation',

@@ -98,0 +99,0 @@ rulesetName,

@@ -14,2 +14,5 @@ const Ajv = require('ajv');

description: { type: "string" },
organisation: { type: "string" },
version: { type: "string" },
module: { type: "string" },
type: { type: "string", enum: ["Field"] },

@@ -16,0 +19,0 @@ subtype: { type: "string", enum: ["DATA_CAPTURE"] },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet