Skip to content

Commit

Permalink
Merge pull request #106 from gbtb16/refactor/all-needed
Browse files Browse the repository at this point in the history
refactor(all-needed): including basis, directories, pubspecs, examples, github actions, etc
  • Loading branch information
gbtb16 authored Jan 31, 2024
2 parents 73bb22a + f028e27 commit 1d43bcd
Show file tree
Hide file tree
Showing 154 changed files with 725 additions and 560 deletions.
24 changes: 10 additions & 14 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,27 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "pub"
directory: "/kiwi"
- package-ecosystem: "pub.dev"
directory: "/packages/kiwi"
schedule:
interval: "daily"
labels:
- "pub"
- "pub.dev"
- "kiwi"
- "dependencies"
- package-ecosystem: "pub"
directory: "/kiwi_generator"

- package-ecosystem: "pub.dev"
directory: "/packages/kiwi_generator"
schedule:
interval: "daily"
labels:
- "pub"
- "kiwi_generator"
- "pub.dev"
- "kiwi generator"
- "dependencies"

- package-ecosystem: "github-actions"
- package-ecosystem: "github actions"
directory: "/"
schedule:
interval: "weekly"
labels:
- "github-actions"
- "github actions"
- "dependencies"
20 changes: 10 additions & 10 deletions .github/workflows/build_all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: build_all

on:
push:
branches: [ "master" ]
branches: [ 'master', 'stable' ]
pull_request:
branches: [ "master" ]
branches: [ 'master', 'stable' ]

jobs:
flutter:
Expand All @@ -17,12 +17,12 @@ jobs:
- uses: subosito/[email protected]
with:
channel: ${{ matrix.version }}
- name: Build & format for flutter_example
- name: Build & format for flutter_kiwi example
run: |
cd flutter_example
cd examples/flutter_kiwi
flutter packages get
flutter packages pub run build_runner build --delete-conflicting-outputs
dart format .
dart format --line-length 160 .
- name: Use verify-changed-files to check if any of the above files changed.
uses: tj-actions/verify-changed-files@v17
- name: Run step only when any of the above files change.
Expand All @@ -41,16 +41,16 @@ jobs:
sdk: ${{ matrix.sdk }}
- name: Build & format for kiwi_generator
run: |
cd kiwi_generator
cd packages/kiwi_generator
dart pub get
dart run build_runner build --delete-conflicting-outputs
dart format .
- name: Build & format for example
dart format --line-length 160 .
- name: Build & format for dart_kiwi example
run: |
cd example
cd examples/dart_kiwi
dart pub get
dart run build_runner build --delete-conflicting-outputs
dart format .
dart format --line-length 160 .
- name: Use verify-changed-files to check if any of the above files changed.
uses: tj-actions/verify-changed-files@v17
- name: Run step only when any of the above files change.
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: changelog

on:
push:
branches: [ "master" ]
branches: [ 'master', 'stable' ]
pull_request:
branches: [ "master" ]
branches: [ 'master', 'stable' ]

jobs:
check:
Expand All @@ -16,7 +16,6 @@ jobs:
sdk: 'stable'
- name: Check changelog
run: |
cd tool/actions
cd tools/kiwi_cli_actions
dart pub get
cd ../..
dart run tool/actions/changelog_checker.dart
dart run
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
name: example
name: dart_kiwi_example

on:
push:
branches: [ "master" ]
branches: [ 'master', 'stable' ]
pull_request:
branches: [ "master" ]
branches: [ 'master', 'stable' ]

jobs:
check:
runs-on: ubuntu-latest
defaults:
run:
working-directory: example
working-directory: examples/dart_kiwi
steps:
- uses: actions/checkout@v4
- uses: subosito/[email protected]
with:
channel: 'stable'
- run: flutter packages get
- run: flutter analyze
- run: dart format -o none --set-exit-if-changed .
- run: dart format --line-length 160 -o none --set-exit-if-changed .
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
name: flutter_example
name: flutter_kiwi_example

on:
push:
branches: [ "master" ]
branches: [ 'master', 'stable' ]
pull_request:
branches: [ "master" ]
branches: [ 'master', 'stable' ]

