Skip to content

Commit

Permalink
creates a new deployment on the console (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmikey authored Sep 1, 2022
1 parent dea9c06 commit f1015d6
Showing 1 changed file with 30 additions and 4 deletions.
34 changes: 30 additions & 4 deletions src/commands/function/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ const deployFunction = (data: any) => {
console.log(Chalk.yellow(`Deploying ${functionName}`));
axios
.post(
`${server}/api/modules/deploy`,
`${server}/api/modules/new`,
{
functionId,
functionName,
name: functionName,
userFunctionId,
},
{
Expand All @@ -35,15 +35,41 @@ const deployFunction = (data: any) => {
}
)
.then((res) => {
console.log(res);
if (res.data && res.data.success) {
axios
.post(
`${server}/modules/deploy`,
{
functionName: functionName.replace(/\s+/g, "-"),
functionId: functionId,
userFunctionid: res.data._id,
},
{
headers: {
Authorization: `Bearer ${token}`,
},
}
)
.then((res) => {
console.log(
Chalk.green(
`Successfully deployed ${functionName} with id ${functionId}`
)
);
})
.catch((error) => {
console.log("error publishing function", error);
});
}
})
.catch((error) => {
console.log("error publishing function", error);
});
};

export const run = (options: any) => {
const { debug, name, path, rebuild } = options;
const { debug, name, path = process.cwd(), rebuild } = options;

const {
bls: { functionId: userFunctionId },
} = require(`${path}/package`);
Expand Down

0 comments on commit f1015d6

Please sign in to comment.