@adonisjs/core 6.20.0 → 6.21.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/add.d.ts +1 -1
- package/build/commands/add.js +49 -0
- package/package.json +1 -2
package/build/commands/add.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CommandOptions } from '../types/ace.js';
|
|
1
|
+
import { type CommandOptions } from '../types/ace.js';
|
|
2
2
|
import { BaseCommand } from '../modules/ace/main.js';
|
|
3
3
|
declare const KNOWN_PACKAGE_MANAGERS: readonly ["npm", "pnpm", "bun", "yarn", "yarn@berry", "pnpm@6"];
|
|
4
4
|
/**
|
package/build/commands/add.js
CHANGED
|
@@ -25,6 +25,47 @@ export default class Add extends BaseCommand {
|
|
|
25
25
|
static options = {
|
|
26
26
|
allowUnknownFlags: true,
|
|
27
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* Extract the bare package name and version from a user-supplied
|
|
30
|
+
* package string. Scoped packages like "@adonisjs/auth@1.0.0"
|
|
31
|
+
* need special handling since the first "@" is part of the scope.
|
|
32
|
+
*/
|
|
33
|
+
#extractPackageNameAndVersion(pkg) {
|
|
34
|
+
if (pkg.startsWith('@')) {
|
|
35
|
+
const secondAtIndex = pkg.indexOf('@', 1);
|
|
36
|
+
if (secondAtIndex === -1) {
|
|
37
|
+
return { name: pkg };
|
|
38
|
+
}
|
|
39
|
+
return { name: pkg.substring(0, secondAtIndex), version: pkg.substring(secondAtIndex + 1) };
|
|
40
|
+
}
|
|
41
|
+
const atIndex = pkg.indexOf('@');
|
|
42
|
+
if (atIndex === -1) {
|
|
43
|
+
return { name: pkg };
|
|
44
|
+
}
|
|
45
|
+
return { name: pkg.substring(0, atIndex), version: pkg.substring(atIndex + 1) };
|
|
46
|
+
}
|
|
47
|
+
#getPackageVersion(packageName) {
|
|
48
|
+
return {
|
|
49
|
+
'@adonisjs/inertia': '^3.1.1',
|
|
50
|
+
'@adonisjs/session': '^7.7.1',
|
|
51
|
+
'@adonisjs/transmit': '^2.0.2',
|
|
52
|
+
'@adonisjs/cache': '^1.3.1',
|
|
53
|
+
'@adonisjs/otel': '^1.2.0',
|
|
54
|
+
'@adonisjs/lock': '^1.1.1',
|
|
55
|
+
'@adonisjs/cors': '^2.2.1',
|
|
56
|
+
'@adonisjs/bouncer': '^3.1.6',
|
|
57
|
+
'@adonisjs/shield': '^8.2.0',
|
|
58
|
+
'@adonisjs/drive': '^3.4.1',
|
|
59
|
+
'@adonisjs/auth': '^9.6.0',
|
|
60
|
+
'@adonisjs/vite': '^4.0.0',
|
|
61
|
+
'@adonisjs/redis': '^9.2.0',
|
|
62
|
+
'@adonisjs/i18n': '^2.2.3',
|
|
63
|
+
'@adonisjs/ally': '^5.1.1',
|
|
64
|
+
'@adonisjs/limiter': '^2.4.0',
|
|
65
|
+
'@adonisjs/static': '^1.1.1',
|
|
66
|
+
'@adonisjs/lucid-slugify': '^3.0.0',
|
|
67
|
+
}[packageName];
|
|
68
|
+
}
|
|
28
69
|
/**
|
|
29
70
|
* Detect the package manager to use
|
|
30
71
|
*/
|
|
@@ -57,6 +98,14 @@ export default class Add extends BaseCommand {
|
|
|
57
98
|
* Install the package using the selected package manager
|
|
58
99
|
*/
|
|
59
100
|
async #installPackage(npmPackageName) {
|
|
101
|
+
const { name, version } = this.#extractPackageNameAndVersion(npmPackageName);
|
|
102
|
+
const knownVersion = this.#getPackageVersion(name);
|
|
103
|
+
if (knownVersion) {
|
|
104
|
+
npmPackageName = `${name}@${knownVersion}`;
|
|
105
|
+
}
|
|
106
|
+
else if (version) {
|
|
107
|
+
npmPackageName = `${name}@${version}`;
|
|
108
|
+
}
|
|
60
109
|
const colors = this.colors;
|
|
61
110
|
const spinner = this.logger
|
|
62
111
|
.await(`installing ${colors.green(this.name)} using ${colors.grey(this.packageManager)}`)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonisjs/core",
|
|
3
3
|
"description": "Core of AdonisJS",
|
|
4
|
-
"version": "6.
|
|
4
|
+
"version": "6.21.0",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20.6.0"
|
|
7
7
|
},
|
|
@@ -193,7 +193,6 @@
|
|
|
193
193
|
],
|
|
194
194
|
"license": "MIT",
|
|
195
195
|
"publishConfig": {
|
|
196
|
-
"provenance": true,
|
|
197
196
|
"access": "public"
|
|
198
197
|
},
|
|
199
198
|
"c8": {
|