@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.
- package/build/ace-manifest.json +17 -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 -217
- 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 -53
- package/build/commands/Test.js +159 -152
- 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 +23 -23
- package/build/src/EnvParser/index.js +52 -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 +16 -16
package/build/ace-manifest.json
CHANGED
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
},
|
|
69
69
|
"make:command": {
|
|
70
70
|
"settings": {},
|
|
71
|
-
"commandPath": "./commands/Make
|
|
71
|
+
"commandPath": "./commands/Make\\Command",
|
|
72
72
|
"commandName": "make:command",
|
|
73
73
|
"description": "Make a new ace command",
|
|
74
74
|
"args": [
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
},
|
|
94
94
|
"make:controller": {
|
|
95
95
|
"settings": {},
|
|
96
|
-
"commandPath": "./commands/Make
|
|
96
|
+
"commandPath": "./commands/Make\\Controller",
|
|
97
97
|
"commandName": "make:controller",
|
|
98
98
|
"description": "Make a new HTTP controller",
|
|
99
99
|
"args": [
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
},
|
|
126
126
|
"make:exception": {
|
|
127
127
|
"settings": {},
|
|
128
|
-
"commandPath": "./commands/Make
|
|
128
|
+
"commandPath": "./commands/Make\\Exception",
|
|
129
129
|
"commandName": "make:exception",
|
|
130
130
|
"description": "Make a new custom exception class",
|
|
131
131
|
"args": [
|
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
},
|
|
157
157
|
"make:listener": {
|
|
158
158
|
"settings": {},
|
|
159
|
-
"commandPath": "./commands/Make
|
|
159
|
+
"commandPath": "./commands/Make\\Listener",
|
|
160
160
|
"commandName": "make:listener",
|
|
161
161
|
"description": "Make a new event listener class",
|
|
162
162
|
"args": [
|
|
@@ -181,7 +181,7 @@
|
|
|
181
181
|
},
|
|
182
182
|
"make:middleware": {
|
|
183
183
|
"settings": {},
|
|
184
|
-
"commandPath": "./commands/Make
|
|
184
|
+
"commandPath": "./commands/Make\\Middleware",
|
|
185
185
|
"commandName": "make:middleware",
|
|
186
186
|
"description": "Make a new middleware",
|
|
187
187
|
"args": [
|
|
@@ -206,7 +206,7 @@
|
|
|
206
206
|
},
|
|
207
207
|
"make:prldfile": {
|
|
208
208
|
"settings": {},
|
|
209
|
-
"commandPath": "./commands/Make
|
|
209
|
+
"commandPath": "./commands/Make\\PreloadFile",
|
|
210
210
|
"commandName": "make:prldfile",
|
|
211
211
|
"description": "Make a new preload file",
|
|
212
212
|
"args": [
|
|
@@ -230,7 +230,7 @@
|
|
|
230
230
|
},
|
|
231
231
|
"make:provider": {
|
|
232
232
|
"settings": {},
|
|
233
|
-
"commandPath": "./commands/Make
|
|
233
|
+
"commandPath": "./commands/Make\\Provider",
|
|
234
234
|
"commandName": "make:provider",
|
|
235
235
|
"description": "Make a new provider class",
|
|
236
236
|
"args": [
|
|
@@ -261,7 +261,7 @@
|
|
|
261
261
|
},
|
|
262
262
|
"make:suite": {
|
|
263
263
|
"settings": {},
|
|
264
|
-
"commandPath": "./commands/Make
|
|
264
|
+
"commandPath": "./commands/Make\\Suite",
|
|
265
265
|
"commandName": "make:suite",
|
|
266
266
|
"description": "Create a new test suite",
|
|
267
267
|
"args": [
|
|
@@ -292,7 +292,7 @@
|
|
|
292
292
|
},
|
|
293
293
|
"make:test": {
|
|
294
294
|
"settings": {},
|
|
295
|
-
"commandPath": "./commands/Make
|
|
295
|
+
"commandPath": "./commands/Make\\Test",
|
|
296
296
|
"commandName": "make:test",
|
|
297
297
|
"description": "Make a new test",
|
|
298
298
|
"args": [
|
|
@@ -324,7 +324,7 @@
|
|
|
324
324
|
},
|
|
325
325
|
"make:validator": {
|
|
326
326
|
"settings": {},
|
|
327
|
-
"commandPath": "./commands/Make
|
|
327
|
+
"commandPath": "./commands/Make\\Validator",
|
|
328
328
|
"commandName": "make:validator",
|
|
329
329
|
"description": "Make a new validator",
|
|
330
330
|
"args": [
|
|
@@ -349,7 +349,7 @@
|
|
|
349
349
|
},
|
|
350
350
|
"make:view": {
|
|
351
351
|
"settings": {},
|
|
352
|
-
"commandPath": "./commands/Make
|
|
352
|
+
"commandPath": "./commands/Make\\View",
|
|
353
353
|
"commandName": "make:view",
|
|
354
354
|
"description": "Make a new view template",
|
|
355
355
|
"args": [
|
|
@@ -478,6 +478,12 @@
|
|
|
478
478
|
"type": "array",
|
|
479
479
|
"description": "Filter tests by title"
|
|
480
480
|
},
|
|
481
|
+
{
|
|
482
|
+
"name": "groups",
|
|
483
|
+
"propertyName": "groups",
|
|
484
|
+
"type": "array",
|
|
485
|
+
"description": "Filter tests by group title"
|
|
486
|
+
},
|
|
481
487
|
{
|
|
482
488
|
"name": "timeout",
|
|
483
489
|
"propertyName": "timeout",
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { BaseCommand } from '@adonisjs/core/build/standalone';
|
|
2
|
-
/**
|
|
3
|
-
* Compile typescript project Javascript
|
|
4
|
-
*/
|
|
5
|
-
export default class Build extends BaseCommand {
|
|
6
|
-
static commandName: string;
|
|
7
|
-
static description: string;
|
|
8
|
-
/**
|
|
9
|
-
* Build for production
|
|
10
|
-
*/
|
|
11
|
-
production: boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Bundle frontend assets. Defaults to true
|
|
14
|
-
*/
|
|
15
|
-
assets: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Ignore ts errors and complete the build process. Defaults to false
|
|
18
|
-
*/
|
|
19
|
-
ignoreTsErrors: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Path to the TypeScript project configuration file. Defaults to "tsconfig.json"
|
|
22
|
-
*/
|
|
23
|
-
tsconfig: string;
|
|
24
|
-
/**
|
|
25
|
-
* Arguments to pass to the `encore` binary
|
|
26
|
-
*/
|
|
27
|
-
encoreArgs: string[];
|
|
28
|
-
/**
|
|
29
|
-
* Select the client for deciding the lock file to copy to the
|
|
30
|
-
* build folder
|
|
31
|
-
*/
|
|
32
|
-
client: string;
|
|
33
|
-
/**
|
|
34
|
-
* Invoked automatically by ace
|
|
35
|
-
*/
|
|
36
|
-
run(): Promise<void>;
|
|
37
|
-
}
|
|
1
|
+
import { BaseCommand } from '@adonisjs/core/build/standalone';
|
|
2
|
+
/**
|
|
3
|
+
* Compile typescript project Javascript
|
|
4
|
+
*/
|
|
5
|
+
export default class Build extends BaseCommand {
|
|
6
|
+
static commandName: string;
|
|
7
|
+
static description: string;
|
|
8
|
+
/**
|
|
9
|
+
* Build for production
|
|
10
|
+
*/
|
|
11
|
+
production: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Bundle frontend assets. Defaults to true
|
|
14
|
+
*/
|
|
15
|
+
assets: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Ignore ts errors and complete the build process. Defaults to false
|
|
18
|
+
*/
|
|
19
|
+
ignoreTsErrors: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Path to the TypeScript project configuration file. Defaults to "tsconfig.json"
|
|
22
|
+
*/
|
|
23
|
+
tsconfig: string;
|
|
24
|
+
/**
|
|
25
|
+
* Arguments to pass to the `encore` binary
|
|
26
|
+
*/
|
|
27
|
+
encoreArgs: string[];
|
|
28
|
+
/**
|
|
29
|
+
* Select the client for deciding the lock file to copy to the
|
|
30
|
+
* build folder
|
|
31
|
+
*/
|
|
32
|
+
client: string;
|
|
33
|
+
/**
|
|
34
|
+
* Invoked automatically by ace
|
|
35
|
+
*/
|
|
36
|
+
run(): Promise<void>;
|
|
37
|
+
}
|
package/build/commands/Build.js
CHANGED
|
@@ -1,138 +1,138 @@
|
|
|
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 has_yarn_1 = __importDefault(require("has-yarn"));
|
|
47
|
-
const standalone_1 = require("@adonisjs/core/build/standalone");
|
|
48
|
-
const paths_1 = require("../config/paths");
|
|
49
|
-
/**
|
|
50
|
-
* Compile typescript project Javascript
|
|
51
|
-
*/
|
|
52
|
-
class Build extends standalone_1.BaseCommand {
|
|
53
|
-
constructor() {
|
|
54
|
-
super(...arguments);
|
|
55
|
-
/**
|
|
56
|
-
* Bundle frontend assets. Defaults to true
|
|
57
|
-
*/
|
|
58
|
-
this.assets = true;
|
|
59
|
-
/**
|
|
60
|
-
* Path to the TypeScript project configuration file. Defaults to "tsconfig.json"
|
|
61
|
-
*/
|
|
62
|
-
this.tsconfig = paths_1.TSCONFIG_FILE_NAME;
|
|
63
|
-
/**
|
|
64
|
-
* Arguments to pass to the `encore` binary
|
|
65
|
-
*/
|
|
66
|
-
this.encoreArgs = [];
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Invoked automatically by ace
|
|
70
|
-
*/
|
|
71
|
-
async run() {
|
|
72
|
-
const { Compiler } = await Promise.resolve().then(() => __importStar(require('../src/Compiler')));
|
|
73
|
-
/**
|
|
74
|
-
* Deciding the client to use for installing dependencies
|
|
75
|
-
*/
|
|
76
|
-
this.client = this.client || (0, has_yarn_1.default)(this.application.appRoot) ? 'yarn' : 'npm';
|
|
77
|
-
if (this.client !== 'npm' && this.client !== 'yarn') {
|
|
78
|
-
this.logger.warning('--client must be set to "npm" or "yarn"');
|
|
79
|
-
this.exitCode = 1;
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Stop on error when "ignoreTsErrors" is not set
|
|
84
|
-
*/
|
|
85
|
-
const stopOnError = !this.ignoreTsErrors;
|
|
86
|
-
try {
|
|
87
|
-
const compiler = new Compiler(this.application.appRoot, this.encoreArgs, this.assets, this.logger, this.tsconfig);
|
|
88
|
-
const compiled = this.production
|
|
89
|
-
? await compiler.compileForProduction(stopOnError, this.client)
|
|
90
|
-
: await compiler.compile(stopOnError);
|
|
91
|
-
/**
|
|
92
|
-
* Set exitCode based upon the compiled status
|
|
93
|
-
*/
|
|
94
|
-
if (!compiled) {
|
|
95
|
-
this.exitCode = 1;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
catch (error) {
|
|
99
|
-
this.logger.fatal(error);
|
|
100
|
-
this.exitCode = 1;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
Build.commandName = 'build';
|
|
105
|
-
Build.description = 'Compile project from Typescript to Javascript. Also compiles the frontend assets if using webpack encore';
|
|
106
|
-
__decorate([
|
|
107
|
-
standalone_1.flags.boolean({ description: 'Build for production', alias: 'prod' }),
|
|
108
|
-
__metadata("design:type", Boolean)
|
|
109
|
-
], Build.prototype, "production", void 0);
|
|
110
|
-
__decorate([
|
|
111
|
-
standalone_1.flags.boolean({
|
|
112
|
-
description: 'Build frontend assets when webpack encore is installed. Use --no-assets to disable',
|
|
113
|
-
}),
|
|
114
|
-
__metadata("design:type", Boolean)
|
|
115
|
-
], Build.prototype, "assets", void 0);
|
|
116
|
-
__decorate([
|
|
117
|
-
standalone_1.flags.boolean({
|
|
118
|
-
description: 'Ignore typescript errors and complete the build process',
|
|
119
|
-
}),
|
|
120
|
-
__metadata("design:type", Boolean)
|
|
121
|
-
], Build.prototype, "ignoreTsErrors", void 0);
|
|
122
|
-
__decorate([
|
|
123
|
-
standalone_1.flags.string({
|
|
124
|
-
description: 'Path to the TypeScript project configuration file',
|
|
125
|
-
}),
|
|
126
|
-
__metadata("design:type", String)
|
|
127
|
-
], Build.prototype, "tsconfig", void 0);
|
|
128
|
-
__decorate([
|
|
129
|
-
standalone_1.flags.array({ description: 'CLI options to pass to the encore command line' }),
|
|
130
|
-
__metadata("design:type", Array)
|
|
131
|
-
], Build.prototype, "encoreArgs", void 0);
|
|
132
|
-
__decorate([
|
|
133
|
-
standalone_1.flags.string({
|
|
134
|
-
description: 'Select the package manager to decide which lock file to copy to the build folder',
|
|
135
|
-
}),
|
|
136
|
-
__metadata("design:type", String)
|
|
137
|
-
], Build.prototype, "client", void 0);
|
|
138
|
-
exports.default = Build;
|
|
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 has_yarn_1 = __importDefault(require("has-yarn"));
|
|
47
|
+
const standalone_1 = require("@adonisjs/core/build/standalone");
|
|
48
|
+
const paths_1 = require("../config/paths");
|
|
49
|
+
/**
|
|
50
|
+
* Compile typescript project Javascript
|
|
51
|
+
*/
|
|
52
|
+
class Build extends standalone_1.BaseCommand {
|
|
53
|
+
constructor() {
|
|
54
|
+
super(...arguments);
|
|
55
|
+
/**
|
|
56
|
+
* Bundle frontend assets. Defaults to true
|
|
57
|
+
*/
|
|
58
|
+
this.assets = true;
|
|
59
|
+
/**
|
|
60
|
+
* Path to the TypeScript project configuration file. Defaults to "tsconfig.json"
|
|
61
|
+
*/
|
|
62
|
+
this.tsconfig = paths_1.TSCONFIG_FILE_NAME;
|
|
63
|
+
/**
|
|
64
|
+
* Arguments to pass to the `encore` binary
|
|
65
|
+
*/
|
|
66
|
+
this.encoreArgs = [];
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Invoked automatically by ace
|
|
70
|
+
*/
|
|
71
|
+
async run() {
|
|
72
|
+
const { Compiler } = await Promise.resolve().then(() => __importStar(require('../src/Compiler')));
|
|
73
|
+
/**
|
|
74
|
+
* Deciding the client to use for installing dependencies
|
|
75
|
+
*/
|
|
76
|
+
this.client = this.client || (0, has_yarn_1.default)(this.application.appRoot) ? 'yarn' : 'npm';
|
|
77
|
+
if (this.client !== 'npm' && this.client !== 'yarn') {
|
|
78
|
+
this.logger.warning('--client must be set to "npm" or "yarn"');
|
|
79
|
+
this.exitCode = 1;
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Stop on error when "ignoreTsErrors" is not set
|
|
84
|
+
*/
|
|
85
|
+
const stopOnError = !this.ignoreTsErrors;
|
|
86
|
+
try {
|
|
87
|
+
const compiler = new Compiler(this.application.appRoot, this.encoreArgs, this.assets, this.logger, this.tsconfig);
|
|
88
|
+
const compiled = this.production
|
|
89
|
+
? await compiler.compileForProduction(stopOnError, this.client)
|
|
90
|
+
: await compiler.compile(stopOnError);
|
|
91
|
+
/**
|
|
92
|
+
* Set exitCode based upon the compiled status
|
|
93
|
+
*/
|
|
94
|
+
if (!compiled) {
|
|
95
|
+
this.exitCode = 1;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
this.logger.fatal(error);
|
|
100
|
+
this.exitCode = 1;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
Build.commandName = 'build';
|
|
105
|
+
Build.description = 'Compile project from Typescript to Javascript. Also compiles the frontend assets if using webpack encore';
|
|
106
|
+
__decorate([
|
|
107
|
+
standalone_1.flags.boolean({ description: 'Build for production', alias: 'prod' }),
|
|
108
|
+
__metadata("design:type", Boolean)
|
|
109
|
+
], Build.prototype, "production", void 0);
|
|
110
|
+
__decorate([
|
|
111
|
+
standalone_1.flags.boolean({
|
|
112
|
+
description: 'Build frontend assets when webpack encore is installed. Use --no-assets to disable',
|
|
113
|
+
}),
|
|
114
|
+
__metadata("design:type", Boolean)
|
|
115
|
+
], Build.prototype, "assets", void 0);
|
|
116
|
+
__decorate([
|
|
117
|
+
standalone_1.flags.boolean({
|
|
118
|
+
description: 'Ignore typescript errors and complete the build process',
|
|
119
|
+
}),
|
|
120
|
+
__metadata("design:type", Boolean)
|
|
121
|
+
], Build.prototype, "ignoreTsErrors", void 0);
|
|
122
|
+
__decorate([
|
|
123
|
+
standalone_1.flags.string({
|
|
124
|
+
description: 'Path to the TypeScript project configuration file',
|
|
125
|
+
}),
|
|
126
|
+
__metadata("design:type", String)
|
|
127
|
+
], Build.prototype, "tsconfig", void 0);
|
|
128
|
+
__decorate([
|
|
129
|
+
standalone_1.flags.array({ description: 'CLI options to pass to the encore command line' }),
|
|
130
|
+
__metadata("design:type", Array)
|
|
131
|
+
], Build.prototype, "encoreArgs", void 0);
|
|
132
|
+
__decorate([
|
|
133
|
+
standalone_1.flags.string({
|
|
134
|
+
description: 'Select the package manager to decide which lock file to copy to the build folder',
|
|
135
|
+
}),
|
|
136
|
+
__metadata("design:type", String)
|
|
137
|
+
], Build.prototype, "client", void 0);
|
|
138
|
+
exports.default = Build;
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { BaseCommand } from '@adonisjs/core/build/standalone';
|
|
2
|
-
/**
|
|
3
|
-
* Configure a package
|
|
4
|
-
*/
|
|
5
|
-
export default class Configure extends BaseCommand {
|
|
6
|
-
static commandName: string;
|
|
7
|
-
static description: string;
|
|
8
|
-
static aliases: string[];
|
|
9
|
-
private appType;
|
|
10
|
-
/**
|
|
11
|
-
* Use yarn when building for production to install dependencies
|
|
12
|
-
*/
|
|
13
|
-
packages: string[];
|
|
14
|
-
/**
|
|
15
|
-
* Returns package manager for installing dependencies
|
|
16
|
-
*/
|
|
17
|
-
private getPackageManager;
|
|
18
|
-
/**
|
|
19
|
-
* Configure encore
|
|
20
|
-
*/
|
|
21
|
-
private configureEncore;
|
|
22
|
-
/**
|
|
23
|
-
* Configure tests
|
|
24
|
-
*/
|
|
25
|
-
private configureTests;
|
|
26
|
-
/**
|
|
27
|
-
* Configure a give package
|
|
28
|
-
*/
|
|
29
|
-
private configurePackage;
|
|
30
|
-
/**
|
|
31
|
-
* Invoked automatically by ace
|
|
32
|
-
*/
|
|
33
|
-
run(): Promise<void>;
|
|
34
|
-
}
|
|
1
|
+
import { BaseCommand } from '@adonisjs/core/build/standalone';
|
|
2
|
+
/**
|
|
3
|
+
* Configure a package
|
|
4
|
+
*/
|
|
5
|
+
export default class Configure extends BaseCommand {
|
|
6
|
+
static commandName: string;
|
|
7
|
+
static description: string;
|
|
8
|
+
static aliases: string[];
|
|
9
|
+
private appType;
|
|
10
|
+
/**
|
|
11
|
+
* Use yarn when building for production to install dependencies
|
|
12
|
+
*/
|
|
13
|
+
packages: string[];
|
|
14
|
+
/**
|
|
15
|
+
* Returns package manager for installing dependencies
|
|
16
|
+
*/
|
|
17
|
+
private getPackageManager;
|
|
18
|
+
/**
|
|
19
|
+
* Configure encore
|
|
20
|
+
*/
|
|
21
|
+
private configureEncore;
|
|
22
|
+
/**
|
|
23
|
+
* Configure tests
|
|
24
|
+
*/
|
|
25
|
+
private configureTests;
|
|
26
|
+
/**
|
|
27
|
+
* Configure a give package
|
|
28
|
+
*/
|
|
29
|
+
private configurePackage;
|
|
30
|
+
/**
|
|
31
|
+
* Invoked automatically by ace
|
|
32
|
+
*/
|
|
33
|
+
run(): Promise<void>;
|
|
34
|
+
}
|