Skip to content

Commit d0fd0c3

Browse files
authored
Merge pull request #86 from bertdeblock/add-more-generators
Add controller(-test), route(-test) and util(-test) generators
2 parents 3fcdecd + 4fe0152 commit d0fd0c3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1278
-72
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,20 @@ jobs:
5151
run: |
5252
node bin/gember.js component foo --cwd=test-app
5353
node bin/gember.js component-test foo --cwd=test-app
54+
node bin/gember.js controller foo --cwd=test-app
55+
node bin/gember.js controller-test foo --cwd=test-app
5456
node bin/gember.js helper foo --cwd=test-app
5557
node bin/gember.js helper-test foo --cwd=test-app
5658
node bin/gember.js modifier foo --cwd=test-app
5759
node bin/gember.js modifier-test foo --cwd=test-app
60+
node bin/gember.js route foo --cwd=test-app
61+
node bin/gember.js route-test foo --cwd=test-app
5862
node bin/gember.js service foo --cwd=test-app
5963
node bin/gember.js service-test foo --cwd=test-app
64+
node bin/gember.js util foo --cwd=test-app
65+
node bin/gember.js util-test foo --cwd=test-app
6066
- name: Run tests in test app
6167
run: |
6268
cd test-app
69+
pnpm lint:format
6370
pnpm test

README.md

Lines changed: 250 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -61,23 +61,51 @@ yarn add -D @bertdeblock/gember
6161
```shell
6262
Generate components, helpers, modifiers and services in v1/v2 apps/addons. (gember v1.4.0)
6363

64-
USAGE `gember component|component-test|helper|helper-test|modifier|modifier-test|service|service-test|acceptance-test`
64+
USAGE `gember acceptance-test|component|component-test|controller|controller-test|helper|helper-test|modifier|modifier-test|route|route-test|service|service-test|util|util-test`
6565

6666
COMMANDS
6767

68+
`acceptance-test` Generate a new acceptance-test
6869
`component` Generate a new component
6970
`component-test` Generate a new component-test
71+
`controller` Generate a new controller
72+
`controller-test` Generate a new controller-test
7073
`helper` Generate a new helper
7174
`helper-test` Generate a new helper-test
7275
`modifier` Generate a new modifier
7376
`modifier-test` Generate a new modifier-test
77+
`route` Generate a new route
78+
`route-test` Generate a new route-test
7479
`service` Generate a new service
7580
`service-test` Generate a new service-test
76-
`acceptance-test` Generate a new acceptance-test
81+
`util` Generate a new util
82+
`util-test` Generate a new util-test
7783

7884
Use `gember <command> --help` for more information about a command.
7985
```
8086

