Skip to content

Commit

Permalink
feat(cli): add VSCode settings to app templates (#14)
Browse files Browse the repository at this point in the history
* Add VSCode settings for app templates

* Avoid ignore .vscode folder under templates

* Compile templates
  • Loading branch information
ferrarafer authored Apr 20, 2023
1 parent c8a96a4 commit bf296fb
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ Thumbs.db
*.iml
.vscode/
.vs/

# Avoid ignore .vscode folder under templates
!**/templates/**/.vscode
6 changes: 6 additions & 0 deletions lib/src/templates/app/mobile/.vscode/settings.json.stk
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.patterns": {
"*.dart": "\$\{capture}.mobile.dart, \$\{capture}.tablet.dart, \$\{capture}.desktop.dart, \$\{capture}.form.dart, \$\{capture}.g.dart, \$\{capture}.freezed.dart, \$\{capture}.logger.dart, \$\{capture}.locator.dart, \$\{capture}.router.dart, \$\{capture}.dialogs.dart, \$\{capture}.bottomsheets.dart"
}
}
6 changes: 6 additions & 0 deletions lib/src/templates/app/web/.vscode/settings.json.stk
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.patterns": {
"*.dart": "\$\{capture}.mobile.dart, \$\{capture}.tablet.dart, \$\{capture}.desktop.dart, \$\{capture}.form.dart, \$\{capture}.g.dart, \$\{capture}.freezed.dart, \$\{capture}.logger.dart, \$\{capture}.locator.dart, \$\{capture}.router.dart, \$\{capture}.dialogs.dart, \$\{capture}.bottomsheets.dart"
}
}
8 changes: 8 additions & 0 deletions lib/src/templates/compiled_template_map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ Map<String, Map<String, StackedTemplate>> kCompiledStackedTemplates = {
relativeOutputPath: kAppWebTemplatePubspecYamlStkPath,
content: kAppWebTemplatePubspecYamlStkContent,
fileType: FileType.text),
TemplateFile(
relativeOutputPath: kAppWebTemplateSettingsJsonStkPath,
content: kAppWebTemplateSettingsJsonStkContent,
fileType: FileType.text),
],
modificationFiles: [],
),
Expand Down Expand Up @@ -248,6 +252,10 @@ Map<String, Map<String, StackedTemplate>> kCompiledStackedTemplates = {
relativeOutputPath: kAppMobileTemplatePubspecYamlStkPath,
content: kAppMobileTemplatePubspecYamlStkContent,
fileType: FileType.text),
TemplateFile(
relativeOutputPath: kAppMobileTemplateSettingsJsonStkPath,
content: kAppMobileTemplateSettingsJsonStkContent,
fileType: FileType.text),
],
modificationFiles: [],
),
Expand Down
36 changes: 36 additions & 0 deletions lib/src/templates/compiled_templates.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1916,6 +1916,24 @@ flutter:
// --------------------------------------------------


// -------- SettingsJsonStk Template Data ----------

const String kAppWebTemplateSettingsJsonStkPath =
'.vscode/settings.json.stk';

const String kAppWebTemplateSettingsJsonStkContent = '''
{
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.patterns": {
"*.dart": "\$\{capture}.mobile.dart, \$\{capture}.tablet.dart, \$\{capture}.desktop.dart, \$\{capture}.form.dart, \$\{capture}.g.dart, \$\{capture}.freezed.dart, \$\{capture}.logger.dart, \$\{capture}.locator.dart, \$\{capture}.router.dart, \$\{capture}.dialogs.dart, \$\{capture}.bottomsheets.dart"
}
}
''';

// --------------------------------------------------


// -------- StackedJsonStk Template Data ----------

const String kAppMobileTemplateStackedJsonStkPath =
Expand Down Expand Up @@ -3111,6 +3129,24 @@ flutter:
// --------------------------------------------------


// -------- SettingsJsonStk Template Data ----------

const String kAppMobileTemplateSettingsJsonStkPath =
'.vscode/settings.json.stk';

const String kAppMobileTemplateSettingsJsonStkContent = '''
{
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.patterns": {
"*.dart": "\$\{capture}.mobile.dart, \$\{capture}.tablet.dart, \$\{capture}.desktop.dart, \$\{capture}.form.dart, \$\{capture}.g.dart, \$\{capture}.freezed.dart, \$\{capture}.logger.dart, \$\{capture}.locator.dart, \$\{capture}.router.dart, \$\{capture}.dialogs.dart, \$\{capture}.bottomsheets.dart"
}
}
''';

// --------------------------------------------------


// -------- GenericDialogModelTest Template Data ----------

const String kDialogEmptyTemplateGenericDialogModelTestPath =
Expand Down

0 comments on commit bf296fb

Please sign in to comment.