@catladder/cli 0.0.0-refactor-docker-de6b3576 → 0.0.0-refactor-docker-427f63d6
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/bundles/catenv/index.js +53 -42
- package/dist/bundles/cli/index.js +45 -30
- package/dist/cli/src/apps/catenv/catenv.js +8 -12
- package/dist/cli/src/apps/catenv/catenv.js.map +1 -1
- package/dist/cli/src/utils/gitlab.d.ts +1 -1
- package/dist/cli/src/utils/gitlab.js +37 -24
- package/dist/cli/src/utils/gitlab.js.map +1 -1
- package/dist/pipeline/src/build/node/buildJob.js +3 -1
- package/dist/pipeline/src/build/node/buildJob.js.map +1 -1
- package/dist/pipeline/src/pipeline/generatePipelineFiles.js +5 -5
- package/dist/pipeline/src/pipeline/generatePipelineFiles.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/apps/catenv/catenv.ts +8 -7
- package/src/utils/gitlab.ts +26 -10
package/package.json
CHANGED
|
@@ -11,13 +11,14 @@ export default async (choice?: Choice) => {
|
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
await Promise.all([
|
|
15
|
+
config.pipelineType
|
|
16
|
+
? generatePipelineFiles(config, config.pipelineType, "local")
|
|
17
|
+
: undefined,
|
|
18
|
+
writeDotEnvFiles(config, choice),
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
writeDTsFiles(config, choice),
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
printVariables(config, choice),
|
|
23
|
+
]);
|
|
23
24
|
};
|
package/src/utils/gitlab.ts
CHANGED
|
@@ -114,20 +114,36 @@ type GitlabVariable = {
|
|
|
114
114
|
environment_scope: string;
|
|
115
115
|
};
|
|
116
116
|
export const getAllVariables = memoizee(
|
|
117
|
-
async (
|
|
117
|
+
async (
|
|
118
|
+
vorpal: CommandInstance | null,
|
|
119
|
+
n = 5, // how many requests to do in parallel, 5 seems a good value for many projects, ideally we would do one request in parallel per component
|
|
120
|
+
): Promise<Array<GitlabVariable>> => {
|
|
118
121
|
const { id } = await getProjectInfo(vorpal);
|
|
122
|
+
|
|
119
123
|
let all: Array<GitlabVariable> = [];
|
|
120
|
-
let result: Array<GitlabVariable
|
|
124
|
+
let result: Array<Array<GitlabVariable>> = [];
|
|
121
125
|
let page = 1;
|
|
126
|
+
|
|
122
127
|
do {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
// Create an array of promises for N pages
|
|
129
|
+
const promises = Array.from({ length: n }, (_, i) => {
|
|
130
|
+
return doGitlabRequest(
|
|
131
|
+
vorpal,
|
|
132
|
+
`projects/${id}/variables?per_page=100&page=${page + i}`,
|
|
133
|
+
);
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
// Wait for all promises to resolve
|
|
137
|
+
result = await Promise.all(promises);
|
|
138
|
+
|
|
139
|
+
// Increment the page by N
|
|
140
|
+
page += n;
|
|
141
|
+
|
|
142
|
+
// Flatten the result array and add it to 'all'
|
|
143
|
+
all = [...all, ...result.flat()];
|
|
144
|
+
// Continue only if the last page had results
|
|
145
|
+
} while (result.length > 0 && result[result.length - 1].length > 0);
|
|
146
|
+
|
|
131
147
|
return all;
|
|
132
148
|
},
|
|
133
149
|
{ promise: true },
|