From e84740fa995ecb4cd9de25291a00b9942b8107a7 Mon Sep 17 00:00:00 2001 From: danylo-safonov-solid Date: Fri, 15 Sep 2023 21:36:00 +0300 Subject: [PATCH 1/3] init --- {tools/add_imports/bin => bin}/add_imports.dart | 7 +++++-- .../lib/src => lib/src/add_imports}/args.dart | 3 +++ .../lib/src => lib/src/add_imports}/config.dart | 3 +++ pubspec.yaml | 7 ++++++- tools/add_imports/.gitignore | 1 - tools/add_imports/analysis_options.yaml | 8 -------- tools/add_imports/pubspec.yaml | 14 -------------- 7 files changed, 17 insertions(+), 26 deletions(-) rename {tools/add_imports/bin => bin}/add_imports.dart (86%) rename {tools/add_imports/lib/src => lib/src/add_imports}/args.dart (86%) rename {tools/add_imports/lib/src => lib/src/add_imports}/config.dart (91%) delete mode 100644 tools/add_imports/.gitignore delete mode 100644 tools/add_imports/analysis_options.yaml delete mode 100644 tools/add_imports/pubspec.yaml diff --git a/tools/add_imports/bin/add_imports.dart b/bin/add_imports.dart similarity index 86% rename from tools/add_imports/bin/add_imports.dart rename to bin/add_imports.dart index 44dfbdb..1f8f8fe 100644 --- a/tools/add_imports/bin/add_imports.dart +++ b/bin/add_imports.dart @@ -1,9 +1,12 @@ +// This is a CLI tool so it is okay here. +// ignore_for_file: avoid_print + import 'dart:io'; -import 'package:add_imports/src/args.dart'; -import 'package:add_imports/src/config.dart'; import 'package:args/args.dart'; import 'package:collection/collection.dart'; +import 'package:deno_postgres_interop/src/add_imports/args.dart'; +import 'package:deno_postgres_interop/src/add_imports/config.dart'; import 'package:yaml/yaml.dart'; void main(List arguments) { diff --git a/tools/add_imports/lib/src/args.dart b/lib/src/add_imports/args.dart similarity index 86% rename from tools/add_imports/lib/src/args.dart rename to lib/src/add_imports/args.dart index 840274b..026631a 100644 --- a/tools/add_imports/lib/src/args.dart +++ b/lib/src/add_imports/args.dart @@ -1,3 +1,6 @@ +// This is an internal implementation so it is okay here. +// ignore_for_file: public_member_api_docs + import 'package:args/args.dart'; class Args { diff --git a/tools/add_imports/lib/src/config.dart b/lib/src/add_imports/config.dart similarity index 91% rename from tools/add_imports/lib/src/config.dart rename to lib/src/add_imports/config.dart index 95f09fc..1146c91 100644 --- a/tools/add_imports/lib/src/config.dart +++ b/lib/src/add_imports/config.dart @@ -1,3 +1,6 @@ +// This is an internal implementation so it is okay here. +// ignore_for_file: public_member_api_docs + import 'package:collection/collection.dart'; import 'package:yaml/yaml.dart'; diff --git a/pubspec.yaml b/pubspec.yaml index 27cc4a1..80d1838 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -8,5 +8,10 @@ environment: # Tested with 3.0.6, but others should work too sdk: '>=3.0.0 <3.1.0' +dependencies: + args: ^2.4.2 + collection: ^1.18.0 + yaml: ^3.1.2 + dev_dependencies: - solid_lints: 0.0.19 + solid_lints: ^0.0.19 diff --git a/tools/add_imports/.gitignore b/tools/add_imports/.gitignore deleted file mode 100644 index cb3e7cf..0000000 --- a/tools/add_imports/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.dart_tool/ diff --git a/tools/add_imports/analysis_options.yaml b/tools/add_imports/analysis_options.yaml deleted file mode 100644 index e79270d..0000000 --- a/tools/add_imports/analysis_options.yaml +++ /dev/null @@ -1,8 +0,0 @@ -include: package:solid_lints/analysis_options.yaml - -linter: - rules: - prefer_foreach: true - prefer_single_quotes: true - public_member_api_docs: false - avoid_print: false diff --git a/tools/add_imports/pubspec.yaml b/tools/add_imports/pubspec.yaml deleted file mode 100644 index a69e3c3..0000000 --- a/tools/add_imports/pubspec.yaml +++ /dev/null @@ -1,14 +0,0 @@ -name: add_imports -description: add_imports. -version: 1.0.0 - -environment: - sdk: ^3.0.0 - -dependencies: - args: ^2.4.2 - collection: ^1.18.0 - yaml: ^3.1.2 - -dev_dependencies: - solid_lints: ^0.0.19 From bb3269d5ab85c043412bf7ad11efe81782491347 Mon Sep 17 00:00:00 2001 From: danylo-safonov-solid Date: Fri, 15 Sep 2023 21:41:25 +0300 Subject: [PATCH 2/3] upd script --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 05204a5..60320a8 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ The main scenario is Supabase Edge Functions, but it should also work for other 4. Add imports to generated file by calling the script: ```bash - dart run tools/add_imports/bin/add_imports.dart + dart run deno_postgres_interop:add_imports \ --filename=example/functions/dart_edge/main.dart.js ``` Note: your filename may differ from the example From f7ae41b07aaffa71e025e25b01f299e4508787eb Mon Sep 17 00:00:00 2001 From: danylo-safonov-solid Date: Fri, 15 Sep 2023 22:03:52 +0300 Subject: [PATCH 3/3] fix action --- .github/workflows/on-pr-push-code-check.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/on-pr-push-code-check.yml b/.github/workflows/on-pr-push-code-check.yml index 194db84..7b4d864 100644 --- a/.github/workflows/on-pr-push-code-check.yml +++ b/.github/workflows/on-pr-push-code-check.yml @@ -15,7 +15,7 @@ jobs: id: check_files uses: andstor/file-existence-action@v1 with: - files: 'pubspec.yaml, tools/add_imports/pubspec.yaml' + files: 'pubspec.yaml' - name: Early exit if: steps.check_files.outputs.files_exists == 'false' @@ -34,10 +34,6 @@ jobs: - name: Get main dependencies run: dart pub get - - name: Get add_imports dependencies - run: dart pub get - working-directory: tools/add_imports - - name: Run static code analysis uses: invertase/github-action-dart-analyzer@v1 with: