optikit 1.4.0 โ†’ 1.4.1

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.
package/CHANGELOG.md CHANGED
@@ -12,6 +12,14 @@ We follow **Semantic Versioning (SemVer)**:
12
12
 
13
13
  ---
14
14
 
15
+ ### ๐Ÿ›  [1.4.1] - Fix Generate Module Command
16
+
17
+ - ๐Ÿ”ด Fixed `generate module` routing to repo handler instead of module handler
18
+ - ๐Ÿ”„ Restructured `generate` as parent command with `module` and `repo` subcommands
19
+ - ๐Ÿงน Removed stale `repo/` directory from module scaffolding structure
20
+
21
+ ---
22
+
15
23
  ### ๐ŸŒŸ [1.4.0] - Interactive Repo Picker & Module Cleanup
16
24
 
17
25
  - ๐Ÿ“‚ Interactive arrow-key directory picker for `gen repo` โ€” browse, open, go back, or create folders
@@ -6,30 +6,38 @@ import { runDoctor } from "./doctor.js";
6
6
  import { showStatus } from "./status.js";
7
7
  export const projectCommands = [
8
8
  {
9
- command: "generate module <moduleName>",
10
- aliases: ["gen module"],
11
- describe: "Generate a module with structure",
9
+ command: "generate",
10
+ aliases: ["gen"],
11
+ describe: "Generate module or repository scaffolding",
12
12
  builder: (yargs) => {
13
13
  return yargs
14
- .positional("moduleName", { describe: "The name of the module to generate", type: "string" })
15
- .option("with-route", { alias: "r", type: "boolean", default: false, description: "Also register a route in app_router.dart" });
14
+ .command({
15
+ command: "module <moduleName>",
16
+ describe: "Generate a module with full BLoC structure",
17
+ builder: (y) => {
18
+ return y
19
+ .positional("moduleName", { describe: "The name of the module to generate", type: "string" })
20
+ .option("with-route", { alias: "r", type: "boolean", default: false, description: "Also register a route in app_router.dart" });
21
+ },
22
+ handler: (argv) => {
23
+ const moduleName = argv.moduleName;
24
+ generateModule(moduleName);
25
+ if (argv.withRoute) {
26
+ addRoute(moduleName);
27
+ }
28
+ },
29
+ })
30
+ .command({
31
+ command: "repo <moduleName>",
32
+ describe: "Generate a repository file for an existing module",
33
+ builder: (y) => {
34
+ return y.positional("moduleName", { describe: "The module name", type: "string" });
35
+ },
36
+ handler: async (argv) => { await generateRepoModule(argv.moduleName); },
37
+ })
38
+ .demandCommand(1, "Specify a subcommand: module or repo");
16
39
  },
17
- handler: (argv) => {
18
- const moduleName = argv.moduleName;
19
- generateModule(moduleName);
20
- if (argv.withRoute) {
21
- addRoute(moduleName);
22
- }
23
- },
24
- },
25
- {
26
- command: "generate repo <moduleName>",
27
- aliases: ["gen repo"],
28
- describe: "Generate a repository file for an existing module",
29
- builder: (yargs) => {
30
- return yargs.positional("moduleName", { describe: "The module name", type: "string" });
31
- },
32
- handler: async (argv) => { await generateRepoModule(argv.moduleName); },
40
+ handler: () => { },
33
41
  },
34
42
  {
35
43
  command: "add-route <moduleName>",
package/dist/constants.js CHANGED
@@ -44,7 +44,7 @@ export const BACKUP_CONFIG = {
44
44
  };
45
45
  // Module generation
46
46
  export const MODULE_STRUCTURE = {
47
- DIRECTORIES: ["bloc", "event", "state", "screen", "import", "factory", "repo"],
47
+ DIRECTORIES: ["bloc", "event", "state", "screen", "import", "factory"],
48
48
  NAME_PATTERN: /^[a-z0-9_]+$/,
49
49
  };
50
50
  // Flutter commands
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "optikit",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "OptiKit CLI",
5
5
  "main": "src/cli.ts",
6
6
  "type": "module",
@@ -8,28 +8,36 @@ import { showStatus } from "./status.js";
8
8
 
9
9
  export const projectCommands: CommandModule[] = [
10
10
  {
11
- command: "generate module <moduleName>",
12
- aliases: ["gen module"],
13
- describe: "Generate a module with structure",
11
+ command: "generate",
12
+ aliases: ["gen"],
13
+ describe: "Generate module or repository scaffolding",
14
14
  builder: (yargs) => {
15
15
  return yargs
16
- .positional("moduleName", { describe: "The name of the module to generate", type: "string" as const })
17
- .option("with-route", { alias: "r", type: "boolean", default: false, description: "Also register a route in app_router.dart" });
16
+ .command({
17
+ command: "module <moduleName>",
18
+ describe: "Generate a module with full BLoC structure",
19
+ builder: (y) => {
20
+ return y
21
+ .positional("moduleName", { describe: "The name of the module to generate", type: "string" as const })
22
+ .option("with-route", { alias: "r", type: "boolean", default: false, description: "Also register a route in app_router.dart" });
23
+ },
24
+ handler: (argv) => {
25
+ const moduleName = argv.moduleName as string;
26
+ generateModule(moduleName);
27
+ if (argv.withRoute) { addRoute(moduleName); }
28
+ },
29
+ })
30
+ .command({
31
+ command: "repo <moduleName>",
32
+ describe: "Generate a repository file for an existing module",
33
+ builder: (y) => {
34
+ return y.positional("moduleName", { describe: "The module name", type: "string" as const });
35
+ },
36
+ handler: async (argv) => { await generateRepoModule(argv.moduleName as string); },
37
+ })
38
+ .demandCommand(1, "Specify a subcommand: module or repo");
18
39
  },
19
- handler: (argv) => {
20
- const moduleName = argv.moduleName as string;
21
- generateModule(moduleName);
22
- if (argv.withRoute) { addRoute(moduleName); }
23
- },
24
- },
25
- {
26
- command: "generate repo <moduleName>",
27
- aliases: ["gen repo"],
28
- describe: "Generate a repository file for an existing module",
29
- builder: (yargs) => {
30
- return yargs.positional("moduleName", { describe: "The module name", type: "string" as const });
31
- },
32
- handler: async (argv) => { await generateRepoModule(argv.moduleName as string); },
40
+ handler: () => { /* handled by subcommands */ },
33
41
  },
34
42
  {
35
43
  command: "add-route <moduleName>",
package/src/constants.ts CHANGED
@@ -48,7 +48,7 @@ export const BACKUP_CONFIG = {
48
48
 
49
49
  // Module generation
50
50
  export const MODULE_STRUCTURE = {
51
- DIRECTORIES: ["bloc", "event", "state", "screen", "import", "factory", "repo"],
51
+ DIRECTORIES: ["bloc", "event", "state", "screen", "import", "factory"],
52
52
  NAME_PATTERN: /^[a-z0-9_]+$/,
53
53
  } as const;
54
54