@strapi/upgrade 0.0.0-experimental.ae69a6ec6a65b1061cd6a00b2608abeeff436042 → 0.0.0-experimental.b0db56479de441dfe8feb37a43c7f6f6fecf75c1

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.
@@ -5,6 +5,7 @@ export type { SemVer, Range } from 'semver';
5
5
  export declare enum ReleaseType {
6
6
  Major = "major",
7
7
  Minor = "minor",
8
- Patch = "patch"
8
+ Patch = "patch",
9
+ Latest = "latest"
9
10
  }
10
11
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/modules/version/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAE7B,MAAM,MAAM,cAAc,GACtB,GAAG,OAAO,EAAE,GACZ,GAAG,OAAO,IAAI,OAAO,EAAE,GACvB,GAAG,OAAO,IAAI,OAAO,IAAI,OAAO,EAAE,CAAC;AAEvC,MAAM,MAAM,aAAa,GAAG,GAAG,OAAO,IAAI,OAAO,IAAI,OAAO,EAAE,CAAC;AAE/D,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE5C,oBAAY,WAAW;IACrB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,KAAK,UAAU;CAChB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/modules/version/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAE7B,MAAM,MAAM,cAAc,GACtB,GAAG,OAAO,EAAE,GACZ,GAAG,OAAO,IAAI,OAAO,EAAE,GACvB,GAAG,OAAO,IAAI,OAAO,IAAI,OAAO,EAAE,CAAC;AAEvC,MAAM,MAAM,aAAa,GAAG,GAAG,OAAO,IAAI,OAAO,IAAI,OAAO,EAAE,CAAC;AAE/D,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE5C,oBAAY,WAAW;IAErB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,KAAK,UAAU;IAEf,MAAM,WAAW;CAClB"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/tasks/codemods/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAmD,MAAM,uBAAuB,CAAC;AAEjG,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErD,eAAO,MAAM,WAAW,SAAU,MAAM,WAAuC,CAAC;AAEhF,eAAO,MAAM,kBAAkB,mBACb,QAAQ,MAAM,UACtB,QAAQ,WAAW,GAAG,QAAQ,aAAa,kBAkBpD,CAAC;AAEF,eAAO,MAAM,mBAAmB,YACrB,OAAO,UACR,QAAQ,WAAW,GAAG,QAAQ,aAAa,GAAG,aAAa,KAClE,aAeF,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/tasks/codemods/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAmD,MAAM,uBAAuB,CAAC;AAEjG,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErD,eAAO,MAAM,WAAW,SAAU,MAAM,WAAuC,CAAC;AAEhF,eAAO,MAAM,kBAAkB,mBACb,QAAQ,MAAM,UACtB,QAAQ,WAAW,GAAG,QAAQ,aAAa,kBAoBpD,CAAC;AAEF,eAAO,MAAM,mBAAmB,YACrB,OAAO,UACR,QAAQ,WAAW,GAAG,QAAQ,aAAa,GAAG,aAAa,KAClE,aAeF,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './latest';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tasks/upgrade/prompts/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { Upgrader } from '../../../modules/upgrader';
2
+ import type { UpgradeOptions } from '../types';
3
+ /**
4
+ * Handles the upgrade prompts when using the latest tag.
5
+ *
6
+ * - checks if an upgrade involves a major bump, warning and asking for user confirmation before proceeding
7
+ */
8
+ export declare const latest: (upgrader: Upgrader, options: UpgradeOptions) => Promise<void>;
9
+ //# sourceMappingURL=latest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"latest.d.ts","sourceRoot":"","sources":["../../../../src/tasks/upgrade/prompts/latest.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C;;;;GAIG;AACH,eAAO,MAAM,MAAM,aAAoB,QAAQ,WAAW,cAAc,kBAgDvE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"major.d.ts","sourceRoot":"","sources":["../../../../src/tasks/upgrade/requirements/major.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,4BAA4B,gEAYxC,CAAC;AAEF,eAAO,MAAM,gCAAgC,gEAgB5C,CAAC"}
1
+ {"version":3,"file":"major.d.ts","sourceRoot":"","sources":["../../../../src/tasks/upgrade/requirements/major.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,4BAA4B,gEAYxC,CAAC;AAEF,eAAO,MAAM,gCAAgC,gEAmB5C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../../../src/tasks/upgrade/upgrade.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,eAAO,MAAM,OAAO,YAAmB,cAAc,kBAuDpD,CAAC"}
1
+ {"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../../../src/tasks/upgrade/upgrade.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAG9C,eAAO,MAAM,OAAO,YAAmB,cAAc,kBAuDpD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/upgrade",
3
- "version": "0.0.0-experimental.ae69a6ec6a65b1061cd6a00b2608abeeff436042",
3
+ "version": "0.0.0-experimental.b0db56479de441dfe8feb37a43c7f6f6fecf75c1",
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": "0.0.0-experimental.ae69a6ec6a65b1061cd6a00b2608abeeff436042",
62
+ "@strapi/utils": "0.0.0-experimental.b0db56479de441dfe8feb37a43c7f6f6fecf75c1",
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": "0.0.0-experimental.ae69a6ec6a65b1061cd6a00b2608abeeff436042",
79
+ "@strapi/types": "0.0.0-experimental.b0db56479de441dfe8feb37a43c7f6f6fecf75c1",
80
80
  "@types/fs-extra": "11.0.4",
81
81
  "@types/jscodeshift": "0.11.10",
82
- "eslint-config-custom": "0.0.0-experimental.ae69a6ec6a65b1061cd6a00b2608abeeff436042",
82
+ "eslint-config-custom": "0.0.0-experimental.b0db56479de441dfe8feb37a43c7f6f6fecf75c1",
83
83
  "rimraf": "5.0.5"
84
84
  },
85
85
  "engines": {
86
86
  "node": ">=18.0.0 <=22.x.x",
87
87
  "npm": ">=6.0.0"
88
88
  },
89
- "gitHead": "ae69a6ec6a65b1061cd6a00b2608abeeff436042"
89
+ "gitHead": "b0db56479de441dfe8feb37a43c7f6f6fecf75c1"
90
90
  }
