mirror of
https://github.com/rowyio/rowy.git
synced 2026-07-12 13:28:48 +02:00
add functionConfig.ts validation
This commit is contained in:
@@ -34,10 +34,17 @@ export default async function generateConfig(
|
||||
await addPackages(requiredDependencies.map((p: any) => ({ name: p })));
|
||||
}
|
||||
|
||||
await asyncExecute(
|
||||
const isFunctionConfigValid = await asyncExecute(
|
||||
"cd build/functions/src; tsc functionConfig.ts",
|
||||
commandErrorHandler({ user })
|
||||
commandErrorHandler({
|
||||
user,
|
||||
functionConfigTs: configFile,
|
||||
description: `Invalid compiled functionConfig.ts`,
|
||||
})
|
||||
);
|
||||
if (!isFunctionConfigValid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const { sparksConfig } = require("../functions/src/functionConfig.js");
|
||||
const requiredSparks = sparksConfig.map((s: any) => s.type);
|
||||
|
||||
@@ -13,7 +13,7 @@ export const asyncExecute = async (command: string, callback: any) =>
|
||||
child.exec(command, async function (error, stdout, stderr) {
|
||||
console.log({ error, stdout, stderr });
|
||||
await callback(error, stdout, stderr);
|
||||
resolve(true);
|
||||
resolve(!error);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ function firetableUser(user: admin.auth.UserRecord) {
|
||||
export function commandErrorHandler(meta: {
|
||||
user: admin.auth.UserRecord;
|
||||
description?: string;
|
||||
combiledScript?: string;
|
||||
functionConfigTs?: string;
|
||||
sparksConfig?: string;
|
||||
}) {
|
||||
return async function (error, stdout, stderr) {
|
||||
@@ -32,7 +32,7 @@ export function commandErrorHandler(meta: {
|
||||
errorStackTrace: error?.stack ?? "",
|
||||
command: error?.cmd ?? "",
|
||||
description: meta?.description ?? "",
|
||||
combiledScript: meta?.combiledScript ?? "",
|
||||
functionConfigTs: meta?.functionConfigTs ?? "",
|
||||
sparksConfig: meta?.sparksConfig ?? "",
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user