Skip to content

Commit

Permalink
Update if-else blocks to be more legible
Browse files Browse the repository at this point in the history
  • Loading branch information
mvlassis committed Aug 28, 2024
1 parent 27483d0 commit b0e6329
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 314 deletions.
54 changes: 12 additions & 42 deletions dist/channel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42604,29 +42604,6 @@ __exportStar(__nccwpck_require__(6366), exports);

"use strict";

var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
Expand All @@ -42638,31 +42615,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Bundle = void 0;
const core = __importStar(__nccwpck_require__(2186));
const exec = __importStar(__nccwpck_require__(1514));
const core_1 = __nccwpck_require__(2186);
const exec_1 = __nccwpck_require__(1514);
class Bundle {
publish(path, channel) {
return __awaiter(this, void 0, void 0, function* () {
core.exportVariable('CHARMCRAFT_AUTH', core.getInput('credentials'));
(0, core_1.exportVariable)('CHARMCRAFT_AUTH', (0, core_1.getInput)('credentials'));
process.chdir(path);
const result = yield exec.getExecOutput('charmcraft', ['pack']);
if (result.exitCode === 0) {
const lastLine = result.stderr.trim().split('\n').pop();
if (lastLine) {
const bundleName = lastLine.split(' ')[1];
yield exec.exec('charmcraft', [
'upload',
bundleName,
'--release',
channel,
]);
}
else {
throw new Error('Failed to extract the bundle name from the output of charmcraft pack.');
}
const result = yield (0, exec_1.getExecOutput)('charmcraft', ['pack']);
if (result.exitCode !== 0) {
throw new Error(`charmcraft pack ran unsuccessfully with exit code ${result.exitCode}.`);
}
const lastLine = result.stderr.trim().split('\n').pop();
if (lastLine) {
const bundleName = lastLine.split(' ')[1];
yield (0, exec_1.exec)('charmcraft', ['upload', bundleName, '--release', channel]);
}
else {
throw new Error(`charmcraft pack ran unsuccessfully with exit code ${result.exitCode}.`);
throw new Error('Failed to extract the bundle name from the output of charmcraft pack.');
}
});
}
Expand Down
54 changes: 12 additions & 42 deletions dist/check-libraries/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42799,29 +42799,6 @@ __exportStar(__nccwpck_require__(6366), exports);

"use strict";

var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
Expand All @@ -42833,31 +42810,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Bundle = void 0;
const core = __importStar(__nccwpck_require__(2186));
const exec = __importStar(__nccwpck_require__(1514));
const core_1 = __nccwpck_require__(2186);
const exec_1 = __nccwpck_require__(1514);
class Bundle {
publish(path, channel) {
return __awaiter(this, void 0, void 0, function* () {
core.exportVariable('CHARMCRAFT_AUTH', core.getInput('credentials'));
(0, core_1.exportVariable)('CHARMCRAFT_AUTH', (0, core_1.getInput)('credentials'));
process.chdir(path);
const result = yield exec.getExecOutput('charmcraft', ['pack']);
if (result.exitCode === 0) {
const lastLine = result.stderr.trim().split('\n').pop();
if (lastLine) {
const bundleName = lastLine.split(' ')[1];
yield exec.exec('charmcraft', [
'upload',
bundleName,
'--release',
channel,
]);
}
else {
throw new Error('Failed to extract the bundle name from the output of charmcraft pack.');
}
const result = yield (0, exec_1.getExecOutput)('charmcraft', ['pack']);
if (result.exitCode !== 0) {
throw new Error(`charmcraft pack ran unsuccessfully with exit code ${result.exitCode}.`);
}
const lastLine = result.stderr.trim().split('\n').pop();
if (lastLine) {
const bundleName = lastLine.split(' ')[1];
yield (0, exec_1.exec)('charmcraft', ['upload', bundleName, '--release', channel]);
}
else {
throw new Error(`charmcraft pack ran unsuccessfully with exit code ${result.exitCode}.`);
throw new Error('Failed to extract the bundle name from the output of charmcraft pack.');
}
});
}
Expand Down
54 changes: 12 additions & 42 deletions dist/promote-charm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42683,29 +42683,6 @@ __exportStar(__nccwpck_require__(6366), exports);

"use strict";

var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
Expand All @@ -42717,31 +42694,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Bundle = void 0;
const core = __importStar(__nccwpck_require__(2186));
const exec = __importStar(__nccwpck_require__(1514));
const core_1 = __nccwpck_require__(2186);
const exec_1 = __nccwpck_require__(1514);
class Bundle {
publish(path, channel) {
return __awaiter(this, void 0, void 0, function* () {
core.exportVariable('CHARMCRAFT_AUTH', core.getInput('credentials'));
(0, core_1.exportVariable)('CHARMCRAFT_AUTH', (0, core_1.getInput)('credentials'));
process.chdir(path);
const result = yield exec.getExecOutput('charmcraft', ['pack']);
if (result.exitCode === 0) {
const lastLine = result.stderr.trim().split('\n').pop();
if (lastLine) {
const bundleName = lastLine.split(' ')[1];
yield exec.exec('charmcraft', [
'upload',
bundleName,
'--release',
channel,
]);
}
else {
throw new Error('Failed to extract the bundle name from the output of charmcraft pack.');
}
const result = yield (0, exec_1.getExecOutput)('charmcraft', ['pack']);
if (result.exitCode !== 0) {
throw new Error(`charmcraft pack ran unsuccessfully with exit code ${result.exitCode}.`);
}
const lastLine = result.stderr.trim().split('\n').pop();
if (lastLine) {
const bundleName = lastLine.split(' ')[1];
yield (0, exec_1.exec)('charmcraft', ['upload', bundleName, '--release', channel]);
}
else {
throw new Error(`charmcraft pack ran unsuccessfully with exit code ${result.exitCode}.`);
throw new Error('Failed to extract the bundle name from the output of charmcraft pack.');
}
});
}
Expand Down
54 changes: 12 additions & 42 deletions dist/release-charm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42695,29 +42695,6 @@ __exportStar(__nccwpck_require__(6366), exports);

"use strict";

var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
Expand All @@ -42729,31 +42706,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Bundle = void 0;
const core = __importStar(__nccwpck_require__(2186));
const exec = __importStar(__nccwpck_require__(1514));
const core_1 = __nccwpck_require__(2186);
const exec_1 = __nccwpck_require__(1514);
class Bundle {
publish(path, channel) {
return __awaiter(this, void 0, void 0, function* () {
core.exportVariable('CHARMCRAFT_AUTH', core.getInput('credentials'));
(0, core_1.exportVariable)('CHARMCRAFT_AUTH', (0, core_1.getInput)('credentials'));
process.chdir(path);
const result = yield exec.getExecOutput('charmcraft', ['pack']);
if (result.exitCode === 0) {
const lastLine = result.stderr.trim().split('\n').pop();
if (lastLine) {
const bundleName = lastLine.split(' ')[1];
yield exec.exec('charmcraft', [
'upload',
bundleName,
'--release',
channel,
]);
}
else {
throw new Error('Failed to extract the bundle name from the output of charmcraft pack.');
}
const result = yield (0, exec_1.getExecOutput)('charmcraft', ['pack']);
if (result.exitCode !== 0) {
throw new Error(`charmcraft pack ran unsuccessfully with exit code ${result.exitCode}.`);
}
const lastLine = result.stderr.trim().split('\n').pop();
if (lastLine) {
const bundleName = lastLine.split(' ')[1];
yield (0, exec_1.exec)('charmcraft', ['upload', bundleName, '--release', channel]);
}
else {
throw new Error(`charmcraft pack ran unsuccessfully with exit code ${result.exitCode}.`);
throw new Error('Failed to extract the bundle name from the output of charmcraft pack.');
}
});
}
Expand Down
54 changes: 12 additions & 42 deletions dist/release-libraries/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42826,29 +42826,6 @@ __exportStar(__nccwpck_require__(6366), exports);

"use strict";

var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
Expand All @@ -42860,31 +42837,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Bundle = void 0;
const core = __importStar(__nccwpck_require__(2186));
const exec = __importStar(__nccwpck_require__(1514));
const core_1 = __nccwpck_require__(2186);
const exec_1 = __nccwpck_require__(1514);
class Bundle {
publish(path, channel) {
return __awaiter(this, void 0, void 0, function* () {
core.exportVariable('CHARMCRAFT_AUTH', core.getInput('credentials'));
(0, core_1.exportVariable)('CHARMCRAFT_AUTH', (0, core_1.getInput)('credentials'));
process.chdir(path);
const result = yield exec.getExecOutput('charmcraft', ['pack']);
if (result.exitCode === 0) {
const lastLine = result.stderr.trim().split('\n').pop();
if (lastLine) {
const bundleName = lastLine.split(' ')[1];
yield exec.exec('charmcraft', [
'upload',
bundleName,
'--release',
channel,
]);
}
else {
throw new Error('Failed to extract the bundle name from the output of charmcraft pack.');
}
const result = yield (0, exec_1.getExecOutput)('charmcraft', ['pack']);
if (result.exitCode !== 0) {
throw new Error(`charmcraft pack ran unsuccessfully with exit code ${result.exitCode}.`);
}
const lastLine = result.stderr.trim().split('\n').pop();
if (lastLine) {
const bundleName = lastLine.split(' ')[1];
yield (0, exec_1.exec)('charmcraft', ['upload', bundleName, '--release', channel]);
}
else {
throw new Error(`charmcraft pack ran unsuccessfully with exit code ${result.exitCode}.`);
throw new Error('Failed to extract the bundle name from the output of charmcraft pack.');
}
});
}
Expand Down
Loading

0 comments on commit b0e6329

Please sign in to comment.