@adonisjs/assembler 5.8.1 → 5.9.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.
Files changed (66) hide show
  1. package/build/ace-manifest.json +17 -11
  2. package/build/commands/Build.d.ts +37 -37
  3. package/build/commands/Build.js +138 -138
  4. package/build/commands/Invoke.d.ts +34 -34
  5. package/build/commands/Invoke.js +221 -217
  6. package/build/commands/Make/Base.d.ts +30 -30
  7. package/build/commands/Make/Base.js +75 -75
  8. package/build/commands/Make/Command.d.ts +35 -35
  9. package/build/commands/Make/Command.js +82 -82
  10. package/build/commands/Make/Controller.d.ts +37 -37
  11. package/build/commands/Make/Controller.js +89 -89
  12. package/build/commands/Make/Exception.d.ts +32 -32
  13. package/build/commands/Make/Exception.js +75 -75
  14. package/build/commands/Make/Listener.d.ts +30 -30
  15. package/build/commands/Make/Listener.js +70 -70
  16. package/build/commands/Make/Middleware.d.ts +31 -31
  17. package/build/commands/Make/Middleware.js +87 -87
  18. package/build/commands/Make/PreloadFile.d.ts +38 -38
  19. package/build/commands/Make/PreloadFile.js +157 -157
  20. package/build/commands/Make/Provider.d.ts +31 -31
  21. package/build/commands/Make/Provider.js +114 -114
  22. package/build/commands/Make/Suite.d.ts +41 -41
  23. package/build/commands/Make/Suite.js +120 -120
  24. package/build/commands/Make/Test.d.ts +35 -35
  25. package/build/commands/Make/Test.js +96 -96
  26. package/build/commands/Make/Validator.d.ts +31 -31
  27. package/build/commands/Make/Validator.js +71 -71
  28. package/build/commands/Make/View.d.ts +30 -30
  29. package/build/commands/Make/View.js +70 -70
  30. package/build/commands/Serve.d.ts +33 -33
  31. package/build/commands/Serve.js +112 -112
  32. package/build/commands/Test.d.ts +57 -53
  33. package/build/commands/Test.js +159 -152
  34. package/build/commands/TypeCheck.d.ts +16 -16
  35. package/build/commands/TypeCheck.js +85 -85
  36. package/build/config/paths.d.ts +7 -7
  37. package/build/config/paths.js +18 -18
  38. package/build/register.d.ts +1 -1
  39. package/build/register.js +15 -15
  40. package/build/src/AssetsBundler/index.d.ts +76 -76
  41. package/build/src/AssetsBundler/index.js +216 -216
  42. package/build/src/Compiler/index.d.ts +62 -62
  43. package/build/src/Compiler/index.js +287 -287
  44. package/build/src/Contracts/index.d.ts +8 -8
  45. package/build/src/Contracts/index.js +10 -10
  46. package/build/src/DevServer/index.d.ts +70 -70
  47. package/build/src/DevServer/index.js +306 -306
  48. package/build/src/EnvParser/index.d.ts +23 -23
  49. package/build/src/EnvParser/index.js +52 -52
  50. package/build/src/HttpServer/index.d.ts +34 -34
  51. package/build/src/HttpServer/index.js +87 -87
  52. package/build/src/Manifest/index.d.ts +32 -32
  53. package/build/src/Manifest/index.js +88 -88
  54. package/build/src/RcFile/index.d.ts +72 -72
  55. package/build/src/RcFile/index.js +174 -174
  56. package/build/src/Test/index.d.ts +75 -75
  57. package/build/src/Test/index.js +346 -346
  58. package/build/src/Test/process.d.ts +22 -22
  59. package/build/src/Test/process.js +68 -68
  60. package/build/src/Ts/index.d.ts +24 -24
  61. package/build/src/Ts/index.js +55 -55
  62. package/build/src/requireHook/index.d.ts +5 -5
  63. package/build/src/requireHook/index.js +28 -28
  64. package/build/src/requireHook/ioc-transformer.d.ts +6 -6
  65. package/build/src/requireHook/ioc-transformer.js +21 -21
  66. package/package.json +16 -16
