Skip to content

Commit

Permalink
Update manage-project.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
p-zielinski committed Oct 19, 2023
1 parent b671815 commit cbf9600
Showing 1 changed file with 4 additions and 22 deletions.
26 changes: 4 additions & 22 deletions scripts/manage-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,19 @@ const runCliProcess = async ({
stdoutIncludes,
stderrIncludes,
resolveErrorAsFalse = false,
ignoreStdout = false,
}: {
command: string;
stdoutIncludes?: string;
stderrIncludes?: string;
resolveErrorAsFalse?: boolean;
ignoreStdout?: boolean;
}) => {
return await new Promise((resolve) => {
exec(command, (error, stdout, stderr) => {
if (
(stdoutIncludes && stdout?.includes(stdoutIncludes)) ||
(!stdoutIncludes && stdout) ||
(!ignoreStdout && !stdoutIncludes && stdout) ||
(stderrIncludes && stderr.includes(stderrIncludes))
) {
return resolve(true);
Expand Down Expand Up @@ -164,31 +166,11 @@ const uploadOpenApiFile = async (version) => {
await runCliProcess({
command: `rdme openapi ./reference/OpenAPI.json --version=${version} --create`,
stderrIncludes: `We're sorry, your upload request timed out. Please try again or split your file up into smaller chunks.`,
ignoreStdout: true,
});
console.log(colors.green("OPEN API FILE WAS UPLOADED"));
};

const updateReferenceDocs = async (version) => {
return await new Promise((resolve, reject) => {
exec(
`rdme docs ./docs/reference-docs --version=${version}`,
(error, stdout, stderr) => {
if (
stderr?.includes(
`We couldn't save this doc (Unable to find a category with the slug 'voucherify-api')`
)
) {
return resolve(false);
}
if (stdout?.includes("successfully created")) {
return resolve(true);
}
return resolve(false);
}
);
});
};

const createNewVersion = async (version) => {
//create fork
try {
Expand Down

0 comments on commit cbf9600

Please sign in to comment.