@adonisjs/assembler 5.9.0 → 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 +11 -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 -221
  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 -57
  33. package/build/commands/Test.js +159 -159
  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 +1 -1
@@ -1,96 +1,96 @@
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
- var __importDefault = (this && this.__importDefault) || function (mod) {
20
- return (mod && mod.__esModule) ? mod : { "default": mod };
21
- };
22
- Object.defineProperty(exports, "__esModule", { value: true });
23
- const path_1 = require("path");
24
- const glob_parent_1 = __importDefault(require("glob-parent"));
25
- const helpers_1 = require("@poppinss/utils/build/helpers");
26
- const standalone_1 = require("@adonisjs/core/build/standalone");
27
- const Base_1 = require("./Base");
28
- /**
29
- * Command to make a new test
30
- */
31
- class MakeTest extends Base_1.BaseGenerator {
32
- constructor() {
33
- super(...arguments);
34
- /**
35
- * Required by BaseGenerator
36
- */
37
- this.extname = '.spec.ts';
38
- this.form = 'singular';
39
- this.pattern = 'snakecase';
40
- }
41
- /**
42
- * Returns the template stub path
43
- */
44
- getStub() {
45
- return (0, path_1.join)(__dirname, '..', '..', 'templates', 'test.txt');
46
- }
47
- /**
48
- * The file is created inside the parent directory of the first
49
- * glob pattern
50
- */
51
- getDestinationPath() {
52
- const testSuites = this.application.rcFile.tests.suites;
53
- const mentionedSuite = testSuites.find(({ name }) => this.suite === name);
54
- const suiteGlob = Array.isArray(mentionedSuite.files)
55
- ? mentionedSuite.files[0]
56
- : mentionedSuite.files;
57
- return (0, glob_parent_1.default)(suiteGlob);
58
- }
59
- templateData() {
60
- return {
61
- name: helpers_1.string.sentenceCase(this.name),
62
- };
63
- }
64
- async run() {
65
- const testSuites = this.application.rcFile.tests.suites;
66
- const mentionedSuite = testSuites.find(({ name }) => this.suite === name);
67
- if (!mentionedSuite) {
68
- this.logger.error(`Invalid suite "${this.suite}". Make sure the suite is registered inside the .adonisrc.json file`);
69
- return;
70
- }
71
- this.resourceName = this.name;
72
- this.createExact = this.exact;
73
- await super.generate();
74
- }
75
- }
76
- /**
77
- * Command meta data
78
- */
79
- MakeTest.commandName = 'make:test';
80
- MakeTest.description = 'Make a new test';
81
- __decorate([
82
- standalone_1.args.string({ description: 'Name of the test suite' }),
83
- __metadata("design:type", String)
84
- ], MakeTest.prototype, "suite", void 0);
85
- __decorate([
86
- standalone_1.args.string({ description: 'Name of the test file' }),
87
- __metadata("design:type", String)
88
- ], MakeTest.prototype, "name", void 0);
89
- __decorate([
90
- standalone_1.flags.boolean({
91
- description: 'Create the test file with the exact name as provided',
92
- alias: 'e',
93
- }),
94
- __metadata("design:type", Boolean)
95
- ], MakeTest.prototype, "exact", void 0);
96
- exports.default = MakeTest;
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
20
+ return (mod && mod.__esModule) ? mod : { "default": mod };
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ const path_1 = require("path");
24
+ const glob_parent_1 = __importDefault(require("glob-parent"));
25
+ const helpers_1 = require("@poppinss/utils/build/helpers");
26
+ const standalone_1 = require("@adonisjs/core/build/standalone");
27
+ const Base_1 = require("./Base");
28
+ /**
29
+ * Command to make a new test
30
+ */
31
+ class MakeTest extends Base_1.BaseGenerator {
32
+ constructor() {
33
+ super(...arguments);
34
+ /**
35
+ * Required by BaseGenerator
36
+ */
37
+ this.extname = '.spec.ts';
38
+ this.form = 'singular';
39
+ this.pattern = 'snakecase';
40
+ }
41
+ /**
42
+ * Returns the template stub path
43
+ */
44
+ getStub() {
45
+ return (0, path_1.join)(__dirname, '..', '..', 'templates', 'test.txt');
46
+ }
47
+ /**
48
+ * The file is created inside the parent directory of the first
49
+ * glob pattern
50
+ */
51
+ getDestinationPath() {
52
+ const testSuites = this.application.rcFile.tests.suites;
53
+ const mentionedSuite = testSuites.find(({ name }) => this.suite === name);
54
+ const suiteGlob = Array.isArray(mentionedSuite.files)
55
+ ? mentionedSuite.files[0]
56
+ : mentionedSuite.files;
57
+ return (0, glob_parent_1.default)(suiteGlob);
58
+ }
59
+ templateData() {
60
+ return {
61
+ name: helpers_1.string.sentenceCase(this.name),
62
+ };
63
+ }
64
+ async run() {
65
+ const testSuites = this.application.rcFile.tests.suites;
66
+ const mentionedSuite = testSuites.find(({ name }) => this.suite === name);
67
+ if (!mentionedSuite) {
68
+ this.logger.error(`Invalid suite "${this.suite}". Make sure the suite is registered inside the .adonisrc.json file`);
69
+ return;
70
+ }
71
+ this.resourceName = this.name;
72
+ this.createExact = this.exact;
73
+ await super.generate();
74
+ }
75
+ }
76
+ /**
77
+ * Command meta data
78
+ */
79
+ MakeTest.commandName = 'make:test';
80
+ MakeTest.description = 'Make a new test';
81
+ __decorate([
82
+ standalone_1.args.string({ description: 'Name of the test suite' }),
83
+ __metadata("design:type", String)
84
+ ], MakeTest.prototype, "suite", void 0);
85
+ __decorate([
86
+ standalone_1.args.string({ description: 'Name of the test file' }),
87
+ __metadata("design:type", String)
88
+ ], MakeTest.prototype, "name", void 0);
89
+ __decorate([
90
+ standalone_1.flags.boolean({
91
+ description: 'Create the test file with the exact name as provided',
92
+ alias: 'e',
93
+ }),
94
+ __metadata("design:type", Boolean)
95
+ ], MakeTest.prototype, "exact", void 0);
96
+ exports.default = MakeTest;
@@ -1,31 +1,31 @@
1
- import { BaseGenerator } from './Base';
2
- /**
3
- * Command to make a new validator
4
- */
5
- export default class MakeValidator extends BaseGenerator {
6
- /**
7
- * Required by BaseGenerator
8
- */
9
- protected suffix: string;
10
- protected form: "singular";
11
- protected pattern: "pascalcase";
12
- protected resourceName: string;
13
- protected createExact: boolean;
14
- /**
15
- * Command meta data
16
- */
17
- static commandName: string;
18
- static description: string;
19
- name: string;
20
- exact: boolean;
21
- /**
22
- * Returns the template stub path
23
- */
24
- protected getStub(): string;
25
- /**
26
- * Pull path for the `validators` directory declaration from
27
- * the `.adonisrc.json` file or fallback to `app/Validators`
28
- */
29
- protected getDestinationPath(): string;
30
- run(): Promise<void>;
31
- }
1
+ import { BaseGenerator } from './Base';
2
+ /**
3
+ * Command to make a new validator
4
+ */
5
+ export default class MakeValidator extends BaseGenerator {
6
+ /**
7
+ * Required by BaseGenerator
8
+ */
9
+ protected suffix: string;
10
+ protected form: "singular";
11
+ protected pattern: "pascalcase";
12
+ protected resourceName: string;
13
+ protected createExact: boolean;
14
+ /**
15
+ * Command meta data
16
+ */
17
+ static commandName: string;
18
+ static description: string;
19
+ name: string;
20
+ exact: boolean;
21
+ /**
22
+ * Returns the template stub path
23
+ */
24
+ protected getStub(): string;
25
+ /**
26
+ * Pull path for the `validators` directory declaration from
27
+ * the `.adonisrc.json` file or fallback to `app/Validators`
28
+ */
29
+ protected getDestinationPath(): string;
30
+ run(): Promise<void>;
31
+ }
@@ -1,71 +1,71 @@
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 validator
25
- */
26
- class MakeValidator extends Base_1.BaseGenerator {
27
- constructor() {
28
- super(...arguments);
29
- /**
30
- * Required by BaseGenerator
31
- */
32
- this.suffix = 'Validator';
33
- this.form = 'singular';
34
- this.pattern = 'pascalcase';
35
- }
36
- /**
37
- * Returns the template stub path
38
- */
39
- getStub() {
40
- return (0, path_1.join)(__dirname, '..', '..', 'templates', 'validator.txt');
41
- }
42
- /**
43
- * Pull path for the `validators` directory declaration from
44
- * the `.adonisrc.json` file or fallback to `app/Validators`
45
- */
46
- getDestinationPath() {
47
- return this.getPathForNamespace('validators') || 'app/Validators';
48
- }
49
- async run() {
50
- this.resourceName = this.name;
51
- this.createExact = this.exact;
52
- await super.generate();
53
- }
54
- }
55
- /**
56
- * Command meta data
57
- */
58
- MakeValidator.commandName = 'make:validator';
59
- MakeValidator.description = 'Make a new validator';
60
- __decorate([
61
- standalone_1.args.string({ description: 'Name of the validator class' }),
62
- __metadata("design:type", String)
63
- ], MakeValidator.prototype, "name", void 0);
64
- __decorate([
65
- standalone_1.flags.boolean({
66
- description: 'Create the validator with the exact name as provided',
67
- alias: 'e',
68
- }),
69
- __metadata("design:type", Boolean)
70
- ], MakeValidator.prototype, "exact", void 0);
71
- exports.default = MakeValidator;
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 validator
25
+ */
26
+ class MakeValidator extends Base_1.BaseGenerator {
27
+ constructor() {
28
+ super(...arguments);
29
+ /**
30
+ * Required by BaseGenerator
31
+ */
32
+ this.suffix = 'Validator';
33
+ this.form = 'singular';
34
+ this.pattern = 'pascalcase';
35
+ }
36
+ /**
37
+ * Returns the template stub path
38
+ */
39
+ getStub() {
40
+ return (0, path_1.join)(__dirname, '..', '..', 'templates', 'validator.txt');
41
+ }
42
+ /**
43
+ * Pull path for the `validators` directory declaration from
44
+ * the `.adonisrc.json` file or fallback to `app/Validators`
45
+ */
46
+ getDestinationPath() {
47
+ return this.getPathForNamespace('validators') || 'app/Validators';
48
+ }
49
+ async run() {
50
+ this.resourceName = this.name;
51
+ this.createExact = this.exact;
52
+ await super.generate();
53
+ }
54
+ }
55
+ /**
56
+ * Command meta data
57
+ */
58
+ MakeValidator.commandName = 'make:validator';
59
+ MakeValidator.description = 'Make a new validator';
60
+ __decorate([
61
+ standalone_1.args.string({ description: 'Name of the validator class' }),
62
+ __metadata("design:type", String)
63
+ ], MakeValidator.prototype, "name", void 0);
64
+ __decorate([
65
+ standalone_1.flags.boolean({
66
+ description: 'Create the validator with the exact name as provided',
67
+ alias: 'e',
68
+ }),
69
+ __metadata("design:type", Boolean)
70
+ ], MakeValidator.prototype, "exact", void 0);
71
+ exports.default = MakeValidator;
@@ -1,30 +1,30 @@
1
- import { BaseGenerator } from './Base';
2
- /**
3
- * Command to make a new view
4
- */
5
- export default class MakeView extends BaseGenerator {
6
- /**
7
- * Required by BaseGenerator
8
- */
9
- protected suffix: string;
10
- protected extname: string;
11
- protected pattern: "snakecase";
12
- protected resourceName: string;
13
- protected createExact: boolean;
14
- /**
15
- * Command meta data
16
- */
17
- static commandName: string;
18
- static description: string;
19
- name: string;
20
- exact: boolean;
21
- /**
22
- * Returns the template stub path
23
- */
24
- protected getStub(): string;
25
- /**
26
- * Path to the providers directory
27
- */
28
- protected getDestinationPath(): string;
29
- run(): Promise<void>;
30
- }
1
+ import { BaseGenerator } from './Base';
2
+ /**
3
+ * Command to make a new view
4
+ */
5
+ export default class MakeView extends BaseGenerator {
6
+ /**
7
+ * Required by BaseGenerator
8
+ */
9
+ protected suffix: string;
10
+ protected extname: string;
11
+ protected pattern: "snakecase";
12
+ protected resourceName: string;
13
+ protected createExact: boolean;
14
+ /**
15
+ * Command meta data
16
+ */
17
+ static commandName: string;
18
+ static description: string;
19
+ name: string;
20
+ exact: boolean;
21
+ /**
22
+ * Returns the template stub path
23
+ */
24
+ protected getStub(): string;
25
+ /**
26
+ * Path to the providers directory
27
+ */
28
+ protected getDestinationPath(): string;
29
+ run(): Promise<void>;
30
+ }
@@ -1,70 +1,70 @@
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 view
25
- */
26
- class MakeView extends Base_1.BaseGenerator {
27
- constructor() {
28
- super(...arguments);
29
- /**
30
- * Required by BaseGenerator
31
- */
32
- this.suffix = '';
33
- this.extname = '.edge';
34
- this.pattern = 'snakecase';
35
- }
36
- /**
37
- * Returns the template stub path
38
- */
39
- getStub() {
40
- return (0, path_1.join)(__dirname, '..', '..', 'templates', 'view.txt');
41
- }
42
- /**
43
- * Path to the providers directory
44
- */
45
- getDestinationPath() {
46
- return this.application.rcFile.directories.views || 'resources/views';
47
- }
48
- async run() {
49
- this.resourceName = this.name;
50
- this.createExact = this.exact;
51
- await super.generate();
52
- }
53
- }
54
- /**
55
- * Command meta data
56
- */
57
- MakeView.commandName = 'make:view';
58
- MakeView.description = 'Make a new view template';
59
- __decorate([
60
- standalone_1.args.string({ description: 'Name of the view' }),
61
- __metadata("design:type", String)
62
- ], MakeView.prototype, "name", void 0);
63
- __decorate([
64
- standalone_1.flags.boolean({
65
- description: 'Create the template file with the exact name as provided',
66
- alias: 'e',
67
- }),
68
- __metadata("design:type", Boolean)
69
- ], MakeView.prototype, "exact", void 0);
70
- exports.default = MakeView;
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 view
25
+ */
26
+ class MakeView extends Base_1.BaseGenerator {
27
+ constructor() {
28
+ super(...arguments);
29
+ /**
30
+ * Required by BaseGenerator
31
+ */
32
+ this.suffix = '';
33
+ this.extname = '.edge';
34
+ this.pattern = 'snakecase';
35
+ }
36
+ /**
37
+ * Returns the template stub path
38
+ */
39
+ getStub() {
40
+ return (0, path_1.join)(__dirname, '..', '..', 'templates', 'view.txt');
41
+ }
42
+ /**
43
+ * Path to the providers directory
44
+ */
45
+ getDestinationPath() {
46
+ return this.application.rcFile.directories.views || 'resources/views';
47
+ }
48
+ async run() {
49
+ this.resourceName = this.name;
50
+ this.createExact = this.exact;
51
+ await super.generate();
52
+ }
53
+ }
54
+ /**
55
+ * Command meta data
56
+ */
57
+ MakeView.commandName = 'make:view';
58
+ MakeView.description = 'Make a new view template';
59
+ __decorate([
60
+ standalone_1.args.string({ description: 'Name of the view' }),
61
+ __metadata("design:type", String)
62
+ ], MakeView.prototype, "name", void 0);
63
+ __decorate([
64
+ standalone_1.flags.boolean({
65
+ description: 'Create the template file with the exact name as provided',
66
+ alias: 'e',
67
+ }),
68
+ __metadata("design:type", Boolean)
69
+ ], MakeView.prototype, "exact", void 0);
70
+ exports.default = MakeView;