-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
create.ts
41 lines (34 loc) · 1.05 KB
/
create.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright 2020 the Fastro author. All rights reserved. MIT license.
// deno-lint-ignore no-explicit-any
function createConfig(data: any) {
const { appId, userEmail } = data;
const yaml_config = !userEmail ? `app_id: ${appId}` : `app_id: ${appId}
user_email: ${userEmail}`;
return yaml_config;
}
// deno-lint-ignore no-explicit-any
function createPage(data: any) {
const yaml_content = `type: page
title: Hello world
description: This is my awesome landing page
headline:
title: Headline
description: My headline description
image: headline.png
`;
return yaml_content;
}
function createService() {}
function createMiddleware() {}
function createHelp() {
console.log("create help");
}
// deno-lint-ignore no-explicit-any
export async function create(args?: any) {
if (args.help) return createHelp();
if (args.config) return createConfig(args);
if (args.page) return createPage(args);
if (args.service) return createService();
if (args.middleware) return createMiddleware();
const encoder = new TextEncoder();
}