Skip to content

Commit 433af5c

Browse files
authored
Add README and CHANGELOG for functions_framework_tool package (#144)
* Add README and CHANGELOG for functions_framework_tool package * Minor nits
1 parent 62d434d commit 433af5c

File tree

2 files changed

+128
-0
lines changed

2 files changed

+128
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Changelog
2+
3+
## 0.3.0
4+
5+
The first version is `0.3.0` to align with the rest of published Functions
6+
Framework packages. This package is intended to support tools for working with
7+
Functions Framework projects. In this early iteration, a CLI tool (`dartfn`) is
8+
provided with a `generate` command for scaffolding new projects into an empty
9+
directory. Three initial generator templates are available (`helloworld`,
10+
`json`, and `cloudevent`).

functions_framework_tool/README.md

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Functions Framework Tool package for Dart
2+
3+
This package is intended to support tools for working with Functions Framework
4+
projects.
5+
6+
In this early iteration, a CLI tool (`dartfn`) is provided with a `generate`
7+
command for scaffolding new projects into an empty directory. Three initial
8+
generator templates are available:
9+
10+
* helloworld - a basic HTTP handler function
11+
* json - a simple function handler that accepts and sends JSON
12+
* cloudevent - a simple cloudevent function handler
13+
14+
To install the `dartfn` tool on your machine, run the following command:
15+
16+
```shell
17+
dart pub global activate dartfn
18+
```
19+
20+
Run `dartfn` without any arguments to confirm it is installed.
21+
22+
```shell
23+
dartfn is a tool for managing Dart Functions-as-a-Service (FaaS) projects.
24+
25+
Usage: dartfn <command> [arguments]
26+
27+
Global options:
28+
-h, --help Print this usage information.
29+
30+
Available commands:
31+
generate Generate a project to get started.
32+
version Print the current version.
33+
34+
Run "dartfn help <command>" for more information about a command.
35+
```
36+
37+
## List available generators
38+
39+
```shell
40+
dartfn generate --list
41+
```
42+
43+
Output
44+
```text
45+
Available generators:
46+
cloudevent - A sample Functions Framework project for handling a cloudevent.
47+
helloworld - A sample "Hello, World!" Functions Framework project.
48+
json - A sample Functions Framework project for handling JSON.
49+
```
50+
51+
If you want the generator list as JSON, use the hidden `--machine` flag:
52+
53+
```shell
54+
dartfn generate --machine
55+
```
56+
Output
57+
```json
58+
[{"name":"cloudevent","label":"Dart Package","description":"A sample Functions Framework project for handling a cloudevent.","categories":["dart"],"entrypoint":"bin/server.dart"},{"name":"helloworld","label":"Dart Package","description":"A sample \"Hello, World!\" Functions Framework project.","categories":["dart"],"entrypoint":"bin/server.dart"},{"name":"json","label":"Dart Package","description":"A sample Functions Framework project for handling JSON.","categories":["dart"],"entrypoint":"bin/server.dart"}]
59+
```
60+
61+
## Run a generator
62+
63+
```shell
64+
mkdir demo
65+
cd demo
66+
dartfn generate helloworld
67+
```
68+
69+
Output
70+
```text
71+
project: demo
72+
Creating helloworld application `ex`:
73+
demo/.gitignore
74+
demo/Dockerfile
75+
demo/README.md
76+
demo/analysis_options.yaml
77+
demo/bin/server.dart
78+
demo/lib/functions.dart
79+
demo/pubspec.yaml
80+
demo/test/function_test.dart
81+
8 files written.
82+
83+
--> to provision required packages, run 'pub get'
84+
```
85+
86+
## Print the version and check for updates
87+
88+
```shell
89+
dartfn version
90+
```
91+
92+
Output
93+
```text
94+
Google Functions Framework for Dart CLI (dartfn) version: 0.3.0
95+
```
96+
97+
If a newer version is available, the command will inform you. Example:
98+
99+
```shell
100+
dartfn version
101+
```
102+
103+
Output
104+
```text
105+
Google Functions Framework for Dart CLI (dartfn) version: 0.2.0
106+
Version 0.3.0 is available! To update to this version, run: `pub global activate dartfn`.
107+
```
108+
109+
If you just want the version number, use the `-s` or `--short` option:
110+
111+
```shell
112+
dartfn version --short
113+
```
114+
115+
Output
116+
```text
117+
0.3.0-dev
118+
```

0 commit comments

Comments
 (0)