Skip to content
This repository was archived by the owner on Feb 21, 2024. It is now read-only.

Commit 85496c2

Browse files
authored
feat!: add publishable flag (#30)
1 parent 8ac1813 commit 85496c2

9 files changed

Lines changed: 54 additions & 2 deletions

File tree

brick/__brick__/{{project_name.snakeCase()}}/.github/workflows/main.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ jobs:
1818
with:
1919
flutter_channel: stable
2020
flutter_version: 3.3.7
21+
{{#publishable}}
22+
pana:
23+
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/pana.yml@v1
24+
{{/publishable}}

brick/__brick__/{{project_name.snakeCase()}}/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: {{project_name.snakeCase()}}
22
description: {{{description}}}
33
version: 0.1.0+1
4-
publish_to: none
4+
{{^publishable}}publish_to: none{{/publishable}}
55

66
environment:
77
sdk: ">=2.18.0 <3.0.0"

brick/__brick__/{{project_name.snakeCase()}}/CHANGELOG.md renamed to brick/__brick__/{{project_name.snakeCase()}}/{{#publishable}}CHANGELOG.md{{\publishable}}

File renamed without changes.

brick/brick.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,8 @@ vars:
1717
description: The package description
1818
default: A very good flutter package
1919
prompt: What is the project description?
20+
publishable:
21+
type: boolean
22+
description: Whether the generated package is intended to be published.
23+
default: false
24+
prompt: Will the package be published?

patches/changelog.patch

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
diff --git a/src/very_good_flutter_package/CHANGELOG.md "b/src/very_good_flutter_package/{{#publishable}}CHANGELOG.md{{\\publishable}}"
2+
similarity index 100%
3+
rename from src/very_good_flutter_package/CHANGELOG.md
4+
rename to "src/very_good_flutter_package/{{#publishable}}CHANGELOG.md{{\\publishable}}"

patches/pubspec_publish.patch

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/src/very_good_flutter_package/pubspec.yaml b/src/very_good_flutter_package/pubspec.yaml
2+
index 48792b7..999e3c8 100644
3+
--- a/src/very_good_flutter_package/pubspec.yaml
4+
+++ b/src/very_good_flutter_package/pubspec.yaml
5+
@@ -1,7 +1,7 @@
6+
name: very_good_flutter_package
7+
description: A Very Good Flutter package created by Very Good Ventures.
8+
version: 0.1.0+1
9+
-publish_to: none
10+
+{{^publishable}}publish_to: none{{/publishable}}
11+
12+
environment:
13+
sdk: ">=2.18.0 <3.0.0"

patches/workflow_pana.patch

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
diff --git a/src/very_good_flutter_package/.github/workflows/main.yaml b/src/very_good_flutter_package/.github/workflows/main.yaml
2+
index b85c81c..3409173 100644
3+
--- a/src/very_good_flutter_package/.github/workflows/main.yaml
4+
+++ b/src/very_good_flutter_package/.github/workflows/main.yaml
5+
@@ -18,3 +18,7 @@ jobs:
6+
with:
7+
flutter_channel: stable
8+
flutter_version: 3.3.7
9+
+{{#publishable}}
10+
+ pana:
11+
+ uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/pana.yml@v1
12+
+{{/publishable}}

src/very_good_flutter_package/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
21+
SOFTWARE.

tool/generator/main.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,20 @@ void main() async {
3333
),
3434
);
3535

36+
// Apply patches
37+
await Future.wait(
38+
Directory('patches').listSync().whereType<File>().map(
39+
(file) async {
40+
final process = await Process.start('git', ['apply']);
41+
process.stdin
42+
.write(file.readAsStringSync().replaceAll('src', targetPath));
43+
await process.stdin.close();
44+
45+
await process.exitCode;
46+
},
47+
),
48+
);
49+
3650
// Convert Values to Variables
3751
await Future.wait(
3852
Directory(p.join(targetPath, 'very_good_flutter_package'))

0 commit comments

Comments
 (0)