Skip to content

Commit 5802260

Browse files
authored
faet: full repo clean-up and reorganisation in preparation for alpha release (#27)
* fix: general repo cleanup * chore: repo clean-up and reorganisation
1 parent ead9549 commit 5802260

File tree

300 files changed

+1495
-1293
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

300 files changed

+1495
-1293
lines changed

.fvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"flutter": "3.16.9"
2+
"flutter": "stable"
33
}

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,4 @@ pubspec_overrides.yaml
3333
# FVM Version Cache
3434
.fvm/
3535

36-
packages/clerk_auth/.env.test
3736
packages/clerk_flutter/widgetbook/.env

melos.yaml

+27-3
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,41 @@ name: clerk_sdk
22

33
packages:
44
- packages/**
5-
- packages/clerk_flutter/widgetbook
65

76
ide:
87
intellij:
98
enabled: true
109
moduleNamePrefix: ''
1110

1211
scripts:
12+
# Clean all packages
13+
clean:
14+
name: Clean all
15+
description: Run flutter clean in all packages
16+
run: melos exec -- flutter clean
17+
18+
# Pub get all packages
19+
get:
20+
name: Get all
21+
description: Run pub get in all packages
22+
run: melos exec -o -- dart pub get
23+
24+
# Pub upgrade all packages
25+
upgrade:
26+
name: Upgrade all
27+
description: Run pub upgrade in all packages
28+
run: melos exec -o -- dart pub upgrade
29+
30+
# Build runner (code generation)
1331
brunner:
14-
run: melos exec --fail-fast -c 1 --depends-on="build_runner" -- dart run build_runner build --delete-conflicting-outputs
32+
run: melos exec -o -- dart run build_runner build --delete-conflicting-outputs
33+
packageFilters:
34+
scope: "clerk_auth"
35+
36+
# Format code
1537
format:
16-
run: melos exec --fail-fast -c 1 -- dart format --line-length=100 --output=none .
38+
run: melos exec -- dart format MELOS_PACKAGE_PATH --line-length=100
39+
40+
# Run build and format code
1741
brunner_format:
1842
run: melos brunner && melos format

packages/clerk_analysis/.gitignore

-7
This file was deleted.

packages/clerk_analysis/LICENSE

-21
This file was deleted.

packages/clerk_analysis/README.md

-4
This file was deleted.

packages/clerk_analysis/pubspec.yaml

-10
This file was deleted.

packages/clerk_auth/.gitignore

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
1+
# IntelliJ related
2+
*.iml
3+
*.ipr
4+
*.iws
5+
.idea/
6+
7+
# The .vscode folder contains launch configuration and tasks you configure in
8+
# VS Code which you may wish to be included in version control, so this line
9+
# is commented out by default.
10+
.vscode/
11+
112
# https://dart.dev/guides/libraries/private-files
213
# Created by `dart pub`
314
.dart_tool/
15+
build/
416

517
# Avoid committing pubspec.lock for library packages; see
618
# https://dart.dev/guides/libraries/private-files#pubspeclock.
719
pubspec.lock
8-
/.env.test
20+
.env.test
21+
22+
# Flutter auto-generated files
23+
.flutter-plugins
24+
.flutter-plugins-dependencies

packages/clerk_auth/CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 0.0.1
2+
3+
- Pre-alpha version.

packages/clerk_auth/LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 Clerk
3+
Copyright (c) 2024 Clerk
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
+23-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,23 @@
1-
include: package:clerk_analysis/lints.yaml
1+
include: package:lints/recommended.yaml
2+
3+
# analyzer:
4+
# exclude:
5+
# - path/to/excluded/files/**
6+
7+
linter:
8+
rules:
9+
- avoid_print
10+
- avoid_unnecessary_containers
11+
- avoid_web_libraries_in_flutter
12+
- no_logic_in_create_state
13+
# - public_member_api_docs
14+
- prefer_const_constructors
15+
- prefer_const_constructors_in_immutables
16+
- prefer_const_declarations
17+
- prefer_const_literals_to_create_immutables
18+
- sized_box_for_whitespace
19+
- sort_constructors_first
20+
- sort_child_properties_last
21+
- use_build_context_synchronously
22+
- use_full_hex_values_for_flutter_colors
23+
- use_key_in_widget_constructors

packages/clerk_auth/build.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
targets:
2+
$default:
3+
sources:
4+
exclude:
5+
- test/**
6+
builders:
7+
# See https://pub.dev/packages/json_serializable
8+
json_serializable:
9+
options:
10+
explicit_to_json: true
11+
field_rename: snake
12+
include_if_null: false

packages/clerk_auth/build/native_assets/macos/native_assets.yaml

-5
This file was deleted.
Binary file not shown.

packages/clerk_auth/build/unit_test_assets/AssetManifest.json

-1
This file was deleted.

packages/clerk_auth/build/unit_test_assets/FontManifest.json

-1
This file was deleted.
Binary file not shown.
Binary file not shown.

packages/clerk_auth/example/clerk_auth_example.dart

-3
This file was deleted.

packages/clerk_auth/lib/clerk_api/clerk_api.dart

-4
This file was deleted.
+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
/// Package that will allow you to authenticate and use Clerk from Dart code.
22
library clerk_auth;
33

4-
export 'clerk_auth/clerk_auth.dart';
5-
export 'models/models.dart';
4+
export 'src/clerk_api/api.dart';
5+
export 'src/clerk_auth/auth.dart';
6+
export 'src/models/models.dart';
7+
export 'src/utils/extensions.dart';
8+
export 'src/utils/logging.dart';

packages/clerk_auth/lib/clerk_auth/clerk_auth.dart

-6
This file was deleted.

packages/clerk_auth/lib/models/environment/env.dart

-19
This file was deleted.

packages/clerk_auth/lib/clerk_api/api.dart packages/clerk_auth/lib/src/clerk_api/api.dart

+8-8
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@ import 'dart:async';
22
import 'dart:convert';
33
import 'dart:io' show HttpStatus, HttpHeaders;
44

5-
import 'package:clerk_auth/clerk_api/token_cache.dart';
5+
import 'package:clerk_auth/src/clerk_api/token_cache.dart';
66
import 'package:clerk_auth/clerk_auth.dart';
7-
import 'package:common/common.dart';
87
import 'package:http/http.dart' as http;
98

10-
class Api with Logging {
11-
static final _caches = <String, Api>{};
9+
export 'package:clerk_auth/src/models/models.dart';
1210

11+
class Api with Logging {
1312
Api._(this._tokenCache, this._domain, this._client);
1413

1514
factory Api({
@@ -28,6 +27,8 @@ class Api with Logging {
2827
final String _domain;
2928
final HttpClient _client;
3029

30+
static final _caches = <String, Api>{};
31+
3132
static const _scheme = 'https';
3233
static const _kJwtKey = 'jwt';
3334
static const _kIsNative = '_is_native';
@@ -36,7 +37,6 @@ class Api with Logging {
3637
static const _kErrorsKey = 'errors';
3738
static const _kClientKey = 'client';
3839
static const _kResponseKey = 'response';
39-
static const _kDataKey = 'data';
4040

4141
// environment & client
4242

@@ -63,6 +63,7 @@ class Api with Logging {
6363
}
6464

6565
Future<Client> createClient() => _fetchClient(method: HttpMethod.post);
66+
6667
Future<Client> currentClient() => _fetchClient(method: HttpMethod.get);
6768

6869
// Sign out / delete user
@@ -260,7 +261,7 @@ class Api with Logging {
260261
}) async {
261262
final factor = signIn.factorFor(strategy, stage);
262263
if (factor is! Factor) {
263-
return ApiResponse(status: HttpStatus.badRequest);
264+
return const ApiResponse(status: HttpStatus.badRequest);
264265
}
265266

266267
return _fetchApiResponse(
@@ -395,7 +396,6 @@ class Api with Logging {
395396
return ApiResponse(status: resp.statusCode, errors: errors);
396397
}
397398
} catch (error, stacktrace) {
398-
print('ERROR: $error');
399399
logSevere('Error during fetch', error, stacktrace);
400400
return ApiResponse(
401401
status: HttpStatus.internalServerError,
@@ -460,7 +460,7 @@ class Api with Logging {
460460
static String deriveDomainFrom(String key) {
461461
final domainStartPosition = key.lastIndexOf('_') + 1;
462462
if (domainStartPosition < 1) {
463-
throw FormatException('Public key not in correct format');
463+
throw const FormatException('Public key not in correct format');
464464
}
465465

466466
// base64 requires quad-byte aligned strings, but the string that comes from Clerk

packages/clerk_auth/lib/clerk_api/token_cache.dart packages/clerk_auth/lib/src/clerk_api/token_cache.dart

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@ import 'package:http/http.dart' as http;
66
import 'package:logger/logger.dart';
77

88
class TokenCache {
9-
static const _tokenExpiryBuffer = Duration(seconds: 10);
9+
TokenCache(this.publicKey, this.persistor);
1010

1111
final String publicKey;
1212
final Persistor? persistor;
13+
14+
static const _tokenExpiryBuffer = Duration(seconds: 10);
15+
1316
final logger = Logger();
1417
late final RSAPublicKey rsaKey = RSAPublicKey(publicKey);
1518

16-
TokenCache(this.publicKey, this.persistor);
17-
1819
bool get canRefreshSessionToken => clientToken.isNotEmpty && sessionId.isNotEmpty;
1920

2021
String _sessionId = '';

0 commit comments

Comments
 (0)