Skip to content

Commit

Permalink
Update READMEs
Browse files Browse the repository at this point in the history
- Add CLI docs
- Add template READMEs with C3 command and preview deployment link
  • Loading branch information
maxwellpeterson committed Nov 22, 2024
1 parent a780108 commit 6493cf0
Show file tree
Hide file tree
Showing 10 changed files with 144 additions and 30 deletions.
33 changes: 32 additions & 1 deletion cli/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
# Templates CLI

TODO
A handy CLI for developing templates.

## Upload

The `upload` command uploads template contents to the Cloudflare Templates API for consumption by the Cloudflare dashboard and other template clients. This command runs in CI on merges to the `main` branch.

```
$ npx cli help upload
Usage: cli upload [options] [path-to-templates]
upload templates to the templates API
Arguments:
path-to-templates path to directory containing templates (default: ".")
```

## Lint

The `lint` command finds and fixes template style problems that aren't covered by Prettier or ESList. This linter focuses on Cloudflare-specific configuration and project structure.

```
$ npx cli help lint
Usage: cli lint [options] [path-to-templates]
find and fix template style problems
Arguments:
path-to-templates path to directory containing templates (default: ".")
Options:
--fix fix problems that can be automatically fixed
```
13 changes: 8 additions & 5 deletions cli/src/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@ export async function upload(config: UploadConfig) {
const results = await Promise.allSettled(
templatePaths.map((templatePath) => uploadTemplate(templatePath, config)),
);
results.forEach((result, i) => {
if (result.status === "rejected") {
console.error(`Upload ${templatePaths[i]} failed: ${result.reason}`);
}
});
if (results.some((result) => result.status === "rejected")) {
results.forEach((result, i) => {
if (result.status === "rejected") {
console.error(`Upload ${templatePaths[i]} failed: ${result.reason}`);
}
});
process.exit(1);
}
}

async function uploadTemplate(templatePath: string, config: UploadConfig) {
Expand Down
16 changes: 13 additions & 3 deletions d1-template/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# D1 Template
# Worker + D1 Database

[Visit](https://d1-template.templates.workers.dev)
Cloudflare's native serverless SQL database.

TODO
## Develop Locally

Use this template with [C3](https://developers.cloudflare.com/pages/get-started/c3/) (the `create-cloudflare` CLI):

```
npm create cloudflare@latest -- --template=cloudflare/templates/d1-template
```

## Preview Deployment

A live public deployment of this template is available at [https://d1-template.templates.workers.dev](https://d1-template.templates.workers.dev)
16 changes: 13 additions & 3 deletions image-classification-template/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Image Classification Template
# Image Classification App

[Visit](https://image-classification-template.templates.workers.dev)
Identify and label objects found in images.

TODO
## Develop Locally

Use this template with [C3](https://developers.cloudflare.com/pages/get-started/c3/) (the `create-cloudflare` CLI):

```
npm create cloudflare@latest -- --template=cloudflare/templates/image-classification-template
```

## Preview Deployment

A live public deployment of this template is available at [https://image-classification-template.templates.workers.dev](https://image-classification-template.templates.workers.dev)
16 changes: 13 additions & 3 deletions llm-template/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# LLM Template
# LLM App

[Visit](https://llm-template.templates.workers.dev)
Perform natural language processing tasks using a Large Language Model (LLM) with Workers.

TODO
## Develop Locally

Use this template with [C3](https://developers.cloudflare.com/pages/get-started/c3/) (the `create-cloudflare` CLI):

```
npm create cloudflare@latest -- --template=cloudflare/templates/llm-template
```

## Preview Deployment

A live public deployment of this template is available at [https://llm-template.templates.workers.dev](https://llm-template.templates.workers.dev)
16 changes: 13 additions & 3 deletions speech-to-text-template/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Speech to Text Template
# Speech to Text App

[Visit](https://speech-to-text-template.templates.workers.dev)
Convert audio to text with Whisper.

TODO
## Develop Locally

Use this template with [C3](https://developers.cloudflare.com/pages/get-started/c3/) (the `create-cloudflare` CLI):

```
npm create cloudflare@latest -- --template=cloudflare/templates/speech-to-text-template
```

## Preview Deployment

A live public deployment of this template is available at [https://speech-to-text-template.templates.workers.dev](https://speech-to-text-template.templates.workers.dev)
16 changes: 13 additions & 3 deletions text-classification-template/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Text Classification Template
# Text Classification App

[Visit](https://text-classification-template.templates.workers.dev)
Categorize unstructured text into groups based on criteria of your choice.

TODO
## Develop Locally

Use this template with [C3](https://developers.cloudflare.com/pages/get-started/c3/) (the `create-cloudflare` CLI):

```
npm create cloudflare@latest -- --template=cloudflare/templates/text-classification-template
```

## Preview Deployment

A live public deployment of this template is available at [https://text-classification-template.templates.workers.dev](https://text-classification-template.templates.workers.dev)
16 changes: 13 additions & 3 deletions text-to-image-template/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Text to Image Template
# Text to Image App

[Visit](https://text-to-image-template.templates.workers.dev)
Generate images based on text prompts.

TODO
## Develop Locally

Use this template with [C3](https://developers.cloudflare.com/pages/get-started/c3/) (the `create-cloudflare` CLI):

```
npm create cloudflare@latest -- --template=cloudflare/templates/text-to-image-template
```

## Preview Deployment

A live public deployment of this template is available at [https://text-to-image-template.templates.workers.dev](https://text-to-image-template.templates.workers.dev)
16 changes: 13 additions & 3 deletions translation-template/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Translation Template
# Translation App

[Visit](https://translation-template.templates.workers.dev)
Translate text from one language to another.

TODO
## Develop Locally

Use this template with [C3](https://developers.cloudflare.com/pages/get-started/c3/) (the `create-cloudflare` CLI):

```
npm create cloudflare@latest -- --template=cloudflare/templates/translation-template
```

## Preview Deployment

A live public deployment of this template is available at [https://translation-template.templates.workers.dev](https://translation-template.templates.workers.dev)
16 changes: 13 additions & 3 deletions vector-embedding-template/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Vector Embedding Template
# Vector Embedding App

[Visit](https://vector-embedding-template.templates.workers.dev)
Convert text into mathematical vectors so that you can perform text analysis and transformations.

TODO
## Develop Locally

Use this template with [C3](https://developers.cloudflare.com/pages/get-started/c3/) (the `create-cloudflare` CLI):

```
npm create cloudflare@latest -- --template=cloudflare/templates/vector-embedding-template
```

## Preview Deployment

A live public deployment of this template is available at [https://vector-embedding-template.templates.workers.dev](https://vector-embedding-template.templates.workers.dev)

0 comments on commit 6493cf0

Please sign in to comment.