@adonisjs/core 7.0.0-next.2 → 7.0.0-next.20
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-sWl9sgM1.js +16 -0
- package/build/app-B6oge7b3.js +5 -0
- package/build/app-DNvbxVWl.js +5 -0
- package/build/bodyparser_middleware-BmARtnYe.js +3 -0
- package/build/chunk-B88MteZI.js +26 -0
- package/build/commands/add.d.ts +4 -3
- package/build/commands/add.js +76 -110
- package/build/commands/build.js +51 -107
- package/build/commands/commands.json +1 -1
- package/build/commands/configure.js +82 -177
- package/build/commands/eject.js +17 -60
- package/build/commands/env/add.js +55 -134
- package/build/commands/generate_key.js +22 -66
- package/build/commands/inspect_rcfile.js +27 -55
- package/build/commands/list/routes.js +246 -116
- package/build/commands/make/command.js +15 -57
- package/build/commands/make/controller.js +43 -120
- package/build/commands/make/event.js +16 -62
- package/build/commands/make/exception.js +16 -62
- package/build/commands/make/listener.js +36 -93
- package/build/commands/make/middleware.js +41 -101
- package/build/commands/make/preload.js +47 -113
- package/build/commands/make/provider.js +47 -112
- package/build/commands/make/service.js +16 -55
- package/build/commands/make/test.js +47 -132
- package/build/commands/make/transformer.js +17 -64
- package/build/commands/make/validator.js +20 -80
- package/build/commands/make/view.js +15 -56
- package/build/commands/repl.js +17 -50
- package/build/commands/serve.js +80 -156
- package/build/commands/test.js +92 -208
- package/build/config-Dd2H6-_e.js +5 -0
- package/build/config_provider-DWVFHOQX.js +15 -0
- package/build/container-uxa8LpGI.js +5 -0
- package/build/core-BuPP8K6N.js +140 -0
- package/build/create_kernel-Cn8zVtvt.js +3 -0
- package/build/create_kernel-Cpqqa931.js +38 -0
- package/build/decorate-CJcHOoD-.js +7 -0
- package/build/define_config-CoWy5lbf.js +62 -0
- package/build/dumper-BTjb8j4y.js +147 -0
- package/build/edge-BVYR-Vjr.js +47 -0
- package/build/events-C4d0OPUI.js +5 -0
- package/build/exceptions-DNMesP42.js +2 -0
- package/build/factories/app.js +2 -9
- package/build/factories/bodyparser.js +2 -9
- package/build/factories/core/ace.js +16 -46
- package/build/factories/core/ignitor.js +13 -180
- package/build/factories/core/main.js +24 -11
- package/build/factories/core/test_utils.js +21 -43
- package/build/factories/encryption.d.ts +1 -1
- package/build/factories/encryption.js +2 -9
- package/build/factories/events.js +2 -9
- package/build/factories/hash.js +2 -9
- package/build/factories/http.js +2 -9
- package/build/factories/logger.js +2 -9
- package/build/factories/stubs.js +27 -91
- package/build/ignitor-BrmVPN5N.js +71 -0
- package/build/index.d.ts +1 -1
- package/build/index.js +12 -46
- package/build/logger-0KKSqgPG.js +13 -0
- package/build/main-BU8NWUEG.js +73 -0
- package/build/main-Bfnr5tAw.js +2 -0
- package/build/main-BlJhxJJ2.js +81 -0
- package/build/main-C4B2SPOT.js +5 -0
- package/build/main-CZZ21eXm.js +171 -0
- package/build/main-D-WhqOOn.js +51 -0
- package/build/main-DOY5Q8Av.js +5 -0
- package/build/main-kn40V-hF.js +2 -0
- package/build/main-nojlltNo.js +30 -0
- package/build/{stubs/make → make}/health/controller.stub +5 -2
- package/build/modules/ace/codemods.d.ts +109 -14
- package/build/modules/ace/codemods.js +222 -382
- package/build/modules/ace/main.d.ts +30 -0
- package/build/modules/ace/main.js +2 -11
- package/build/modules/app.d.ts +17 -0
- package/build/modules/app.js +4 -9
- package/build/modules/bodyparser/bodyparser_middleware.js +2 -14
- package/build/modules/bodyparser/main.js +4 -9
- package/build/modules/config.d.ts +17 -0
- package/build/modules/config.js +4 -9
- package/build/modules/container.js +4 -9
- package/build/modules/dumper/dumper.d.ts +5 -0
- package/build/modules/dumper/main.d.ts +21 -0
- package/build/modules/dumper/main.js +6 -11
- package/build/modules/dumper/plugins/edge.js +2 -62
- package/build/modules/encryption/define_config.d.ts +128 -0
- package/build/modules/encryption/drivers/aes_256_cbc.d.ts +20 -0
- package/build/modules/encryption/drivers/aes_256_cbc.js +2 -0
- package/build/modules/encryption/drivers/aes_256_gcm.d.ts +21 -0
- package/build/modules/encryption/drivers/aes_256_gcm.js +2 -0
- package/build/modules/encryption/drivers/chacha20_poly1305.d.ts +21 -0
- package/build/modules/encryption/drivers/chacha20_poly1305.js +2 -0
- package/build/modules/encryption/main.d.ts +85 -0
- package/build/modules/encryption/main.js +5 -0
- package/build/modules/env/editor.js +2 -9
- package/build/modules/env/main.d.ts +19 -0
- package/build/modules/env/main.js +2 -9
- package/build/modules/events.js +4 -9
- package/build/modules/hash/drivers/argon.js +2 -9
- package/build/modules/hash/drivers/bcrypt.d.ts +11 -0
- package/build/modules/hash/drivers/bcrypt.js +2 -9
- package/build/modules/hash/drivers/scrypt.js +2 -9
- package/build/modules/hash/main.d.ts +18 -0
- package/build/modules/hash/main.js +5 -10
- package/build/modules/hash/phc_formatter.js +2 -9
- package/build/modules/health.js +2 -9
- package/build/modules/http/main.js +4 -15
- package/build/modules/http/request_validator.d.ts +1 -3
- package/build/modules/http/url_builder_client.d.ts +1 -0
- package/build/modules/http/url_builder_client.js +2 -0
- package/build/modules/logger.d.ts +30 -0
- package/build/modules/logger.js +4 -9
- package/build/modules/repl.js +4 -9
- package/build/modules/transformers/main.js +4 -9
- package/build/providers/app_provider.d.ts +14 -25
- package/build/providers/app_provider.js +155 -363
- package/build/providers/edge_provider.js +97 -114
- package/build/providers/hash_provider.js +28 -91
- package/build/providers/repl_provider.js +66 -152
- package/build/providers/vinejs_provider.d.ts +1 -1
- package/build/providers/vinejs_provider.js +19 -66
- package/build/repl-GSxgovJQ.js +5 -0
- package/build/services/ace.js +2 -17
- package/build/services/app.js +2 -21
- package/build/services/config.js +2 -13
- package/build/services/dumper.js +5 -21
- package/build/services/emitter.js +2 -14
- package/build/services/encryption.js +2 -14
- package/build/services/hash.js +2 -14
- package/build/services/logger.js +2 -14
- package/build/services/repl.js +2 -14
- package/build/services/router.js +2 -14
- package/build/services/server.js +2 -14
- package/build/services/test_utils.js +2 -17
- package/build/services/url_builder.d.ts +3 -3
- package/build/services/url_builder.js +5 -17
- package/build/src/assembler_hooks/index_entities.d.ts +29 -1
- package/build/src/debug.d.ts +1 -1
- package/build/src/exceptions.js +2 -49
- package/build/src/helpers/assert.js +2 -55
- package/build/src/helpers/http.d.ts +20 -0
- package/build/src/helpers/http.js +2 -0
- package/build/src/helpers/is.js +3 -31
- package/build/src/helpers/main.d.ts +1 -5
- package/build/src/helpers/main.js +5 -56
- package/build/src/helpers/string.js +2 -60
- package/build/src/helpers/types.js +26 -135
- package/build/src/helpers/verification_token.js +2 -120
- package/build/src/test_utils/main.js +8 -77
- package/build/src/types.d.ts +53 -99
- package/build/src/types.js +0 -8
- package/build/src/utils.d.ts +1 -1
- package/build/src/vine.js +2 -97
- package/build/string-Cx6q_win.js +28 -0
- package/build/test_utils-hkQDmNpX.js +10 -0
- package/build/toolkit/main.js +19 -21
- package/build/types/ace.js +2 -9
- package/build/types/app.js +2 -9
- package/build/types/bodyparser.js +2 -9
- package/build/types/common.js +2 -9
- package/build/types/container.js +2 -9
- package/build/types/encryption.d.ts +39 -1
- package/build/types/encryption.js +1 -9
- package/build/types/events.js +2 -9
- package/build/types/hash.js +2 -9
- package/build/types/health.js +2 -9
- package/build/types/helpers.d.ts +20 -0
- package/build/types/helpers.js +0 -8
- package/build/types/http.js +2 -9
- package/build/types/logger.js +2 -9
- package/build/types/repl.js +2 -9
- package/build/types/transformers.js +2 -9
- package/build/utils-CtGytdtt.js +42 -0
- package/build/verification_token-DrdoU4RH.js +46 -0
- package/build/vine-DGint2rk.js +32 -0
- package/package.json +113 -60
- package/build/modules/ace/commands.js +0 -157
- package/build/modules/ace/create_kernel.js +0 -91
- package/build/modules/ace/kernel.js +0 -40
- package/build/modules/dumper/define_config.js +0 -36
- package/build/modules/dumper/dumper.js +0 -256
- package/build/modules/dumper/errors.js +0 -119
- package/build/modules/encryption.d.ts +0 -1
- package/build/modules/encryption.js +0 -9
- package/build/modules/hash/define_config.js +0 -125
- package/build/modules/http/request_validator.js +0 -100
- package/build/src/assembler_hooks/index_entities.js +0 -107
- package/build/src/cli_formatters/routes_list.js +0 -381
- package/build/src/config_provider.js +0 -71
- package/build/src/debug.js +0 -25
- package/build/src/ignitor/ace.js +0 -102
- package/build/src/ignitor/http.js +0 -146
- package/build/src/ignitor/main.js +0 -124
- package/build/src/ignitor/test.js +0 -66
- package/build/src/test_utils/http.js +0 -82
- package/build/src/utils.js +0 -104
- package/build/stubs/main.js +0 -9
- package/build/toolkit/commands/index_commands.js +0 -30
- /package/build/{stubs/make → make}/command/main.stub +0 -0
- /package/build/{stubs/make → make}/controller/actions.stub +0 -0
- /package/build/{stubs/make → make}/controller/api.stub +0 -0
- /package/build/{stubs/make → make}/controller/main.stub +0 -0
- /package/build/{stubs/make → make}/controller/resource.stub +0 -0
- /package/build/{stubs/make → make}/event/main.stub +0 -0
- /package/build/{stubs/make → make}/exception/main.stub +0 -0
- /package/build/{stubs/make → make}/health/main.stub +0 -0
- /package/build/{stubs/make → make}/listener/for_event.stub +0 -0
- /package/build/{stubs/make → make}/listener/main.stub +0 -0
- /package/build/{stubs/make → make}/middleware/main.stub +0 -0
- /package/build/{stubs/make → make}/preload/main.stub +0 -0
- /package/build/{stubs/make → make}/provider/main.stub +0 -0
- /package/build/{stubs/make → make}/service/main.stub +0 -0
- /package/build/{stubs/make → make}/test/main.stub +0 -0
- /package/build/{stubs/make → make}/transformer/main.stub +0 -0
- /package/build/{stubs/make → make}/validator/main.stub +0 -0
- /package/build/{stubs/make → make}/validator/resource.stub +0 -0
- /package/build/{stubs/make → make}/view/main.stub +0 -0
|
@@ -1,178 +1,83 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { t as stubsRoot } from "../main-kn40V-hF.js";
|
|
2
|
+
import { f as BaseCommand, l as flags, o as args } from "../main-BlJhxJJ2.js";
|
|
3
|
+
import { t as __decorate } from "../decorate-CJcHOoD-.js";
|
|
4
|
+
import { RuntimeException } from "@poppinss/utils/exception";
|
|
5
|
+
var Configure = class extends BaseCommand {
|
|
6
|
+
static commandName = "configure";
|
|
7
|
+
static description = "Configure a package after it has been installed";
|
|
8
|
+
static options = { allowUnknownFlags: true };
|
|
9
|
+
get parsedFlags() {
|
|
10
|
+
return this.parsed.flags;
|
|
11
|
+
}
|
|
12
|
+
get parsedArgs() {
|
|
13
|
+
return this.parsed._;
|
|
14
|
+
}
|
|
15
|
+
async #getPackageSource(packageName) {
|
|
16
|
+
try {
|
|
17
|
+
return await this.app.import(packageName);
|
|
18
|
+
} catch (error) {
|
|
19
|
+
if (error.code && error.code === "ERR_MODULE_NOT_FOUND" || error.message.startsWith("Cannot find module")) return null;
|
|
20
|
+
throw error;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
async #configureVineJS() {
|
|
24
|
+
await (await this.createCodemods()).updateRcFile((rcFile) => {
|
|
25
|
+
rcFile.addProvider("@adonisjs/core/providers/vinejs_provider");
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
async #configureEdge() {
|
|
29
|
+
await (await this.createCodemods()).updateRcFile((rcFile) => {
|
|
30
|
+
rcFile.addProvider("@adonisjs/core/providers/edge_provider");
|
|
31
|
+
rcFile.addMetaFile("resources/views/**/*.edge", false);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
async #configureHealthChecks() {
|
|
35
|
+
const codemods = await this.createCodemods();
|
|
36
|
+
await codemods.makeUsingStub(stubsRoot, "make/health/main.stub", {
|
|
37
|
+
flags: this.parsed.flags,
|
|
38
|
+
entity: this.app.generators.createEntity("health")
|
|
39
|
+
});
|
|
40
|
+
await codemods.makeUsingStub(stubsRoot, "make/health/controller.stub", {
|
|
41
|
+
flags: this.parsed.flags,
|
|
42
|
+
entity: this.app.generators.createEntity("health_checks")
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
async createCodemods() {
|
|
46
|
+
const codemods = await super.createCodemods();
|
|
47
|
+
codemods.overwriteExisting = this.force === true;
|
|
48
|
+
codemods.verboseInstallOutput = this.verbose === true;
|
|
49
|
+
return codemods;
|
|
50
|
+
}
|
|
51
|
+
async run() {
|
|
52
|
+
if (this.name === "vinejs") return this.#configureVineJS();
|
|
53
|
+
if (this.name === "edge") return this.#configureEdge();
|
|
54
|
+
if (this.name === "health_checks") return this.#configureHealthChecks();
|
|
55
|
+
const packageExports = await this.#getPackageSource(this.name);
|
|
56
|
+
if (!packageExports) {
|
|
57
|
+
this.logger.error(`Cannot find module "${this.name}". Make sure to install it`);
|
|
58
|
+
this.exitCode = 1;
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (!packageExports.configure) {
|
|
62
|
+
this.logger.error(`Cannot configure module "${this.name}". The module does not export the configure hook`);
|
|
63
|
+
this.exitCode = 1;
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (packageExports.stubsRoot) this.stubsRoot = packageExports.stubsRoot;
|
|
67
|
+
try {
|
|
68
|
+
await packageExports.configure(this);
|
|
69
|
+
} catch (error) {
|
|
70
|
+
throw new RuntimeException(`Unable to configure package "${this.name}"`, { cause: error });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
14
73
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
* ace configure @adonisjs/lucid
|
|
26
|
-
* ace configure vinejs
|
|
27
|
-
* ace configure edge
|
|
28
|
-
* ace configure health_checks
|
|
29
|
-
* ace configure @adonisjs/auth --force --verbose
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export default class Configure extends BaseCommand {
|
|
33
|
-
/**
|
|
34
|
-
* The command name
|
|
35
|
-
*/
|
|
36
|
-
static commandName = 'configure';
|
|
37
|
-
/**
|
|
38
|
-
* The command description
|
|
39
|
-
*/
|
|
40
|
-
static description = 'Configure a package after it has been installed';
|
|
41
|
-
/**
|
|
42
|
-
* Command options configuration.
|
|
43
|
-
* Allows unknown flags to be passed to package configure functions.
|
|
44
|
-
*/
|
|
45
|
-
static options = {
|
|
46
|
-
allowUnknownFlags: true,
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* Expose all flags from the protected property "parsed" for access by package configure functions
|
|
50
|
-
*/
|
|
51
|
-
get parsedFlags() {
|
|
52
|
-
return this.parsed.flags;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Expose all arguments from the protected property "parsed" for access by package configure functions
|
|
56
|
-
*/
|
|
57
|
-
get parsedArgs() {
|
|
58
|
-
return this.parsed._;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Import and return the main exports of a package.
|
|
62
|
-
* Returns null if the package is not found, rethrows other errors.
|
|
63
|
-
*
|
|
64
|
-
* @param packageName - The name of the package to import
|
|
65
|
-
* @returns The package exports or null if not found
|
|
66
|
-
*/
|
|
67
|
-
async #getPackageSource(packageName) {
|
|
68
|
-
try {
|
|
69
|
-
const packageExports = await this.app.import(packageName);
|
|
70
|
-
return packageExports;
|
|
71
|
-
}
|
|
72
|
-
catch (error) {
|
|
73
|
-
if ((error.code && error.code === 'ERR_MODULE_NOT_FOUND') ||
|
|
74
|
-
error.message.startsWith('Cannot find module')) {
|
|
75
|
-
return null;
|
|
76
|
-
}
|
|
77
|
-
throw error;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Configure VineJS validation library by registering its provider in the RC file
|
|
82
|
-
*/
|
|
83
|
-
async #configureVineJS() {
|
|
84
|
-
const codemods = await this.createCodemods();
|
|
85
|
-
await codemods.updateRcFile((rcFile) => {
|
|
86
|
-
rcFile.addProvider('@adonisjs/core/providers/vinejs_provider');
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Configure Edge template engine by registering its provider and adding view meta files
|
|
91
|
-
*/
|
|
92
|
-
async #configureEdge() {
|
|
93
|
-
const codemods = await this.createCodemods();
|
|
94
|
-
await codemods.updateRcFile((rcFile) => {
|
|
95
|
-
rcFile.addProvider('@adonisjs/core/providers/edge_provider');
|
|
96
|
-
rcFile.addMetaFile('resources/views/**/*.edge', false);
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Configure health checks feature by generating the main health file and controller
|
|
101
|
-
*/
|
|
102
|
-
async #configureHealthChecks() {
|
|
103
|
-
const codemods = await this.createCodemods();
|
|
104
|
-
await codemods.makeUsingStub(stubsRoot, 'make/health/main.stub', {
|
|
105
|
-
flags: this.parsed.flags,
|
|
106
|
-
entity: this.app.generators.createEntity('health'),
|
|
107
|
-
});
|
|
108
|
-
await codemods.makeUsingStub(stubsRoot, 'make/health/controller.stub', {
|
|
109
|
-
flags: this.parsed.flags,
|
|
110
|
-
entity: this.app.generators.createEntity('health_checks'),
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Create a codemods instance configured with command options.
|
|
115
|
-
* Sets overwrite and verbose flags based on command arguments.
|
|
116
|
-
*/
|
|
117
|
-
async createCodemods() {
|
|
118
|
-
const codemods = await super.createCodemods();
|
|
119
|
-
codemods.overwriteExisting = this.force === true;
|
|
120
|
-
codemods.verboseInstallOutput = this.verbose === true;
|
|
121
|
-
return codemods;
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Execute the configure command. Handles built-in configurations for VineJS, Edge,
|
|
125
|
-
* and health checks, or imports and executes the configure function from the specified package.
|
|
126
|
-
*/
|
|
127
|
-
async run() {
|
|
128
|
-
if (this.name === 'vinejs') {
|
|
129
|
-
return this.#configureVineJS();
|
|
130
|
-
}
|
|
131
|
-
if (this.name === 'edge') {
|
|
132
|
-
return this.#configureEdge();
|
|
133
|
-
}
|
|
134
|
-
if (this.name === 'health_checks') {
|
|
135
|
-
return this.#configureHealthChecks();
|
|
136
|
-
}
|
|
137
|
-
const packageExports = await this.#getPackageSource(this.name);
|
|
138
|
-
if (!packageExports) {
|
|
139
|
-
this.logger.error(`Cannot find module "${this.name}". Make sure to install it`);
|
|
140
|
-
this.exitCode = 1;
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Warn, there are not instructions to run
|
|
145
|
-
*/
|
|
146
|
-
if (!packageExports.configure) {
|
|
147
|
-
this.logger.error(`Cannot configure module "${this.name}". The module does not export the configure hook`);
|
|
148
|
-
this.exitCode = 1;
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Set stubsRoot property when package exports it
|
|
153
|
-
*/
|
|
154
|
-
if (packageExports.stubsRoot) {
|
|
155
|
-
this.stubsRoot = packageExports.stubsRoot;
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Run instructions
|
|
159
|
-
*/
|
|
160
|
-
try {
|
|
161
|
-
await packageExports.configure(this);
|
|
162
|
-
}
|
|
163
|
-
catch (error) {
|
|
164
|
-
throw new RuntimeException(`Unable to configure package "${this.name}"`, {
|
|
165
|
-
cause: error,
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
__decorate([
|
|
171
|
-
args.string({ description: 'Package name' })
|
|
172
|
-
], Configure.prototype, "name", void 0);
|
|
173
|
-
__decorate([
|
|
174
|
-
flags.boolean({ description: 'Display logs in verbose mode', alias: 'v' })
|
|
175
|
-
], Configure.prototype, "verbose", void 0);
|
|
176
|
-
__decorate([
|
|
177
|
-
flags.boolean({ description: 'Forcefully overwrite existing files', alias: 'f' })
|
|
178
|
-
], Configure.prototype, "force", void 0);
|
|
74
|
+
__decorate([args.string({ description: "Package name" })], Configure.prototype, "name", void 0);
|
|
75
|
+
__decorate([flags.boolean({
|
|
76
|
+
description: "Display logs in verbose mode",
|
|
77
|
+
alias: "v"
|
|
78
|
+
})], Configure.prototype, "verbose", void 0);
|
|
79
|
+
__decorate([flags.boolean({
|
|
80
|
+
description: "Forcefully overwrite existing files",
|
|
81
|
+
alias: "f"
|
|
82
|
+
})], Configure.prototype, "force", void 0);
|
|
83
|
+
export { Configure as default };
|
package/build/commands/eject.js
CHANGED
|
@@ -1,61 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
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;
|
|
13
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1
|
+
import { t as string_default } from "../string-Cx6q_win.js";
|
|
2
|
+
import { f as BaseCommand, l as flags, o as args } from "../main-BlJhxJJ2.js";
|
|
3
|
+
import { t as __decorate } from "../decorate-CJcHOoD-.js";
|
|
4
|
+
var Eject = class extends BaseCommand {
|
|
5
|
+
static commandName = "eject";
|
|
6
|
+
static description = "Eject scaffolding stubs to your application root";
|
|
7
|
+
async run() {
|
|
8
|
+
(await (await this.app.stubs.create()).copy(this.stubPath, { pkg: this.pkg })).forEach((stubPath) => {
|
|
9
|
+
this.logger.success(`eject ${string_default.toUnixSlash(this.app.relativePath(stubPath))}`);
|
|
10
|
+
});
|
|
11
|
+
}
|
|
14
12
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```
|
|
24
|
-
* ace eject make/controller
|
|
25
|
-
* ace eject make/controller --pkg=@adonisjs/lucid
|
|
26
|
-
* ace eject stubs/
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
export default class Eject extends BaseCommand {
|
|
30
|
-
/**
|
|
31
|
-
* The command name
|
|
32
|
-
*/
|
|
33
|
-
static commandName = 'eject';
|
|
34
|
-
/**
|
|
35
|
-
* The command description
|
|
36
|
-
*/
|
|
37
|
-
static description = 'Eject scaffolding stubs to your application root';
|
|
38
|
-
/**
|
|
39
|
-
* Execute the command to eject stubs from the specified package.
|
|
40
|
-
* Copies the stubs to the application root and logs success messages
|
|
41
|
-
* for each ejected file.
|
|
42
|
-
*/
|
|
43
|
-
async run() {
|
|
44
|
-
const stubs = await this.app.stubs.create();
|
|
45
|
-
const copied = await stubs.copy(this.stubPath, {
|
|
46
|
-
pkg: this.pkg,
|
|
47
|
-
});
|
|
48
|
-
copied.forEach((stubPath) => {
|
|
49
|
-
this.logger.success(`eject ${stringHelpers.toUnixSlash(this.app.relativePath(stubPath))}`);
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
__decorate([
|
|
54
|
-
args.string({ description: 'Path to the stubs directory or a single stub file' })
|
|
55
|
-
], Eject.prototype, "stubPath", void 0);
|
|
56
|
-
__decorate([
|
|
57
|
-
flags.string({
|
|
58
|
-
description: 'Mention package name for searching stubs',
|
|
59
|
-
default: '@adonisjs/core',
|
|
60
|
-
})
|
|
61
|
-
], Eject.prototype, "pkg", void 0);
|
|
13
|
+
__decorate([args.string({ description: "Path to the stubs directory or a single stub file" })], Eject.prototype, "stubPath", void 0);
|
|
14
|
+
__decorate([flags.string({
|
|
15
|
+
description: "Mention package name for searching stubs",
|
|
16
|
+
default: "@adonisjs/core"
|
|
17
|
+
})], Eject.prototype, "pkg", void 0);
|
|
18
|
+
export { Eject as default };
|
|
@@ -1,135 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { t as string_default } from "../../string-Cx6q_win.js";
|
|
2
|
+
import { f as BaseCommand, l as flags, o as args } from "../../main-BlJhxJJ2.js";
|
|
3
|
+
import { t as __decorate } from "../../decorate-CJcHOoD-.js";
|
|
4
|
+
const ALLOWED_TYPES = [
|
|
5
|
+
"string",
|
|
6
|
+
"boolean",
|
|
7
|
+
"number",
|
|
8
|
+
"enum"
|
|
9
|
+
];
|
|
10
|
+
var EnvAdd = class extends BaseCommand {
|
|
11
|
+
static commandName = "env:add";
|
|
12
|
+
static description = "Add a new environment variable";
|
|
13
|
+
static options = { allowUnknownFlags: true };
|
|
14
|
+
#isTypeFlagValid() {
|
|
15
|
+
return ALLOWED_TYPES.includes(this.type);
|
|
16
|
+
}
|
|
17
|
+
async run() {
|
|
18
|
+
if (!this.name) this.name = await this.prompt.ask("Enter the variable name", {
|
|
19
|
+
validate: (value) => !!value,
|
|
20
|
+
format: (value) => string_default.snakeCase(value).toUpperCase()
|
|
21
|
+
});
|
|
22
|
+
if (!this.value) this.value = await this.prompt.ask("Enter the variable value");
|
|
23
|
+
if (!this.type) this.type = await this.prompt.choice("Select the variable type", ALLOWED_TYPES);
|
|
24
|
+
if (this.type === "enum" && !this.enumValues) this.enumValues = await this.prompt.ask("Enter the enum values separated by a comma", { result: (value) => value.split(",").map((one) => one.trim()) });
|
|
25
|
+
if (!this.#isTypeFlagValid()) {
|
|
26
|
+
this.logger.error(`Invalid type "${this.type}". Must be one of ${ALLOWED_TYPES.join(", ")}`);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const codemods = await this.createCodemods();
|
|
30
|
+
const transformedName = string_default.snakeCase(this.name).toUpperCase();
|
|
31
|
+
await codemods.defineEnvVariables({ [transformedName]: this.value }, { omitFromExample: [transformedName] });
|
|
32
|
+
const validation = {
|
|
33
|
+
string: "Env.schema.string()",
|
|
34
|
+
number: "Env.schema.number()",
|
|
35
|
+
boolean: "Env.schema.boolean()",
|
|
36
|
+
enum: `Env.schema.enum(['${this.enumValues.join("','")}'] as const)`
|
|
37
|
+
}[this.type];
|
|
38
|
+
await codemods.defineEnvValidations({ variables: { [transformedName]: validation } });
|
|
39
|
+
this.logger.success("Environment variable added successfully");
|
|
40
|
+
}
|
|
14
41
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
* ace env:add LOG_LEVEL info --type=enum --enum-values=debug,info,warn,error
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
export default class EnvAdd extends BaseCommand {
|
|
34
|
-
/**
|
|
35
|
-
* The command name
|
|
36
|
-
*/
|
|
37
|
-
static commandName = 'env:add';
|
|
38
|
-
/**
|
|
39
|
-
* The command description
|
|
40
|
-
*/
|
|
41
|
-
static description = 'Add a new environment variable';
|
|
42
|
-
/**
|
|
43
|
-
* Command options configuration.
|
|
44
|
-
* Allows unknown flags to be passed through.
|
|
45
|
-
*/
|
|
46
|
-
static options = {
|
|
47
|
-
allowUnknownFlags: true,
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* Validate that the provided type is one of the allowed types.
|
|
51
|
-
*
|
|
52
|
-
* @returns True if the type is valid, false otherwise
|
|
53
|
-
*/
|
|
54
|
-
#isTypeFlagValid() {
|
|
55
|
-
return ALLOWED_TYPES.includes(this.type);
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Execute the command to add a new environment variable.
|
|
59
|
-
* Prompts for missing values, validates inputs, and updates all relevant files.
|
|
60
|
-
*/
|
|
61
|
-
async run() {
|
|
62
|
-
/**
|
|
63
|
-
* Prompt for missing name
|
|
64
|
-
*/
|
|
65
|
-
if (!this.name) {
|
|
66
|
-
this.name = await this.prompt.ask('Enter the variable name', {
|
|
67
|
-
validate: (value) => !!value,
|
|
68
|
-
format: (value) => stringHelpers.snakeCase(value).toUpperCase(),
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Prompt for missing value
|
|
73
|
-
*/
|
|
74
|
-
if (!this.value) {
|
|
75
|
-
this.value = await this.prompt.ask('Enter the variable value');
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Prompt for missing type
|
|
79
|
-
*/
|
|
80
|
-
if (!this.type) {
|
|
81
|
-
this.type = await this.prompt.choice('Select the variable type', ALLOWED_TYPES);
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Prompt for missing enum values if the selected env type is `enum`
|
|
85
|
-
*/
|
|
86
|
-
if (this.type === 'enum' && !this.enumValues) {
|
|
87
|
-
this.enumValues = await this.prompt.ask('Enter the enum values separated by a comma', {
|
|
88
|
-
result: (value) => value.split(',').map((one) => one.trim()),
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Validate inputs
|
|
93
|
-
*/
|
|
94
|
-
if (!this.#isTypeFlagValid()) {
|
|
95
|
-
this.logger.error(`Invalid type "${this.type}". Must be one of ${ALLOWED_TYPES.join(', ')}`);
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Add the environment variable to the `.env` and `.env.example` files
|
|
100
|
-
*/
|
|
101
|
-
const codemods = await this.createCodemods();
|
|
102
|
-
const transformedName = stringHelpers.snakeCase(this.name).toUpperCase();
|
|
103
|
-
await codemods.defineEnvVariables({ [transformedName]: this.value }, { omitFromExample: [transformedName] });
|
|
104
|
-
/**
|
|
105
|
-
* Add the environment variable to the `start/env.ts` file
|
|
106
|
-
*/
|
|
107
|
-
const validation = {
|
|
108
|
-
string: 'Env.schema.string()',
|
|
109
|
-
number: 'Env.schema.number()',
|
|
110
|
-
boolean: 'Env.schema.boolean()',
|
|
111
|
-
enum: `Env.schema.enum(['${this.enumValues.join("','")}'] as const)`,
|
|
112
|
-
}[this.type];
|
|
113
|
-
await codemods.defineEnvValidations({ variables: { [transformedName]: validation } });
|
|
114
|
-
this.logger.success('Environment variable added successfully');
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
__decorate([
|
|
118
|
-
args.string({
|
|
119
|
-
description: 'Variable name. Will be converted to screaming snake case',
|
|
120
|
-
required: false,
|
|
121
|
-
})
|
|
122
|
-
], EnvAdd.prototype, "name", void 0);
|
|
123
|
-
__decorate([
|
|
124
|
-
args.string({ description: 'Variable value', required: false })
|
|
125
|
-
], EnvAdd.prototype, "value", void 0);
|
|
126
|
-
__decorate([
|
|
127
|
-
flags.string({ description: 'Type of the variable' })
|
|
128
|
-
], EnvAdd.prototype, "type", void 0);
|
|
129
|
-
__decorate([
|
|
130
|
-
flags.array({
|
|
131
|
-
description: 'Allowed values for the enum type in a comma-separated list',
|
|
132
|
-
default: [''],
|
|
133
|
-
required: false,
|
|
134
|
-
})
|
|
135
|
-
], EnvAdd.prototype, "enumValues", void 0);
|
|
42
|
+
__decorate([args.string({
|
|
43
|
+
description: "Variable name. Will be converted to screaming snake case",
|
|
44
|
+
required: false
|
|
45
|
+
})], EnvAdd.prototype, "name", void 0);
|
|
46
|
+
__decorate([args.string({
|
|
47
|
+
description: "Variable value",
|
|
48
|
+
required: false
|
|
49
|
+
})], EnvAdd.prototype, "value", void 0);
|
|
50
|
+
__decorate([flags.string({ description: "Type of the variable" })], EnvAdd.prototype, "type", void 0);
|
|
51
|
+
__decorate([flags.array({
|
|
52
|
+
description: "Allowed values for the enum type in a comma-separated list",
|
|
53
|
+
default: [""],
|
|
54
|
+
required: false
|
|
55
|
+
})], EnvAdd.prototype, "enumValues", void 0);
|
|
56
|
+
export { EnvAdd as default };
|
|
@@ -1,67 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { f as BaseCommand, l as flags } from "../main-BlJhxJJ2.js";
|
|
2
|
+
import { t as __decorate } from "../decorate-CJcHOoD-.js";
|
|
3
|
+
import string from "@poppinss/utils/string";
|
|
4
|
+
import { EnvEditor } from "@adonisjs/env/editor";
|
|
5
|
+
var GenerateKey = class extends BaseCommand {
|
|
6
|
+
static commandName = "generate:key";
|
|
7
|
+
static description = "Generate a cryptographically secure random application key";
|
|
8
|
+
async run() {
|
|
9
|
+
let writeToFile = process.env.NODE_ENV !== "production";
|
|
10
|
+
if (this.force) writeToFile = true;
|
|
11
|
+
if (this.show) writeToFile = false;
|
|
12
|
+
const secureKey = string.random(32);
|
|
13
|
+
if (writeToFile) {
|
|
14
|
+
const editor = await EnvEditor.create(this.app.appRoot);
|
|
15
|
+
editor.add("APP_KEY", secureKey, true);
|
|
16
|
+
await editor.save();
|
|
17
|
+
this.logger.action("add APP_KEY to .env").succeeded();
|
|
18
|
+
} else this.logger.log(`APP_KEY = ${secureKey}`);
|
|
19
|
+
}
|
|
14
20
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* The generate key command is used to generate the app key
|
|
20
|
-
* and write it inside the .env file.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```
|
|
24
|
-
* ace generate:key
|
|
25
|
-
* ace generate:key --show
|
|
26
|
-
* ace generate:key --force
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
export default class GenerateKey extends BaseCommand {
|
|
30
|
-
/**
|
|
31
|
-
* The command name
|
|
32
|
-
*/
|
|
33
|
-
static commandName = 'generate:key';
|
|
34
|
-
/**
|
|
35
|
-
* The command description
|
|
36
|
-
*/
|
|
37
|
-
static description = 'Generate a cryptographically secure random application key';
|
|
38
|
-
async run() {
|
|
39
|
-
let writeToFile = process.env.NODE_ENV !== 'production';
|
|
40
|
-
if (this.force) {
|
|
41
|
-
writeToFile = true;
|
|
42
|
-
}
|
|
43
|
-
if (this.show) {
|
|
44
|
-
writeToFile = false;
|
|
45
|
-
}
|
|
46
|
-
const secureKey = string.random(32);
|
|
47
|
-
if (writeToFile) {
|
|
48
|
-
const editor = await EnvEditor.create(this.app.appRoot);
|
|
49
|
-
editor.add('APP_KEY', secureKey, true);
|
|
50
|
-
await editor.save();
|
|
51
|
-
this.logger.action('add APP_KEY to .env').succeeded();
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
this.logger.log(`APP_KEY = ${secureKey}`);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
__decorate([
|
|
59
|
-
flags.boolean({
|
|
60
|
-
description: 'Display the key on the terminal, instead of writing it to .env file',
|
|
61
|
-
})
|
|
62
|
-
], GenerateKey.prototype, "show", void 0);
|
|
63
|
-
__decorate([
|
|
64
|
-
flags.boolean({
|
|
65
|
-
description: 'Force update .env file in production environment',
|
|
66
|
-
})
|
|
67
|
-
], GenerateKey.prototype, "force", void 0);
|
|
21
|
+
__decorate([flags.boolean({ description: "Display the key on the terminal, instead of writing it to .env file" })], GenerateKey.prototype, "show", void 0);
|
|
22
|
+
__decorate([flags.boolean({ description: "Force update .env file in production environment" })], GenerateKey.prototype, "force", void 0);
|
|
23
|
+
export { GenerateKey as default };
|