Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
francescovallone committed May 7, 2024
2 parents 47b4677 + 36ef71a commit 5c3f69e
Show file tree
Hide file tree
Showing 127 changed files with 2,447 additions and 1,703 deletions.
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: Bug
about: Create a report to warn us about a bug
title: "fix: "
labels: bug
---

**What happened**

A simple and clear description of what the bug is.

**Code**

```dart
void main() {
/// your code goes here
}
```

**What should have happened**

A simple and clear description of what you expected to happen.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE/feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: Feature
about: A new feature to be added to the project
title: "feat: "
labels: feature
---

**Description**

Clearly describe what you are looking to add. The more context the better.

**Requirements**

- [ ] Checklist of requirements to be fulfilled
- [ ] Another requirement
26 changes: 26 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

## Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update

# Checklist:

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules

1 change: 1 addition & 0 deletions .github/workflows/serinus_docs_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- 'docs/**'
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/serinus_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@ jobs:
run: |
dart pub global activate coverage
export SERINUS_TEST=true
dart test --coverage=coverage test/serinus.dart && dart pub global run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --packages=.dart_tool/package_config.json --report-on=${{inputs.report_on}}
dart test --coverage=coverage && dart pub global run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --packages=.dart_tool/package_config.json --report-on=${{inputs.report_on}}
- name: 📊 Check Code Coverage
uses: VeryGoodOpenSource/very_good_coverage@v2
with:
path: ./packages/serinus/coverage/lcov.info
min_coverage: 70
min_coverage: 80

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3

uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
20 changes: 16 additions & 4 deletions .website/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,20 @@ export default defineConfig({
],
lastUpdated: true,
themeConfig: {
footer: {
copyright: 'Copyright © 2024 Francesco Vallone',
message: 'Built with 💙 and Dart 🎯 | One of the 🐤 of <a href="https://github.com/serinus-nest">Serinus Nest</a>'
},
// https://vitepress.dev/reference/default-theme-config
logo: '/serinus-logo.png',
nav: [
{
text: 'pub.dev',
link: 'https://pub.dev/packages/serinus'
}
},
],
sidebar: [
{
text: 'Serinus - Dart Backend Framework',
link: '/',
items: [
{ text: 'Introduction', link: '/introduction' },
{
Expand All @@ -44,6 +46,15 @@ export default defineConfig({
{ text: 'Model View Controller', link: '/techniques/mvc' },
{ text: 'Versioning', link: '/techniques/versioning' },
]
},
{
text: 'Plugins',
items: [
{ text: 'Configuration', link: '/plugins/configuration' },
{ text: 'Serve Static Files [WIP]' },
{ text: 'Swagger [WIP]' }
],
link: '/plugins/'
}
]
},
Expand All @@ -54,7 +65,8 @@ export default defineConfig({
],
socialLinks: [
{ icon: 'github', link: 'https://github.com/francescovallone/serinus' },
{ icon: 'twitter', link: 'https://twitter.com/serinus_nest'}
{ icon: 'twitter', link: 'https://twitter.com/serinus_nest'},
{ icon: 'discord', link: 'https://discord.gg/zydgnJ3ksJ' }
]
}
})
6 changes: 3 additions & 3 deletions .website/.vitepress/theme/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
}

