Skip to content

Commit b313f88

Browse files
Code Refactor
1 parent f382536 commit b313f88

File tree

7 files changed

+45
-45
lines changed

7 files changed

+45
-45
lines changed

dist/index.js

+22-22
Original file line numberDiff line numberDiff line change
@@ -65273,7 +65273,7 @@ const xml2js = __nccwpck_require__(7486);
6527365273

6527465274
class Archive {
6527565275
// Parse the manifest XML file and extract paths of files to be included in the package
65276-
static async GetPathsFromManifest(manifestPath) {
65276+
static async getPathsFromManifest(manifestPath) {
6527765277
const manifest = fs.readFileSync(manifestPath, "utf8");
6527865278
const xml = await new Promise((resolve, reject) => {
6527965279
xml2js.parseString(manifest, { explicitArray: false }, (err, json) => {
@@ -65306,7 +65306,7 @@ class Archive {
6530665306
}
6530765307

6530865308
// Create a new DAR package using the manifest file
65309-
static async CreateNewDarPackage(manifestPath, outputPath, packageName) {
65309+
static async createNewDarPackage(manifestPath, outputPath, packageName) {
6531065310
try {
6531165311
const rootPath = process.cwd();
6531265312
const manifestFileFullPath = path.join(rootPath, "deployit-manifest.xml");
@@ -65338,10 +65338,10 @@ class Archive {
6533865338
throw new Error(`A DAR package already exists at ${packageFullPath}.`);
6533965339
}
6534065340

65341-
const filesToInclude = await Archive.GetPathsFromManifest(manifestPath);
65341+
const filesToInclude = await Archive.getPathsFromManifest(manifestPath);
6534265342
console.log(`Files to include in the package = ${filesToInclude}`);
6534365343

65344-
await Archive.CompressPackage(packageFullPath, filesToInclude, rootPath);
65344+
await Archive.compressPackage(packageFullPath, filesToInclude, rootPath);
6534565345
console.log("Package created at:", packageFullPath);
6534665346

6534765347
return packageFullPath;
@@ -65352,7 +65352,7 @@ class Archive {
6535265352
}
6535365353

6535465354
// Compress the files into a DAR package
65355-
static async CompressPackage(packageFullPath, filesToInclude, rootPath) {
65355+
static async compressPackage(packageFullPath, filesToInclude, rootPath) {
6535665356
const archive = archiver("zip", {});
6535765357
const output = fs.createWriteStream(packageFullPath);
6535865358

@@ -65443,17 +65443,17 @@ class DeployManager {
6544365443

6544465444
// Deploy a package
6544565445
static async deployPackage(packageFullPath, targetEnvironment, rollback) {
65446-
if (!Util.StartsWith(targetEnvironment, "Environments/", true)) {
65446+
if (!Util.startsWith(targetEnvironment, "Environments/", true)) {
6544765447
targetEnvironment = `Environments/${targetEnvironment}`;
6544865448
}
6544965449

6545065450
if (!await this.environmentExists(targetEnvironment)) {
6545165451
throw new Error(`Specified environment ${targetEnvironment} doesn't exists.`);
6545265452
}
6545365453

65454-
const manifest = await Zip.GetManifestFromPackage(packageFullPath);
65455-
const application = await Util.GetApplication(manifest);
65456-
const version = await Util.GetVersion(manifest);
65454+
const manifest = await Zip.getManifestFromPackage(packageFullPath);
65455+
const application = await Util.getApplication(manifest);
65456+
const version = await Util.getVersion(manifest);
6545765457
const deploymentPackageId = `Applications/${application}/${version}`;
6545865458

6545965459
console.log(`Package name is ${deploymentPackageId}`);
@@ -65671,10 +65671,10 @@ async function createNewPackage(manifestPath, outputPath, packageName, versionNu
6567165671

6567265672
const outputFullPath = path.join(process.cwd(), outputPath);
6567365673
if (versionNumber) {
65674-
Util.SetVersion(manifestFullPath, versionNumber);
65674+
Util.setVersion(manifestFullPath, versionNumber);
6567565675
}
6567665676

65677-
return Archive.CreateNewDarPackage(manifestFullPath, outputFullPath, packageName);
65677+
return Archive.createNewDarPackage(manifestFullPath, outputFullPath, packageName);
6567865678
}
6567965679

6568065680
async function publishPackage(packageFullPath) {
@@ -65782,13 +65782,13 @@ const xml2js = __nccwpck_require__(7486);
6578265782
class Util {
6578365783

6578465784
// Get version from manifest file
65785-
static async GetVersionFromManifest(manifestPath) {
65785+
static async getVersionFromManifest(manifestPath) {
6578665786
const text = fs.readFileSync(manifestPath, "utf8");
65787-
return await Util.GetVersion(text);
65787+
return await Util.getVersion(text);
6578865788
}
6578965789

6579065790
// Get version from manifest content
65791-
static async GetVersion(manifest) {
65791+
static async getVersion(manifest) {
6579265792
const xml = await this.xml2json(manifest);
6579365793

6579465794
const udmDeploymentPackageElement = xml["udm.DeploymentPackage"];
@@ -65804,7 +65804,7 @@ class Util {
6580465804
}
6580565805

6580665806
// Check if input string starts with a specific value
65807-
static StartsWith(inputString, value, ignoreCase) {
65807+
static startsWith(inputString, value, ignoreCase) {
6580865808
const subString = inputString.substring(0, value.length);
6580965809

6581065810
if (ignoreCase) {
@@ -65815,7 +65815,7 @@ class Util {
6581565815
}
6581665816

6581765817
// Set version in the manifest file
65818-
static async SetVersion(manifestPath, version) {
65818+
static async setVersion(manifestPath, version) {
6581965819
const text = fs.readFileSync(manifestPath, "utf8");
6582065820
const xml = await this.xml2json(text);
6582165821

@@ -65835,13 +65835,13 @@ class Util {
6583565835
}
6583665836

6583765837
// Get application from manifest file
65838-
static async GetApplicationFromManifest(manifestPath) {
65838+
static async getApplicationFromManifest(manifestPath) {
6583965839
const manifest = fs.readFileSync(manifestPath, "utf8");
65840-
return await Util.GetApplication(manifest);
65840+
return await Util.getApplication(manifest);
6584165841
}
6584265842

6584365843
// Get application from manifest content
65844-
static async GetApplication(manifest) {
65844+
static async getApplication(manifest) {
6584565845
const xml = await this.xml2json(manifest);
6584665846

6584765847
const udmDeploymentPackageElement = xml["udm.DeploymentPackage"];
@@ -65857,8 +65857,8 @@ class Util {
6585765857
}
6585865858

6585965859
// Get application name from manifest file
65860-
static async GetApplicationNameFromManifest(manifestPath) {
65861-
const application = await this.GetApplicationFromManifest(manifestPath);
65860+
static async getApplicationNameFromManifest(manifestPath) {
65861+
const application = await this.getApplicationFromManifest(manifestPath);
6586265862
const splitPath = application.split("/");
6586365863
return splitPath[splitPath.length - 1];
6586465864
}
@@ -65890,7 +65890,7 @@ class Zip {
6589065890

6589165891
//Extracts the 'deployit-manifest.xml' from the provided zip package.
6589265892

65893-
static async GetManifestFromPackage(packagePath) {
65893+
static async getManifestFromPackage(packagePath) {
6589465894
const zip = await Zip.openStreamZip(packagePath);
6589565895

6589665896
try {

dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/archive.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const xml2js = require("xml2js");
55

66
class Archive {
77
// Parse the manifest XML file and extract paths of files to be included in the package
8-
static async GetPathsFromManifest(manifestPath) {
8+
static async getPathsFromManifest(manifestPath) {
99
const manifest = fs.readFileSync(manifestPath, "utf8");
1010
const xml = await new Promise((resolve, reject) => {
1111
xml2js.parseString(manifest, { explicitArray: false }, (err, json) => {
@@ -38,7 +38,7 @@ class Archive {
3838
}
3939

4040
// Create a new DAR package using the manifest file
41-
static async CreateNewDarPackage(manifestPath, outputPath, packageName) {
41+
static async createNewDarPackage(manifestPath, outputPath, packageName) {
4242
try {
4343
const rootPath = process.cwd();
4444
const manifestFileFullPath = path.join(rootPath, "deployit-manifest.xml");
@@ -70,10 +70,10 @@ class Archive {
7070
throw new Error(`A DAR package already exists at ${packageFullPath}.`);
7171
}
7272

73-
const filesToInclude = await Archive.GetPathsFromManifest(manifestPath);
73+
const filesToInclude = await Archive.getPathsFromManifest(manifestPath);
7474
console.log(`Files to include in the package = ${filesToInclude}`);
7575

76-
await Archive.CompressPackage(packageFullPath, filesToInclude, rootPath);
76+
await Archive.compressPackage(packageFullPath, filesToInclude, rootPath);
7777
console.log("Package created at:", packageFullPath);
7878

7979
return packageFullPath;
@@ -84,7 +84,7 @@ class Archive {
8484
}
8585

8686
// Compress the files into a DAR package
87-
static async CompressPackage(packageFullPath, filesToInclude, rootPath) {
87+
static async compressPackage(packageFullPath, filesToInclude, rootPath) {
8888
const archive = archiver("zip", {});
8989
const output = fs.createWriteStream(packageFullPath);
9090

src/deploy-manager.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,17 @@ class DeployManager {
5858

5959
// Deploy a package
6060
static async deployPackage(packageFullPath, targetEnvironment, rollback) {
61-
if (!Util.StartsWith(targetEnvironment, "Environments/", true)) {
61+
if (!Util.startsWith(targetEnvironment, "Environments/", true)) {
6262
targetEnvironment = `Environments/${targetEnvironment}`;
6363
}
6464

6565
if (!await this.environmentExists(targetEnvironment)) {
6666
throw new Error(`Specified environment ${targetEnvironment} doesn't exists.`);
6767
}
6868

69-
const manifest = await Zip.GetManifestFromPackage(packageFullPath);
70-
const application = await Util.GetApplication(manifest);
71-
const version = await Util.GetVersion(manifest);
69+
const manifest = await Zip.getManifestFromPackage(packageFullPath);
70+
const application = await Util.getApplication(manifest);
71+
const version = await Util.getVersion(manifest);
7272
const deploymentPackageId = `Applications/${application}/${version}`;
7373

7474
console.log(`Package name is ${deploymentPackageId}`);

src/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ async function createNewPackage(manifestPath, outputPath, packageName, versionNu
1717

1818
const outputFullPath = path.join(process.cwd(), outputPath);
1919
if (versionNumber) {
20-
Util.SetVersion(manifestFullPath, versionNumber);
20+
Util.setVersion(manifestFullPath, versionNumber);
2121
}
2222

23-
return Archive.CreateNewDarPackage(manifestFullPath, outputFullPath, packageName);
23+
return Archive.createNewDarPackage(manifestFullPath, outputFullPath, packageName);
2424
}
2525

2626
async function publishPackage(packageFullPath) {

src/util.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ const xml2js = require("xml2js");
44
class Util {
55

66
// Get version from manifest file
7-
static async GetVersionFromManifest(manifestPath) {
7+
static async getVersionFromManifest(manifestPath) {
88
const text = fs.readFileSync(manifestPath, "utf8");
9-
return await Util.GetVersion(text);
9+
return await Util.getVersion(text);
1010
}
1111

1212
// Get version from manifest content
13-
static async GetVersion(manifest) {
13+
static async getVersion(manifest) {
1414
const xml = await this.xml2json(manifest);
1515

1616
const udmDeploymentPackageElement = xml["udm.DeploymentPackage"];
@@ -26,7 +26,7 @@ class Util {
2626
}
2727

2828
// Check if input string starts with a specific value
29-
static StartsWith(inputString, value, ignoreCase) {
29+
static startsWith(inputString, value, ignoreCase) {
3030
const subString = inputString.substring(0, value.length);
3131

3232
if (ignoreCase) {
@@ -37,7 +37,7 @@ class Util {
3737
}
3838

3939
// Set version in the manifest file
40-
static async SetVersion(manifestPath, version) {
40+
static async setVersion(manifestPath, version) {
4141
const text = fs.readFileSync(manifestPath, "utf8");
4242
const xml = await this.xml2json(text);
4343

@@ -57,13 +57,13 @@ class Util {
5757
}
5858

5959
// Get application from manifest file
60-
static async GetApplicationFromManifest(manifestPath) {
60+
static async getApplicationFromManifest(manifestPath) {
6161
const manifest = fs.readFileSync(manifestPath, "utf8");
62-
return await Util.GetApplication(manifest);
62+
return await Util.getApplication(manifest);
6363
}
6464

6565
// Get application from manifest content
66-
static async GetApplication(manifest) {
66+
static async getApplication(manifest) {
6767
const xml = await this.xml2json(manifest);
6868

6969
const udmDeploymentPackageElement = xml["udm.DeploymentPackage"];
@@ -79,8 +79,8 @@ class Util {
7979
}
8080

8181
// Get application name from manifest file
82-
static async GetApplicationNameFromManifest(manifestPath) {
83-
const application = await this.GetApplicationFromManifest(manifestPath);
82+
static async getApplicationNameFromManifest(manifestPath) {
83+
const application = await this.getApplicationFromManifest(manifestPath);
8484
const splitPath = application.split("/");
8585
return splitPath[splitPath.length - 1];
8686
}

src/zip.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ class Zip {
44

55
//Extracts the 'deployit-manifest.xml' from the provided zip package.
66

7-
static async GetManifestFromPackage(packagePath) {
7+
static async getManifestFromPackage(packagePath) {
88
const zip = await Zip.openStreamZip(packagePath);
99

1010
try {

0 commit comments

Comments
 (0)