jobs:
check:
runs-on: ubuntu-latest
defaults:
run:
working-directory: flutter_example
working-directory: examples/flutter_kiwi
steps:
- uses: actions/checkout@v4
- uses: subosito/[email protected]
with:
channel: 'stable'
- run: flutter packages get
- run: flutter analyze
- run: dart format -o none --set-exit-if-changed .
- run: dart format --line-length 160 -o none --set-exit-if-changed .
8 changes: 4 additions & 4 deletions .github/workflows/kiwi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: kiwi

on:
push:
branches: [ "master" ]
branches: [ 'master', 'stable' ]
pull_request:
branches: [ "master" ]
branches: [ 'master', 'stable' ]

jobs:
check:
Expand All @@ -14,13 +14,13 @@ jobs:
sdk: [ stable, beta, dev ]
defaults:
run:
working-directory: kiwi
working-directory: packages/kiwi
steps:
- uses: actions/checkout@v4
- uses: dart-lang/setup-dart@v1
with:
sdk: ${{ matrix.sdk }}
- run: dart pub get
- run: dart analyze --fatal-infos --fatal-warnings .
- run: dart format -o none --set-exit-if-changed .
- run: dart format --line-length 160 -o none --set-exit-if-changed .
- run: dart pub run test
8 changes: 4 additions & 4 deletions .github/workflows/kiwi_generator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: kiwi_generator

on:
push:
branches: [ "master" ]
branches: [ 'master', 'stable' ]
pull_request:
branches: [ "master" ]
branches: [ 'master', 'stable' ]

jobs:
check:
Expand All @@ -14,13 +14,13 @@ jobs:
sdk: [ stable, beta, dev ]
defaults:
run:
working-directory: kiwi_generator
working-directory: packages/kiwi_generator
steps:
- uses: actions/checkout@v4
- uses: dart-lang/setup-dart@v1
with:
sdk: ${{ matrix.sdk }}
- run: dart pub get
- run: dart analyze --fatal-infos --fatal-warnings .
- run: dart format -o none --set-exit-if-changed .
- run: dart format --line-length 160 -o none --set-exit-if-changed .
- run: dart pub run test
26 changes: 11 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

