@catladder/pipeline 1.138.0 → 1.139.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/build/base/createAppBuildJob.js +2 -1
- package/dist/bundles/catladder-gitlab/index.js +1 -1
- package/dist/constants.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/config.d.ts +13 -3
- package/examples/__snapshots__/local-dot-env.ts.snap +1839 -0
- package/examples/local-dot-env.ts +25 -0
- package/package.json +1 -1
- package/src/build/base/createAppBuildJob.ts +3 -1
- package/src/types/config.ts +14 -3
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Config } from "../src";
|
|
2
|
+
import { createAllPipelines } from "./__utils__/helpers";
|
|
3
|
+
const config: Config = {
|
|
4
|
+
appName: "test-app",
|
|
5
|
+
customerName: "pan",
|
|
6
|
+
components: {
|
|
7
|
+
api: {
|
|
8
|
+
dotEnv: "local", // creates .env file only locally, not during build
|
|
9
|
+
envDTs: true, // creates type files based on env vars, so that process.env is typed
|
|
10
|
+
dir: "api",
|
|
11
|
+
build: {
|
|
12
|
+
type: "node",
|
|
13
|
+
},
|
|
14
|
+
deploy: {
|
|
15
|
+
type: "google-cloudrun",
|
|
16
|
+
projectId: "google-project-id",
|
|
17
|
+
region: "europe-west6",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
it("matches snapshot", async () => {
|
|
24
|
+
expect(await createAllPipelines(config)).toMatchSnapshot();
|
|
25
|
+
});
|
package/package.json
CHANGED
|
@@ -34,7 +34,9 @@ export const createAppBuildJob = (
|
|
|
34
34
|
},
|
|
35
35
|
|
|
36
36
|
script: [
|
|
37
|
-
...(context.componentConfig.dotEnv
|
|
37
|
+
...(context.componentConfig.dotEnv === true // don't build when set to `local`
|
|
38
|
+
? writeDotEnv(context)
|
|
39
|
+
: []),
|
|
38
40
|
...writeBuildInfo(context),
|
|
39
41
|
...ensureNodeVersion(context), // in pure node repos, we might want to have the nvmrc file in top-level
|
|
40
42
|
`cd ${context.componentConfig.dir}`,
|
package/src/types/config.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { DeployConfig } from "../deploy/types";
|
|
|
4
4
|
import type { CatladderJob } from "./jobs";
|
|
5
5
|
import type { Context } from "./context";
|
|
6
6
|
import type { PartialDeep } from "./utils";
|
|
7
|
+
import { load } from "js-yaml";
|
|
7
8
|
export type PipelineTrigger = "mainBranch" | "mr" | "taggedRelease";
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -146,13 +147,23 @@ export type ComponentConfig<C extends ConfigProps = never> = {
|
|
|
146
147
|
customJobs?: CatladderJob[] | ((context: Context) => CatladderJob[]);
|
|
147
148
|
|
|
148
149
|
/**
|
|
149
|
-
*
|
|
150
|
+
* whether to create a .env
|
|
150
151
|
*
|
|
151
152
|
* Be careful, this will overwrite any existing .env file!
|
|
153
|
+
*
|
|
154
|
+
* if set to true it will create .env locally and during build.
|
|
155
|
+
* Be careful: the .env file usually ends up in the build artifacts.
|
|
156
|
+
* Use this for apps and clients where env does not contain any secrets
|
|
157
|
+
*
|
|
158
|
+
*
|
|
159
|
+
* if set to "local" it will only create .env file locally.
|
|
160
|
+
* Use this in combination with @dotenvx/dotenvx or node 20 to start apps locally with .env files
|
|
161
|
+
* During build and runtime, it relies on the env vars set in the environment
|
|
162
|
+
*
|
|
152
163
|
*/
|
|
153
|
-
dotEnv?: boolean;
|
|
164
|
+
dotEnv?: boolean | "local";
|
|
154
165
|
/**
|
|
155
|
-
*
|
|
166
|
+
* whether to create a env.d.ts localy and during build jobs
|
|
156
167
|
*
|
|
157
168
|
* Be careful, this will overwrite any existing env.d.ts file!
|
|
158
169
|
*/
|