.image-bg {
background-image: linear-gradient(-45deg, hsla(36, 100%, 75%, 0.5) 50%, hsla(36, 100%, 50%, 0.5) 50%) !important;
background-image: -moz-linear-gradient(-45deg, hsla(36, 100%, 75%, 0.5) 50%, hsla(36, 100%, 50%, 0.5) 50%) !important;
background-image: -webkit-linear-gradient(-45deg, hsla(36, 100%, 75%, 0.5) 50%, hsla(36, 100%, 50%, 0.5) 50%) !important;
background-image: linear-gradient(-45deg, rgba(255, 152, 0, 0.6) 50%, rgba(245, 124, 0, 0.6) 50%) !important;
background-image: -moz-linear-gradient(-45deg, rgba(255, 152, 0, 0.6) 50%, rgba(245, 124, 0, 0.6) 50%) !important;
background-image: -webkit-linear-gradient(-45deg, rgba(255, 152, 0, 0.6) 50%, rgba(245, 124, 0, 0.6) 50%) !important;
}
2 changes: 1 addition & 1 deletion .website/overview/pipes.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import 'package:serinus/serinus.dart';
class MyController extends Controller {
MyController({super.path = '/'}) {
on(GetRoute(path: '/'), (context, request) {
on(GetRoute(path: '/'), (context) {
return Response.text(
data: 'Hello World!',
);
Expand Down
15 changes: 7 additions & 8 deletions .website/overview/providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,14 @@ If you want to use a provider from a submodule, you must add the `Type` of the p
import 'package:serinus/serinus.dart';
class MyController extends Controller {
MyController({super.path = '/'});
@override
Future<Response> handle(Request request) async {
final myProvider = context.get<MyProvider>();
return Response.text(
data: 'Hello World!',
);
MyController({super.path = '/'}){
on(GetRoute(path: '/'), (context) {
return Response.text(
data: context.use<MyProvider>().myMethod(),
);
});
}
}
```

Expand Down
6 changes: 6 additions & 0 deletions .website/overview/routes.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ They only exposes the endpoint and the method that the route will respond to so
To add routes you first need to create a class that extends the `Route` class and then add it to the controller using the `on` method.

::: code-group

```dart [my_controller.dart]
import 'package:serinus/serinus.dart';
import 'my_routes.dart';
Expand All @@ -22,6 +23,7 @@ class MyController extends Controller {
}
}
```

```dart [my_routes.dart]
import 'package:serinus/serinus.dart';
Expand All @@ -34,6 +36,7 @@ class GetRoute extends Route {
}
```

:::

## Query Parameters
Expand Down Expand Up @@ -61,6 +64,7 @@ class GetRoute extends Route {
To define a path parameter you need to add the parameter name between `<` and `>` in the path of the route.

::: code-group

```dart [my_controller.dart]
import 'package:serinus/serinus.dart';
Expand All @@ -76,6 +80,7 @@ class MyController extends Controller {
}
}
```

```dart [my_routes.dart]
import 'package:serinus/serinus.dart';
Expand All @@ -88,6 +93,7 @@ class GetRoute extends Route {
}
```

:::

## Adding Pipes
Expand Down
45 changes: 45 additions & 0 deletions .website/plugins/configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Config <Badge type="tip" text="^0.2.1"/>

Serinus Config is a plugin that allows to load .env files in your Serinus application.

::: warning
This plugin uses the [dotenv](https://pub.dev/packages/dotenv) package to load the .env files.
:::

## Installation

The installation of the plugin is immediate and can be done using the following command:

```bash
dart pub add serinus_config
```

## Usage

To use the plugin, you need to import it in your entrypoint module:

```dart
import 'package:serinus_config/serinus_config.dart';
import 'package:serinus/serinus.dart';
class AppModule extends Module {
AppModule() : super(imports: [ConfigModule()]);
}
```

### Options

The plugin allows you to specify the path of the .env file to load using the `dotEnvPath` parameter. The default value is `.env`.

```dart
import 'package:serinus_config/serinus_config.dart';
import 'package:serinus/serinus.dart';
class AppModule extends Module {
AppModule() : super(imports: [ConfigModule(dotEnvPath: '.env')]);
}
```
7 changes: 7 additions & 0 deletions .website/plugins/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Plugins

This is a list of plugins that are available for Serinus. If you would like to add your own plugin, please submit a pull request to the [Serinus GitHub repository](https://github.com/francescovallone/serinus).

## Official Plugins

- [Configuration](/plugins/configuration)
4 changes: 2 additions & 2 deletions .website/techniques/mvc.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ import 'package:serinus/serinus.dart';
class MyController extends Controller {
MyController({super.path = '/'}) {
on(GetRoute(path: '/'), (context, request) {
on(GetRoute(path: '/'), (context) {
// This refers to the view file `views/index.mustache`
return Response.render(View(view: 'index', variables: {'name': 'Serinus'}));
});
Expand All @@ -89,7 +89,7 @@ import 'package:serinus/serinus.dart';
class MyController extends Controller {
MyController({super.path = '/'}) {
on(GetRoute(path: '/'), (context, request) {
on(GetRoute(path: '/'), (context) {
return Response.renderString(ViewString(viewData: 'Hello {{name}}', variables: {'name': 'Serinus'}));
});
}
Expand Down
2 changes: 1 addition & 1 deletion .website/techniques/versioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class MyController extends Controller {
int get version => 2;
MyController({super.path = '/'}) {
on(GetRoute(path: '/'), (context, request) {
on(GetRoute(path: '/'), (context) {
return Response.text('Hello, World!');
});
}
Expand Down
Loading

0 comments on commit 5c3f69e

Please sign in to comment.