Skip to content

Commit 951fc9e

Browse files
authored
core: migrate-to-plain-dart (#1)
* chore: migrate to plain dart * chore: increase description length * ci: add publish workflows * chore: fix analyze * ci: ignore example * fix: auto read coverrage files * ci: generate test coverage
1 parent 64a2840 commit 951fc9e

File tree

9 files changed

+95
-20
lines changed

9 files changed

+95
-20
lines changed

.github/workflows/create-tag.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Create release tag with push
2+
3+
on:
4+
push:
5+
branches:
6+
- 'releases/**'
7+
8+
jobs:
9+
create-tag:
10+
if: github.event.created
11+
runs-on: ubuntu-latest
12+
env:
13+
GITHUB_SHORT_REF: ${{ github.ref_name }}
14+
steps:
15+
- name: Extract version to step variable
16+
id: get_version
17+
run: |
18+
echo "RELEASE_VERSION=$(
19+
echo $GITHUB_SHORT_REF | rev | cut -d/ -f1 | rev
20+
)" >> $GITHUB_OUTPUT
21+
- name: Create tag
22+
uses: actions/github-script@v6
23+
with:
24+
github-token: ${{ secrets.ACCESS_TOKEN }}
25+
script: |
26+
github.rest.git.createRef({
27+
owner: context.repo.owner,
28+
repo: context.repo.repo,
29+
ref: 'refs/tags/${{steps.get_version.outputs.RELEASE_VERSION}}',
30+
sha: context.sha
31+
})

.github/workflows/publish.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Echo release tag
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]+.[0-9]+.[0-9]+*'
7+
8+
jobs:
9+
publish:
10+
uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1
11+
with:
12+
environment: 'production'

.github/workflows/test-analyze.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# ==================================================
2+
# This is the main worflow for testing and analyzing
3+
# the code.
4+
# ==================================================
5+
6+
name: CI
7+
8+
on:
9+
pull_request:
10+
types: [opened, synchronize]
11+
branches:
12+
- master
13+
workflow_dispatch:
14+
15+
jobs:
16+
analyze:
17+
runs-on: ubuntu-latest
18+
timeout-minutes: 10
19+
steps:
20+
- name: Fetch code from repository
21+
uses: actions/checkout@v3
22+
- run: rm -rf example
23+
- uses: dart-lang/setup-dart@v1
24+
with:
25+
sdk: 2.19.1
26+
- run: dart pub get
27+
- run: dart format --output=none --set-exit-if-changed .
28+
- run: dart analyze
29+
- name: Run test and generate coverrage
30+
run: |
31+
dart test --coverage=./coverage
32+
dart pub global activate coverage
33+
dart pub global run coverage:format_coverage --packages=.dart_tool/package_config.json --report-on=lib --lcov -o ./coverage/lcov.info -i ./coverage
34+
- name: Upload coverage to codecov
35+
uses: codecov/codecov-action@v3
36+
with:
37+
verbose: true
38+
fail_ci_if_error: true
39+
file: ./coverage/lcov.info

analysis_options.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
include: package:flutter_lints/flutter.yaml
1+
include: package:lints/recommended.yaml
2+
23

34
analyzer:
45
errors:

example/pubspec.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,4 +193,3 @@ packages:
193193
version: "2.1.4"
194194
sdks:
195195
dart: ">=2.19.1 <3.0.0"
196-
flutter: ">=1.17.0"

example/pubspec.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,16 @@ environment:
88
sdk: '>=2.19.1 <3.0.0'
99

1010
dependencies:
11-
remove_markdown:
12-
path: ../
11+
cupertino_icons: ^1.0.2
1312
flutter:
1413
sdk: flutter
15-
16-
cupertino_icons: ^1.0.2
14+
remove_markdown:
15+
path: ../
1716

1817
dev_dependencies:
18+
flutter_lints: ^2.0.0
1919
flutter_test:
2020
sdk: flutter
21-
flutter_lints: ^2.0.0
2221

2322
flutter:
2423
uses-material-design: true

lib/remove_markdown.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ extension RemoveMarkdown on String {
3030
bool abbr = true,
3131
}) {
3232
var output = replaceAll(
33-
RegExp(r'^(-\s*?|\*\s*?|_\s*?){3,}\s*', multiLine: true), '');
33+
RegExp(r'^(-\s*?|\*\s*?|_\s*?){3,}\s*', multiLine: true),
34+
'',
35+
);
3436

3537
if (stripListLeaders) {
3638
if (listUnicodeChar != null) {

pubspec.yaml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
11
name: remove_markdown
2-
description: Markdown removal from string.
2+
description: Strip markdown from markdown formatted string.
33
version: 0.0.1
44
homepage: https://github.com/wizlif/remove_markdown
55

66
environment:
77
sdk: '>=2.19.1 <3.0.0'
8-
flutter: ">=1.17.0"
9-
10-
dependencies:
11-
flutter:
12-
sdk: flutter
138

149
dev_dependencies:
15-
flutter_lints: ^2.0.0
16-
flutter_test:
17-
sdk: flutter
18-
19-
flutter:
10+
lints: ^2.0.0
11+
test: ^1.21.0

test/remove_markdown_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import 'package:flutter_test/flutter_test.dart';
21
import 'package:remove_markdown/remove_markdown.dart';
2+
import 'package:test/test.dart';
33

44
import 'cases.dart';
55

0 commit comments

Comments
 (0)