@@ -1,5 +1,6 @@
1
+ import path from 'path';
2
+ import semver from 'semver';
1
3
  import type { modules } from '../../../dist';
2
- import { upgradeIfExists } from '../../utils/upgrade-package';
3
4
 
4
5
  const DEP_NAME = 'better-sqlite3';
5
6
  const DEP_PATH = `dependencies.${DEP_NAME}`;
@@ -13,3 +14,35 @@ const transform: modules.runner.json.JSONTransform = (file, params) => {
13
14
  };
14
15
 
15
16
  export default transform;
17
+
18
+ // TODO: move this to a utility once we solve the issue where codemods are not transpiled properly
19
+ const upgradeIfExists = (
20
+ file: modules.runner.json.JSONSourceFile,
21
+ params: modules.runner.json.JSONTransformParams,
22
+ packagePath: string,
23
+ targetVersion: string
24
+ ) => {
25
+ const { cwd, json } = params;
26
+
27
+ // Return early if the file path is not the root package.json
28
+ if (file.path !== path.join(cwd, 'package.json')) {
29
+ return file.json;
30
+ }
31
+
32
+ const packageJson = json(file.json);
33
+
34
+ // Check if the package exists
35
+ if (packageJson.has(packagePath)) {
36
+ const currentVersion = packageJson.get(packagePath);
37
+ // ensure we only upgrade, not downgrade
38
+ if (
39
+ typeof currentVersion === 'string' &&
40
+ semver.valid(currentVersion) &&
41
+ semver.lt(currentVersion, targetVersion)
42
+ ) {
43
+ packageJson.set(packagePath, targetVersion);
44
+ }
45
+ }
46
+
47
+ return packageJson.root();
48
+ };
@@ -1,35 +0,0 @@
1
- import path from 'node:path';
2
- import semver from 'semver';
3
- import { type modules } from '../../dist';
4
-
5
- export const upgradeIfExists = (
6
- file: modules.runner.json.JSONSourceFile,
7
- params: modules.runner.json.JSONTransformParams,
8
- packagePath: string,
9
- targetVersion: string
10
- ) => {
11
- const { cwd, json } = params;
12
-
13
- // Return early if the file path is not the root package.json
14
- if (file.path !== path.join(cwd, 'package.json')) {
15
- return file.json;
16
- }
17
-
18
- const packageJson = json(file.json);
19
-
20
- // Check if the package exists
21
- if (packageJson.has(packagePath)) {
22
- const currentVersion = packageJson.get(packagePath);
23
-
24
- // ensure we only upgrade, not downgrade
25
- if (
26
- typeof currentVersion === 'string' &&
27
- semver.valid(currentVersion) &&
28
- semver.lt(currentVersion, targetVersion)
29
- ) {
30
- packageJson.set(packagePath, targetVersion);
31
- }
32
- }
33
-
34
- return packageJson.root();
35
- };