@comet/upgrade 1.23.0 → 1.24.0
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.
|
@@ -29,12 +29,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
const fs_1 = __importDefault(require("fs"));
|
|
30
30
|
const crypto = __importStar(require("node:crypto"));
|
|
31
31
|
const ts_morph_1 = require("ts-morph");
|
|
32
|
+
const execute_command_util_1 = require("../util/execute-command.util");
|
|
32
33
|
async function addSitePreviewSecret() {
|
|
33
34
|
updateApiFiles1();
|
|
34
35
|
updateApiFiles2();
|
|
35
36
|
updateApiFiles3();
|
|
36
37
|
updateDotEnvFile();
|
|
37
38
|
updateValuesTplFile();
|
|
39
|
+
updateChart();
|
|
40
|
+
await executeHelmDependencyUpdate();
|
|
38
41
|
}
|
|
39
42
|
exports.default = addSitePreviewSecret;
|
|
40
43
|
function updateApiFiles1() {
|
|
@@ -146,3 +149,37 @@ function updateValuesTplFile() {
|
|
|
146
149
|
fs_1.default.writeFileSync(valuesFileName, content);
|
|
147
150
|
console.log(" finished.");
|
|
148
151
|
}
|
|
152
|
+
function updateChart() {
|
|
153
|
+
const filename = "deployment/helm/Chart.yaml";
|
|
154
|
+
console.log(`Update ${filename}`);
|
|
155
|
+
if (!fs_1.default.existsSync(filename)) {
|
|
156
|
+
console.error(" could not find file, please make sure to remove authproxy-preview and execute helm dependency update.");
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
const file = fs_1.default.readFileSync(filename, "utf8");
|
|
160
|
+
const lines = file.split(/\n/);
|
|
161
|
+
let startingLine = 0;
|
|
162
|
+
let isAuthproxyPreview = false;
|
|
163
|
+
lines.forEach((line, index) => {
|
|
164
|
+
const match1 = line.match(/-.*oauth2-proxy/);
|
|
165
|
+
if (match1) {
|
|
166
|
+
startingLine = index;
|
|
167
|
+
}
|
|
168
|
+
const match2 = line.match(/alias.*authproxy-preview/);
|
|
169
|
+
if (match2) {
|
|
170
|
+
isAuthproxyPreview = true;
|
|
171
|
+
}
|
|
172
|
+
const match3 = line.match(/- .*/);
|
|
173
|
+
if (match3 && isAuthproxyPreview) {
|
|
174
|
+
lines.splice(startingLine, index - startingLine);
|
|
175
|
+
isAuthproxyPreview = false;
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
const content = lines.join("\n").replace(/oauth2-proxy-preview/g, "site");
|
|
179
|
+
fs_1.default.writeFileSync(filename, content);
|
|
180
|
+
console.log(" finished.");
|
|
181
|
+
}
|
|
182
|
+
async function executeHelmDependencyUpdate() {
|
|
183
|
+
console.log('Execute "helm dependency update deployment/helm" ...');
|
|
184
|
+
await (0, execute_command_util_1.executeCommand)("helm", ["dependency", "update", "deployment/helm"]);
|
|
185
|
+
}
|