in src/utils/checkIsRoutineCreated.ts [32:60]
export async function checkRoutineExist(name: string, entry?: string) {
const isCreatedRoutine = await isRoutineExist(name);
if (!isCreatedRoutine) {
logger.log(
t('first_deploy').d(
'This is the first time to deploy, we will create a new routine for you.'
)
);
const entryFile = path.resolve(entry ?? '', 'src/index.js');
await prodBuild(false, entryFile, entry);
const code = readEdgeRoutineFile(entry) || '';
const server = await ApiService.getInstance();
const specList = (
(await server.ListRoutineOptionalSpecs())?.data.Specs ?? []
).reduce((acc, item) => {
if (item.IsAvailable) {
acc.push(item.SpecName);
}
return acc;
}, [] as string[]);
const spec = await displaySelectSpec(specList);
await createEdgeRoutine({
name: name,
specName: spec,
code: code
});
}
}