Socket
Socket
Sign inDemoInstall

@adobe/aem-cs-source-migration-commons

Package Overview
Dependencies
Maintainers
80
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@adobe/aem-cs-source-migration-commons - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

src/conversion_report/README.md

2

package.json
{
"name": "@adobe/aem-cs-source-migration-commons",
"description": "Common helper utilities used by AEM as a Cloud Service code refactoring tools",
"version": "0.0.1",
"version": "0.0.2",
"repository": "https://github.com/adobe/aem-cloud-service-source-migration/packages/commons",

@@ -6,0 +6,0 @@ "author": "Adobe Inc.",

@@ -13,6 +13,6 @@ <!--

[![Version](https://img.shields.io/npm/v/@adobe/aem-cs-source-migration-commons.svg)](https://npmjs.org/package/@adobe/aio-cli-plugin-cloud-service-migration)
[![Downloads/week](https://img.shields.io/npm/dw/@adobe/aem-cs-source-migration-commons.svg)](https://npmjs.org/package/@adobe/aio-cli-plugin-cloud-service-migration)
[![Version](https://img.shields.io/npm/v/@adobe/aem-cs-source-migration-commons.svg)](https://npmjs.org/package/@adobe/aem-cs-source-migration-commons)
[![Downloads/week](https://img.shields.io/npm/dw/@adobe/aem-cs-source-migration-commons.svg)](https://npmjs.org/package/@adobe/aem-cs-source-migration-commons)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Codecov Coverage](https://img.shields.io/codecov/c/github/adobe/aem-cs-source-migration-commons/master.svg?style=flat-square)](https://codecov.io/gh/adobe/aio-cli-plugin-cloud-service-migration/)
[![Codecov Coverage](https://img.shields.io/codecov/c/github/adobe/aem-cs-source-migration-commons/master.svg?style=flat-square)](https://codecov.io/gh/adobe/aem-cs-source-migration-commons/)

@@ -19,0 +19,0 @@ # @adobe/aem-cs-source-migration-commons

@@ -18,2 +18,4 @@ /*

TEMPLATE_FOLDER: "templates",
TARGET_PROJECT_FOLDER: "./target/project",

@@ -29,2 +31,4 @@

WARNING: "WARNING",
ACTION_ADDED: "Added",

@@ -31,0 +35,0 @@

@@ -21,4 +21,4 @@ /*

*
* @param {String} rule The rule that is being executed/followed.
* @param {String} description The details of the rule that is being followed for conversion.
* @param {String} rule The rule that is being followed while executing the particular ConversionStep.
* @param {String} description The details of the rule that is being followed for ConversionStep.
*

@@ -37,3 +37,3 @@ */

*
* Add an operation to the list of operations performed while executing the step
* Add an operation that was performed while executing the ConversionStep
*/

@@ -49,3 +49,3 @@ addOperation(operation) {

*
* Get the rule that is being executed/followed.
* Get the rule that is being followed while executing the particular ConversionStep.
*/

@@ -61,3 +61,3 @@ getRule() {

*
* Get the details of the rule that is being followed for conversion.
* Get the details of the rule that is being followed while executing the particular ConversionStep.
*/

@@ -73,3 +73,3 @@ getDescription() {

*
* Get the list of operations performed while executing the step
* Get the list of operations performed while executing the particular ConversionStep
*/

@@ -85,6 +85,6 @@ getOperations() {

*
* Find whether some operation (under the given step) has been performed on target dispatcher configurations
* Find whether any operation has been performed while executing the particular ConversionStep
*
* Return:
* bool: `true` if at least one operation has been performed, else `false`
* boolean: `true` if at least one operation has been performed, else `false`
*/

@@ -91,0 +91,0 @@ isPerformed() {

@@ -27,3 +27,5 @@ /*

*
* @param {List[ConversionStep]} ConversionStep List of steps performed that are to be added to the summary report
* @param {Array[ConversionStep]} ConversionStep List of steps performed that are to be added to the summary report
* @param String target The path/location where the summary report need to be creation
* @param String report_name The name of the base summary report template file
* @private

@@ -37,4 +39,12 @@ *

try {
fsExtra.copyFileSync(path.join(__dirname, report_name), file_path);
logger.info(report_name + " copied successfully to " + target);
fsExtra.copyFileSync(
path.join(__dirname, constants.TEMPLATE_FOLDER, report_name),
file_path
);
logger.info(
"Base summary report template " +
report_name +
" copied to " +
target
);
} catch (err) {

@@ -57,3 +67,3 @@ logger.error(

file_path,
`#### + ${conversion_step.getRule()}`
`#### ${conversion_step.getRule()}`
);

@@ -74,2 +84,3 @@ fs.appendFileSync(file_path, LINE_SEP);

});
logger.info(report_name + " generation complete.");
}

@@ -76,0 +87,0 @@

@@ -19,3 +19,9 @@ /*

var Util = {
// Function to grab values from command line input
/**
*
* @param String flag command line argument which need to be read
* @return {String} flag value
*
* Grab values from command line input
*/
grab: (flag) => {

@@ -26,3 +32,8 @@ let indexAfterFlag = process.argv.indexOf(flag) + 1;

// Function to recursively delete a folder and its content
/**
*
* @param String path The path/location where content need to be deleted
*
* Recursively delete a folder and its content
*/
deleteFolderRecursive: (path) => {

@@ -44,12 +55,60 @@ if (fs.existsSync(path)) {

// Function to get the content of an XML file as a array of strings (lines)
getXMLContent: (file) => {
if (!fs.existsSync(file)) {
/**
*
* @param String filePath path of file whose content need to be read
* @return {Array.<String>} content of an XML file as a array of strings
*
* Async function to get the content of an XML file as a array of strings (lines)
*/
getXMLContent: async (filePath) => {
if (!fs.existsSync(filePath)) {
return [];
}
// read contents of the file and split them by newline
return fs.readFileSync(file.toString(), "UTF-8").split(/\r?\n/);
var data = await fs.promises.readFile(filePath, "utf8");
return data.split(/\r?\n/);
},
// Function to data (a string array) to a file
/**
*
* @param String filePath path of file whose content need to be read
* @return {Array.<String>} content of an XML file as a array of strings
*
* Sync function to get the content of an XML file as a array of strings (lines)
*/
getXMLContentSync: (filePath) => {
if (!fs.existsSync(filePath)) {
return [];
}
// read contents of the file and split them by newline
return fs.readFileSync(filePath, "utf8").split(/\r?\n/);
},
/**
*
* @param String filePath path of file where data need to be written
* @param String[] data content to be written of provided file
*
* Async function to write data (a string array) to a file
*/
writeDataToFileAsync: (filePath, data) => {
return new Promise((resolve, reject) => {
const file = fs.createWriteStream(filePath);
data.forEach((line) => {
file.write(line.toString() + "\r\n");
});
file.end();
file.on("finish", () => resolve(true));
file.on("error", reject);
});
},
/**
*
* @param String filePath path of file where data need to be written
* @param String[] data content to be written of provided file
* @param String errorMsg error msg to log in case of failure/error
*
* Sync function to write data (a string array) to a file
*/
writeDataToFileSync: (filePath, data, errorMsg) => {

@@ -66,2 +125,10 @@ var file = fs.createWriteStream(filePath);

/**
*
* @param String sourcePath path from where file need to be copied
* @param String destinationPath path where file to be copied
* @param String errorMsg error msg to log in case of failure/error
*
* Sync function to write data (a string array) to a file
*/
copyFolderSync: (sourcePath, destinationPath) => {

@@ -75,2 +142,10 @@ // NOTE : In copySync method of fs-extra module, if src is a directory it will copy

/**
*
* @param String directoryPath path which need to be scanned
* @param String fileExtension file extension which need to be search
* @return {Array.<String>} list of all files
*
* Get all files with given extension under given directory
*/
globGetFilesByExtension(directoryPath, fileExtension) {

@@ -81,2 +156,10 @@ let globPattern = directoryPath + "/**/*" + fileExtension;

/**
*
* @param String directoryPath path which need to be scanned
* @param String fileName file name which need to be search
* @return {Array.<String>} list of all files
*
* Get all files with given fileName under given directory
*/
globGetFilesByName(directoryPath, fileName) {

@@ -83,0 +166,0 @@ let globPattern = directoryPath + "/**/" + fileName;

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