87+
### acceptance-test
88+
89+
```shell
90+
Generate a new acceptance-test (acceptance-test)
91+
92+
USAGE `acceptance-test [OPTIONS] <NAME>`
93+
94+
ARGUMENTS
95+
96+
`NAME` The acceptance-test's name
97+
98+
OPTIONS
99+
100+
`--copy` Copy the generated acceptance-test to the clipboard, instead of writing it to disk
101+
`--cwd` The current working directory to run the acceptance-test generator in
102+
`-d, --destroy` Destroy a acceptance-test by name
103+
`--log` Log the generated acceptance-test to the console, instead of writing it to disk
104+
`--path` Generate a acceptance-test at a custom path, e.g. `--path=src/-private`
105+
`-ts, --typescript` Generate a `.ts` acceptance-test, instead of a `.js` acceptance-test
106+
107+
```
108+
81109
### component
82110
83111
```shell
@@ -125,6 +153,51 @@ OPTIONS
125153
126154
```
127155
156+
### controller
157+
158+
```shell
159+
Generate a new controller (controller)
160+
161+
USAGE `controller [OPTIONS] <NAME>`
162+
163+
ARGUMENTS
164+
165+
`NAME` The controller's name
166+
167+
OPTIONS
168+
169+
`--copy` Copy the generated controller to the clipboard, instead of writing it to disk
170+
`--cwd` The current working directory to run the controller generator in
171+
`-d, --destroy` Destroy a controller by name
172+
`--log` Log the generated controller to the console, instead of writing it to disk
173+
`--path` Generate a controller at a custom path, e.g. `--path=src/-private`
174+
`--test` Generate a corresponding controller-test
175+
`-ts, --typescript` Generate a `.ts` controller, instead of a `.js` controller
176+
177+
```
178+
179+
### controller-test
180+
181+
```shell
182+
Generate a new controller-test (controller-test)
183+
184+
USAGE `controller-test [OPTIONS] <NAME>`
185+
186+
ARGUMENTS
187+
188+
`NAME` The controller-test's name
189+
190+
OPTIONS
191+
192+
`--copy` Copy the generated controller-test to the clipboard, instead of writing it to disk
193+
`--cwd` The current working directory to run the controller-test generator in
194+
`-d, --destroy` Destroy a controller-test by name
195+
`--log` Log the generated controller-test to the console, instead of writing it to disk
196+
`--path` Generate a controller-test at a custom path, e.g. `--path=src/-private`
197+
`-ts, --typescript` Generate a `.ts` controller-test, instead of a `.js` controller-test
198+
199+
```
200+
128201
### helper
129202
130203
```shell
@@ -217,6 +290,51 @@ OPTIONS
217290
218291
```
219292
293+
### route
294+
295+
```shell
296+
Generate a new route (route)
297+
298+
USAGE `route [OPTIONS] <NAME>`
299+
300+
ARGUMENTS
301+
302+
`NAME` The route's name
303+
304+
OPTIONS
305+
306+
`--copy` Copy the generated route to the clipboard, instead of writing it to disk
307+
`--cwd` The current working directory to run the route generator in
308+
`-d, --destroy` Destroy a route by name
309+
`--log` Log the generated route to the console, instead of writing it to disk
310+
`--path` Generate a route at a custom path, e.g. `--path=src/-private`
311+
`--test` Generate a corresponding route-test
312+
`-ts, --typescript` Generate a `.ts` route, instead of a `.js` route
313+
314+
```
315+
316+
### route-test
317+
318+
```shell
319+
Generate a new route-test (route-test)
320+
321+
USAGE `route-test [OPTIONS] <NAME>`
322+
323+
ARGUMENTS
324+
325+
`NAME` The route-test's name
326+
327+
OPTIONS
328+
329+
`--copy` Copy the generated route-test to the clipboard, instead of writing it to disk
330+
`--cwd` The current working directory to run the route-test generator in
331+
`-d, --destroy` Destroy a route-test by name
332+
`--log` Log the generated route-test to the console, instead of writing it to disk
333+
`--path` Generate a route-test at a custom path, e.g. `--path=src/-private`
334+
`-ts, --typescript` Generate a `.ts` route-test, instead of a `.js` route-test
335+
336+
```
337+
220338
### service
221339
222340
```shell
@@ -262,25 +380,48 @@ OPTIONS
262380
263381
```
264382
265-
### acceptance-test
383+
### util
266384
267385
```shell
268-
Generate a new acceptance-test (acceptance-test)
386+
Generate a new util (util)
269387
270-
USAGE `acceptance-test [OPTIONS] <NAME>`
388+
USAGE `util [OPTIONS] <NAME>`
271389
272390
ARGUMENTS
273391
274-
`NAME` The acceptance-test's name
392+
`NAME` The util's name
275393

276394
OPTIONS
277395

278-
`--copy` Copy the generated acceptance-test to the clipboard, instead of writing it to disk
279-
`--cwd` The current working directory to run the acceptance-test generator in
280-
`-d, --destroy` Destroy a acceptance-test by name
281-
`--log` Log the generated acceptance-test to the console, instead of writing it to disk
282-
`--path` Generate a acceptance-test at a custom path, e.g. `--path=src/-private`
283-
`-ts, --typescript` Generate a `.ts` acceptance-test, instead of a `.js` acceptance-test
396+
`--copy` Copy the generated util to the clipboard, instead of writing it to disk
397+
`--cwd` The current working directory to run the util generator in
398+
`-d, --destroy` Destroy a util by name
399+
`--log` Log the generated util to the console, instead of writing it to disk
400+
`--path` Generate a util at a custom path, e.g. `--path=src/-private`
401+
`--test` Generate a corresponding util-test
402+
`-ts, --typescript` Generate a `.ts` util, instead of a `.js` util
403+
404+
```
405+
406+
### util-test
407+
408+
```shell
409+
Generate a new util-test (util-test)
410+
411+
USAGE `util-test [OPTIONS] <NAME>`
412+
413+
ARGUMENTS
414+
415+
`NAME` The util-test's name
416+
417+
OPTIONS
418+
419+
`--copy` Copy the generated util-test to the clipboard, instead of writing it to disk
420+
`--cwd` The current working directory to run the util-test generator in
421+
`-d, --destroy` Destroy a util-test by name
422+
`--log` Log the generated util-test to the console, instead of writing it to disk
423+
`--path` Generate a util-test at a custom path, e.g. `--path=src/-private`
424+
`-ts, --typescript` Generate a `.ts` util-test, instead of a `.js` util-test
284425
285426
```
286427
@@ -314,6 +455,20 @@ export default defineConfig(async () => ({}));
314455
```ts
315456
export type Config = {
316457
generators?: {
458+
"acceptance-test"?: {
459+
// Copy the generated acceptance-test to the clipboard, instead of writing it to disk:
460+
copy?: boolean;
461+
// The current working directory to run the acceptance-test generator in:
462+
cwd?: string;
463+
// Destroy a acceptance-test by name:
464+
destroy?: boolean;
465+
// Log the generated acceptance-test to the console, instead of writing it to disk:
466+
log?: boolean;
467+
// Generate a acceptance-test at a custom path, e.g. `--path=src/-private`:
468+
path?: string;
469+
// Generate a `.ts` acceptance-test, instead of a `.js` acceptance-test:
470+
typescript?: boolean;
471+
};
317472
component?: {
318473
// Generate a `class-based` component, instead of a `template-only` component:
319474
classBased?: boolean;
@@ -348,6 +503,36 @@ export type Config = {
348503
// Generate a `.gts` component-test, instead of a `.gjs` component-test:
349504
typescript?: boolean;
350505
};
506+
controller?: {
507+
// Copy the generated controller to the clipboard, instead of writing it to disk:
508+
copy?: boolean;
509+
// The current working directory to run the controller generator in:
510+
cwd?: string;
511+
// Destroy a controller by name:
512+
destroy?: boolean;
513+
// Log the generated controller to the console, instead of writing it to disk:
514+
log?: boolean;
515+
// Generate a controller at a custom path, e.g. `--path=src/-private`:
516+
path?: string;
517+
// Generate a corresponding controller-test:
518+
test?: boolean;
519+
// Generate a `.ts` controller, instead of a `.js` controller:
520+
typescript?: boolean;
521+
};
522+
"controller-test"?: {
523+
// Copy the generated controller-test to the clipboard, instead of writing it to disk:
524+
copy?: boolean;
525+
// The current working directory to run the controller-test generator in:
526+
cwd?: string;
527+
// Destroy a controller-test by name:
528+
destroy?: boolean;
529+
// Log the generated controller-test to the console, instead of writing it to disk:
530+
log?: boolean;
531+
// Generate a controller-test at a custom path, e.g. `--path=src/-private`:
532+
path?: string;
533+
// Generate a `.ts` controller-test, instead of a `.js` controller-test:
534+
typescript?: boolean;
535+
};
351536
helper?: {
352537
// Generate a `class-based` helper, instead of a `function-based` helper:
353538
classBased?: boolean;
@@ -412,6 +597,36 @@ export type Config = {
412597
// Generate a `.gts` modifier-test, instead of a `.gjs` modifier-test:
413598
typescript?: boolean;
414599
};
600+
route?: {
601+
// Copy the generated route to the clipboard, instead of writing it to disk:
602+
copy?: boolean;
603+
// The current working directory to run the route generator in:
604+
cwd?: string;
605+
// Destroy a route by name:
606+
destroy?: boolean;
607+
// Log the generated route to the console, instead of writing it to disk:
608+
log?: boolean;
609+
// Generate a route at a custom path, e.g. `--path=src/-private`:
610+
path?: string;
611+
// Generate a corresponding route-test:
612+
test?: boolean;
613+
// Generate a `.ts` route, instead of a `.js` route:
614+
typescript?: boolean;
615+
};
616+
"route-test"?: {
617+
// Copy the generated route-test to the clipboard, instead of writing it to disk:
618+
copy?: boolean;
619+
// The current working directory to run the route-test generator in:
620+
cwd?: string;
621+
// Destroy a route-test by name:
622+
destroy?: boolean;
623+
// Log the generated route-test to the console, instead of writing it to disk:
624+
log?: boolean;
625+
// Generate a route-test at a custom path, e.g. `--path=src/-private`:
626+
path?: string;
627+
// Generate a `.ts` route-test, instead of a `.js` route-test:
628+
typescript?: boolean;
629+
};
415630
service?: {
416631
// Copy the generated service to the clipboard, instead of writing it to disk:
417632
copy?: boolean;
@@ -442,18 +657,34 @@ export type Config = {
442657
// Generate a `.ts` service-test, instead of a `.js` service-test:
443658
typescript?: boolean;
444659
};
445-
"acceptance-test"?: {
446-
// Copy the generated acceptance-test to the clipboard, instead of writing it to disk:
660+
util?: {
661+
// Copy the generated util to the clipboard, instead of writing it to disk:
447662
copy?: boolean;
448-
// The current working directory to run the acceptance-test generator in:
663+
// The current working directory to run the util generator in:
449664
cwd?: string;
450-
// Destroy a acceptance-test by name:
665+
// Destroy a util by name:
451666
destroy?: boolean;
452-
// Log the generated acceptance-test to the console, instead of writing it to disk:
667+
// Log the generated util to the console, instead of writing it to disk:
453668
log?: boolean;
454-
// Generate a acceptance-test at a custom path, e.g. `--path=src/-private`:
669+
// Generate a util at a custom path, e.g. `--path=src/-private`:
455670
path?: string;
456-
// Generate a `.ts` acceptance-test, instead of a `.js` acceptance-test:
671+
// Generate a corresponding util-test:
672+
test?: boolean;
673+
// Generate a `.ts` util, instead of a `.js` util:
674+
typescript?: boolean;
675+
};
676+
"util-test"?: {
677+
// Copy the generated util-test to the clipboard, instead of writing it to disk:
678+
copy?: boolean;
679+
// The current working directory to run the util-test generator in:
680+
cwd?: string;
681+
// Destroy a util-test by name:
682+
destroy?: boolean;
683+
// Log the generated util-test to the console, instead of writing it to disk:
684+
log?: boolean;
685+
// Generate a util-test at a custom path, e.g. `--path=src/-private`:
686+
path?: string;
687+
// Generate a `.ts` util-test, instead of a `.js` util-test:
457688
typescript?: boolean;
458689
};
459690
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"build": "tsc --project tsconfig.json",
2626
"dev": "pnpm build --watch",
2727
"format": "prettier . --cache --write",
28-
"gember": "GEMBER_PATH=test/output bin/gember.js",
28+
"gember": "GEMBER_CWD=test/output bin/gember.js",
2929
"lint": "concurrently --group --prefix-colors auto \"npm:lint:*(!fix)\"",
3030
"lint:fix": "concurrently --group --prefix-colors auto \"npm:lint:*:fix\"",
3131
"lint:format": "prettier . --cache --check",

0 commit comments

Comments
 (0)