proteum 2.1.1 → 2.1.2

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.
@@ -9,15 +9,71 @@ class InitCommand extends ProteumCommand {
9
9
 
10
10
  public static usage = buildUsage('init');
11
11
 
12
- public legacyArgs = Option.Rest();
12
+ public name = Option.String('--name', { description: 'Human-readable app name.' });
13
+ public description = Option.String('--description', { description: 'App description used in identity.yaml and package.json.' });
14
+ public identifier = Option.String('--identifier', { description: 'Application class and identity identifier.' });
15
+ public port = Option.String('--port', { description: 'Default local router port used in .env.' });
16
+ public url = Option.String('--url', { description: 'Default absolute URL used in .env.' });
17
+ public proteumVersion = Option.String('--proteum-version', {
18
+ description: 'Override the Proteum dependency written to package.json.',
19
+ });
20
+ public install = Option.Boolean('--install', false, { description: 'Run npm install after scaffolding.' });
21
+ public dryRun = Option.Boolean('--dry-run', false, { description: 'Print the scaffold plan without writing files.' });
22
+ public json = Option.Boolean('--json', false, { description: 'Print machine-readable scaffold output.' });
23
+ public force = Option.Boolean('--force', false, { description: 'Allow writing into a non-empty target directory.' });
24
+ public args = Option.Rest();
13
25
 
14
26
  public async execute() {
15
- assertNoLegacyArgs('init', this.legacyArgs);
16
- this.setCliArgs();
27
+ const [directory = ''] = this.args;
28
+
29
+ this.setCliArgs({
30
+ directory,
31
+ name: this.name ?? '',
32
+ description: this.description ?? '',
33
+ identifier: this.identifier ?? '',
34
+ port: this.port ?? '',
35
+ url: this.url ?? '',
36
+ proteumVersion: this.proteumVersion ?? '',
37
+ install: this.install,
38
+ dryRun: this.dryRun,
39
+ json: this.json,
40
+ force: this.force,
41
+ });
17
42
  await runCommandModule(() => import('../commands/init'));
18
43
  }
19
44
  }
20
45
 
46
+ class CreateCommand extends ProteumCommand {
47
+ public static paths = [['create']];
48
+
49
+ public static usage = buildUsage('create');
50
+
51
+ public route = Option.String('--route', { description: 'Explicit URL path used for page or route scaffolds.' });
52
+ public method = Option.String('--method', { description: 'Method name used for controller or command scaffolds.' });
53
+ public httpMethod = Option.String('--http-method', { description: 'HTTP verb used for route scaffolds.' });
54
+ public json = Option.Boolean('--json', false, { description: 'Print machine-readable scaffold output.' });
55
+ public dryRun = Option.Boolean('--dry-run', false, { description: 'Print the scaffold plan without writing files.' });
56
+ public force = Option.Boolean('--force', false, { description: 'Allow overwriting generated target files.' });
57
+ public args = Option.Rest();
58
+
59
+ public async execute() {
60
+ const [kind = '', target = ''] = this.args;
61
+
62
+ this.setCliArgs({
63
+ kind,
64
+ target,
65
+ route: this.route ?? '',
66
+ method: this.method ?? '',
67
+ httpMethod: this.httpMethod ?? '',
68
+ json: this.json,
69
+ dryRun: this.dryRun,
70
+ force: this.force,
71
+ });
72
+
73
+ await runCommandModule(() => import('../commands/create'));
74
+ }
75
+ }
76
+
21
77
  class DevCommand extends ProteumCommand {
22
78
  public static paths = [['dev']];
23
79
 
@@ -242,6 +298,7 @@ class CommandCommand extends ProteumCommand {
242
298
 
243
299
  export const registeredCommands = {
244
300
  init: InitCommand,
301
+ create: CreateCommand,
245
302
  dev: DevCommand,
246
303
  refresh: RefreshCommand,
247
304
  build: BuildCommand,
@@ -265,6 +322,7 @@ export const createCli = (version: string) => {
265
322
  clipanion.register(Builtins.VersionCommand);
266
323
  clipanion.register(Builtins.DefinitionsCommand);
267
324
  clipanion.register(InitCommand);
325
+ clipanion.register(CreateCommand);
268
326
  clipanion.register(DevCommand);
269
327
  clipanion.register(RefreshCommand);
270
328
  clipanion.register(BuildCommand);