@catladder/pipeline 3.18.0 → 3.20.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.
- package/dist/catenv/index.d.ts +7 -0
- package/dist/catenv/index.js +14 -0
- package/dist/catladder-gitlab.js +4 -1
- package/dist/constants.js +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/pipeline/createMainPipeline.js +1 -1
- package/dist/pipeline/generatePipelineFiles.d.ts +2 -1
- package/dist/pipeline/generatePipelineFiles.js +3 -4
- package/dist/pipeline/gitlab/gitlabReleaseJobs.d.ts +2 -1
- package/dist/pipeline/gitlab/gitlabReleaseJobs.js +48 -3
- package/dist/rules/index.d.ts +1 -3
- package/dist/rules/index.js +2 -19
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/config.d.ts +10 -0
- package/dist/types/hooks.d.ts +26 -0
- package/dist/types/hooks.js +5 -0
- package/dist/types/release.d.ts +7 -0
- package/dist/types/release.js +5 -0
- package/dist/utils/writeFiles.d.ts +12 -6
- package/dist/utils/writeFiles.js +59 -41
- package/examples/__snapshots__/automatic-releases.test.ts.snap +1484 -0
- package/examples/__snapshots__/cloud-run-health-check-defaults.test.ts.snap +0 -2
- package/examples/__snapshots__/cloud-run-health-check-only-startup.test.ts.snap +0 -2
- package/examples/__snapshots__/cloud-run-health-check.test.ts.snap +0 -2
- package/examples/__snapshots__/cloud-run-http2.test.ts.snap +0 -2
- package/examples/__snapshots__/cloud-run-llama.test.ts.snap +0 -2
- package/examples/__snapshots__/cloud-run-memory-limit.test.ts.snap +0 -2
- package/examples/__snapshots__/cloud-run-meteor-with-worker.test.ts.snap +0 -2
- package/examples/__snapshots__/cloud-run-nextjs.test.ts.snap +0 -2
- package/examples/__snapshots__/cloud-run-no-cpu-throttling.test.ts.snap +0 -2
- package/examples/__snapshots__/cloud-run-no-service.test.ts.snap +0 -2
- package/examples/__snapshots__/cloud-run-non-public.test.ts.snap +0 -2
- package/examples/__snapshots__/cloud-run-post-stop-job.test.ts.snap +0 -2
- package/examples/__snapshots__/cloud-run-service-custom-vpc-connector.test.ts.snap +0 -2
- package/examples/__snapshots__/cloud-run-service-custom-vpc.test.ts.snap +0 -2
- package/examples/__snapshots__/cloud-run-service-gen2.test.ts.snap +0 -2
- package/examples/__snapshots__/cloud-run-service-increase-timout.test.ts.snap +0 -2
- package/examples/__snapshots__/cloud-run-service-with-volumes.test.ts.snap +0 -2
- package/examples/__snapshots__/cloud-run-storybook.test.ts.snap +0 -2
- package/examples/__snapshots__/cloud-run-with-agents.test.ts.snap +0 -2
- package/examples/__snapshots__/cloud-run-with-gpu.test.ts.snap +0 -2
- package/examples/__snapshots__/cloud-run-with-ngnix.test.ts.snap +0 -2
- package/examples/__snapshots__/cloud-run-with-sql-legacy-jobs.test.ts.snap +0 -2
- package/examples/__snapshots__/cloud-run-with-sql-multiple-dbs.test.ts.snap +0 -2
- package/examples/__snapshots__/cloud-run-with-sql-reuse-db.test.ts.snap +0 -2
- package/examples/__snapshots__/cloud-run-with-sql.test.ts.snap +0 -2
- package/examples/__snapshots__/cloud-run-with-worker.test.ts.snap +0 -2
- package/examples/__snapshots__/custom-build-job-with-tests.test.ts.snap +0 -2
- package/examples/__snapshots__/custom-build-job.test.ts.snap +0 -2
- package/examples/__snapshots__/custom-deploy.test.ts.snap +0 -2
- package/examples/__snapshots__/custom-envs.test.ts.snap +0 -2
- package/examples/__snapshots__/custom-sbom-java.test.ts.snap +0 -2
- package/examples/__snapshots__/custom-verify-job.test.ts.snap +0 -2
- package/examples/__snapshots__/git-submodule.test.ts.snap +0 -2
- package/examples/__snapshots__/kubernetes-application-customization.test.ts.snap +0 -2
- package/examples/__snapshots__/kubernetes-with-cloud-sql.test.ts.snap +0 -2
- package/examples/__snapshots__/kubernetes-with-jobs.test.ts.snap +0 -2
- package/examples/__snapshots__/kubernetes-with-mongodb.test.ts.snap +0 -2
- package/examples/__snapshots__/local-dot-env.test.ts.snap +0 -2
- package/examples/__snapshots__/meteor-kubernetes.test.ts.snap +0 -2
- package/examples/__snapshots__/modify-generated-files.test.ts.snap +640 -0
- package/examples/__snapshots__/multiline-var.test.ts.snap +0 -2
- package/examples/__snapshots__/native-app.test.ts.snap +0 -2
- package/examples/__snapshots__/node-build-with-custom-image.test.ts.snap +0 -2
- package/examples/__snapshots__/node-build-with-docker-additions.test.ts.snap +0 -2
- package/examples/__snapshots__/override-secrets.test.ts.snap +0 -2
- package/examples/__snapshots__/rails-k8s-with-worker-dockerfile.test.ts.snap +0 -2
- package/examples/__snapshots__/rails-k8s-with-worker.test.ts.snap +0 -2
- package/examples/__snapshots__/referencing-other-vars.test.ts.snap +0 -2
- package/examples/__snapshots__/wait-for-other-deploy.test.ts.snap +0 -2
- package/examples/__snapshots__/workspace-api-www-turbo-cache.test.ts.snap +0 -2
- package/examples/__snapshots__/workspace-api-www.test.ts.snap +0 -2
- package/examples/automatic-releases.test.ts +11 -0
- package/examples/automatic-releases.ts +28 -0
- package/examples/modify-generated-files.test.ts +11 -0
- package/examples/modify-generated-files.ts +29 -0
- package/package.json +1 -1
- package/src/catenv/index.ts +14 -0
- package/src/catladder-gitlab.ts +4 -1
- package/src/index.ts +1 -0
- package/src/pipeline/createMainPipeline.ts +9 -7
- package/src/pipeline/generatePipelineFiles.ts +5 -4
- package/src/pipeline/gitlab/gitlabReleaseJobs.ts +37 -4
- package/src/rules/index.ts +0 -32
- package/src/types/config.ts +12 -0
- package/src/types/hooks.ts +29 -0
- package/src/types/release.ts +7 -0
- package/src/utils/writeFiles.ts +58 -34
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { stringify } from "yaml";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
commentChar
|
|
5
|
-
}: {
|
|
2
|
+
import type { Config } from "../types";
|
|
3
|
+
type WriteFileOptions = {
|
|
6
4
|
commentChar: string;
|
|
7
|
-
}
|
|
5
|
+
};
|
|
8
6
|
type StringifyOptions = Exclude<Parameters<typeof stringify>[2], null | undefined | string | number>;
|
|
9
7
|
export declare const yamlStringifyOptions: StringifyOptions;
|
|
10
|
-
export declare
|
|
8
|
+
export declare class FileWriter {
|
|
9
|
+
private readonly config;
|
|
10
|
+
static create(config: Config): FileWriter;
|
|
11
|
+
constructor(config: Config);
|
|
12
|
+
protected writeTheFile(path: string, content: string): Promise<void>;
|
|
13
|
+
writeGeneratedFile(path: string, content: string, options: WriteFileOptions): Promise<void>;
|
|
14
|
+
writeYamlfile(path: string, data: any): Promise<void>;
|
|
15
|
+
protected getAutoGeneratedHeader(commentChar: string): string;
|
|
16
|
+
}
|
|
11
17
|
export {};
|
package/dist/utils/writeFiles.js
CHANGED
|
@@ -118,34 +118,9 @@ var __generator = this && this.__generator || function (thisArg, body) {
|
|
|
118
118
|
Object.defineProperty(exports, "__esModule", {
|
|
119
119
|
value: true
|
|
120
120
|
});
|
|
121
|
-
exports.
|
|
121
|
+
exports.FileWriter = exports.yamlStringifyOptions = void 0;
|
|
122
122
|
var promises_1 = require("fs/promises");
|
|
123
123
|
var yaml_1 = require("yaml");
|
|
124
|
-
var getAutoGeneratedHeader = function (commentChar) {
|
|
125
|
-
return ["-------------------------------------------------", "\uD83D\uDC31 \uD83D\uDD28 This file is generated by catladder", "\uD83D\uDEA8 Do not edit this file manually \uD83D\uDEA8", "-------------------------------------------------"].map(function (line) {
|
|
126
|
-
return "".concat(commentChar, " ").concat(line);
|
|
127
|
-
}).join("\n").concat("\n");
|
|
128
|
-
};
|
|
129
|
-
exports.getAutoGeneratedHeader = getAutoGeneratedHeader;
|
|
130
|
-
var writeGeneratedFile = function (path_1, content_1, _a) {
|
|
131
|
-
return __awaiter(void 0, [path_1, content_1, _a], void 0, function (path, content, _b) {
|
|
132
|
-
var commentChar = _b.commentChar;
|
|
133
|
-
return __generator(this, function (_c) {
|
|
134
|
-
switch (_c.label) {
|
|
135
|
-
case 0:
|
|
136
|
-
return [4 /*yield*/, (0, promises_1.writeFile)(path,
|
|
137
|
-
// need to spread out the jobs, forgot why
|
|
138
|
-
[(0, exports.getAutoGeneratedHeader)(commentChar), content].join("\n"), {
|
|
139
|
-
encoding: "utf-8"
|
|
140
|
-
})];
|
|
141
|
-
case 1:
|
|
142
|
-
_c.sent();
|
|
143
|
-
return [2 /*return*/];
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
};
|
|
148
|
-
exports.writeGeneratedFile = writeGeneratedFile;
|
|
149
124
|
exports.yamlStringifyOptions = {
|
|
150
125
|
// prevents colapsing long command statements into multiple lines
|
|
151
126
|
lineWidth: 0,
|
|
@@ -154,19 +129,62 @@ exports.yamlStringifyOptions = {
|
|
|
154
129
|
// Better readability when bash commands most often use double quotes
|
|
155
130
|
singleQuote: true
|
|
156
131
|
};
|
|
157
|
-
var
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
132
|
+
var FileWriter = /** @class */function () {
|
|
133
|
+
function FileWriter(config) {
|
|
134
|
+
this.config = config;
|
|
135
|
+
this.config = config;
|
|
136
|
+
}
|
|
137
|
+
FileWriter.create = function (config) {
|
|
138
|
+
return new FileWriter(config);
|
|
139
|
+
};
|
|
140
|
+
FileWriter.prototype.writeTheFile = function (path, content) {
|
|
141
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
142
|
+
var transformedContent;
|
|
143
|
+
var _a, _b;
|
|
144
|
+
return __generator(this, function (_c) {
|
|
145
|
+
switch (_c.label) {
|
|
146
|
+
case 0:
|
|
147
|
+
return [4 /*yield*/, (_a = this.config.hooks) === null || _a === void 0 ? void 0 : _a.transformFileBeforeWrite({
|
|
148
|
+
filename: path,
|
|
149
|
+
content: content,
|
|
150
|
+
extension: (_b = path.split(".").pop()) !== null && _b !== void 0 ? _b : "",
|
|
151
|
+
path: path
|
|
152
|
+
})];
|
|
153
|
+
case 1:
|
|
154
|
+
transformedContent = _c.sent();
|
|
155
|
+
return [4 /*yield*/, (0, promises_1.writeFile)(path, transformedContent !== null && transformedContent !== void 0 ? transformedContent : content, {
|
|
156
|
+
encoding: "utf-8"
|
|
157
|
+
})];
|
|
158
|
+
case 2:
|
|
159
|
+
_c.sent();
|
|
160
|
+
return [2 /*return*/];
|
|
161
|
+
}
|
|
162
|
+
});
|
|
169
163
|
});
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
|
|
164
|
+
};
|
|
165
|
+
FileWriter.prototype.writeGeneratedFile = function (path, content, options) {
|
|
166
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
167
|
+
return __generator(this, function (_a) {
|
|
168
|
+
switch (_a.label) {
|
|
169
|
+
case 0:
|
|
170
|
+
return [4 /*yield*/, this.writeTheFile(path, [this.getAutoGeneratedHeader(options.commentChar), content].join("\n"))];
|
|
171
|
+
case 1:
|
|
172
|
+
_a.sent();
|
|
173
|
+
return [2 /*return*/];
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
};
|
|
178
|
+
FileWriter.prototype.writeYamlfile = function (path, data) {
|
|
179
|
+
return this.writeGeneratedFile(path, (0, yaml_1.stringify)(data, exports.yamlStringifyOptions), {
|
|
180
|
+
commentChar: "#"
|
|
181
|
+
});
|
|
182
|
+
};
|
|
183
|
+
FileWriter.prototype.getAutoGeneratedHeader = function (commentChar) {
|
|
184
|
+
return ["-------------------------------------------------", "\uD83D\uDC31 \uD83D\uDD28 This file is generated by catladder", "\uD83D\uDEA8 Do not edit this file manually \uD83D\uDEA8", "-------------------------------------------------"].map(function (line) {
|
|
185
|
+
return "".concat(commentChar, " ").concat(line);
|
|
186
|
+
}).join("\n").concat("\n");
|
|
187
|
+
};
|
|
188
|
+
return FileWriter;
|
|
189
|
+
}();
|
|
190
|
+
exports.FileWriter = FileWriter;
|