diff --git a/template/dart/.dart_tool/package_config.json b/template/dart/.dart_tool/package_config.json index 30136f5..404c846 100644 --- a/template/dart/.dart_tool/package_config.json +++ b/template/dart/.dart_tool/package_config.json @@ -2,19 +2,463 @@ "configVersion": 2, "packages": [ { - "name": "function", - "rootUri": "../function", + "name": "_fe_analyzer_shared", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/_fe_analyzer_shared-76.0.0", + "packageUri": "lib/", + "languageVersion": "3.3" + }, + { + "name": "_macros", + "rootUri": "file:///Users/fabian/.puro/shared/caches/cb4b5fff73850b2e42bd4de7cb9a4310a78ac40d/dart-sdk/pkg/_macros", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "analyzer", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/analyzer-6.11.0", + "packageUri": "lib/", + "languageVersion": "3.3" + }, + { + "name": "args", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/args-2.6.0", + "packageUri": "lib/", + "languageVersion": "3.3" + }, + { + "name": "async", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/async-2.12.0", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "boolean_selector", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/boolean_selector-2.1.2", + "packageUri": "lib/", + "languageVersion": "3.1" + }, + { + "name": "build", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/build-2.4.2", "packageUri": "lib/", "languageVersion": "3.6" }, { - "name": "openfaas_dart_template", + "name": "build_config", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/build_config-1.1.2", + "packageUri": "lib/", + "languageVersion": "3.6" + }, + { + "name": "build_daemon", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/build_daemon-4.0.3", + "packageUri": "lib/", + "languageVersion": "3.6" + }, + { + "name": "build_resolvers", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/build_resolvers-2.4.3", + "packageUri": "lib/", + "languageVersion": "3.6" + }, + { + "name": "build_runner", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/build_runner-2.4.14", + "packageUri": "lib/", + "languageVersion": "3.6" + }, + { + "name": "build_runner_core", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/build_runner_core-8.0.0", + "packageUri": "lib/", + "languageVersion": "3.6" + }, + { + "name": "built_collection", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/built_collection-5.1.1", + "packageUri": "lib/", + "languageVersion": "2.12" + }, + { + "name": "built_value", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/built_value-8.9.3", + "packageUri": "lib/", + "languageVersion": "3.0" + }, + { + "name": "checked_yaml", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/checked_yaml-2.0.3", + "packageUri": "lib/", + "languageVersion": "2.19" + }, + { + "name": "code_builder", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/code_builder-4.10.1", + "packageUri": "lib/", + "languageVersion": "3.5" + }, + { + "name": "collection", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/collection-1.19.1", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "convert", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/convert-3.1.2", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "coverage", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/coverage-1.11.1", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "crypto", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/crypto-3.0.6", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "dart_flutter_team_lints", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/dart_flutter_team_lints-3.2.1", + "packageUri": "lib/", + "languageVersion": "3.5" + }, + { + "name": "dart_style", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/dart_style-2.3.7", + "packageUri": "lib/", + "languageVersion": "3.0" + }, + { + "name": "file", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/file-7.0.1", + "packageUri": "lib/", + "languageVersion": "3.0" + }, + { + "name": "fixnum", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/fixnum-1.1.1", + "packageUri": "lib/", + "languageVersion": "3.1" + }, + { + "name": "frontend_server_client", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/frontend_server_client-4.0.0", + "packageUri": "lib/", + "languageVersion": "3.0" + }, + { + "name": "functions_framework", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/functions_framework-0.4.3+1", + "packageUri": "lib/", + "languageVersion": "3.0" + }, + { + "name": "functions_framework_builder", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/functions_framework_builder-0.4.10", + "packageUri": "lib/", + "languageVersion": "3.0" + }, + { + "name": "glob", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/glob-2.1.2", + "packageUri": "lib/", + "languageVersion": "2.19" + }, + { + "name": "google_cloud", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/google_cloud-0.2.0", + "packageUri": "lib/", + "languageVersion": "3.0" + }, + { + "name": "graphs", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/graphs-2.3.2", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "http", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/http-1.2.2", + "packageUri": "lib/", + "languageVersion": "3.3" + }, + { + "name": "http_multi_server", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/http_multi_server-3.2.2", + "packageUri": "lib/", + "languageVersion": "3.2" + }, + { + "name": "http_parser", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/http_parser-4.1.2", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "io", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/io-1.0.5", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "js", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/js-0.7.1", + "packageUri": "lib/", + "languageVersion": "3.1" + }, + { + "name": "json_annotation", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/json_annotation-4.9.0", + "packageUri": "lib/", + "languageVersion": "3.0" + }, + { + "name": "lints", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/lints-5.1.1", + "packageUri": "lib/", + "languageVersion": "3.6" + }, + { + "name": "logging", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/logging-1.3.0", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "macros", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/macros-0.1.3-main.0", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "matcher", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/matcher-0.12.17", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "meta", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/meta-1.16.0", + "packageUri": "lib/", + "languageVersion": "2.12" + }, + { + "name": "mime", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/mime-2.0.0", + "packageUri": "lib/", + "languageVersion": "3.2" + }, + { + "name": "node_preamble", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/node_preamble-2.0.2", + "packageUri": "lib/", + "languageVersion": "2.12" + }, + { + "name": "package_config", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/package_config-2.1.1", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "path", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/path-1.9.1", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "pool", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/pool-1.5.1", + "packageUri": "lib/", + "languageVersion": "2.12" + }, + { + "name": "pub_semver", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/pub_semver-2.1.5", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "pubspec_parse", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/pubspec_parse-1.5.0", + "packageUri": "lib/", + "languageVersion": "3.6" + }, + { + "name": "shelf", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/shelf-1.4.2", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "shelf_packages_handler", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/shelf_packages_handler-3.0.2", + "packageUri": "lib/", + "languageVersion": "2.17" + }, + { + "name": "shelf_static", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/shelf_static-1.1.3", + "packageUri": "lib/", + "languageVersion": "3.3" + }, + { + "name": "shelf_web_socket", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/shelf_web_socket-2.0.1", + "packageUri": "lib/", + "languageVersion": "3.3" + }, + { + "name": "source_gen", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/source_gen-1.5.0", + "packageUri": "lib/", + "languageVersion": "3.0" + }, + { + "name": "source_helper", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/source_helper-1.3.5", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "source_map_stack_trace", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/source_map_stack_trace-2.1.2", + "packageUri": "lib/", + "languageVersion": "3.3" + }, + { + "name": "source_maps", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/source_maps-0.10.13", + "packageUri": "lib/", + "languageVersion": "3.3" + }, + { + "name": "source_span", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/source_span-1.10.1", + "packageUri": "lib/", + "languageVersion": "3.1" + }, + { + "name": "stack_trace", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/stack_trace-1.12.1", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "stream_channel", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/stream_channel-2.1.4", + "packageUri": "lib/", + "languageVersion": "3.3" + }, + { + "name": "stream_transform", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/stream_transform-2.1.1", + "packageUri": "lib/", + "languageVersion": "3.1" + }, + { + "name": "string_scanner", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/string_scanner-1.4.1", + "packageUri": "lib/", + "languageVersion": "3.1" + }, + { + "name": "term_glyph", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/term_glyph-1.2.2", + "packageUri": "lib/", + "languageVersion": "3.1" + }, + { + "name": "test", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/test-1.25.14", + "packageUri": "lib/", + "languageVersion": "3.5" + }, + { + "name": "test_api", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/test_api-0.7.4", + "packageUri": "lib/", + "languageVersion": "3.5" + }, + { + "name": "test_core", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/test_core-0.6.8", + "packageUri": "lib/", + "languageVersion": "3.5" + }, + { + "name": "test_process", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/test_process-2.1.1", + "packageUri": "lib/", + "languageVersion": "3.1" + }, + { + "name": "timing", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/timing-1.0.2", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "typed_data", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/typed_data-1.4.0", + "packageUri": "lib/", + "languageVersion": "3.5" + }, + { + "name": "vm_service", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/vm_service-15.0.0", + "packageUri": "lib/", + "languageVersion": "3.3" + }, + { + "name": "watcher", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/watcher-1.1.1", + "packageUri": "lib/", + "languageVersion": "3.1" + }, + { + "name": "web", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/web-1.1.0", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "web_socket", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/web_socket-0.1.6", + "packageUri": "lib/", + "languageVersion": "3.3" + }, + { + "name": "web_socket_channel", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/web_socket_channel-3.0.1", + "packageUri": "lib/", + "languageVersion": "3.3" + }, + { + "name": "webkit_inspection_protocol", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/webkit_inspection_protocol-1.2.1", + "packageUri": "lib/", + "languageVersion": "3.0" + }, + { + "name": "yaml", + "rootUri": "file:///Users/fabian/.puro/shared/pub_cache/hosted/pub.dev/yaml-3.1.3", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "hello", "rootUri": "../", "packageUri": "lib/", "languageVersion": "3.6" } ], - "generated": "2025-01-17T14:56:26.255979Z", + "generated": "2025-01-17T19:28:00.403390Z", "generator": "pub", "generatorVersion": "3.6.0", "pubCache": "file:///Users/fabian/.puro/shared/pub_cache" diff --git a/template/dart/function/.gitignore b/template/dart/.gitignore similarity index 100% rename from template/dart/function/.gitignore rename to template/dart/.gitignore diff --git a/template/dart/CHANGELOG.md b/template/dart/CHANGELOG.md index e69de29..effe43c 100644 --- a/template/dart/CHANGELOG.md +++ b/template/dart/CHANGELOG.md @@ -0,0 +1,3 @@ +## 1.0.0 + +- Initial version. diff --git a/template/dart/Dockerfile b/template/dart/Dockerfile index 669246c..a9aca84 100644 --- a/template/dart/Dockerfile +++ b/template/dart/Dockerfile @@ -13,29 +13,47 @@ RUN apt-get update -qy \ COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog RUN chmod +x /usr/bin/fwatchdog -# Add non root user -RUN addgroup --system app && adduser --system --group app -RUN mkdir -p /home/app +# # Add non root user +# RUN addgroup --system app && adduser --system --group app +# RUN mkdir -p /home/app -WORKDIR /home/app -COPY bin /home/app/bin -COPY pubspec.yaml . -RUN chown -R app /home/app +# WORKDIR /home/app +# COPY bin /home/app/bin +# COPY pubspec.yaml . +# RUN chown -R app /home/app -COPY function function +# COPY function function -RUN pub get -RUN pub get --offline +# RUN pub get +# RUN pub get --offline -WORKDIR /home/app/function/ +# WORKDIR /home/app/function/ -RUN pub get && pub get --offline +# RUN pub get && pub get --offline -RUN chown -R app /home/app +# RUN chown -R app /home/app -USER app +# USER app -ENV fprocess="dart /home/app/bin/main.dart" +# Resolve app dependencies. +WORKDIR /app +COPY pubspec.* ./ +RUN dart pub get + +# Copy app source code and AOT compile it. +COPY . . +# Ensure packages are still up-to-date if anything has changed +RUN dart pub get --offline +RUN dart pub run build_runner build --delete-conflicting-outputs +RUN dart compile exe bin/server.dart -o bin/server + +# Build minimal serving image from AOT-compiled `/server` and required system +# libraries and configuration files stored in `/runtime/` from the build stage. +FROM scratch +COPY --from=build /runtime/ / +COPY --from=build /app/bin/server /app/bin/ + +ENV fprocess="/app/bin/server" EXPOSE 8080 HEALTHCHECK --interval=3s CMD [ -e /tmp/.lock ] || exit 1 diff --git a/template/dart/README.md b/template/dart/README.md index 9f527b0..3816eca 100644 --- a/template/dart/README.md +++ b/template/dart/README.md @@ -1 +1,2 @@ -# openfaas-dart-template \ No newline at end of file +A sample command-line application with an entrypoint in `bin/`, library code +in `lib/`, and example unit test in `test/`. diff --git a/template/dart/function/analysis_options.yaml b/template/dart/analysis_options.yaml similarity index 100% rename from template/dart/function/analysis_options.yaml rename to template/dart/analysis_options.yaml diff --git a/template/dart/bin/main.dart b/template/dart/bin/main.dart deleted file mode 100644 index 2fcdc98..0000000 --- a/template/dart/bin/main.dart +++ /dev/null @@ -1,23 +0,0 @@ -import 'package:function/handler.dart' as handler; -import 'dart:io'; -import 'dart:convert'; - -String streamReadAllSync(Stream> stream, - {Encoding encoding = systemEncoding}) { - final List input = []; - int byte; - - while ((byte = stdin.readByteSync()) != -1) input.add(byte); - - final String inputStr = encoding.decode(input); - - if (inputStr.isEmpty) return inputStr; - - // Manually trim the trailing newline added in the response string - return inputStr.substring(0, inputStr.length - 1); -} - -void main() async { - String input = streamReadAllSync(stdin); - print(handler.Handle(input)); -} diff --git a/template/dart/bin/server.dart b/template/dart/bin/server.dart new file mode 100644 index 0000000..4282f44 --- /dev/null +++ b/template/dart/bin/server.dart @@ -0,0 +1,28 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import 'package:functions_framework/serve.dart'; +import 'package:hello/functions.dart' as function_library; + +Future main(List args) async { + await serve(args, _nameToFunctionTarget); +} + +FunctionTarget? _nameToFunctionTarget(String name) => switch (name) { + 'function' => FunctionTarget.http( + function_library.function, + ), + _ => null + }; diff --git a/template/dart/function/CHANGELOG.md b/template/dart/function/CHANGELOG.md deleted file mode 100644 index effe43c..0000000 --- a/template/dart/function/CHANGELOG.md +++ /dev/null @@ -1,3 +0,0 @@ -## 1.0.0 - -- Initial version. diff --git a/template/dart/function/README.md b/template/dart/function/README.md deleted file mode 100644 index 3816eca..0000000 --- a/template/dart/function/README.md +++ /dev/null @@ -1,2 +0,0 @@ -A sample command-line application with an entrypoint in `bin/`, library code -in `lib/`, and example unit test in `test/`. diff --git a/template/dart/function/lib/handler.dart b/template/dart/function/lib/handler.dart deleted file mode 100644 index 64e0b5d..0000000 --- a/template/dart/function/lib/handler.dart +++ /dev/null @@ -1,3 +0,0 @@ -String Handle(String req) { - return req; -} diff --git a/template/dart/function/pubspec.lock b/template/dart/function/pubspec.lock deleted file mode 100644 index 8cb5d7d..0000000 --- a/template/dart/function/pubspec.lock +++ /dev/null @@ -1,402 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - _fe_analyzer_shared: - dependency: transitive - description: - name: _fe_analyzer_shared - sha256: "03f6da266a27a4538a69295ec142cb5717d7d4e5727b84658b63e1e1509bac9c" - url: "https://pub.dev" - source: hosted - version: "79.0.0" - _macros: - dependency: transitive - description: dart - source: sdk - version: "0.3.3" - analyzer: - dependency: transitive - description: - name: analyzer - sha256: c9040fc56483c22a5e04a9f6a251313118b1a3c42423770623128fa484115643 - url: "https://pub.dev" - source: hosted - version: "7.2.0" - args: - dependency: transitive - description: - name: args - sha256: bf9f5caeea8d8fe6721a9c358dd8a5c1947b27f1cfaa18b39c301273594919e6 - url: "https://pub.dev" - source: hosted - version: "2.6.0" - async: - dependency: transitive - description: - name: async - sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63 - url: "https://pub.dev" - source: hosted - version: "2.12.0" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" - url: "https://pub.dev" - source: hosted - version: "2.1.2" - collection: - dependency: transitive - description: - name: collection - sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" - url: "https://pub.dev" - source: hosted - version: "1.19.1" - convert: - dependency: transitive - description: - name: convert - sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 - url: "https://pub.dev" - source: hosted - version: "3.1.2" - coverage: - dependency: transitive - description: - name: coverage - sha256: e3493833ea012784c740e341952298f1cc77f1f01b1bbc3eb4eecf6984fb7f43 - url: "https://pub.dev" - source: hosted - version: "1.11.1" - crypto: - dependency: transitive - description: - name: crypto - sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" - url: "https://pub.dev" - source: hosted - version: "3.0.6" - file: - dependency: transitive - description: - name: file - sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 - url: "https://pub.dev" - source: hosted - version: "7.0.1" - frontend_server_client: - dependency: transitive - description: - name: frontend_server_client - sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 - url: "https://pub.dev" - source: hosted - version: "4.0.0" - glob: - dependency: transitive - description: - name: glob - sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" - url: "https://pub.dev" - source: hosted - version: "2.1.2" - http_multi_server: - dependency: transitive - description: - name: http_multi_server - sha256: aa6199f908078bb1c5efb8d8638d4ae191aac11b311132c3ef48ce352fb52ef8 - url: "https://pub.dev" - source: hosted - version: "3.2.2" - http_parser: - dependency: transitive - description: - name: http_parser - sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" - url: "https://pub.dev" - source: hosted - version: "4.1.2" - io: - dependency: transitive - description: - name: io - sha256: dfd5a80599cf0165756e3181807ed3e77daf6dd4137caaad72d0b7931597650b - url: "https://pub.dev" - source: hosted - version: "1.0.5" - js: - dependency: transitive - description: - name: js - sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf - url: "https://pub.dev" - source: hosted - version: "0.7.1" - lints: - dependency: "direct dev" - description: - name: lints - sha256: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7 - url: "https://pub.dev" - source: hosted - version: "5.1.1" - logging: - dependency: transitive - description: - name: logging - sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 - url: "https://pub.dev" - source: hosted - version: "1.3.0" - macros: - dependency: transitive - description: - name: macros - sha256: "1d9e801cd66f7ea3663c45fc708450db1fa57f988142c64289142c9b7ee80656" - url: "https://pub.dev" - source: hosted - version: "0.1.3-main.0" - matcher: - dependency: transitive - description: - name: matcher - sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 - url: "https://pub.dev" - source: hosted - version: "0.12.17" - meta: - dependency: transitive - description: - name: meta - sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c - url: "https://pub.dev" - source: hosted - version: "1.16.0" - mime: - dependency: transitive - description: - name: mime - sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" - url: "https://pub.dev" - source: hosted - version: "2.0.0" - node_preamble: - dependency: transitive - description: - name: node_preamble - sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" - url: "https://pub.dev" - source: hosted - version: "2.0.2" - package_config: - dependency: transitive - description: - name: package_config - sha256: "92d4488434b520a62570293fbd33bb556c7d49230791c1b4bbd973baf6d2dc67" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - path: - dependency: transitive - description: - name: path - sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" - url: "https://pub.dev" - source: hosted - version: "1.9.1" - pool: - dependency: transitive - description: - name: pool - sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" - url: "https://pub.dev" - source: hosted - version: "1.5.1" - pub_semver: - dependency: transitive - description: - name: pub_semver - sha256: "7b3cfbf654f3edd0c6298ecd5be782ce997ddf0e00531b9464b55245185bbbbd" - url: "https://pub.dev" - source: hosted - version: "2.1.5" - shelf: - dependency: transitive - description: - name: shelf - sha256: e7dd780a7ffb623c57850b33f43309312fc863fb6aa3d276a754bb299839ef12 - url: "https://pub.dev" - source: hosted - version: "1.4.2" - shelf_packages_handler: - dependency: transitive - description: - name: shelf_packages_handler - sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e" - url: "https://pub.dev" - source: hosted - version: "3.0.2" - shelf_static: - dependency: transitive - description: - name: shelf_static - sha256: c87c3875f91262785dade62d135760c2c69cb217ac759485334c5857ad89f6e3 - url: "https://pub.dev" - source: hosted - version: "1.1.3" - shelf_web_socket: - dependency: transitive - description: - name: shelf_web_socket - sha256: cc36c297b52866d203dbf9332263c94becc2fe0ceaa9681d07b6ef9807023b67 - url: "https://pub.dev" - source: hosted - version: "2.0.1" - source_map_stack_trace: - dependency: transitive - description: - name: source_map_stack_trace - sha256: c0713a43e323c3302c2abe2a1cc89aa057a387101ebd280371d6a6c9fa68516b - url: "https://pub.dev" - source: hosted - version: "2.1.2" - source_maps: - dependency: transitive - description: - name: source_maps - sha256: "190222579a448b03896e0ca6eca5998fa810fda630c1d65e2f78b3f638f54812" - url: "https://pub.dev" - source: hosted - version: "0.10.13" - source_span: - dependency: transitive - description: - name: source_span - sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" - url: "https://pub.dev" - source: hosted - version: "1.10.1" - stack_trace: - dependency: transitive - description: - name: stack_trace - sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" - url: "https://pub.dev" - source: hosted - version: "1.12.1" - stream_channel: - dependency: transitive - description: - name: stream_channel - sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" - url: "https://pub.dev" - source: hosted - version: "2.1.4" - string_scanner: - dependency: transitive - description: - name: string_scanner - sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" - url: "https://pub.dev" - source: hosted - version: "1.4.1" - term_glyph: - dependency: transitive - description: - name: term_glyph - sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" - url: "https://pub.dev" - source: hosted - version: "1.2.2" - test: - dependency: "direct dev" - description: - name: test - sha256: "8391fbe68d520daf2314121764d38e37f934c02fd7301ad18307bd93bd6b725d" - url: "https://pub.dev" - source: hosted - version: "1.25.14" - test_api: - dependency: transitive - description: - name: test_api - sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd - url: "https://pub.dev" - source: hosted - version: "0.7.4" - test_core: - dependency: transitive - description: - name: test_core - sha256: "84d17c3486c8dfdbe5e12a50c8ae176d15e2a771b96909a9442b40173649ccaa" - url: "https://pub.dev" - source: hosted - version: "0.6.8" - typed_data: - dependency: transitive - description: - name: typed_data - sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 - url: "https://pub.dev" - source: hosted - version: "1.4.0" - vm_service: - dependency: transitive - description: - name: vm_service - sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02 - url: "https://pub.dev" - source: hosted - version: "15.0.0" - watcher: - dependency: transitive - description: - name: watcher - sha256: "69da27e49efa56a15f8afe8f4438c4ec02eff0a117df1b22ea4aad194fe1c104" - url: "https://pub.dev" - source: hosted - version: "1.1.1" - web: - dependency: transitive - description: - name: web - sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb - url: "https://pub.dev" - source: hosted - version: "1.1.0" - web_socket: - dependency: transitive - description: - name: web_socket - sha256: "3c12d96c0c9a4eec095246debcea7b86c0324f22df69893d538fcc6f1b8cce83" - url: "https://pub.dev" - source: hosted - version: "0.1.6" - web_socket_channel: - dependency: transitive - description: - name: web_socket_channel - sha256: "9f187088ed104edd8662ca07af4b124465893caf063ba29758f97af57e61da8f" - url: "https://pub.dev" - source: hosted - version: "3.0.1" - webkit_inspection_protocol: - dependency: transitive - description: - name: webkit_inspection_protocol - sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572" - url: "https://pub.dev" - source: hosted - version: "1.2.1" - yaml: - dependency: transitive - description: - name: yaml - sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce - url: "https://pub.dev" - source: hosted - version: "3.1.3" -sdks: - dart: ">=3.6.0 <4.0.0" diff --git a/template/dart/function/pubspec.yaml b/template/dart/function/pubspec.yaml deleted file mode 100644 index 21c246c..0000000 --- a/template/dart/function/pubspec.yaml +++ /dev/null @@ -1,15 +0,0 @@ -name: function -description: A sample command-line application. -version: 1.0.0 -# repository: https://github.com/my_org/my_repo - -environment: - sdk: ^3.6.0 - -# Add regular dependencies here. -dependencies: - # path: ^1.8.0 - -dev_dependencies: - lints: ^5.0.0 - test: ^1.24.0 diff --git a/template/dart/lib/functions.dart b/template/dart/lib/functions.dart new file mode 100644 index 0000000..8bef26b --- /dev/null +++ b/template/dart/lib/functions.dart @@ -0,0 +1,5 @@ +import 'package:functions_framework/functions_framework.dart'; +import 'package:shelf/shelf.dart'; + +@CloudFunction() +Response function(Request request) => Response.ok('Hello, World!'); diff --git a/template/dart/pubspec.lock b/template/dart/pubspec.lock index ebcf15f..5ae6ef1 100644 --- a/template/dart/pubspec.lock +++ b/template/dart/pubspec.lock @@ -1,12 +1,602 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: - function: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: "16e298750b6d0af7ce8a3ba7c18c69c3785d11b15ec83f6dcd0ad2a0009b3cab" + url: "https://pub.dev" + source: hosted + version: "76.0.0" + _macros: + dependency: transitive + description: dart + source: sdk + version: "0.3.3" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: "1f14db053a8c23e260789e9b0980fa27f2680dd640932cae5e1137cce0e46e1e" + url: "https://pub.dev" + source: hosted + version: "6.11.0" + args: + dependency: transitive + description: + name: args + sha256: bf9f5caeea8d8fe6721a9c358dd8a5c1947b27f1cfaa18b39c301273594919e6 + url: "https://pub.dev" + source: hosted + version: "2.6.0" + async: + dependency: transitive + description: + name: async + sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63 + url: "https://pub.dev" + source: hosted + version: "2.12.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + build: + dependency: transitive + description: + name: build + sha256: cef23f1eda9b57566c81e2133d196f8e3df48f244b317368d65c5943d91148f0 + url: "https://pub.dev" + source: hosted + version: "2.4.2" + build_config: + dependency: transitive + description: + name: build_config + sha256: "4ae2de3e1e67ea270081eaee972e1bd8f027d459f249e0f1186730784c2e7e33" + url: "https://pub.dev" + source: hosted + version: "1.1.2" + build_daemon: + dependency: transitive + description: + name: build_daemon + sha256: "294a2edaf4814a378725bfe6358210196f5ea37af89ecd81bfa32960113d4948" + url: "https://pub.dev" + source: hosted + version: "4.0.3" + build_resolvers: + dependency: transitive + description: + name: build_resolvers + sha256: "99d3980049739a985cf9b21f30881f46db3ebc62c5b8d5e60e27440876b1ba1e" + url: "https://pub.dev" + source: hosted + version: "2.4.3" + build_runner: + dependency: "direct dev" + description: + name: build_runner + sha256: "74691599a5bc750dc96a6b4bfd48f7d9d66453eab04c7f4063134800d6a5c573" + url: "https://pub.dev" + source: hosted + version: "2.4.14" + build_runner_core: + dependency: transitive + description: + name: build_runner_core + sha256: "22e3aa1c80e0ada3722fe5b63fd43d9c8990759d0a2cf489c8c5d7b2bdebc021" + url: "https://pub.dev" + source: hosted + version: "8.0.0" + built_collection: + dependency: transitive + description: + name: built_collection + sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" + url: "https://pub.dev" + source: hosted + version: "5.1.1" + built_value: + dependency: transitive + description: + name: built_value + sha256: "28a712df2576b63c6c005c465989a348604960c0958d28be5303ba9baa841ac2" + url: "https://pub.dev" + source: hosted + version: "8.9.3" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff + url: "https://pub.dev" + source: hosted + version: "2.0.3" + code_builder: + dependency: transitive + description: + name: code_builder + sha256: "0ec10bf4a89e4c613960bf1e8b42c64127021740fb21640c29c909826a5eea3e" + url: "https://pub.dev" + source: hosted + version: "4.10.1" + collection: + dependency: transitive + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + convert: + dependency: transitive + description: + name: convert + sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 + url: "https://pub.dev" + source: hosted + version: "3.1.2" + coverage: + dependency: transitive + description: + name: coverage + sha256: e3493833ea012784c740e341952298f1cc77f1f01b1bbc3eb4eecf6984fb7f43 + url: "https://pub.dev" + source: hosted + version: "1.11.1" + crypto: + dependency: transitive + description: + name: crypto + sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" + url: "https://pub.dev" + source: hosted + version: "3.0.6" + dart_flutter_team_lints: + dependency: "direct dev" + description: + name: dart_flutter_team_lints + sha256: c6c9c89f4038a64063b67166b2d291d19697a73e111afa42ddcf1840c410c08e + url: "https://pub.dev" + source: hosted + version: "3.2.1" + dart_style: + dependency: transitive + description: + name: dart_style + sha256: "7856d364b589d1f08986e140938578ed36ed948581fbc3bc9aef1805039ac5ab" + url: "https://pub.dev" + source: hosted + version: "2.3.7" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.dev" + source: hosted + version: "7.0.1" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + url: "https://pub.dev" + source: hosted + version: "1.1.1" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 + url: "https://pub.dev" + source: hosted + version: "4.0.0" + functions_framework: dependency: "direct main" description: - path: function - relative: true - source: path - version: "1.0.0" + name: functions_framework + sha256: e40725fd249690d97319a2e96a0ef82f0510dffc6c99e22a0ebde4a26bddd7a9 + url: "https://pub.dev" + source: hosted + version: "0.4.3+1" + functions_framework_builder: + dependency: "direct dev" + description: + name: functions_framework_builder + sha256: dfd788517985a7e7f85deeb824128a067a2427592cb7f6a2ec49e17bdbfe4d96 + url: "https://pub.dev" + source: hosted + version: "0.4.10" + glob: + dependency: transitive + description: + name: glob + sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + google_cloud: + dependency: transitive + description: + name: google_cloud + sha256: "2fa5d1adf3939ac6e7130ae84de40727efea9d0e08db2e3d7fea3b8b432d741c" + url: "https://pub.dev" + source: hosted + version: "0.2.0" + graphs: + dependency: transitive + description: + name: graphs + sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + http: + dependency: "direct dev" + description: + name: http + sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010 + url: "https://pub.dev" + source: hosted + version: "1.2.2" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + sha256: aa6199f908078bb1c5efb8d8638d4ae191aac11b311132c3ef48ce352fb52ef8 + url: "https://pub.dev" + source: hosted + version: "3.2.2" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" + url: "https://pub.dev" + source: hosted + version: "4.1.2" + io: + dependency: transitive + description: + name: io + sha256: dfd5a80599cf0165756e3181807ed3e77daf6dd4137caaad72d0b7931597650b + url: "https://pub.dev" + source: hosted + version: "1.0.5" + js: + dependency: transitive + description: + name: js + sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf + url: "https://pub.dev" + source: hosted + version: "0.7.1" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" + url: "https://pub.dev" + source: hosted + version: "4.9.0" + lints: + dependency: transitive + description: + name: lints + sha256: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7 + url: "https://pub.dev" + source: hosted + version: "5.1.1" + logging: + dependency: transitive + description: + name: logging + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + url: "https://pub.dev" + source: hosted + version: "1.3.0" + macros: + dependency: transitive + description: + name: macros + sha256: "1d9e801cd66f7ea3663c45fc708450db1fa57f988142c64289142c9b7ee80656" + url: "https://pub.dev" + source: hosted + version: "0.1.3-main.0" + matcher: + dependency: transitive + description: + name: matcher + sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 + url: "https://pub.dev" + source: hosted + version: "0.12.17" + meta: + dependency: transitive + description: + name: meta + sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c + url: "https://pub.dev" + source: hosted + version: "1.16.0" + mime: + dependency: transitive + description: + name: mime + sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" + url: "https://pub.dev" + source: hosted + version: "2.0.0" + node_preamble: + dependency: transitive + description: + name: node_preamble + sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + package_config: + dependency: transitive + description: + name: package_config + sha256: "92d4488434b520a62570293fbd33bb556c7d49230791c1b4bbd973baf6d2dc67" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + path: + dependency: transitive + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + pool: + dependency: transitive + description: + name: pool + sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" + url: "https://pub.dev" + source: hosted + version: "1.5.1" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "7b3cfbf654f3edd0c6298ecd5be782ce997ddf0e00531b9464b55245185bbbbd" + url: "https://pub.dev" + source: hosted + version: "2.1.5" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + sha256: "0560ba233314abbed0a48a2956f7f022cce7c3e1e73df540277da7544cad4082" + url: "https://pub.dev" + source: hosted + version: "1.5.0" + shelf: + dependency: "direct main" + description: + name: shelf + sha256: e7dd780a7ffb623c57850b33f43309312fc863fb6aa3d276a754bb299839ef12 + url: "https://pub.dev" + source: hosted + version: "1.4.2" + shelf_packages_handler: + dependency: transitive + description: + name: shelf_packages_handler + sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + shelf_static: + dependency: transitive + description: + name: shelf_static + sha256: c87c3875f91262785dade62d135760c2c69cb217ac759485334c5857ad89f6e3 + url: "https://pub.dev" + source: hosted + version: "1.1.3" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + sha256: cc36c297b52866d203dbf9332263c94becc2fe0ceaa9681d07b6ef9807023b67 + url: "https://pub.dev" + source: hosted + version: "2.0.1" + source_gen: + dependency: transitive + description: + name: source_gen + sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832" + url: "https://pub.dev" + source: hosted + version: "1.5.0" + source_helper: + dependency: transitive + description: + name: source_helper + sha256: "86d247119aedce8e63f4751bd9626fc9613255935558447569ad42f9f5b48b3c" + url: "https://pub.dev" + source: hosted + version: "1.3.5" + source_map_stack_trace: + dependency: transitive + description: + name: source_map_stack_trace + sha256: c0713a43e323c3302c2abe2a1cc89aa057a387101ebd280371d6a6c9fa68516b + url: "https://pub.dev" + source: hosted + version: "2.1.2" + source_maps: + dependency: transitive + description: + name: source_maps + sha256: "190222579a448b03896e0ca6eca5998fa810fda630c1d65e2f78b3f638f54812" + url: "https://pub.dev" + source: hosted + version: "0.10.13" + source_span: + dependency: transitive + description: + name: source_span + sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" + url: "https://pub.dev" + source: hosted + version: "1.10.1" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" + url: "https://pub.dev" + source: hosted + version: "1.12.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: ad47125e588cfd37a9a7f86c7d6356dde8dfe89d071d293f80ca9e9273a33871 + url: "https://pub.dev" + source: hosted + version: "2.1.1" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + test: + dependency: "direct dev" + description: + name: test + sha256: "8391fbe68d520daf2314121764d38e37f934c02fd7301ad18307bd93bd6b725d" + url: "https://pub.dev" + source: hosted + version: "1.25.14" + test_api: + dependency: transitive + description: + name: test_api + sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd + url: "https://pub.dev" + source: hosted + version: "0.7.4" + test_core: + dependency: transitive + description: + name: test_core + sha256: "84d17c3486c8dfdbe5e12a50c8ae176d15e2a771b96909a9442b40173649ccaa" + url: "https://pub.dev" + source: hosted + version: "0.6.8" + test_process: + dependency: "direct dev" + description: + name: test_process + sha256: ea79c090deffc87d8276a5d28bb498d080a9873be6b1074d9dcfb82eb87e138e + url: "https://pub.dev" + source: hosted + version: "2.1.1" + timing: + dependency: transitive + description: + name: timing + sha256: "62ee18aca144e4a9f29d212f5a4c6a053be252b895ab14b5821996cff4ed90fe" + url: "https://pub.dev" + source: hosted + version: "1.0.2" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02 + url: "https://pub.dev" + source: hosted + version: "15.0.0" + watcher: + dependency: transitive + description: + name: watcher + sha256: "69da27e49efa56a15f8afe8f4438c4ec02eff0a117df1b22ea4aad194fe1c104" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + web: + dependency: transitive + description: + name: web + sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb + url: "https://pub.dev" + source: hosted + version: "1.1.0" + web_socket: + dependency: transitive + description: + name: web_socket + sha256: "3c12d96c0c9a4eec095246debcea7b86c0324f22df69893d538fcc6f1b8cce83" + url: "https://pub.dev" + source: hosted + version: "0.1.6" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + sha256: "9f187088ed104edd8662ca07af4b124465893caf063ba29758f97af57e61da8f" + url: "https://pub.dev" + source: hosted + version: "3.0.1" + webkit_inspection_protocol: + dependency: transitive + description: + name: webkit_inspection_protocol + sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572" + url: "https://pub.dev" + source: hosted + version: "1.2.1" + yaml: + dependency: transitive + description: + name: yaml + sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce + url: "https://pub.dev" + source: hosted + version: "3.1.3" sdks: dart: ">=3.6.0 <4.0.0" diff --git a/template/dart/pubspec.yaml b/template/dart/pubspec.yaml index b86b684..f0c4aa3 100644 --- a/template/dart/pubspec.yaml +++ b/template/dart/pubspec.yaml @@ -1,15 +1,19 @@ -name: openfaas_dart_template -description: An OpenFaaS template for writing functions in Dart. -version: 0.0.1 -# repository: https://github.com/my_org/my_repo -publish_to: 'none' +name: hello +description: A sample command-line application. +version: 1.0.0 +publish_to: none environment: sdk: ^3.6.0 dependencies: - function: - path: ./function + functions_framework: ^0.4.0 + shelf: ^1.0.0 -executables: - dart-faas-function: main \ No newline at end of file +dev_dependencies: + build_runner: ^2.0.0 + dart_flutter_team_lints: ^3.0.0 + functions_framework_builder: ^0.4.1 + http: ^1.0.0 + test: ^1.16.6 + test_process: ^2.0.0 diff --git a/template/dart/test/hello_test.dart b/template/dart/test/hello_test.dart new file mode 100644 index 0000000..2ce5d26 --- /dev/null +++ b/template/dart/test/hello_test.dart @@ -0,0 +1,35 @@ +import 'dart:io'; + +import 'package:http/http.dart'; +import 'package:test/test.dart'; +import 'package:test_process/test_process.dart'; + +const defaultTimeout = Timeout(Duration(seconds: 3)); + +void main() { + test('defaults', timeout: defaultTimeout, () async { + final proc = await TestProcess.start('dart', ['bin/server.dart']); + + await expectLater( + proc.stdout, + emitsThrough('Listening on :8080'), + ); + + final response = await get(Uri.parse('http://localhost:8080')); + expect(response.statusCode, 200); + expect(response.body, 'Hello, World!'); + + await expectLater( + proc.stdout, + emitsThrough(endsWith('GET [200] /')), + ); + + proc.signal(ProcessSignal.sigterm); + await proc.shouldExit(0); + + await expectLater( + proc.stdout, + emitsThrough('Received signal SIGTERM - closing'), + ); + }); +}