Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## [Unreleased]

### Features

* **create commands:** Add --no-test flag to skip test file generation ([#XX](https://github.com/Stacked-Org/stacked/issues/1097))
- Added --no-test flag to all create commands (view, service, bottom_sheet, dialog, widget)
- When provided, no test files will be generated for the created components
- Maintains backward compatibility with default behavior unchanged
- Fixed for-loop bug in CreateWidgetCommand

# [1.14.0](https://github.com/Stacked-Org/cli/compare/v1.13.4...v1.14.0) (2025-02-18)


Expand Down
6 changes: 6 additions & 0 deletions lib/src/commands/create/create_bottom_sheet_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ class CreateBottomSheetCommand extends Command with ProjectStructureValidator {
..addOption(
ksProjectPath,
help: kCommandHelpProjectPath,
)
..addFlag(
ksNoTest,
defaultsTo: false,
help: kCommandHelpNoTest,
);
}

Expand All @@ -88,6 +93,7 @@ class CreateBottomSheetCommand extends Command with ProjectStructureValidator {
excludeRoute: argResults![ksExcludeRoute],
hasModel: argResults![ksModel],
templateType: templateType,
noTest: argResults![ksNoTest],
);

await _analyticsService.createBottomSheetEvent(
Expand Down
6 changes: 6 additions & 0 deletions lib/src/commands/create/create_dialog_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ class CreateDialogCommand extends Command with ProjectStructureValidator {
..addOption(
ksProjectPath,
help: kCommandHelpProjectPath,
)
..addFlag(
ksNoTest,
defaultsTo: false,
help: kCommandHelpNoTest,
);
}

Expand All @@ -88,6 +93,7 @@ class CreateDialogCommand extends Command with ProjectStructureValidator {
excludeRoute: argResults![ksExcludeRoute],
hasModel: argResults![ksModel],
templateType: templateType,
noTest: argResults![ksNoTest],
);

await _analyticsService.createDialogEvent(
Expand Down
6 changes: 6 additions & 0 deletions lib/src/commands/create/create_service_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ class CreateServiceCommand extends Command with ProjectStructureValidator {
..addOption(
ksProjectPath,
help: kCommandHelpProjectPath,
)
..addFlag(
ksNoTest,
defaultsTo: false,
help: kCommandHelpNoTest,
);
}

Expand All @@ -82,6 +87,7 @@ class CreateServiceCommand extends Command with ProjectStructureValidator {
verbose: true,
excludeRoute: argResults![ksExcludeDependency],
templateType: templateType,
noTest: argResults![ksNoTest],
);

await _analyticsService.createServiceEvent(
Expand Down
6 changes: 6 additions & 0 deletions lib/src/commands/create/create_view_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ class CreateViewCommand extends Command with ProjectStructureValidator {
..addOption(
ksProjectPath,
help: kCommandHelpProjectPath,
)
..addFlag(
ksNoTest,
defaultsTo: false,
help: kCommandHelpNoTest,
);
}

Expand Down Expand Up @@ -96,6 +101,7 @@ class CreateViewCommand extends Command with ProjectStructureValidator {
excludeRoute: argResults![ksExcludeRoute],
useBuilder: argResults![ksV1] ?? _configService.v1,
templateType: templateType,
noTest: argResults![ksNoTest],
);

await _analyticsService.createViewEvent(
Expand Down
8 changes: 7 additions & 1 deletion lib/src/commands/create/create_widget_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ class CreateWidgetCommand extends Command with ProjectStructureValidator {
..addOption(
ksProjectPath,
help: kCommandHelpProjectPath,
)
..addFlag(
ksNoTest,
defaultsTo: false,
help: kCommandHelpNoTest,
);
}

Expand All @@ -82,14 +87,15 @@ class CreateWidgetCommand extends Command with ProjectStructureValidator {
workingDirectory: argResults![ksProjectPath]);
await validateStructure(outputPath: argResults![ksProjectPath]);

for (var i = 0; i < widgetNames.length; i) {
for (var i = 0; i < widgetNames.length; i++) {
await _templateService.renderTemplate(
templateName: name,
name: widgetNames[i],
outputPath: argResults![ksProjectPath],
verbose: true,
hasModel: argResults![ksModel],
templateType: templateType,
noTest: argResults![ksNoTest],
);

await _analyticsService.createWidgetEvent(
Expand Down
1 change: 1 addition & 0 deletions lib/src/constants/command_constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const String ksAppDescription = 'description';
const String ksAppOrganization = 'org';
const String ksAppPlatforms = 'platforms';
const String ksProjectPath = 'project-path';
const String ksNoTest = 'no-test';

/// A list of strings that are used to run the run build_runner
/// [build or watch] --delete-conflicting-outputs command.
Expand Down
3 changes: 3 additions & 0 deletions lib/src/constants/message_constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,6 @@ Paths on Stacked config do not need to start with directory "lib" or "test" beca
const String kCommandHelpProjectPath = '''
When path is provided, it will be considered the project directory instead of the current directory.
''';

const String kCommandHelpNoTest =
'When provided, no test files will be generated for the created component.';
Loading