Skip to content

Commit

Permalink
#296: small updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Ventura committed Nov 22, 2022
1 parent f24797d commit 9b09f8d
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 29 deletions.
17 changes: 4 additions & 13 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
{
"type": "node-terminal",
"name": "debug: dist/init",
"name": "init (dist/)",
"request": "launch",
"command": "node Init.fn.js --preserve-symlinks",
"cwd": "${workspaceFolder}/copado-function/dist",
Expand All @@ -18,7 +18,7 @@
},
{
"type": "node-terminal",
"name": "debug: dist/retrieve",
"name": "retrieve (dist/)",
"request": "launch",
"command": "node Retrieve.fn.js --preserve-symlinks",
"cwd": "${workspaceFolder}/copado-function/dist",
Expand All @@ -27,7 +27,7 @@
},
{
"type": "node-terminal",
"name": "debug: dist/commit",
"name": "commit (dist/)",
"request": "launch",
"command": "node Commit.fn.js --preserve-symlinks",
"cwd": "${workspaceFolder}/copado-function/dist",
Expand All @@ -36,21 +36,12 @@
},
{
"type": "node-terminal",
"name": "debug: dist/deploy",
"name": "deploy (dist/)",
"request": "launch",
"command": "node Deploy.fn.js --preserve-symlinks",
"cwd": "${workspaceFolder}/copado-function/dist",
"envFile": "${workspaceFolder}/copado-function/app/environments/Deploy.env",
"preLaunchTask": "esbuild"
},
{
"type": "node-terminal",
"name": "debug: dist/upgrade",
"request": "launch",
"command": "node Upgrade.fn.js --preserve-symlinks",
"cwd": "${workspaceFolder}/copado-function/dist",
"envFile": "${workspaceFolder}/copado-function/app/environments/Upgrade.env",
"preLaunchTask": "esbuild"
}
]
}
7 changes: 6 additions & 1 deletion copado-function/app/Init.fn.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
'use strict';

const resolve = require('node:path').resolve;
const fs = require('node:fs');
const CONFIG = require('./common/Config');
const Log = require('./common/Log');
const Util = require('./common/Util');
Expand Down Expand Up @@ -96,6 +97,7 @@ async function run() {
Util.execCommand(null, 'npm --version', null);
Util.execCommand(null, 'node --version', null);
Util.execCommand(null, 'git version', null);
Util.execCommand(null, 'mcdev --version', null);
}

Log.debug(`Change Working directory to: ${CONFIG.tmpDirectory}`);
Expand All @@ -109,6 +111,9 @@ async function run() {
}

// actually change working directory
if (!fs.existsSync(CONFIG.tmpDirectory)) {
fs.mkdirSync(CONFIG.tmpDirectory);
}
process.chdir(CONFIG.tmpDirectory);
Log.debug(process.cwd());

