@adonisjs/assembler 5.9.5 → 6.0.0-0

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 (97) hide show
  1. package/LICENSE.md +1 -1
  2. package/build/index.d.ts +2 -0
  3. package/build/index.js +2 -0
  4. package/build/src/bundler.d.ts +10 -0
  5. package/build/src/bundler.js +133 -0
  6. package/build/src/dev_server.d.ts +13 -0
  7. package/build/src/dev_server.js +189 -0
  8. package/build/src/run.d.ts +3 -0
  9. package/build/src/run.js +19 -0
  10. package/build/src/types.d.ts +26 -0
  11. package/build/src/watch.d.ts +8 -0
  12. package/build/src/watch.js +18 -0
  13. package/package.json +77 -99
  14. package/build/ace-manifest.json +0 -521
  15. package/build/commands/Build.d.ts +0 -37
  16. package/build/commands/Build.js +0 -138
  17. package/build/commands/Invoke.d.ts +0 -34
  18. package/build/commands/Invoke.js +0 -234
  19. package/build/commands/Make/Base.d.ts +0 -30
  20. package/build/commands/Make/Base.js +0 -75
  21. package/build/commands/Make/Command.d.ts +0 -35
  22. package/build/commands/Make/Command.js +0 -82
  23. package/build/commands/Make/Controller.d.ts +0 -37
  24. package/build/commands/Make/Controller.js +0 -89
  25. package/build/commands/Make/Exception.d.ts +0 -32
  26. package/build/commands/Make/Exception.js +0 -75
  27. package/build/commands/Make/Listener.d.ts +0 -30
  28. package/build/commands/Make/Listener.js +0 -70
  29. package/build/commands/Make/Middleware.d.ts +0 -31
  30. package/build/commands/Make/Middleware.js +0 -87
  31. package/build/commands/Make/PreloadFile.d.ts +0 -38
  32. package/build/commands/Make/PreloadFile.js +0 -157
  33. package/build/commands/Make/Provider.d.ts +0 -31
  34. package/build/commands/Make/Provider.js +0 -114
  35. package/build/commands/Make/Suite.d.ts +0 -41
  36. package/build/commands/Make/Suite.js +0 -120
  37. package/build/commands/Make/Test.d.ts +0 -35
  38. package/build/commands/Make/Test.js +0 -96
  39. package/build/commands/Make/Validator.d.ts +0 -31
  40. package/build/commands/Make/Validator.js +0 -71
  41. package/build/commands/Make/View.d.ts +0 -30
  42. package/build/commands/Make/View.js +0 -70
  43. package/build/commands/Serve.d.ts +0 -33
  44. package/build/commands/Serve.js +0 -112
  45. package/build/commands/Test.d.ts +0 -57
  46. package/build/commands/Test.js +0 -159
  47. package/build/commands/TypeCheck.d.ts +0 -16
  48. package/build/commands/TypeCheck.js +0 -85
  49. package/build/config/paths.d.ts +0 -7
  50. package/build/config/paths.js +0 -18
  51. package/build/register.js +0 -15
  52. package/build/src/AssetsBundler/index.d.ts +0 -76
  53. package/build/src/AssetsBundler/index.js +0 -216
  54. package/build/src/Compiler/index.d.ts +0 -62
  55. package/build/src/Compiler/index.js +0 -287
  56. package/build/src/Contracts/index.d.ts +0 -8
  57. package/build/src/Contracts/index.js +0 -10
  58. package/build/src/DevServer/index.d.ts +0 -70
  59. package/build/src/DevServer/index.js +0 -306
  60. package/build/src/EnvParser/index.d.ts +0 -21
  61. package/build/src/EnvParser/index.js +0 -48
  62. package/build/src/HttpServer/index.d.ts +0 -34
  63. package/build/src/HttpServer/index.js +0 -87
  64. package/build/src/Manifest/index.d.ts +0 -32
  65. package/build/src/Manifest/index.js +0 -88
  66. package/build/src/RcFile/index.d.ts +0 -72
  67. package/build/src/RcFile/index.js +0 -174
  68. package/build/src/Test/index.d.ts +0 -75
  69. package/build/src/Test/index.js +0 -346
  70. package/build/src/Test/process.d.ts +0 -22
  71. package/build/src/Test/process.js +0 -68
  72. package/build/src/Ts/index.d.ts +0 -24
  73. package/build/src/Ts/index.js +0 -55
  74. package/build/src/requireHook/index.d.ts +0 -5
  75. package/build/src/requireHook/index.js +0 -28
  76. package/build/src/requireHook/ioc-transformer.d.ts +0 -6
  77. package/build/src/requireHook/ioc-transformer.js +0 -21
  78. package/build/templates/command.txt +0 -33
  79. package/build/templates/controller.txt +0 -3
  80. package/build/templates/event-listener.txt +0 -3
  81. package/build/templates/exception.txt +0 -15
  82. package/build/templates/middleware.txt +0 -8
  83. package/build/templates/preload-file.txt +0 -9
  84. package/build/templates/provider.txt +0 -40
  85. package/build/templates/resource-controller.txt +0 -17
  86. package/build/templates/self-handle-exception.txt +0 -32
  87. package/build/templates/test-entrypoint.txt +0 -45
  88. package/build/templates/test.txt +0 -5
  89. package/build/templates/tests/bootstrap.txt +0 -69
  90. package/build/templates/tests/functional/hello_world_api.spec.txt +0 -8
  91. package/build/templates/tests/functional/hello_world_slim.spec.txt +0 -8
  92. package/build/templates/tests/functional/hello_world_web.spec.txt +0 -8
  93. package/build/templates/tests-contract.txt +0 -18
  94. package/build/templates/validator.txt +0 -40
  95. package/build/templates/view.txt +0 -0
  96. package/build/templates/webpack.config.txt +0 -214
  97. /package/build/{register.d.ts → src/types.js} +0 -0
