helm-viewer 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +3 -0
- package/binary/index.html +6 -4
- package/binary/index.js +33 -22
- package/package.json +2 -2
- package/helm-viewer-0.2.0.rc1.tgz +0 -0
- package/helm-viewer-0.2.0.tgz +0 -0
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -26,6 +26,9 @@ helm-viewer
|
|
|
26
26
|
|
|
27
27
|
# To target a specific path
|
|
28
28
|
helm-viewer path/of/the/chart
|
|
29
|
+
|
|
30
|
+
# To compute the chart with an external values file
|
|
31
|
+
helm-viewer path/of/the/chart path/of/the/values/file
|
|
29
32
|
```
|
|
30
33
|
|
|
31
34
|
It will analyze the helm chart and generate a HTML report, automatically opened in your favorite browser.
|
package/binary/index.html
CHANGED
|
@@ -22,16 +22,18 @@
|
|
|
22
22
|
</head>
|
|
23
23
|
<body>
|
|
24
24
|
<div id="app" class="flex h-screen">
|
|
25
|
-
<div
|
|
25
|
+
<div
|
|
26
|
+
class="w-2/5 xl:w-1/5 bg-blue-50 h-screen overflow-scroll"
|
|
27
|
+
>
|
|
26
28
|
<div class="p-2">
|
|
27
|
-
<h1 class="italic text-4xl font-thin ml-4 mb-8">>> Computed files</h1>
|
|
29
|
+
<h1 class="italic text-2xl xl:text-4xl font-thin ml-4 mb-8">>> Computed files</h1>
|
|
28
30
|
|
|
29
31
|
<div
|
|
30
32
|
v-if="data.templated"
|
|
31
33
|
v-for="template of Object.keys(data.templated)"
|
|
32
|
-
class="mb-
|
|
34
|
+
class="mb-2"
|
|
33
35
|
>
|
|
34
|
-
<p class="text-3xl font-thin">
|
|
36
|
+
<p class="text-xl xl:text-3xl font-thin">
|
|
35
37
|
{{ template }}
|
|
36
38
|
</p>
|
|
37
39
|
|
package/binary/index.js
CHANGED
|
@@ -5744,7 +5744,7 @@ exports.saveSourcesYamlToFiles = exports.saveTemplatedYamlToFiles = void 0;
|
|
|
5744
5744
|
const fs_1 = __nccwpck_require__(7147);
|
|
5745
5745
|
const js_yaml_1 = __importDefault(__nccwpck_require__(1917));
|
|
5746
5746
|
const path_1 = __nccwpck_require__(1017);
|
|
5747
|
-
function saveTemplatedYamlToFiles(helmTemplate) {
|
|
5747
|
+
function saveTemplatedYamlToFiles(tmpDir, helmTemplate) {
|
|
5748
5748
|
var _a, _b;
|
|
5749
5749
|
const dataFileJSON = { templated: {} };
|
|
5750
5750
|
const files = helmTemplate.split('---');
|
|
@@ -5752,18 +5752,18 @@ function saveTemplatedYamlToFiles(helmTemplate) {
|
|
|
5752
5752
|
const jsonFile = js_yaml_1.default.load(file);
|
|
5753
5753
|
if (jsonFile) {
|
|
5754
5754
|
const key = jsonFile.kind + "_" + ((_a = jsonFile === null || jsonFile === void 0 ? void 0 : jsonFile.metadata) === null || _a === void 0 ? void 0 : _a.name.replaceAll('-', "_"));
|
|
5755
|
-
(0, fs_1.writeFileSync)(
|
|
5755
|
+
(0, fs_1.writeFileSync)(`${tmpDir}/templated/${key}.yaml`, file);
|
|
5756
5756
|
if (!dataFileJSON["templated"][jsonFile.kind]) {
|
|
5757
5757
|
dataFileJSON["templated"][jsonFile.kind] = {};
|
|
5758
5758
|
}
|
|
5759
5759
|
dataFileJSON["templated"][jsonFile.kind][(_b = jsonFile === null || jsonFile === void 0 ? void 0 : jsonFile.metadata) === null || _b === void 0 ? void 0 : _b.name.replaceAll('-', "_")] = file;
|
|
5760
5760
|
}
|
|
5761
5761
|
}
|
|
5762
|
-
(0, fs_1.writeFileSync)(
|
|
5762
|
+
(0, fs_1.writeFileSync)(`${tmpDir}/global-data.json`, JSON.stringify(dataFileJSON, null, 2));
|
|
5763
5763
|
}
|
|
5764
5764
|
exports.saveTemplatedYamlToFiles = saveTemplatedYamlToFiles;
|
|
5765
|
-
function saveSourcesYamlToFiles(path, prefix = false) {
|
|
5766
|
-
const dataFileJSON = JSON.parse((0, fs_1.readFileSync)(
|
|
5765
|
+
function saveSourcesYamlToFiles(path, tmpDir, prefix = false) {
|
|
5766
|
+
const dataFileJSON = JSON.parse((0, fs_1.readFileSync)(`${tmpDir}/global-data.json`, 'utf-8'));
|
|
5767
5767
|
if (!dataFileJSON["sources"]) {
|
|
5768
5768
|
dataFileJSON["sources"] = {};
|
|
5769
5769
|
}
|
|
@@ -5772,10 +5772,10 @@ function saveSourcesYamlToFiles(path, prefix = false) {
|
|
|
5772
5772
|
const fileFullPath = (0, path_1.join)(path, file);
|
|
5773
5773
|
if (!(0, fs_1.statSync)(fileFullPath).isDirectory()) {
|
|
5774
5774
|
const fileContent = (0, fs_1.readFileSync)(fileFullPath);
|
|
5775
|
-
let destinationPath =
|
|
5775
|
+
let destinationPath = `${tmpDir}/sources/${file}`;
|
|
5776
5776
|
if (prefix) {
|
|
5777
|
-
(0, fs_1.mkdirSync)(
|
|
5778
|
-
destinationPath =
|
|
5777
|
+
(0, fs_1.mkdirSync)(`${tmpDir}/sources/${path.split('/').at(-1)}`, { recursive: true });
|
|
5778
|
+
destinationPath = `${tmpDir}/sources/${path.split('/').at(-1)}/${file}`;
|
|
5779
5779
|
}
|
|
5780
5780
|
(0, fs_1.writeFileSync)(destinationPath, fileContent);
|
|
5781
5781
|
if (!prefix) {
|
|
@@ -5786,12 +5786,12 @@ function saveSourcesYamlToFiles(path, prefix = false) {
|
|
|
5786
5786
|
dataFileJSON["sources"][path.split('/').at(-1)] = {};
|
|
5787
5787
|
}
|
|
5788
5788
|
dataFileJSON["sources"][path.split('/').at(-1)][file] = String(fileContent);
|
|
5789
|
-
(0, fs_1.writeFileSync)(
|
|
5789
|
+
(0, fs_1.writeFileSync)(`${tmpDir}/global-data.json`, JSON.stringify(dataFileJSON, null, 2));
|
|
5790
5790
|
}
|
|
5791
5791
|
}
|
|
5792
5792
|
else {
|
|
5793
|
-
(0, fs_1.writeFileSync)(
|
|
5794
|
-
saveSourcesYamlToFiles(fileFullPath, true);
|
|
5793
|
+
(0, fs_1.writeFileSync)(`${tmpDir}/global-data.json`, JSON.stringify(dataFileJSON, null, 2));
|
|
5794
|
+
saveSourcesYamlToFiles(fileFullPath, tmpDir, true);
|
|
5795
5795
|
}
|
|
5796
5796
|
}
|
|
5797
5797
|
}
|
|
@@ -5825,21 +5825,32 @@ const fs_1 = __nccwpck_require__(7147);
|
|
|
5825
5825
|
const open_1 = __importDefault(__nccwpck_require__(5768));
|
|
5826
5826
|
const crypto_1 = __nccwpck_require__(6113);
|
|
5827
5827
|
const chalk_1 = __importDefault(__nccwpck_require__(385));
|
|
5828
|
+
const os_1 = __nccwpck_require__(2037);
|
|
5828
5829
|
function run() {
|
|
5829
|
-
var _a, _b;
|
|
5830
|
+
var _a, _b, _c, _d;
|
|
5830
5831
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5831
5832
|
const currentPath = (_b = (_a = process.argv) === null || _a === void 0 ? void 0 : _a.at(2)) !== null && _b !== void 0 ? _b : process.cwd();
|
|
5832
|
-
|
|
5833
|
-
(
|
|
5834
|
-
|
|
5835
|
-
|
|
5833
|
+
const values = (_d = (_c = process.argv) === null || _c === void 0 ? void 0 : _c.at(3)) !== null && _d !== void 0 ? _d : undefined;
|
|
5834
|
+
console.log(chalk_1.default.cyanBright(`⚡️ Path detected ${currentPath}`));
|
|
5835
|
+
console.log(values
|
|
5836
|
+
? chalk_1.default.greenBright(`🔑 Values detected ${values}`)
|
|
5837
|
+
: chalk_1.default.redBright(`❌ No value detected, computing with default values in the Chart`));
|
|
5838
|
+
const tmpDir = `${(0, os_1.tmpdir)()}/${(0, crypto_1.randomUUID)()}`;
|
|
5839
|
+
(0, fs_1.mkdirSync)(tmpDir, { recursive: true });
|
|
5840
|
+
(0, fs_1.mkdirSync)(`${tmpDir}/sources`, { recursive: true });
|
|
5841
|
+
(0, fs_1.mkdirSync)(`${tmpDir}/templated`, { recursive: true });
|
|
5836
5842
|
if (!(0, is_chart_folder_1.isChartFolder)(currentPath)) {
|
|
5837
5843
|
console.log('Not a chart folder');
|
|
5838
5844
|
process.exit(1);
|
|
5839
5845
|
}
|
|
5840
5846
|
let stdout;
|
|
5841
5847
|
try {
|
|
5842
|
-
|
|
5848
|
+
if (!values) {
|
|
5849
|
+
({ stdout } = yield (0, execa_1.$) `helm template ${currentPath}`);
|
|
5850
|
+
}
|
|
5851
|
+
else {
|
|
5852
|
+
({ stdout } = yield (0, execa_1.$) `helm template ${currentPath} --values ${values}`);
|
|
5853
|
+
}
|
|
5843
5854
|
}
|
|
5844
5855
|
catch (err) {
|
|
5845
5856
|
console.log("\n");
|
|
@@ -5848,9 +5859,9 @@ function run() {
|
|
|
5848
5859
|
console.log("\n");
|
|
5849
5860
|
process.exit(1);
|
|
5850
5861
|
}
|
|
5851
|
-
(0, save_yaml_1.saveTemplatedYamlToFiles)(stdout);
|
|
5852
|
-
(0, save_yaml_1.saveSourcesYamlToFiles)(currentPath);
|
|
5853
|
-
const JSON = (0, fs_1.readFileSync)(
|
|
5862
|
+
(0, save_yaml_1.saveTemplatedYamlToFiles)(tmpDir, stdout);
|
|
5863
|
+
(0, save_yaml_1.saveSourcesYamlToFiles)(currentPath, tmpDir);
|
|
5864
|
+
const JSON = (0, fs_1.readFileSync)(`${tmpDir}/global-data.json`, 'utf-8');
|
|
5854
5865
|
if (process.env.NODE_ENV === "development") {
|
|
5855
5866
|
(0, fs_1.mkdirSync)('src/assets', { recursive: true });
|
|
5856
5867
|
(0, fs_1.writeFileSync)('src/assets/global-data.js', `const DATA = ${JSON}`);
|
|
@@ -5859,8 +5870,8 @@ function run() {
|
|
|
5859
5870
|
file = file
|
|
5860
5871
|
.replace('<script src="assets/global-data.js"></script>', `<script>const DATA = ${JSON};</script>`);
|
|
5861
5872
|
const id = (0, crypto_1.randomUUID)();
|
|
5862
|
-
(0, fs_1.writeFileSync)(
|
|
5863
|
-
(0, open_1.default)(
|
|
5873
|
+
(0, fs_1.writeFileSync)(`${tmpDir}/index-${id}.html`, file);
|
|
5874
|
+
(0, open_1.default)(`${tmpDir}/index-${id}.html`);
|
|
5864
5875
|
});
|
|
5865
5876
|
}
|
|
5866
5877
|
;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "helm-viewer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Quick tool to easily view your helm charts.",
|
|
5
5
|
"author": "Tchoupinax <corentinfiloche@hotmail.fr> (https://corentinfiloche.xyz)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"pack": "npm pack --dry-run",
|
|
26
26
|
"publish": "npm publish",
|
|
27
27
|
"=== RUN ==============================================": "",
|
|
28
|
-
"run": "NODE_ENV=development npx vite-node src/index.ts -- ~/Downloads/traefik
|
|
28
|
+
"run": "NODE_ENV=development npx vite-node src/index.ts -- ~/Downloads/traefik",
|
|
29
29
|
"=== BUILD ============================================": "",
|
|
30
30
|
"build": "tsc",
|
|
31
31
|
"=== CLEAN ============================================": "",
|
|
Binary file
|
package/helm-viewer-0.2.0.tgz
DELETED
|
Binary file
|