Skip to content

Commit

Permalink
feat: add tekartik_common_build
Browse files Browse the repository at this point in the history
  • Loading branch information
alextekartik committed Oct 4, 2024
1 parent 14aec53 commit 24b83da
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/common_build/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# (the recommended set includes the core lints).
# The core lints are also what is used by pub.dev for scoring packages.

include: package:lints/recommended.yaml
include: package:tekartik_lints/package.yaml

# Uncomment the following section to specify additional rules.

Expand Down
1 change: 1 addition & 0 deletions packages/common_build/lib/common_app_builder.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export 'src/common_app_builder.dart' show CommonAppBuilder, CommonAppBuilderExt;
15 changes: 15 additions & 0 deletions packages/common_build/lib/src/common_app_builder.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import 'package:tekartik_common_build/version_io.dart' as version_io;

/// Common app builder
abstract class CommonAppBuilder {
/// Path
String get path;
}

/// Common app builder extension
extension CommonAppBuilderExt on CommonAppBuilder {
/// Generate the version
Future<void> generateVersion() async {
await version_io.generateVersion(path: path);
}
}
1 change: 1 addition & 0 deletions packages/common_build/lib/src/version_io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:path/path.dart';
import 'package:process_run/shell.dart';
import 'package:process_run/stdio.dart';

/// Generate lib/src/version.dart with a text
Future<void> generateVersion({String path = '.'}) async {
var pubspecYamlMap = await pathGetPubspecYamlMap(path);

Expand Down
7 changes: 6 additions & 1 deletion packages/common_build/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@ environment:

# Add regular dependencies here.
dependencies:
dev_build: '>=1.0.0'
dev_build: '>=1.0.0+14'
process_run: '>=1.2.0'
path: '>=1.8.0'

dev_dependencies:
lints: '>=4.0.0'
tekartik_lints:
git:
url: https://github.com/tekartik/common.dart
ref: dart3a
path: packages/lints
test: '>=1.24.0'
5 changes: 0 additions & 5 deletions packages/firebase_build/lib/src/app_build.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'package:process_run/shell.dart';
import 'package:tekartik_flutter_build/app_build.dart';

import 'firebase_deploy.dart';
import 'package:tekartik_common_build/version_io.dart' as version_io;

/// Build a web app
Future<void> flutterWebAppBuild(String directory) async {
Expand Down Expand Up @@ -103,10 +102,6 @@ class FlutterFirebaseWebAppBuilder {
await flutterWebAppClean(options.path);
}

Future<void> generateVersion() async {
await version_io.generateVersion(path: options.path);
}

Future<void> serve({FirebaseWebAppActionController? controller}) async {
await firebaseWebAppServe(options.path, options.deployOptions,
controller: controller);
Expand Down
1 change: 1 addition & 0 deletions packages/flutter_build/lib/app_build.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export 'package:tekartik_common_build/common_app_builder.dart';
export 'src/app_build.dart'
show
flutterWebAppClean,
Expand Down
4 changes: 3 additions & 1 deletion packages/flutter_build/lib/src/app_build.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:dev_build/build_support.dart';
import 'package:path/path.dart';
import 'package:process_run/shell.dart';
import 'package:process_run/stdio.dart';
import 'package:tekartik_common_build/common_app_builder.dart';
import 'package:tekartik_deploy/fs_deploy.dart';
import 'package:tekartik_web_publish/web_publish.dart';

Expand Down Expand Up @@ -59,11 +60,12 @@ class FlutterWebAppOptions {
}

/// Convenient builder.
class FlutterWebAppBuilder {
class FlutterWebAppBuilder implements CommonAppBuilder {
final FlutterWebAppOptions options;
final WebAppDeployer? deployer;

/// Project path.
@override
String get path => options.path;

FlutterWebAppBuilder({required this.options, this.deployer});
Expand Down

0 comments on commit 24b83da

Please sign in to comment.