@@ -1,75 +0,0 @@
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 event exceptions class
25
- */
26
- class MakeException extends Base_1.BaseGenerator {
27
- constructor() {
28
- super(...arguments);
29
- /**
30
- * Required by BaseGenerator
31
- */
32
- this.form = 'singular';
33
- this.pattern = 'pascalcase';
34
- this.suffix = 'Exception';
35
- }
36
- /**
37
- * Returns the template stub
38
- */
39
- getStub() {
40
- return (0, path_1.join)(__dirname, '..', '..', 'templates', this.selfHandle ? 'self-handle-exception.txt' : 'exception.txt');
41
- }
42
- /**
43
- * Pull path from the `exceptions` namespace declaration from
44
- * the `.adonisrc.json` file or fallback to `app/Exceptions`
45
- */
46
- getDestinationPath() {
47
- return this.getPathForNamespace('exceptions') || 'app/Exceptions';
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
- MakeException.commandName = 'make:exception';
59
- MakeException.description = 'Make a new custom exception class';
60
- __decorate([
61
- standalone_1.args.string({ description: 'Name of the exception class' }),
62
- __metadata("design:type", String)
63
- ], MakeException.prototype, "name", void 0);
64
- __decorate([
65
- standalone_1.flags.boolean({ description: 'Add the handle method to self handle the exception' }),
66
- __metadata("design:type", Boolean)
67
- ], MakeException.prototype, "selfHandle", void 0);
68
- __decorate([
69
- standalone_1.flags.boolean({
70
- description: 'Create the exception class with the exact name as provided',
71
- alias: 'e',
72
- }),
73
- __metadata("design:type", Boolean)
74
- ], MakeException.prototype, "exact", void 0);
75
- exports.default = MakeException;
@@ -1,30 +0,0 @@
1
- import { BaseGenerator } from './Base';
2
- /**
3
- * Command to make a new event listener class
4
- */
5
- export default class MakeListener extends BaseGenerator {
6
- /**
7
- * Required by BaseGenerator
8
- */
9
- protected form: "singular";
10
- protected pattern: "pascalcase";
11
- protected resourceName: string;
12
- protected createExact: boolean;
13
- /**
14
- * Command meta data
15
- */
16
- static commandName: string;
17
- static description: string;
18
- name: string;
19
- exact: boolean;
20
- /**
21
- * Returns the template stub
22
- */
23
- protected getStub(): string;
24
- /**
25
- * Pull path from the `listeners` directory declaration from
26
- * the `.adonisrc.json` file or fallback to `app/Listeners`
27
- */
28
- protected getDestinationPath(): string;
29
- run(): Promise<void>;
30
- }
@@ -1,70 +0,0 @@
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 event listener class
25
- */
26
- class MakeListener extends Base_1.BaseGenerator {
27
- constructor() {
28
- super(...arguments);
29
- /**
30
- * Required by BaseGenerator
31
- */
32
- this.form = 'singular';
33
- this.pattern = 'pascalcase';
34
- }
35
- /**
36
- * Returns the template stub
37
- */
38
- getStub() {
39
- return (0, path_1.join)(__dirname, '..', '..', 'templates', 'event-listener.txt');
40
- }
41
- /**
42
- * Pull path from the `listeners` directory declaration from
43
- * the `.adonisrc.json` file or fallback to `app/Listeners`
44
- */
45
- getDestinationPath() {
46
- return this.getPathForNamespace('eventListeners') || 'app/Listeners';
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
- MakeListener.commandName = 'make:listener';
58
- MakeListener.description = 'Make a new event listener class';
59
- __decorate([
60
- standalone_1.args.string({ description: 'Name of the event listener class' }),
61
- __metadata("design:type", String)
62
- ], MakeListener.prototype, "name", void 0);
63
- __decorate([
64
- standalone_1.flags.boolean({
65
- description: 'Create the listener with the exact name as provided',
66
- alias: 'e',
67
- }),
68
- __metadata("design:type", Boolean)
69
- ], MakeListener.prototype, "exact", void 0);
70
- exports.default = MakeListener;
@@ -1,31 +0,0 @@
1
- import { BaseGenerator } from './Base';
2
- /**
3
- * Command to make a new middleware
4
- */
5
- export default class MakeMiddleware 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
- * Middleware are always created inside `app/Middleware` directory.
27
- * We can look into configuring it later.
28
- */
29
- protected getDestinationPath(): string;
30
- run(): Promise<void>;
31
- }
@@ -1,87 +0,0 @@
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 middleware
25
- */
26
- class MakeMiddleware extends Base_1.BaseGenerator {
27
- constructor() {
28
- super(...arguments);
29
- /**
30
- * Required by BaseGenerator
31
- */
32
- this.suffix = '';
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', 'middleware.txt');
41
- }
42
- /**
43
- * Middleware are always created inside `app/Middleware` directory.
44
- * We can look into configuring it later.
45
- */
46
- getDestinationPath() {
47
- return this.getPathForNamespace('middleware') || 'app/Middleware';
48
- }
49
- async run() {
50
- this.resourceName = this.name;
51
- this.createExact = this.exact;
52
- const middlewareNamespace = this.application.rcFile.namespaces.middleware || 'App/Middleware';
53
- const file = await super.generate();
54
- if (!file) {
55
- return;
56
- }
57
- const fileJSON = file.toJSON();
58
- if (fileJSON.state === 'persisted') {
59
- this.ui
60
- .instructions()
61
- .heading('Register middleware')
62
- .add(`Open ${this.colors.cyan('start/kernel.ts')} file`)
63
- .add(`Register the following function as a global or a named middleware`)
64
- .add(this.colors
65
- .cyan()
66
- .underline(`() => import('${middlewareNamespace}/${fileJSON.filename}')`))
67
- .render();
68
- }
69
- }
70
- }
71
- /**
72
- * Command meta data
73
- */
74
- MakeMiddleware.commandName = 'make:middleware';
75
- MakeMiddleware.description = 'Make a new middleware';
76
- __decorate([
77
- standalone_1.args.string({ description: 'Name of the middleware class' }),
78
- __metadata("design:type", String)
79
- ], MakeMiddleware.prototype, "name", void 0);
80
- __decorate([
81
- standalone_1.flags.boolean({
82
- description: 'Create the middleware with the exact name as provided',
83
- alias: 'e',
84
- }),
85
- __metadata("design:type", Boolean)
86
- ], MakeMiddleware.prototype, "exact", void 0);
87
- exports.default = MakeMiddleware;
@@ -1,38 +0,0 @@
1
- import { BaseGenerator } from './Base';
2
- import type { AppEnvironments } from '@ioc:Adonis/Core/Application';
3
- /**
4
- * Command to make a new preloaded file
5
- */
6
- export default class MakePreloadFile extends BaseGenerator {
7
- /**
8
- * Required by BaseGenerator
9
- */
10
- protected resourceName: string;
11
- protected createExact: boolean;
12
- /**
13
- * Command name
14
- */
15
- static commandName: string;
16
- /**
17
- * Command description
18
- */
19
- static description: string;
20
- name: string;
21
- environment: AppEnvironments[];
22
- /**
23
- * Check if the mentioned environments are valid
24
- */
25
- private isValidEnviroment;
26
- /**
27
- * Returns the template stub path
28
- */
29
- protected getStub(): string;
30
- /**
31
- * Path to the start directory
32
- */
33
- protected getDestinationPath(): string;
34
- /**
35
- * Run command
36
- */
37
- run(): Promise<void>;
38
- }
@@ -1,157 +0,0 @@
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- var desc = Object.getOwnPropertyDescriptor(m, k);
13
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
14
- desc = { enumerable: true, get: function() { return m[k]; } };
15
- }
16
- Object.defineProperty(o, k2, desc);
17
- }) : (function(o, m, k, k2) {
18
- if (k2 === undefined) k2 = k;
19
- o[k2] = m[k];
20
- }));
21
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
22
- Object.defineProperty(o, "default", { enumerable: true, value: v });
23
- }) : function(o, v) {
24
- o["default"] = v;
25
- });
26
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
27
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
28
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
29
- 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;
30
- return c > 3 && r && Object.defineProperty(target, key, r), r;
31
- };
32
- var __importStar = (this && this.__importStar) || function (mod) {
33
- if (mod && mod.__esModule) return mod;
34
- var result = {};
35
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
36
- __setModuleDefault(result, mod);
37
- return result;
38
- };
39
- var __metadata = (this && this.__metadata) || function (k, v) {
40
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
41
- };
42
- var __importDefault = (this && this.__importDefault) || function (mod) {
43
- return (mod && mod.__esModule) ? mod : { "default": mod };
44
- };
45
- Object.defineProperty(exports, "__esModule", { value: true });
46
- const slash_1 = __importDefault(require("slash"));
47
- const path_1 = require("path");
48
- const standalone_1 = require("@adonisjs/core/build/standalone");
49
- const Base_1 = require("./Base");
50
- const ALLOWED_ENVIRONMENTS = ['console', 'web', 'repl', 'test'];
51
- /**
52
- * Command to make a new preloaded file
53
- */
54
- class MakePreloadFile extends Base_1.BaseGenerator {
55
- constructor() {
56
- super(...arguments);
57
- this.createExact = true;
58
- }
59
- /**
60
- * Check if the mentioned environments are valid
61
- */
62
- isValidEnviroment(environment) {
63
- return !environment.find((one) => !ALLOWED_ENVIRONMENTS.includes(one));
64
- }
65
- /**
66
- * Returns the template stub path
67
- */
68
- getStub() {
69
- return (0, path_1.join)(__dirname, '..', '..', 'templates', 'preload-file.txt');
70
- }
71
- /**
72
- * Path to the start directory
73
- */
74
- getDestinationPath() {
75
- return this.application.rcFile.directories.start || 'start';
76
- }
77
- /**
78
- * Run command
79
- */
80
- async run() {
81
- /**
82
- * Ensure the environments are valid when provided via flag
83
- */
84
- if (this.environment && this.environment.length && !this.isValidEnviroment(this.environment)) {
85
- this.logger.error(`Invalid environment(s) "${this.environment}". Only "${ALLOWED_ENVIRONMENTS}" are allowed`);
86
- return;
87
- }
88
- let environments = this.environment;
89
- /**
90
- * Prompt user to select one or more environments
91
- */
92
- if (!environments) {
93
- environments = await this.prompt.multiple('Select the environment(s) in which you want to load this file', [
94
- {
95
- name: 'all',
96
- message: 'Load file in all environments',
97
- },
98
- {
99
- name: 'console',
100
- message: 'Environment for ace commands',
101
- },
102
- {
103
- name: 'repl',
104
- message: 'Environment for the REPL session',
105
- },
106
- {
107
- name: 'web',
108
- message: 'Environment for HTTP requests',
109
- },
110
- {
111
- name: 'test',
112
- message: 'Environment for the test process',
113
- },
114
- ]);
115
- }
116
- /**
117
- * Generate resource file
118
- */
119
- this.resourceName = this.name;
120
- const file = await super.generate();
121
- if (!file) {
122
- return;
123
- }
124
- /**
125
- * Update preload file
126
- */
127
- const { files } = await Promise.resolve().then(() => __importStar(require('@adonisjs/sink')));
128
- const relativePath = file.toJSON().relativepath;
129
- const rcFile = new files.AdonisRcFile(this.application.appRoot);
130
- if (!environments || !environments.length || environments.includes('all')) {
131
- rcFile.setPreload(`./${(0, slash_1.default)(relativePath).replace((0, path_1.extname)(relativePath), '')}`);
132
- }
133
- else {
134
- rcFile.setPreload(`./${(0, slash_1.default)(relativePath).replace((0, path_1.extname)(relativePath), '')}`, environments);
135
- }
136
- rcFile.commit();
137
- }
138
- }
139
- /**
140
- * Command name
141
- */
142
- MakePreloadFile.commandName = 'make:prldfile';
143
- /**
144
- * Command description
145
- */
146
- MakePreloadFile.description = 'Make a new preload file';
147
- __decorate([
148
- standalone_1.args.string({ description: 'Name of the file' }),
149
- __metadata("design:type", String)
150
- ], MakePreloadFile.prototype, "name", void 0);
151
- __decorate([
152
- standalone_1.flags.array({
153
- description: `Define the preload file environment. Accepted values "${ALLOWED_ENVIRONMENTS}"`,
154
- }),
155
- __metadata("design:type", Array)
156
- ], MakePreloadFile.prototype, "environment", void 0);
157
- exports.default = MakePreloadFile;
@@ -1,31 +0,0 @@
1
- import { BaseGenerator } from './Base';
2
- /**
3
- * Command to make a new provider
4
- */
5
- export default class MakeProvider 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
- ace: boolean;
21
- exact: boolean;
22
- /**
23
- * Returns the template stub path
24
- */
25
- protected getStub(): string;
26
- /**
27
- * Path to the providers directory
28
- */
29
- protected getDestinationPath(): string;
30
- run(): Promise<void>;
31
- }
@@ -1,114 +0,0 @@
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- var desc = Object.getOwnPropertyDescriptor(m, k);
13
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
14
- desc = { enumerable: true, get: function() { return m[k]; } };
15
- }
16
- Object.defineProperty(o, k2, desc);
17
- }) : (function(o, m, k, k2) {
18
- if (k2 === undefined) k2 = k;
19
- o[k2] = m[k];
20
- }));
21
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
22
- Object.defineProperty(o, "default", { enumerable: true, value: v });
23
- }) : function(o, v) {
24
- o["default"] = v;
25
- });
26
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
27
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
28
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
29
- 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;
30
- return c > 3 && r && Object.defineProperty(target, key, r), r;
31
- };
32
- var __importStar = (this && this.__importStar) || function (mod) {
33
- if (mod && mod.__esModule) return mod;
34
- var result = {};
35
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
36
- __setModuleDefault(result, mod);
37
- return result;
38
- };
39
- var __metadata = (this && this.__metadata) || function (k, v) {
40
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
41
- };
42
- var __importDefault = (this && this.__importDefault) || function (mod) {
43
- return (mod && mod.__esModule) ? mod : { "default": mod };
44
- };
45
- Object.defineProperty(exports, "__esModule", { value: true });
46
- const slash_1 = __importDefault(require("slash"));
47
- const path_1 = require("path");
48
- const standalone_1 = require("@adonisjs/core/build/standalone");
49
- const Base_1 = require("./Base");
50
- /**
51
- * Command to make a new provider
52
- */
53
- class MakeProvider extends Base_1.BaseGenerator {
54
- constructor() {
55
- super(...arguments);
56
- /**
57
- * Required by BaseGenerator
58
- */
59
- this.suffix = 'Provider';
60
- this.form = 'singular';
61
- this.pattern = 'pascalcase';
62
- }
63
- /**
64
- * Returns the template stub path
65
- */
66
- getStub() {
67
- return (0, path_1.join)(__dirname, '..', '..', 'templates', 'provider.txt');
68
- }
69
- /**
70
- * Path to the providers directory
71
- */
72
- getDestinationPath() {
73
- return this.application.rcFile.directories.providers || 'providers';
74
- }
75
- async run() {
76
- this.resourceName = this.name;
77
- this.createExact = this.exact;
78
- const file = await super.generate();
79
- if (!file) {
80
- return;
81
- }
82
- const { files } = await Promise.resolve().then(() => __importStar(require('@adonisjs/sink')));
83
- const relativePath = file.toJSON().relativepath;
84
- const rcFile = new files.AdonisRcFile(this.application.appRoot);
85
- if (this.ace) {
86
- rcFile.addAceProvider(`./${(0, slash_1.default)(relativePath).replace((0, path_1.extname)(relativePath), '')}`);
87
- }
88
- else {
89
- rcFile.addProvider(`./${(0, slash_1.default)(relativePath).replace((0, path_1.extname)(relativePath), '')}`);
90
- }
91
- rcFile.commit();
92
- }
93
- }
94
- /**
95
- * Command meta data
96
- */
97
- MakeProvider.commandName = 'make:provider';
98
- MakeProvider.description = 'Make a new provider class';
99
- __decorate([
100
- standalone_1.args.string({ description: 'Name of the provider class' }),
101
- __metadata("design:type", String)
102
- ], MakeProvider.prototype, "name", void 0);
103
- __decorate([
104
- standalone_1.flags.boolean({ description: 'Register provider under the ace providers array' }),
105
- __metadata("design:type", Boolean)
106
- ], MakeProvider.prototype, "ace", void 0);
107
- __decorate([
108
- standalone_1.flags.boolean({
109
- description: 'Create the provider with the exact name as provided',
110
- alias: 'e',
111
- }),
112
- __metadata("design:type", Boolean)
113
- ], MakeProvider.prototype, "exact", void 0);
114
- exports.default = MakeProvider;
@@ -1,41 +0,0 @@
1
- import { BaseCommand } from '@adonisjs/core/build/standalone';
2
- /**
3
- * Create a new test suite
4
- */
5
- export default class CreateSuite extends BaseCommand {
6
- static commandName: string;
7
- static description: string;
8
- /**
9
- * Name of the test suite to be created
10
- */
11
- suite: string;
12
- /**
13
- * Glob pattern for the test suite, or only location to the test suite
14
- */
15
- location: string;
16
- /**
17
- * Should add a sample test file
18
- */
19
- withExampleTest: boolean;
20
- /**
21
- * Get the destination path for the sample test file
22
- */
23
- private getExampleTestDestinationPath;
24
- /**
25
- * Generate suite glob pattern based on `location` argument
26
- */
27
- private generateSuiteGlobPattern;
28
- /**
29
- * Check if the suite name is already defined in RcFile
30
- */
31
- private checkIfSuiteExists;
32
- /**
33
- * Add the new test suite to the AdonisRC File and save it
34
- */
35
- private addSuiteToRcFile;
36
- /**
37
- * Add a sample test file to the new suite folder
38
- */
39
- private createSampleTestFile;
40
- run(): Promise<void>;
41
- }