@adonisjs/assembler 5.9.1 → 5.9.3
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.
- package/build/ace-manifest.json +11 -11
- package/build/commands/Build.d.ts +37 -37
- package/build/commands/Build.js +138 -138
- package/build/commands/Invoke.d.ts +34 -34
- package/build/commands/Invoke.js +221 -221
- package/build/commands/Make/Base.d.ts +30 -30
- package/build/commands/Make/Base.js +75 -75
- package/build/commands/Make/Command.d.ts +35 -35
- package/build/commands/Make/Command.js +82 -82
- package/build/commands/Make/Controller.d.ts +37 -37
- package/build/commands/Make/Controller.js +89 -89
- package/build/commands/Make/Exception.d.ts +32 -32
- package/build/commands/Make/Exception.js +75 -75
- package/build/commands/Make/Listener.d.ts +30 -30
- package/build/commands/Make/Listener.js +70 -70
- package/build/commands/Make/Middleware.d.ts +31 -31
- package/build/commands/Make/Middleware.js +87 -87
- package/build/commands/Make/PreloadFile.d.ts +38 -38
- package/build/commands/Make/PreloadFile.js +157 -157
- package/build/commands/Make/Provider.d.ts +31 -31
- package/build/commands/Make/Provider.js +114 -114
- package/build/commands/Make/Suite.d.ts +41 -41
- package/build/commands/Make/Suite.js +120 -120
- package/build/commands/Make/Test.d.ts +35 -35
- package/build/commands/Make/Test.js +96 -96
- package/build/commands/Make/Validator.d.ts +31 -31
- package/build/commands/Make/Validator.js +71 -71
- package/build/commands/Make/View.d.ts +30 -30
- package/build/commands/Make/View.js +70 -70
- package/build/commands/Serve.d.ts +33 -33
- package/build/commands/Serve.js +112 -112
- package/build/commands/Test.d.ts +57 -57
- package/build/commands/Test.js +159 -159
- package/build/commands/TypeCheck.d.ts +16 -16
- package/build/commands/TypeCheck.js +85 -85
- package/build/config/paths.d.ts +7 -7
- package/build/config/paths.js +18 -18
- package/build/register.d.ts +1 -1
- package/build/register.js +15 -15
- package/build/src/AssetsBundler/index.d.ts +76 -76
- package/build/src/AssetsBundler/index.js +216 -216
- package/build/src/Compiler/index.d.ts +62 -62
- package/build/src/Compiler/index.js +287 -287
- package/build/src/Contracts/index.d.ts +8 -8
- package/build/src/Contracts/index.js +10 -10
- package/build/src/DevServer/index.d.ts +70 -70
- package/build/src/DevServer/index.js +306 -306
- package/build/src/EnvParser/index.d.ts +21 -23
- package/build/src/EnvParser/index.js +48 -52
- package/build/src/HttpServer/index.d.ts +34 -34
- package/build/src/HttpServer/index.js +87 -87
- package/build/src/Manifest/index.d.ts +32 -32
- package/build/src/Manifest/index.js +88 -88
- package/build/src/RcFile/index.d.ts +72 -72
- package/build/src/RcFile/index.js +174 -174
- package/build/src/Test/index.d.ts +75 -75
- package/build/src/Test/index.js +346 -346
- package/build/src/Test/process.d.ts +22 -22
- package/build/src/Test/process.js +68 -68
- package/build/src/Ts/index.d.ts +24 -24
- package/build/src/Ts/index.js +55 -55
- package/build/src/requireHook/index.d.ts +5 -5
- package/build/src/requireHook/index.js +28 -28
- package/build/src/requireHook/ioc-transformer.d.ts +6 -6
- package/build/src/requireHook/ioc-transformer.js +21 -21
- package/package.json +5 -5
|
@@ -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;
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { BaseGenerator } from './Base';
|
|
2
|
-
/**
|
|
3
|
-
* Command to make a new event exceptions class
|
|
4
|
-
*/
|
|
5
|
-
export default class MakeException extends BaseGenerator {
|
|
6
|
-
/**
|
|
7
|
-
* Required by BaseGenerator
|
|
8
|
-
*/
|
|
9
|
-
protected form: "singular";
|
|
10
|
-
protected pattern: "pascalcase";
|
|
11
|
-
protected resourceName: string;
|
|
12
|
-
protected suffix: string;
|
|
13
|
-
protected createExact: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Command meta data
|
|
16
|
-
*/
|
|
17
|
-
static commandName: string;
|
|
18
|
-
static description: string;
|
|
19
|
-
name: string;
|
|
20
|
-
selfHandle: boolean;
|
|
21
|
-
exact: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Returns the template stub
|
|
24
|
-
*/
|
|
25
|
-
protected getStub(): string;
|
|
26
|
-
/**
|
|
27
|
-
* Pull path from the `exceptions` namespace declaration from
|
|
28
|
-
* the `.adonisrc.json` file or fallback to `app/Exceptions`
|
|
29
|
-
*/
|
|
30
|
-
protected getDestinationPath(): string;
|
|
31
|
-
run(): Promise<void>;
|
|
32
|
-
}
|
|
1
|
+
import { BaseGenerator } from './Base';
|
|
2
|
+
/**
|
|
3
|
+
* Command to make a new event exceptions class
|
|
4
|
+
*/
|
|
5
|
+
export default class MakeException extends BaseGenerator {
|
|
6
|
+
/**
|
|
7
|
+
* Required by BaseGenerator
|
|
8
|
+
*/
|
|
9
|
+
protected form: "singular";
|
|
10
|
+
protected pattern: "pascalcase";
|
|
11
|
+
protected resourceName: string;
|
|
12
|
+
protected suffix: string;
|
|
13
|
+
protected createExact: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Command meta data
|
|
16
|
+
*/
|
|
17
|
+
static commandName: string;
|
|
18
|
+
static description: string;
|
|
19
|
+
name: string;
|
|
20
|
+
selfHandle: boolean;
|
|
21
|
+
exact: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Returns the template stub
|
|
24
|
+
*/
|
|
25
|
+
protected getStub(): string;
|
|
26
|
+
/**
|
|
27
|
+
* Pull path from the `exceptions` namespace declaration from
|
|
28
|
+
* the `.adonisrc.json` file or fallback to `app/Exceptions`
|
|
29
|
+
*/
|
|
30
|
+
protected getDestinationPath(): string;
|
|
31
|
+
run(): Promise<void>;
|
|
32
|
+
}
|