@adonisjs/core 6.1.3-0 → 6.1.5-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.
- package/build/commands/build.d.ts +1 -0
- package/build/commands/build.js +39 -32
- package/build/commands/commands.json +1 -1
- package/build/commands/serve.d.ts +3 -1
- package/build/commands/serve.js +43 -32
- package/build/index.d.ts +3 -0
- package/build/modules/ace/main.d.ts +1 -1
- package/build/modules/ace/main.js +1 -1
- package/build/modules/ace/shell.js +0 -1
- package/build/src/internal_helpers.d.ts +8 -0
- package/build/src/internal_helpers.js +32 -0
- package/build/toolkit/commands/index_commands.d.ts +7 -0
- package/build/toolkit/commands/index_commands.js +22 -0
- package/build/toolkit/main.d.ts +2 -0
- package/build/toolkit/main.js +16 -0
- package/package.json +18 -14
package/build/commands/build.js
CHANGED
|
@@ -8,46 +8,45 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
10
|
import { BaseCommand, flags } from '../modules/ace/main.js';
|
|
11
|
+
import { detectAssetsBundler, importAssembler, importTypeScript } from '../src/internal_helpers.js';
|
|
11
12
|
export default class Build extends BaseCommand {
|
|
12
13
|
static commandName = 'build';
|
|
13
14
|
static description = 'Build application for production by compiling frontend assets and TypeScript source to JavaScript';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
'The "@adonisjs/assembler" package is a development dependency and therefore you should use the build command during development only.',
|
|
23
|
-
'',
|
|
24
|
-
'If you are using the build command inside a CI or with a deployment platform, make sure the NODE_ENV is set to "development"',
|
|
25
|
-
].join('\n'));
|
|
26
|
-
this.exitCode = 1;
|
|
27
|
-
}
|
|
15
|
+
#logMissingDevelopmentDependency(dependency) {
|
|
16
|
+
this.logger.error([
|
|
17
|
+
`Cannot find package "${dependency}"`,
|
|
18
|
+
'',
|
|
19
|
+
`The "${dependency}" package is a development dependency and therefore you should use the serve command during development only.`,
|
|
20
|
+
'',
|
|
21
|
+
'If you are using the build command inside a CI or with a deployment platform, make sure the NODE_ENV is set to "development"',
|
|
22
|
+
].join('\n'));
|
|
28
23
|
}
|
|
29
|
-
async
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
catch {
|
|
34
|
-
this.logger.error([
|
|
35
|
-
'Unable to import "typescript"',
|
|
36
|
-
'',
|
|
37
|
-
'The "typescript" package is a development dependency and therefore you should use the build command during development only.',
|
|
38
|
-
'',
|
|
39
|
-
'If you are using the build command inside a CI or with a deployment platform, make sure the NODE_ENV is set to "development"',
|
|
40
|
-
].join('\n'));
|
|
24
|
+
async run() {
|
|
25
|
+
const assembler = await importAssembler(this.app);
|
|
26
|
+
if (!assembler) {
|
|
27
|
+
this.#logMissingDevelopmentDependency('@adonisjs/assembler');
|
|
41
28
|
this.exitCode = 1;
|
|
29
|
+
return;
|
|
42
30
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (!assembler || !ts) {
|
|
31
|
+
const ts = await importTypeScript(this.app);
|
|
32
|
+
if (!ts) {
|
|
33
|
+
this.#logMissingDevelopmentDependency('typescript');
|
|
34
|
+
this.exitCode = 1;
|
|
48
35
|
return;
|
|
49
36
|
}
|
|
50
|
-
const
|
|
37
|
+
const assetsBundler = await detectAssetsBundler(this.app);
|
|
38
|
+
const bundler = new assembler.Bundler(this.app.appRoot, ts, {
|
|
39
|
+
assets: assetsBundler
|
|
40
|
+
? {
|
|
41
|
+
serve: this.assets === false ? false : true,
|
|
42
|
+
driver: assetsBundler.name,
|
|
43
|
+
cmd: assetsBundler.buildCommand,
|
|
44
|
+
}
|
|
45
|
+
: {
|
|
46
|
+
serve: false,
|
|
47
|
+
},
|
|
48
|
+
metaFiles: this.app.rcFile.metaFiles,
|
|
49
|
+
});
|
|
51
50
|
bundler.setLogger(this.logger);
|
|
52
51
|
const stopOnError = this.ignoreTsErrors === true ? false : true;
|
|
53
52
|
const builtSuccessfully = await bundler.bundle(stopOnError, this.packageManager);
|
|
@@ -70,3 +69,11 @@ __decorate([
|
|
|
70
69
|
}),
|
|
71
70
|
__metadata("design:type", String)
|
|
72
71
|
], Build.prototype, "packageManager", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
flags.boolean({
|
|
74
|
+
description: 'Build frontend assets',
|
|
75
|
+
showNegatedVariantInHelp: true,
|
|
76
|
+
default: true,
|
|
77
|
+
}),
|
|
78
|
+
__metadata("design:type", Boolean)
|
|
79
|
+
], Build.prototype, "assets", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"commands":[{"commandName":"build","description":"Build application for production by compiling frontend assets and TypeScript source to JavaScript","help":"","namespace":null,"aliases":[],"flags":[{"name":"watch","flagName":"watch","required":false,"type":"boolean","description":"Watch filesystem and restart the HTTP server on file change"},{"name":"ignoreTsErrors","flagName":"ignore-ts-errors","required":false,"type":"boolean","description":"Ignore TypeScript errors and continue with the build process"},{"name":"packageManager","flagName":"package-manager","required":false,"type":"string","description":"Select the package manager you want to use to install production dependencies"}],"args":[],"options":{},"filePath":"build.js"},{"commandName":"configure","description":"Configure a package post installation","help":"","namespace":null,"aliases":[],"flags":[],"args":[{"name":"name","argumentName":"name","required":true,"description":"Package name","type":"string"}],"options":{},"filePath":"configure.js"},{"commandName":"eject","description":"Eject scaffolding stubs to your application root","help":"","namespace":null,"aliases":[],"flags":[{"name":"pkg","flagName":"pkg","required":false,"type":"string","description":"Mention package name for searching stubs","default":"@adonisjs/core"}],"args":[{"name":"stubPath","argumentName":"stub-path","required":true,"description":"Path to the stubs directory or a single stub file","type":"string"}],"options":{},"filePath":"eject.js"},{"commandName":"generate:key","description":"Generate a secure random application key","help":"","namespace":"generate","aliases":[],"flags":[{"name":"show","flagName":"show","required":false,"type":"boolean","description":"Display the key on the terminal, instead of writing it to .env file"},{"name":"force","flagName":"force","required":false,"type":"boolean","description":"Force update .env file in production environment"}],"args":[],"options":{},"filePath":"generate_key.js"},{"commandName":"make:command","description":"Create a new ace command class","help":"","namespace":"make","aliases":[],"flags":[],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the command","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"make/command.js"},{"commandName":"make:controller","description":"Create a new HTTP controller class","help":"","namespace":"make","aliases":[],"flags":[{"name":"singular","flagName":"singular","required":false,"type":"boolean","description":"Convert controller class and file name to its singular form","alias":"r"},{"name":"resource","flagName":"resource","required":false,"type":"boolean","description":"Generate controller with resource actions","alias":"r"},{"name":"api","flagName":"api","required":false,"type":"boolean","description":"Generate controller with api resource actions","alias":"a"}],"args":[{"name":"name","argumentName":"name","required":true,"description":"The name of the controller","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"make/controller.js"},{"commandName":"make:event","description":"Create a new event class","help":"","namespace":"make","aliases":[],"flags":[],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the event","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"make/event.js"},{"commandName":"make:listener","description":"Create a new event listener class","help":"","namespace":"make","aliases":[],"flags":[{"name":"event","flagName":"event","required":false,"type":"string","description":"Generate an event class alongside the listener","alias":"e"}],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the listener","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"make/listener.js"},{"commandName":"make:middleware","description":"Create a new middleware class","help":"","namespace":"make","aliases":[],"flags":[],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the middleware","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"make/middleware.js"},{"commandName":"make:provider","description":"Create a new service provider class","help":"","namespace":"make","aliases":[],"flags":[],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the provider","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"make/provider.js"},{"commandName":"serve","description":"Start the development HTTP server along with the file watcher to perform restarts on file change","help":"","namespace":null,"aliases":[],"flags":[{"name":"watch","flagName":"watch","required":false,"type":"boolean","description":"Watch filesystem and restart the HTTP server on file change"},{"name":"poll","flagName":"poll","required":false,"type":"boolean","description":"Use polling to detect filesystem changes"}],"args":[],"options":{"staysAlive":true},"filePath":"serve.js"}],"version":1}
|
|
1
|
+
{"commands":[{"commandName":"build","description":"Build application for production by compiling frontend assets and TypeScript source to JavaScript","help":"","namespace":null,"aliases":[],"flags":[{"name":"watch","flagName":"watch","required":false,"type":"boolean","description":"Watch filesystem and restart the HTTP server on file change"},{"name":"ignoreTsErrors","flagName":"ignore-ts-errors","required":false,"type":"boolean","description":"Ignore TypeScript errors and continue with the build process"},{"name":"packageManager","flagName":"package-manager","required":false,"type":"string","description":"Select the package manager you want to use to install production dependencies"},{"name":"assets","flagName":"assets","required":false,"type":"boolean","description":"Build frontend assets","showNegatedVariantInHelp":true,"default":true}],"args":[],"options":{},"filePath":"build.js"},{"commandName":"configure","description":"Configure a package post installation","help":"","namespace":null,"aliases":[],"flags":[],"args":[{"name":"name","argumentName":"name","required":true,"description":"Package name","type":"string"}],"options":{},"filePath":"configure.js"},{"commandName":"eject","description":"Eject scaffolding stubs to your application root","help":"","namespace":null,"aliases":[],"flags":[{"name":"pkg","flagName":"pkg","required":false,"type":"string","description":"Mention package name for searching stubs","default":"@adonisjs/core"}],"args":[{"name":"stubPath","argumentName":"stub-path","required":true,"description":"Path to the stubs directory or a single stub file","type":"string"}],"options":{},"filePath":"eject.js"},{"commandName":"generate:key","description":"Generate a secure random application key","help":"","namespace":"generate","aliases":[],"flags":[{"name":"show","flagName":"show","required":false,"type":"boolean","description":"Display the key on the terminal, instead of writing it to .env file"},{"name":"force","flagName":"force","required":false,"type":"boolean","description":"Force update .env file in production environment"}],"args":[],"options":{},"filePath":"generate_key.js"},{"commandName":"make:command","description":"Create a new ace command class","help":"","namespace":"make","aliases":[],"flags":[],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the command","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"make/command.js"},{"commandName":"make:controller","description":"Create a new HTTP controller class","help":"","namespace":"make","aliases":[],"flags":[{"name":"singular","flagName":"singular","required":false,"type":"boolean","description":"Convert controller class and file name to its singular form","alias":"r"},{"name":"resource","flagName":"resource","required":false,"type":"boolean","description":"Generate controller with resource actions","alias":"r"},{"name":"api","flagName":"api","required":false,"type":"boolean","description":"Generate controller with api resource actions","alias":"a"}],"args":[{"name":"name","argumentName":"name","required":true,"description":"The name of the controller","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"make/controller.js"},{"commandName":"make:event","description":"Create a new event class","help":"","namespace":"make","aliases":[],"flags":[],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the event","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"make/event.js"},{"commandName":"make:listener","description":"Create a new event listener class","help":"","namespace":"make","aliases":[],"flags":[{"name":"event","flagName":"event","required":false,"type":"string","description":"Generate an event class alongside the listener","alias":"e"}],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the listener","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"make/listener.js"},{"commandName":"make:middleware","description":"Create a new middleware class","help":"","namespace":"make","aliases":[],"flags":[],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the middleware","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"make/middleware.js"},{"commandName":"make:provider","description":"Create a new service provider class","help":"","namespace":"make","aliases":[],"flags":[],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the provider","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"make/provider.js"},{"commandName":"serve","description":"Start the development HTTP server along with the file watcher to perform restarts on file change","help":"","namespace":null,"aliases":[],"flags":[{"name":"watch","flagName":"watch","required":false,"type":"boolean","description":"Watch filesystem and restart the HTTP server on file change"},{"name":"poll","flagName":"poll","required":false,"type":"boolean","description":"Use polling to detect filesystem changes"},{"name":"clear","flagName":"clear","required":false,"type":"boolean","description":"Clear the terminal for new logs after file change","showNegatedVariantInHelp":true,"default":true},{"name":"assets","flagName":"assets","required":false,"type":"boolean","description":"Start assets bundler dev server","showNegatedVariantInHelp":true,"default":true}],"args":[],"options":{"staysAlive":true},"filePath":"serve.js"}],"version":1}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { CommandOptions } from '../types/ace.js';
|
|
1
2
|
import { BaseCommand } from '../modules/ace/main.js';
|
|
2
|
-
import { CommandOptions } from '../types/ace.js';
|
|
3
3
|
export default class Serve extends BaseCommand {
|
|
4
4
|
#private;
|
|
5
5
|
static commandName: string;
|
|
@@ -7,5 +7,7 @@ export default class Serve extends BaseCommand {
|
|
|
7
7
|
static options: CommandOptions;
|
|
8
8
|
watch?: boolean;
|
|
9
9
|
poll?: boolean;
|
|
10
|
+
clear?: boolean;
|
|
11
|
+
assets?: boolean;
|
|
10
12
|
run(): Promise<void>;
|
|
11
13
|
}
|
package/build/commands/serve.js
CHANGED
|
@@ -8,50 +8,43 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
10
|
import { BaseCommand, flags } from '../modules/ace/main.js';
|
|
11
|
+
import { detectAssetsBundler, importAssembler, importTypeScript } from '../src/internal_helpers.js';
|
|
11
12
|
export default class Serve extends BaseCommand {
|
|
12
13
|
static commandName = 'serve';
|
|
13
14
|
static description = 'Start the development HTTP server along with the file watcher to perform restarts on file change';
|
|
14
15
|
static options = {
|
|
15
16
|
staysAlive: true,
|
|
16
17
|
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
'The "@adonisjs/assembler" package is a development dependency and therefore you should use the serve command during development only.',
|
|
26
|
-
'',
|
|
27
|
-
'If you are running your application in production, then use "node bin/server.js" command to start the HTTP server',
|
|
28
|
-
].join('\n'));
|
|
29
|
-
this.exitCode = 1;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
async #importTypeScript() {
|
|
33
|
-
try {
|
|
34
|
-
return await this.app.import('typescript');
|
|
35
|
-
}
|
|
36
|
-
catch {
|
|
37
|
-
this.logger.error([
|
|
38
|
-
'Unable to import "typescript"',
|
|
39
|
-
'',
|
|
40
|
-
'The "typescript" package is a development dependency and therefore you should use the serve command during development only.',
|
|
41
|
-
'',
|
|
42
|
-
'If you are running your application in production, then use "node bin/server.js" command to start the HTTP server',
|
|
43
|
-
].join('\n'));
|
|
44
|
-
this.exitCode = 1;
|
|
45
|
-
}
|
|
18
|
+
#logMissingDevelopmentDependency(dependency) {
|
|
19
|
+
this.logger.error([
|
|
20
|
+
`Cannot find package "${dependency}"`,
|
|
21
|
+
'',
|
|
22
|
+
`The "${dependency}" package is a development dependency and therefore you should use the serve command during development only.`,
|
|
23
|
+
'',
|
|
24
|
+
'If you are running your application in production, then use "node bin/server.js" command to start the HTTP server',
|
|
25
|
+
].join('\n'));
|
|
46
26
|
}
|
|
47
27
|
async run() {
|
|
48
|
-
const assembler = await
|
|
28
|
+
const assembler = await importAssembler(this.app);
|
|
49
29
|
if (!assembler) {
|
|
30
|
+
this.#logMissingDevelopmentDependency('@adonisjs/assembler');
|
|
31
|
+
this.exitCode = 1;
|
|
50
32
|
return;
|
|
51
33
|
}
|
|
34
|
+
const assetsBundler = await detectAssetsBundler(this.app);
|
|
52
35
|
const devServer = new assembler.DevServer(this.app.appRoot, {
|
|
36
|
+
clearScreen: this.clear === false ? false : true,
|
|
53
37
|
nodeArgs: this.parsed.nodeArgs,
|
|
54
38
|
scriptArgs: [],
|
|
39
|
+
assets: assetsBundler
|
|
40
|
+
? {
|
|
41
|
+
serve: this.assets === false ? false : true,
|
|
42
|
+
driver: assetsBundler.name,
|
|
43
|
+
cmd: assetsBundler.devServerCommand,
|
|
44
|
+
}
|
|
45
|
+
: {
|
|
46
|
+
serve: false,
|
|
47
|
+
},
|
|
55
48
|
metaFiles: this.app.rcFile.metaFiles,
|
|
56
49
|
});
|
|
57
50
|
devServer.setLogger(this.logger);
|
|
@@ -62,11 +55,13 @@ export default class Serve extends BaseCommand {
|
|
|
62
55
|
this.exitCode = 1;
|
|
63
56
|
});
|
|
64
57
|
if (this.watch) {
|
|
65
|
-
const ts = await
|
|
58
|
+
const ts = await importTypeScript(this.app);
|
|
66
59
|
if (!ts) {
|
|
60
|
+
this.#logMissingDevelopmentDependency('typescript');
|
|
61
|
+
this.exitCode = 1;
|
|
67
62
|
return;
|
|
68
63
|
}
|
|
69
|
-
await devServer.startAndWatch(ts
|
|
64
|
+
await devServer.startAndWatch(ts, { poll: this.poll || false });
|
|
70
65
|
}
|
|
71
66
|
else {
|
|
72
67
|
await devServer.start();
|
|
@@ -81,3 +76,19 @@ __decorate([
|
|
|
81
76
|
flags.boolean({ description: 'Use polling to detect filesystem changes' }),
|
|
82
77
|
__metadata("design:type", Boolean)
|
|
83
78
|
], Serve.prototype, "poll", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
flags.boolean({
|
|
81
|
+
description: 'Clear the terminal for new logs after file change',
|
|
82
|
+
showNegatedVariantInHelp: true,
|
|
83
|
+
default: true,
|
|
84
|
+
}),
|
|
85
|
+
__metadata("design:type", Boolean)
|
|
86
|
+
], Serve.prototype, "clear", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
flags.boolean({
|
|
89
|
+
description: 'Start assets bundler dev server',
|
|
90
|
+
showNegatedVariantInHelp: true,
|
|
91
|
+
default: true,
|
|
92
|
+
}),
|
|
93
|
+
__metadata("design:type", Boolean)
|
|
94
|
+
], Serve.prototype, "assets", void 0);
|
package/build/index.d.ts
CHANGED
|
@@ -59,6 +59,9 @@ export declare const errors: {
|
|
|
59
59
|
E_MISSING_PROVIDER_FILE: new (args: [preloadProperty: string], options?: ErrorOptions | undefined) => import("@poppinss/utils").Exception;
|
|
60
60
|
E_MISSING_SUITE_NAME: new (args: [suiteProperty: string], options?: ErrorOptions | undefined) => import("@poppinss/utils").Exception;
|
|
61
61
|
E_MISSING_SUITE_FILES: new (args: [suiteProperty: string], options?: ErrorOptions | undefined) => import("@poppinss/utils").Exception;
|
|
62
|
+
E_MISSING_BUNDLER_DEV_COMMAND: new (args?: any, options?: ErrorOptions | undefined) => import("@poppinss/utils").Exception;
|
|
63
|
+
E_MISSING_BUNDLER_BUILD_COMMAND: new (args?: any, options?: ErrorOptions | undefined) => import("@poppinss/utils").Exception;
|
|
64
|
+
E_MISSING_BUNDLER_NAME: new (args?: any, options?: ErrorOptions | undefined) => import("@poppinss/utils").Exception;
|
|
62
65
|
E_ROUTE_NOT_FOUND: new (args: [method: string, url: string], options?: ErrorOptions | undefined) => import("@poppinss/utils").Exception;
|
|
63
66
|
E_CANNOT_LOOKUP_ROUTE: new (args: [routeIdentifier: string], options?: ErrorOptions | undefined) => import("@poppinss/utils").Exception;
|
|
64
67
|
E_HTTP_EXCEPTION: {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { Kernel } from './kernel.js';
|
|
2
2
|
export { BaseCommand, ListCommand } from './commands.js';
|
|
3
|
-
export { args, flags, errors, Parser, FsLoader, ListLoader, HelpCommand } from '@adonisjs/ace';
|
|
3
|
+
export { args, flags, errors, Parser, FsLoader, ListLoader, HelpCommand, IndexGenerator, } from '@adonisjs/ace';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { Kernel } from './kernel.js';
|
|
2
2
|
export { BaseCommand, ListCommand } from './commands.js';
|
|
3
|
-
export { args, flags, errors, Parser, FsLoader, ListLoader, HelpCommand } from '@adonisjs/ace';
|
|
3
|
+
export { args, flags, errors, Parser, FsLoader, ListLoader, HelpCommand, IndexGenerator, } from '@adonisjs/ace';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ApplicationService } from './types.js';
|
|
2
|
+
export declare function importAssembler(app: ApplicationService): Promise<typeof import('@adonisjs/assembler') | undefined>;
|
|
3
|
+
export declare function importTypeScript(app: ApplicationService): Promise<typeof import('typescript') | undefined>;
|
|
4
|
+
export declare function detectAssetsBundler(app: ApplicationService): Promise<{
|
|
5
|
+
name: string;
|
|
6
|
+
devServerCommand: string;
|
|
7
|
+
buildCommand: string;
|
|
8
|
+
} | undefined>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
export async function importAssembler(app) {
|
|
3
|
+
try {
|
|
4
|
+
return await app.import('@adonisjs/assembler');
|
|
5
|
+
}
|
|
6
|
+
catch { }
|
|
7
|
+
}
|
|
8
|
+
export async function importTypeScript(app) {
|
|
9
|
+
try {
|
|
10
|
+
return await app.importDefault('typescript');
|
|
11
|
+
}
|
|
12
|
+
catch { }
|
|
13
|
+
}
|
|
14
|
+
export async function detectAssetsBundler(app) {
|
|
15
|
+
if (app.rcFile.assetsBundler) {
|
|
16
|
+
return app.rcFile.assetsBundler;
|
|
17
|
+
}
|
|
18
|
+
if (await fs.exists(app.makePath('vite.config.js'))) {
|
|
19
|
+
return {
|
|
20
|
+
name: 'vite',
|
|
21
|
+
devServerCommand: 'vite',
|
|
22
|
+
buildCommand: 'vite build',
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
if (await fs.exists(app.makePath('webpack.config.js'))) {
|
|
26
|
+
return {
|
|
27
|
+
name: 'encore',
|
|
28
|
+
devServerCommand: 'encore dev-server',
|
|
29
|
+
buildCommand: 'encore',
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { join } from 'node:path';
|
|
11
|
+
import { args, BaseCommand, IndexGenerator } from '@adonisjs/ace';
|
|
12
|
+
export default class IndexCommand extends BaseCommand {
|
|
13
|
+
static commandName = 'index';
|
|
14
|
+
static description = 'Create an index of commands along with a lazy loader';
|
|
15
|
+
async run() {
|
|
16
|
+
await new IndexGenerator(join(process.cwd(), this.commandsDir)).generate();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
__decorate([
|
|
20
|
+
args.string({ description: 'Relative path from cwd to the commands directory' }),
|
|
21
|
+
__metadata("design:type", String)
|
|
22
|
+
], IndexCommand.prototype, "commandsDir", void 0);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import IndexCommand from './commands/index_commands.js';
|
|
3
|
+
import { Kernel, ListLoader, HelpCommand } from '@adonisjs/ace';
|
|
4
|
+
const kernel = Kernel.create();
|
|
5
|
+
kernel.addLoader(new ListLoader([IndexCommand]));
|
|
6
|
+
kernel.defineFlag('help', {
|
|
7
|
+
type: 'boolean',
|
|
8
|
+
description: HelpCommand.description,
|
|
9
|
+
});
|
|
10
|
+
kernel.on('help', async (command, $kernel, parsed) => {
|
|
11
|
+
parsed.args.unshift(command.commandName);
|
|
12
|
+
const help = new HelpCommand($kernel, parsed, kernel.ui, kernel.prompt);
|
|
13
|
+
await help.exec();
|
|
14
|
+
return $kernel.shortcircuit();
|
|
15
|
+
});
|
|
16
|
+
await kernel.handle(process.argv.splice(2));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonisjs/core",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.5-0",
|
|
4
4
|
"description": "Core of AdonisJS",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -11,12 +11,16 @@
|
|
|
11
11
|
"build/providers",
|
|
12
12
|
"build/services",
|
|
13
13
|
"build/factories",
|
|
14
|
+
"build/toolkit",
|
|
14
15
|
"build/types",
|
|
15
16
|
"build/src",
|
|
16
17
|
"build/stubs",
|
|
17
18
|
"build/index.d.ts",
|
|
18
19
|
"build/index.js"
|
|
19
20
|
],
|
|
21
|
+
"bin": {
|
|
22
|
+
"adonis-kit": "./build/toolkit/main.js"
|
|
23
|
+
},
|
|
20
24
|
"exports": {
|
|
21
25
|
".": "./build/index.js",
|
|
22
26
|
"./commands": "./build/commands/main.js",
|
|
@@ -89,7 +93,7 @@
|
|
|
89
93
|
"format": "prettier --write .",
|
|
90
94
|
"sync-labels": "github-label-sync --labels .github/labels.json adonisjs/core",
|
|
91
95
|
"vscode:test": "node --loader=ts-node/esm --experimental-import-meta-resolve bin/test.ts",
|
|
92
|
-
"index:commands": "
|
|
96
|
+
"index:commands": "node --loader=ts-node/esm toolkit/main.js index build/commands"
|
|
93
97
|
},
|
|
94
98
|
"keywords": [
|
|
95
99
|
"adonisjs",
|
|
@@ -99,7 +103,7 @@
|
|
|
99
103
|
"author": "virk,adonisjs",
|
|
100
104
|
"license": "MIT",
|
|
101
105
|
"devDependencies": {
|
|
102
|
-
"@adonisjs/assembler": "^6.1.
|
|
106
|
+
"@adonisjs/assembler": "^6.1.3-0",
|
|
103
107
|
"@commitlint/cli": "^17.4.4",
|
|
104
108
|
"@commitlint/config-conventional": "^17.4.4",
|
|
105
109
|
"@japa/assert": "^1.4.1",
|
|
@@ -111,7 +115,7 @@
|
|
|
111
115
|
"@japa/spec-reporter": "^1.3.3",
|
|
112
116
|
"@swc/core": "^1.3.37",
|
|
113
117
|
"@types/fs-extra": "^11.0.1",
|
|
114
|
-
"@types/node": "^18.14.
|
|
118
|
+
"@types/node": "^18.14.6",
|
|
115
119
|
"@types/pretty-hrtime": "^1.0.1",
|
|
116
120
|
"@types/sinon": "^10.0.13",
|
|
117
121
|
"@types/supertest": "^2.0.12",
|
|
@@ -124,7 +128,6 @@
|
|
|
124
128
|
"eslint-config-prettier": "^8.6.0",
|
|
125
129
|
"eslint-plugin-adonis": "^3.0.3",
|
|
126
130
|
"eslint-plugin-prettier": "^4.2.1",
|
|
127
|
-
"fs-extra": "^11.1.0",
|
|
128
131
|
"get-port": "^6.1.2",
|
|
129
132
|
"github-label-sync": "^2.2.0",
|
|
130
133
|
"husky": "^8.0.3",
|
|
@@ -138,31 +141,32 @@
|
|
|
138
141
|
"typescript": "^4.9.5"
|
|
139
142
|
},
|
|
140
143
|
"dependencies": {
|
|
141
|
-
"@adonisjs/ace": "^12.3.
|
|
142
|
-
"@adonisjs/application": "^7.1.
|
|
143
|
-
"@adonisjs/bodyparser": "^9.3.
|
|
144
|
-
"@adonisjs/config": "^4.2.
|
|
144
|
+
"@adonisjs/ace": "^12.3.1-0",
|
|
145
|
+
"@adonisjs/application": "^7.1.2-0",
|
|
146
|
+
"@adonisjs/bodyparser": "^9.3.2-0",
|
|
147
|
+
"@adonisjs/config": "^4.2.1-0",
|
|
145
148
|
"@adonisjs/encryption": "^5.1.2-0",
|
|
146
149
|
"@adonisjs/env": "^4.2.0-0",
|
|
147
|
-
"@adonisjs/events": "^8.4.
|
|
148
|
-
"@adonisjs/fold": "^9.9.
|
|
150
|
+
"@adonisjs/events": "^8.4.9-0",
|
|
151
|
+
"@adonisjs/fold": "^9.9.3-0",
|
|
149
152
|
"@adonisjs/hash": "^8.3.1-0",
|
|
150
|
-
"@adonisjs/http-server": "^6.8.
|
|
153
|
+
"@adonisjs/http-server": "^6.8.2-0",
|
|
151
154
|
"@adonisjs/logger": "^5.4.2-0",
|
|
152
|
-
"@adonisjs/validator": "^13.0.
|
|
155
|
+
"@adonisjs/validator": "^13.0.2-0",
|
|
153
156
|
"@poppinss/macroable": "^1.0.0-2",
|
|
154
157
|
"@poppinss/utils": "^6.5.0-0",
|
|
155
158
|
"@sindresorhus/is": "^5.3.0",
|
|
156
159
|
"@types/he": "^1.2.0",
|
|
157
160
|
"cuid": "^3.0.0",
|
|
158
161
|
"execa": "^7.0.0",
|
|
162
|
+
"fs-extra": "^11.1.0",
|
|
159
163
|
"he": "^1.2.0",
|
|
160
164
|
"pretty-hrtime": "^1.0.3",
|
|
161
165
|
"youch": "^3.2.3",
|
|
162
166
|
"youch-terminal": "^2.2.0"
|
|
163
167
|
},
|
|
164
168
|
"peerDependencies": {
|
|
165
|
-
"@adonisjs/assembler": "^6.1.
|
|
169
|
+
"@adonisjs/assembler": "^6.1.3-0",
|
|
166
170
|
"argon2": "^0.30.3",
|
|
167
171
|
"bcrypt": "^5.0.1"
|
|
168
172
|
},
|