[![kiwi](https://github.com/gbtb16/kiwi/actions/workflows/kiwi.yml/badge.svg?branch=master)](https://github.com/gbtb16/kiwi/actions/workflows/kiwi.yml)
[![kiwi_generator](https://github.com/gbtb16/kiwi/actions/workflows/kiwi_generator.yml/badge.svg?branch=master)](https://github.com/gbtb16/kiwi/actions/workflows/kiwi_generator.yml)
[![flutter_example](https://github.com/gbtb16/kiwi/actions/workflows/flutter_example.yml/badge.svg?branch=master)](https://github.com/gbtb16/kiwi/actions/workflows/flutter_example.yml)
[![example](https://github.com/gbtb16/kiwi/actions/workflows/example.yml/badge.svg?branch=master)](https://github.com/gbtb16/kiwi/actions/workflows/example.yml)
[![dart_kiwi_example](https://github.com/gbtb16/kiwi/actions/workflows/dart_kiwi_example.yml/badge.svg?branch=master)](https://github.com/gbtb16/kiwi/actions/workflows/dart_kiwi_example.yml)
[![flutter_kiwi_example](https://github.com/gbtb16/kiwi/actions/workflows/flutter_kiwi_example.yml/badge.svg?branch=master)](https://github.com/gbtb16/kiwi/actions/workflows/flutter_kiwi_example.yml)

![Logo](https://raw.githubusercontent.com/gbtb16/kiwi/master/images/logo.png)

Expand All @@ -13,39 +13,35 @@ The container does not rely on reflection, it's just a `Map`, so it's fast.

While using the generator, only constructor injection is supported.

**IMPORTANT: Dart2 is required to use this package.**

**IMPORTANT: From 1.0.0 Container is removed. Use KiwiContainer instead. (better Flutter support)**

## KiwiContainer and annotations
## Kiwi

[![Pub](https://img.shields.io/pub/v/kiwi.svg)](https://pub.dartlang.org/packages/kiwi)

[Source Code](https://github.com/gbtb16/kiwi/tree/master/kiwi)
[Source Code](https://github.com/gbtb16/kiwi/tree/master/packages/kiwi)

The core package providing the IoC container and the annotations which has no dependencies.

Import it into your pubspec `dependencies:` section.

## Generator
## Kiwi Generator

[![Pub](https://img.shields.io/pub/v/kiwi_generator.svg)](https://pub.dartlang.org/packages/kiwi_generator)

[Source Code](https://github.com/gbtb16/kiwi/tree/master/kiwi_generator)
[Source Code](https://github.com/gbtb16/kiwi/tree/master/packages/kiwi_generator)

The package providing the generator.

Import it into your pubspec `dev_dependencies:` section.

## Example
## Dart Kiwi Example

[Source Code](https://github.com/gbtb16/kiwi/tree/master/example)
[Source Code](https://github.com/gbtb16/kiwi/tree/master/examples/dart_kiwi)

An example showing how to setup `kiwi` and `kiwi_generator`.
An example showing how to setup `kiwi` and `kiwi_generator` inside a Dart CLI project.

## Flutter Example
## Flutter Kiwi Example

[Source Code](https://github.com/gbtb16/kiwi/tree/master/flutter_example)
[Source Code](https://github.com/gbtb16/kiwi/tree/master/examples/flutter_kiwi)

An example showing how to setup `kiwi` and `kiwi_generator` inside a Flutter project.

Expand Down
3 changes: 0 additions & 3 deletions example/lib/src/models/pump.dart

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'package:example/src/models/coffee_maker.dart';
import 'package:example/src/modules/drip_coffee_module.dart';
import 'package:dart_kiwi/src/models/coffee_maker.dart';
import 'package:dart_kiwi/src/modules/drip_coffee_module.dart';
import 'package:kiwi/kiwi.dart';

void main() {
void main(List<String> arguments) async {
CoffeeInjector coffeeInjector = getCoffeeInjector();
coffeeInjector.configure();

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import 'package:example/src/models/heater.dart';
import 'package:example/src/models/model.dart';
import 'package:example/src/models/pump.dart';
import 'package:dart_kiwi/src/models/heater.dart';
import 'package:dart_kiwi/src/models/model.dart';
import 'package:dart_kiwi/src/models/pump.dart';

class CoffeeMaker {
final Heater _heater;
final Pump _pump;
final Model _model;

CoffeeMaker(
const CoffeeMaker(
this._heater,
this._pump,
this._model,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import 'package:example/src/models/heater.dart';
import 'package:dart_kiwi/src/models/heater.dart';

class PowerOutlet {}
class PowerOutlet {
const PowerOutlet();
}

class Electricity {
Electricity(PowerOutlet outlet);
const Electricity(PowerOutlet outlet);
}

class ElectricHeater implements Heater {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
abstract class Heater {
abstract interface class Heater {
void on();
void off();
bool get isHot;
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions examples/dart_kiwi/lib/src/models/pump.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
abstract interface class Pump {
void pump();
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import 'package:example/src/models/heater.dart';
import 'package:example/src/models/pump.dart';
import 'package:dart_kiwi/src/models/heater.dart';
import 'package:dart_kiwi/src/models/pump.dart';

class Thermosiphon implements Pump {
final Heater _heater;

Thermosiphon(this._heater);
const Thermosiphon(this._heater);

@override
void pump() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import 'package:example/src/models/coffee_maker.dart';
import 'package:example/src/models/electric_heater.dart';
import 'package:example/src/models/heater.dart';
import 'package:example/src/models/model.dart';
import 'package:example/src/models/pump.dart';
import 'package:example/src/models/thermosiphon.dart';
import 'package:dart_kiwi/src/models/coffee_maker.dart';
import 'package:dart_kiwi/src/models/electric_heater.dart';
import 'package:dart_kiwi/src/models/heater.dart';
import 'package:dart_kiwi/src/models/model.dart';
import 'package:dart_kiwi/src/models/pump.dart';
import 'package:dart_kiwi/src/models/thermosiphon.dart';
import 'package:kiwi/kiwi.dart';

part 'drip_coffee_module.g.dart';
Expand Down
Loading

0 comments on commit 1d43bcd

Please sign in to comment.