Expand Down Expand Up @@ -156,7 +161,7 @@ class Init {
/**
*
* @param {object} credentials the credentials for the salesforce marketing cloud
* @param {string }credentialName the credential name
* @param {string} credentialName the credential name
* @param {object} options contains the url, the downloadBUs and the gitPush values
*/
static mcdevInit(credentials, credentialName, options) {
Expand Down
2 changes: 1 addition & 1 deletion copado-function/app/esbuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const isWatch = args.includes('--watch');
'*/\n\n',
},
platform: 'node',
external: ['../tmp/*'],
external: ['../tmp/*', '../../node_modules/*'],
preserveSymlinks: true,
outdir: '../dist',
absWorkingDir: absWorkingDir,
Expand Down
2 changes: 1 addition & 1 deletion copado-function/dist/Commit.fn.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node

/*
* mcdev-copado v1.2.0 (built 2022-11-22T10:27:33.256Z)
* mcdev-copado v1.2.0 (built 2022-11-22T11:00:11.013Z)
* Function: Commit.fn.js
* Dependenies: mcdev@>=4.1.12, Copado Deployer@20.1
* Homepage: https://github.com/Accenture/sfmc-devtools-copado#readme
Expand Down
2 changes: 1 addition & 1 deletion copado-function/dist/Deploy.fn.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node

/*
* mcdev-copado v1.2.0 (built 2022-11-22T10:27:33.275Z)
* mcdev-copado v1.2.0 (built 2022-11-22T11:00:11.151Z)
* Function: Deploy.fn.js
* Dependenies: mcdev@>=4.1.12, Copado Deployer@20.1
* Homepage: https://github.com/Accenture/sfmc-devtools-copado#readme
Expand Down
26 changes: 15 additions & 11 deletions copado-function/dist/Init.fn.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node

/*
* mcdev-copado v1.2.0 (built 2022-11-22T10:27:33.326Z)
* mcdev-copado v1.2.0 (built 2022-11-22T11:00:11.237Z)
* Function: Init.fn.js
* Dependenies: mcdev@>=4.1.12, Copado Deployer@20.1
* Homepage: https://github.com/Accenture/sfmc-devtools-copado#readme
Expand Down Expand Up @@ -77,15 +77,15 @@ var require_mcdev_copado_d = __commonJS({
var require_Util = __commonJS({
"common/Util.js"(exports, module2) {
"use strict";
var fs = require("fs");
var fs2 = require("fs");
var execSync = require("child_process").execSync;
var TYPE = require_mcdev_copado_d();
var CONFIG2 = require_Config();
var Log2 = require_Log();
var Util2 = class {
static saveJsonFile(localPath, jsObj, beautify) {
const jsonString = beautify ? JSON.stringify(jsObj, null, 4) : JSON.stringify(jsObj);
fs.writeFileSync(localPath, jsonString, "utf8");
fs2.writeFileSync(localPath, jsonString, "utf8");
}
static push(destinationBranch) {
Util2.execCommand(
Expand Down Expand Up @@ -135,7 +135,7 @@ var require_Util = __commonJS({
return exitCode;
}
static provideMCDevTools() {
if (fs.existsSync("package.json")) {
if (fs2.existsSync("package.json")) {
Log2.debug("package.json found, assuming npm was already initialized");
} else {
Util2.execCommand("Initializing npm", ["npm init -y"], "Completed initializing NPM");
Expand Down Expand Up @@ -219,10 +219,10 @@ var require_Util = __commonJS({
if (!mid) {
throw new Error('System Property "mid" not set');
}
if (!fs.existsSync(CONFIG2.configFilePath)) {
if (!fs2.existsSync(CONFIG2.configFilePath)) {
throw new Error("Could not find config file " + CONFIG2.configFilePath);
}
const config = JSON.parse(fs.readFileSync(CONFIG2.configFilePath, "utf8"));
const config = JSON.parse(fs2.readFileSync(CONFIG2.configFilePath, "utf8"));
if (config.credentials[credName] && config.credentials[credName].businessUnits) {
const myBuNameArr = Object.keys(config.credentials[credName].businessUnits).filter(
(buName) => config.credentials[credName].businessUnits[buName] == mid
Expand All @@ -245,7 +245,7 @@ var require_Util = __commonJS({
var require_Copado = __commonJS({
"common/Copado.js"(exports, module2) {
"use strict";
var fs = require("fs");
var fs2 = require("fs");
var exec = require("child_process").exec;
var TYPE = require_mcdev_copado_d();
var Log2 = require_Log();
Expand Down Expand Up @@ -289,7 +289,7 @@ var require_Copado = __commonJS({
}
static getJsonFile(fileSFID, fileName, preMsg) {
Copado2._downloadFile(fileSFID, preMsg);
return JSON.parse(fs.readFileSync(fileName, "utf8"));
return JSON.parse(fs2.readFileSync(fileName, "utf8"));
}
static checkoutSrc(workingBranch, createBranch = false) {
Util2.execCommand(
Expand All @@ -314,7 +314,7 @@ var require_Copado = __commonJS({
Log2.debug("Getting mcdev logs");
try {
const logsAttached = [];
for (const file of fs.readdirSync("logs")) {
for (const file of fs2.readdirSync("logs")) {
Log2.debug("- " + file);
logsAttached.push(Copado2.attachLog("logs/" + file));
}
Expand All @@ -332,6 +332,7 @@ var require_Copado = __commonJS({

// Init.fn.js
var resolve = require("path").resolve;
var fs = require("fs");
var CONFIG = require_Config();
var Log = require_Log();
var Util = require_Util();
Expand Down Expand Up @@ -374,8 +375,8 @@ CONFIG.promotionBranch = null;
CONFIG.promotionName = null;
CONFIG.target_mid = null;
CONFIG.repoUrl = process.env.repoUrl;
CONFIG.downloadBUs = process.env.downloadBUs === "true" ? true : false;
CONFIG.gitPush = process.env.gitPush === "true" ? true : false;
CONFIG.downloadBUs = process.env.downloadBUs === "false" ? false : true;
CONFIG.gitPush = process.env.gitPush === "false" ? false : true;
async function run() {
Log.info("McdevInit.js started");
Log.debug("");
Expand Down Expand Up @@ -416,6 +417,9 @@ async function run() {
} catch {
Log.error("Could not set tmp directoy as safe directory");
}
if (!fs.existsSync(CONFIG.tmpDirectory)) {
fs.mkdirSync(CONFIG.tmpDirectory);
}
process.chdir(CONFIG.tmpDirectory);
Log.debug(process.cwd());
try {
Expand Down
2 changes: 1 addition & 1 deletion copado-function/dist/Retrieve.fn.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node

/*
* mcdev-copado v1.2.0 (built 2022-11-22T10:27:32.381Z)
* mcdev-copado v1.2.0 (built 2022-11-22T11:00:08.542Z)
* Function: Retrieve.fn.js
* Dependenies: mcdev@>=4.1.12, Copado Deployer@20.1
* Homepage: https://github.com/Accenture/sfmc-devtools-copado#readme
Expand Down

0 comments on commit 9b09f8d

Please sign in to comment.