@@ -1,75 +1,75 @@
1
- "use strict";
2
- /*
3
- * @adonisjs/assembler
4
- *
5
- * (c) Harminder Virk <virk@adonisjs.com>
6
- *
7
- * For the full copyright and license information, please view the LICENSE
8
- * file that was distributed with this source code.
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.BaseGenerator = void 0;
12
- const path_1 = require("path");
13
- const fs_extra_1 = require("fs-extra");
14
- const standalone_1 = require("@adonisjs/core/build/standalone");
15
- /**
16
- * Base class to generate framework entities
17
- */
18
- class BaseGenerator extends standalone_1.BaseCommand {
19
- constructor() {
20
- super(...arguments);
21
- this.extname = '.ts';
22
- }
23
- templateData() {
24
- return {};
25
- }
26
- /**
27
- * Returns path for a given namespace by replacing the base namespace
28
- * with the defined directories map inside the `.adonisrc.json`
29
- * file
30
- */
31
- getPathForNamespace(namespaceFor) {
32
- return this.application.resolveNamespaceDirectory(namespaceFor);
33
- }
34
- /**
35
- * Returns contents of the rcFile
36
- */
37
- async hasRcFile(cwd) {
38
- const filePath = (0, path_1.join)(cwd, '.adonisrc.json');
39
- return (0, fs_extra_1.pathExists)(filePath);
40
- }
41
- /**
42
- * Handle command
43
- */
44
- async generate() {
45
- const hasRcFile = await this.hasRcFile(this.application.appRoot);
46
- /**
47
- * Ensure `.adonisrc.json` file exists
48
- */
49
- if (!hasRcFile) {
50
- this.logger.error('Make sure your project root has ".adonisrc.json" file');
51
- return;
52
- }
53
- const transformations = this.createExact
54
- ? {
55
- extname: this.extname,
56
- }
57
- : {
58
- form: this.form,
59
- suffix: this.suffix,
60
- formIgnoreList: this.formIgnoreList,
61
- pattern: this.pattern,
62
- extname: this.extname,
63
- };
64
- const file = this.generator
65
- .addFile(this.resourceName, transformations)
66
- .stub(this.getStub())
67
- .useMustache()
68
- .destinationDir(this.getDestinationPath())
69
- .appRoot(this.application.appRoot)
70
- .apply(this.templateData());
71
- await this.generator.run();
72
- return file;
73
- }
74
- }
75
- exports.BaseGenerator = BaseGenerator;
1
+ "use strict";
2
+ /*
3
+ * @adonisjs/assembler
4
+ *
5
+ * (c) Harminder Virk <virk@adonisjs.com>
6
+ *
7
+ * For the full copyright and license information, please view the LICENSE
8
+ * file that was distributed with this source code.
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.BaseGenerator = void 0;
12
+ const path_1 = require("path");
13
+ const fs_extra_1 = require("fs-extra");
14
+ const standalone_1 = require("@adonisjs/core/build/standalone");
15
+ /**
16
+ * Base class to generate framework entities
17
+ */
18
+ class BaseGenerator extends standalone_1.BaseCommand {
19
+ constructor() {
20
+ super(...arguments);
21
+ this.extname = '.ts';
22
+ }
23
+ templateData() {
24
+ return {};
25
+ }
26
+ /**
27
+ * Returns path for a given namespace by replacing the base namespace
28
+ * with the defined directories map inside the `.adonisrc.json`
29
+ * file
30
+ */
31
+ getPathForNamespace(namespaceFor) {
32
+ return this.application.resolveNamespaceDirectory(namespaceFor);
33
+ }
34
+ /**
35
+ * Returns contents of the rcFile
36
+ */
37
+ async hasRcFile(cwd) {
38
+ const filePath = (0, path_1.join)(cwd, '.adonisrc.json');
39
+ return (0, fs_extra_1.pathExists)(filePath);
40
+ }
41
+ /**
42
+ * Handle command
43
+ */
44
+ async generate() {
45
+ const hasRcFile = await this.hasRcFile(this.application.appRoot);
46
+ /**
47
+ * Ensure `.adonisrc.json` file exists
48
+ */
49
+ if (!hasRcFile) {
50
+ this.logger.error('Make sure your project root has ".adonisrc.json" file');
51
+ return;
52
+ }
53
+ const transformations = this.createExact
54
+ ? {
55
+ extname: this.extname,
56
+ }
57
+ : {
58
+ form: this.form,
59
+ suffix: this.suffix,
60
+ formIgnoreList: this.formIgnoreList,
61
+ pattern: this.pattern,
62
+ extname: this.extname,
63
+ };
64
+ const file = this.generator
65
+ .addFile(this.resourceName, transformations)
66
+ .stub(this.getStub())
67
+ .useMustache()
68
+ .destinationDir(this.getDestinationPath())
69
+ .appRoot(this.application.appRoot)
70
+ .apply(this.templateData());
71
+ await this.generator.run();
72
+ return file;
73
+ }
74
+ }
75
+ exports.BaseGenerator = BaseGenerator;
@@ -1,35 +1,35 @@
1
- import { BaseGenerator } from './Base';
2
- /**
3
- * Command to make a new command
4
- */
5
- export default class MakeCommand extends BaseGenerator {
6
- /**
7
- * Required by BaseGenerator
8
- */
9
- protected pattern: "pascalcase";
10
- protected resourceName: string;
11
- protected createExact: boolean;
12
- /**
13
- * Command meta data
14
- */
15
- static commandName: string;
16
- static description: string;
17
- name: string;
18
- exact: boolean;
19
- /**
20
- * Returns the template stub based upon the `--resource`
21
- * flag value
22
- */
23
- protected getStub(): string;
24
- /**
25
- * Path to the commands directory
26
- */
27
- protected getDestinationPath(): string;
28
- /**
29
- * Passed down to the template.
30
- */
31
- protected templateData(): {
32
- toCommandName: () => (filename: string, render: any) => string;
33
- };
34
- run(): Promise<void>;
35
- }
1
+ import { BaseGenerator } from './Base';
2
+ /**
3
+ * Command to make a new command
4
+ */
5
+ export default class MakeCommand extends BaseGenerator {
6
+ /**
7
+ * Required by BaseGenerator
8
+ */
9
+ protected pattern: "pascalcase";
10
+ protected resourceName: string;
11
+ protected createExact: boolean;
12
+ /**
13
+ * Command meta data
14
+ */
15
+ static commandName: string;
16
+ static description: string;
17
+ name: string;
18
+ exact: boolean;
19
+ /**
20
+ * Returns the template stub based upon the `--resource`
21
+ * flag value
22
+ */
23
+ protected getStub(): string;
24
+ /**
25
+ * Path to the commands directory
26
+ */
27
+ protected getDestinationPath(): string;
28
+ /**
29
+ * Passed down to the template.
30
+ */
31
+ protected templateData(): {
32
+ toCommandName: () => (filename: string, render: any) => string;
33
+ };
34
+ run(): Promise<void>;
35
+ }
@@ -1,82 +1,82 @@
1
- "use strict";
2
- /*
3
- * @adonisjs/assembler
4
- *
5
- * (c) Harminder Virk <virk@adonisjs.com>
6
- *
7
- * For the full copyright and license information, please view the LICENSE
8
- * file that was distributed with this source code.
9
- */
10
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
11
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
13
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
14
- return c > 3 && r && Object.defineProperty(target, key, r), r;
15
- };
16
- var __metadata = (this && this.__metadata) || function (k, v) {
17
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
18
- };
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- const path_1 = require("path");
21
- const standalone_1 = require("@adonisjs/core/build/standalone");
22
- const helpers_1 = require("@poppinss/utils/build/helpers");
23
- const Base_1 = require("./Base");
24
- /**
25
- * Command to make a new command
26
- */
27
- class MakeCommand extends Base_1.BaseGenerator {
28
- constructor() {
29
- super(...arguments);
30
- /**
31
- * Required by BaseGenerator
32
- */
33
- this.pattern = 'pascalcase';
34
- }
35
- /**
36
- * Returns the template stub based upon the `--resource`
37
- * flag value
38
- */
39
- getStub() {
40
- return (0, path_1.join)(__dirname, '..', '..', 'templates', 'command.txt');
41
- }
42
- /**
43
- * Path to the commands directory
44
- */
45
- getDestinationPath() {
46
- return this.application.rcFile.directories.commands || 'commands';
47
- }
48
- /**
49
- * Passed down to the template.
50
- */
51
- templateData() {
52
- return {
53
- toCommandName: () => {
54
- return function (filename, render) {
55
- return helpers_1.string.snakeCase(render(filename)).replace(/_/, ':');
56
- };
57
- },
58
- };
59
- }
60
- async run() {
61
- this.resourceName = this.name;
62
- this.createExact = this.exact;
63
- await super.generate();
64
- }
65
- }
66
- /**
67
- * Command meta data
68
- */
69
- MakeCommand.commandName = 'make:command';
70
- MakeCommand.description = 'Make a new ace command';
71
- __decorate([
72
- standalone_1.args.string({ description: 'Name of the command class' }),
73
- __metadata("design:type", String)
74
- ], MakeCommand.prototype, "name", void 0);
75
- __decorate([
76
- standalone_1.flags.boolean({
77
- description: 'Create the command with the exact name as provided',
78
- alias: 'e',
79
- }),
80
- __metadata("design:type", Boolean)
81
- ], MakeCommand.prototype, "exact", void 0);
82
- exports.default = MakeCommand;
1
+ "use strict";
2
+ /*
3
+ * @adonisjs/assembler
4
+ *
5
+ * (c) Harminder Virk <virk@adonisjs.com>
6
+ *
7
+ * For the full copyright and license information, please view the LICENSE
8
+ * file that was distributed with this source code.
9
+ */
10
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
11
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
13
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
14
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
15
+ };
16
+ var __metadata = (this && this.__metadata) || function (k, v) {
17
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ const path_1 = require("path");
21
+ const standalone_1 = require("@adonisjs/core/build/standalone");
22
+ const helpers_1 = require("@poppinss/utils/build/helpers");
23
+ const Base_1 = require("./Base");
24
+ /**
25
+ * Command to make a new command
26
+ */
27
+ class MakeCommand extends Base_1.BaseGenerator {
28
+ constructor() {
29
+ super(...arguments);
30
+ /**
31
+ * Required by BaseGenerator
32
+ */
33
+ this.pattern = 'pascalcase';
34
+ }
35
+ /**
36
+ * Returns the template stub based upon the `--resource`
37
+ * flag value
38
+ */
39
+ getStub() {
40
+ return (0, path_1.join)(__dirname, '..', '..', 'templates', 'command.txt');
41
+ }
42
+ /**
43
+ * Path to the commands directory
44
+ */
45
+ getDestinationPath() {
46
+ return this.application.rcFile.directories.commands || 'commands';
47
+ }
48
+ /**
49
+ * Passed down to the template.
50
+ */
51
+ templateData() {
52
+ return {
53
+ toCommandName: () => {
54
+ return function (filename, render) {
55
+ return helpers_1.string.snakeCase(render(filename)).replace(/_/, ':');
56
+ };
57
+ },
58
+ };
59
+ }
60
+ async run() {
61
+ this.resourceName = this.name;
62
+ this.createExact = this.exact;
63
+ await super.generate();
64
+ }
65
+ }
66
+ /**
67
+ * Command meta data
68
+ */
69
+ MakeCommand.commandName = 'make:command';
70
+ MakeCommand.description = 'Make a new ace command';
71
+ __decorate([
72
+ standalone_1.args.string({ description: 'Name of the command class' }),
73
+ __metadata("design:type", String)
74
+ ], MakeCommand.prototype, "name", void 0);
75
+ __decorate([
76
+ standalone_1.flags.boolean({
77
+ description: 'Create the command with the exact name as provided',
78
+ alias: 'e',
79
+ }),
80
+ __metadata("design:type", Boolean)
81
+ ], MakeCommand.prototype, "exact", void 0);
82
+ exports.default = MakeCommand;
@@ -1,37 +1,37 @@
1
- import { BaseGenerator } from './Base';
2
- /**
3
- * Command to make a new HTTP Controller
4
- */
5
- export default class MakeController extends BaseGenerator {
6
- /**
7
- * Required by BaseGenerator
8
- */
9
- protected suffix: string;
10
- protected form: "plural";
11
- protected pattern: "pascalcase";
12
- protected resourceName: string;
13
- protected createExact: boolean;
14
- /**
15
- * Do not pluralize following controller names
16
- */
17
- protected formIgnoreList: string[];
18
- /**
19
- * Command meta data
20
- */
21
- static commandName: string;
22
- static description: string;
23
- name: string;
24
- resource: boolean;
25
- exact: boolean;
26
- /**
27
- * Returns the template stub based upon the `--resource`
28
- * flag value
29
- */
30
- protected getStub(): string;
31
- /**
32
- * Pull path from the `httpControllers` directory declaration from
33
- * the `.adonisrc.json` file or fallback to `app/Controllers/Http`
34
- */
35
- protected getDestinationPath(): string;
36
- run(): Promise<void>;
37
- }
1
+ import { BaseGenerator } from './Base';
2
+ /**
3
+ * Command to make a new HTTP Controller
4
+ */
5
+ export default class MakeController extends BaseGenerator {
6
+ /**
7
+ * Required by BaseGenerator
8
+ */
9
+ protected suffix: string;
10
+ protected form: "plural";
11
+ protected pattern: "pascalcase";
12
+ protected resourceName: string;
13
+ protected createExact: boolean;
14
+ /**
15
+ * Do not pluralize following controller names
16
+ */
17
+ protected formIgnoreList: string[];
18
+ /**
19
+ * Command meta data
20
+ */
21
+ static commandName: string;
22
+ static description: string;
23
+ name: string;
24
+ resource: boolean;
25
+ exact: boolean;
26
+ /**
27
+ * Returns the template stub based upon the `--resource`
28
+ * flag value
29
+ */
30
+ protected getStub(): string;
31
+ /**
32
+ * Pull path from the `httpControllers` directory declaration from
33
+ * the `.adonisrc.json` file or fallback to `app/Controllers/Http`
34
+ */
35
+ protected getDestinationPath(): string;
36
+ run(): Promise<void>;
37
+ }
@@ -1,89 +1,89 @@
1
- "use strict";
2
- /*
3
- * @adonisjs/assembler
4
- *
5
- * (c) Harminder Virk <virk@adonisjs.com>
6
- *
7
- * For the full copyright and license information, please view the LICENSE
8
- * file that was distributed with this source code.
9
- */
10
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
11
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
13
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
14
- return c > 3 && r && Object.defineProperty(target, key, r), r;
15
- };
16
- var __metadata = (this && this.__metadata) || function (k, v) {
17
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
18
- };
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- const path_1 = require("path");
21
- const standalone_1 = require("@adonisjs/core/build/standalone");
22
- const Base_1 = require("./Base");
23
- /**
24
- * Command to make a new HTTP Controller
25
- */
26
- class MakeController extends Base_1.BaseGenerator {
27
- constructor() {
28
- super(...arguments);
29
- /**
30
- * Required by BaseGenerator
31
- */
32
- this.suffix = 'Controller';
33
- this.form = 'plural';
34
- this.pattern = 'pascalcase';
35
- /**
36
- * Do not pluralize following controller names
37
- */
38
- this.formIgnoreList = [
39
- 'Home',
40
- 'Auth',
41
- 'Login',
42
- 'Authentication',
43
- 'Adonis',
44
- 'Dashboard',
45
- 'Signup',
46
- 'Api',
47
- ];
48
- }
49
- /**
50
- * Returns the template stub based upon the `--resource`
51
- * flag value
52
- */
53
- getStub() {
54
- return (0, path_1.join)(__dirname, '..', '..', 'templates', this.resource ? 'resource-controller.txt' : 'controller.txt');
55
- }
56
- /**
57
- * Pull path from the `httpControllers` directory declaration from
58
- * the `.adonisrc.json` file or fallback to `app/Controllers/Http`
59
- */
60
- getDestinationPath() {
61
- return this.getPathForNamespace('httpControllers') || 'app/Controllers/Http';
62
- }
63
- async run() {
64
- this.resourceName = this.name;
65
- this.createExact = this.exact;
66
- await super.generate();
67
- }
68
- }
69
- /**
70
- * Command meta data
71
- */
72
- MakeController.commandName = 'make:controller';
73
- MakeController.description = 'Make a new HTTP controller';
74
- __decorate([
75
- standalone_1.args.string({ description: 'Name of the controller class' }),
76
- __metadata("design:type", String)
77
- ], MakeController.prototype, "name", void 0);
78
- __decorate([
79
- standalone_1.flags.boolean({ description: 'Add resourceful methods to the controller class', alias: 'r' }),
80
- __metadata("design:type", Boolean)
81
- ], MakeController.prototype, "resource", void 0);
82
- __decorate([
83
- standalone_1.flags.boolean({
84
- description: 'Create the controller with the exact name as provided',
85
- alias: 'e',
86
- }),
87
- __metadata("design:type", Boolean)
88
- ], MakeController.prototype, "exact", void 0);
89
- exports.default = MakeController;
1
+ "use strict";
2
+ /*
3
+ * @adonisjs/assembler
4
+ *
5
+ * (c) Harminder Virk <virk@adonisjs.com>
6
+ *
7
+ * For the full copyright and license information, please view the LICENSE
8
+ * file that was distributed with this source code.
9
+ */
10
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
11
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
13
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
14
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
15
+ };
16
+ var __metadata = (this && this.__metadata) || function (k, v) {
17
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ const path_1 = require("path");
21
+ const standalone_1 = require("@adonisjs/core/build/standalone");
22
+ const Base_1 = require("./Base");
23
+ /**
24
+ * Command to make a new HTTP Controller
25
+ */
26
+ class MakeController extends Base_1.BaseGenerator {
27
+ constructor() {
28
+ super(...arguments);
29
+ /**
30
+ * Required by BaseGenerator
31
+ */
32
+ this.suffix = 'Controller';
33
+ this.form = 'plural';
34
+ this.pattern = 'pascalcase';
35
+ /**
36
+ * Do not pluralize following controller names
37
+ */
38
+ this.formIgnoreList = [
39
+ 'Home',
40
+ 'Auth',
41
+ 'Login',
42
+ 'Authentication',
43
+ 'Adonis',
44
+ 'Dashboard',
45
+ 'Signup',
46
+ 'Api',
47
+ ];
48
+ }
49
+ /**
50
+ * Returns the template stub based upon the `--resource`
51
+ * flag value
52
+ */
53
+ getStub() {
54
+ return (0, path_1.join)(__dirname, '..', '..', 'templates', this.resource ? 'resource-controller.txt' : 'controller.txt');
55
+ }
56
+ /**
57
+ * Pull path from the `httpControllers` directory declaration from
58
+ * the `.adonisrc.json` file or fallback to `app/Controllers/Http`
59
+ */
60
+ getDestinationPath() {
61
+ return this.getPathForNamespace('httpControllers') || 'app/Controllers/Http';
62
+ }
63
+ async run() {
64
+ this.resourceName = this.name;
65
+ this.createExact = this.exact;
66
+ await super.generate();
67
+ }
68
+ }
69
+ /**
70
+ * Command meta data
71
+ */
72
+ MakeController.commandName = 'make:controller';
73
+ MakeController.description = 'Make a new HTTP controller';
74
+ __decorate([
75
+ standalone_1.args.string({ description: 'Name of the controller class' }),
76
+ __metadata("design:type", String)
77
+ ], MakeController.prototype, "name", void 0);
78
+ __decorate([
79
+ standalone_1.flags.boolean({ description: 'Add resourceful methods to the controller class', alias: 'r' }),
80
+ __metadata("design:type", Boolean)
81
+ ], MakeController.prototype, "resource", void 0);
82
+ __decorate([
83
+ standalone_1.flags.boolean({
84
+ description: 'Create the controller with the exact name as provided',
85
+ alias: 'e',
86
+ }),
87
+ __metadata("design:type", Boolean)
88
+ ], MakeController.prototype, "exact", void 0);
89
+ exports.default = MakeController;