@strapi/upgrade 5.0.0-rc.4 → 5.0.0-rc.6
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/dist/cli.js
CHANGED
|
@@ -1444,7 +1444,7 @@ When executed on a Strapi plugin project, it shows every codemods.
|
|
|
1444
1444
|
return listCodemods(options);
|
|
1445
1445
|
});
|
|
1446
1446
|
};
|
|
1447
|
-
const version = "5.0.0-rc.
|
|
1447
|
+
const version = "5.0.0-rc.6";
|
|
1448
1448
|
register$1(commander.program);
|
|
1449
1449
|
register(commander.program);
|
|
1450
1450
|
commander.program.usage("<command> [options]").on("command:*", ([invalidCmd]) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/upgrade",
|
|
3
|
-
"version": "5.0.0-rc.
|
|
3
|
+
"version": "5.0.0-rc.6",
|
|
4
4
|
"description": "CLI to upgrade Strapi applications effortless",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"strapi",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"watch": "pack-up watch"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@strapi/utils": "5.0.0-rc.
|
|
62
|
+
"@strapi/utils": "5.0.0-rc.6",
|
|
63
63
|
"chalk": "4.1.2",
|
|
64
64
|
"cli-table3": "0.6.2",
|
|
65
65
|
"commander": "8.3.0",
|
|
@@ -76,15 +76,15 @@
|
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@strapi/pack-up": "5.0.0",
|
|
79
|
-
"@strapi/types": "5.0.0-rc.
|
|
79
|
+
"@strapi/types": "5.0.0-rc.6",
|
|
80
80
|
"@types/fs-extra": "11.0.4",
|
|
81
81
|
"@types/jscodeshift": "0.11.10",
|
|
82
|
-
"eslint-config-custom": "5.0.0-rc.
|
|
82
|
+
"eslint-config-custom": "5.0.0-rc.6",
|
|
83
83
|
"rimraf": "5.0.5"
|
|
84
84
|
},
|
|
85
85
|
"engines": {
|
|
86
86
|
"node": ">=18.0.0 <=20.x.x",
|
|
87
87
|
"npm": ">=6.0.0"
|
|
88
88
|
},
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "ae299ee651ea4cca18321a1d2cd3c40bc3870b8a"
|
|
90
90
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import semver from 'semver';
|
|
3
|
+
|
|
4
|
+
import type { modules } from '../../../dist';
|
|
5
|
+
|
|
6
|
+
const DEP_NAME = 'styled-components';
|
|
7
|
+
const DEP_PATH = `dependencies.${DEP_NAME}`;
|
|
8
|
+
|
|
9
|
+
const DEP_NEW_VERSION_RANGE = '^6.0.0';
|
|
10
|
+
|
|
11
|
+
const transform: modules.runner.json.JSONTransform = (file, params) => {
|
|
12
|
+
const { cwd, json } = params;
|
|
13
|
+
|
|
14
|
+
const rootPackageJsonPath = path.join(cwd, 'package.json');
|
|
15
|
+
|
|
16
|
+
if (file.path !== rootPackageJsonPath) {
|
|
17
|
+
return file.json;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const j = json(file.json);
|
|
21
|
+
|
|
22
|
+
if (j.has(DEP_PATH)) {
|
|
23
|
+
const currentVersion = j.get(DEP_PATH);
|
|
24
|
+
|
|
25
|
+
// If the current version is not a string, then something is wrong, abort
|
|
26
|
+
if (typeof currentVersion !== 'string') {
|
|
27
|
+
return j.root();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const currentSatisfiesNew = semver.satisfies(currentVersion, DEP_NEW_VERSION_RANGE);
|
|
31
|
+
|
|
32
|
+
// if the current version satisfies the new range, keep it as is and abort
|
|
33
|
+
if (currentSatisfiesNew) {
|
|
34
|
+
return j.root();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// else, update the version with the new one
|
|
38
|
+
j.set(DEP_PATH, DEP_NEW_VERSION_RANGE);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// If the dependency is not listed yet, add it
|
|
42
|
+
else {
|
|
43
|
+
j.set(DEP_PATH, DEP_NEW_VERSION_RANGE);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return j.root();
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export default transform;
|