wlmaker 1.2.5 → 1.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.mjs +16 -4
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -703,18 +703,21 @@ class Wl${pascal}Skeleton extends StatelessWidget {
703
703
  };
704
704
  }
705
705
  function useCaseTemplate(name, pascal, tierPlural3, tier) {
706
- const widgetCall = tier === "organism" || tier === "template" ? `const Wl${pascal}(i18n: Wl${pascal}I18n())` : `const Wl${pascal}()`;
706
+ const isTemplate = tier === "template";
707
+ const className = isTemplate ? `Wl${pascal}Template` : `Wl${pascal}`;
708
+ const needsI18n = tier === "organism" || tier === "template";
709
+ const widgetCall = needsI18n ? `const ${className}(i18n: Wl${pascal}I18n())` : `const ${className}()`;
707
710
  return `import 'package:design_system/design_system.dart';
708
711
  import 'package:flutter/material.dart';
709
712
  import 'package:widgetbook/widgetbook.dart';
710
713
  import 'package:widgetbook_annotation/widgetbook_annotation.dart' as widgetbook;
711
714
 
712
715
  @widgetbook.UseCase(
713
- name: 'Wl${pascal}',
714
- type: Wl${pascal},
716
+ name: '${className}',
717
+ type: ${className},
715
718
  path: 'wl_design_system/${tierPlural3}/wl_${name}',
716
719
  )
717
- Widget useCaseWl${pascal}(BuildContext context) {
720
+ Widget useCase${className}(BuildContext context) {
718
721
  return ${widgetCall};
719
722
  }
720
723
  `;
@@ -1306,6 +1309,15 @@ program.command("widget").description("Create a new widget in the design system"
1306
1309
  projectRoot: options.dir,
1307
1310
  pattern: options.pattern
1308
1311
  });
1312
+ try {
1313
+ await createUseCase(name, options.tier, {
1314
+ projectRoot: options.dir,
1315
+ buildRunner: false
1316
+ });
1317
+ console.log(chalk5.green("Widgetbook use-case created"));
1318
+ } catch {
1319
+ console.log(chalk5.yellow("Use-case skipped (may already exist)"));
1320
+ }
1309
1321
  } catch (error) {
1310
1322
  console.error(chalk5.red(`Error: ${error}`));
1311
1323
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wlmaker",
3
- "version": "1.2.5",
3
+ "version": "1.2.6",
4
4
  "description": "Create Flutter BLoCs with Freezed sealed classes from the terminal",
5
5
  "keywords": [
6
6
  "flutter",