@tailor-platform/sdk-codemod 0.2.0 → 0.2.3
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @tailor-platform/sdk-codemod
|
|
2
2
|
|
|
3
|
+
## 0.2.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1245](https://github.com/tailor-platform/sdk/pull/1245) [`261a49d`](https://github.com/tailor-platform/sdk/commit/261a49de5d30d3a427a8a484956aa10ee6576abf) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency semver to v7.8.1
|
|
8
|
+
|
|
9
|
+
## 0.2.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#1236](https://github.com/tailor-platform/sdk/pull/1236) [`8b018b8`](https://github.com/tailor-platform/sdk/commit/8b018b8c224e993adc7faf61614242e3f1141f56) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency @ast-grep/napi to v0.42.3
|
|
14
|
+
|
|
15
|
+
- [#1249](https://github.com/tailor-platform/sdk/pull/1249) [`2e11bc2`](https://github.com/tailor-platform/sdk/commit/2e11bc28e76fca4874b9d35454e86253ca53b920) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency zod to v4.4.3
|
|
16
|
+
|
|
17
|
+
## 0.2.1
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [#1131](https://github.com/tailor-platform/sdk/pull/1131) [`f5d3d38`](https://github.com/tailor-platform/sdk/commit/f5d3d38f0b0f5634d4ecd4cb108731f57adc2a57) Thanks [@toiroakr](https://github.com/toiroakr)! - Add `v2/tailordb-namespace` codemod for the `@tailor-platform/function-types` → `@tailor-platform/sdk` vendoring: rewrite references to the deprecated capital-cased `Tailordb` ambient namespace (`Tailordb.QueryResult`, `Tailordb.CommandType`, `Tailordb.Client`, `typeof Tailordb.Client`) to the new lowercase `tailordb.*` namespace re-published by the SDK.
|
|
22
|
+
|
|
3
23
|
## 0.2.0
|
|
4
24
|
|
|
5
25
|
### Minor Changes
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region codemods/v2/tailordb-namespace/scripts/transform.ts
|
|
2
|
+
const MEMBER_GROUP = [
|
|
3
|
+
"QueryResult",
|
|
4
|
+
"CommandType",
|
|
5
|
+
"Client"
|
|
6
|
+
].join("|");
|
|
7
|
+
const PATTERN = new RegExp(String.raw`\bTailordb\.(${MEMBER_GROUP})\b`, "g");
|
|
8
|
+
/**
|
|
9
|
+
* Rewrite references to the deprecated capital-cased `Tailordb` ambient
|
|
10
|
+
* namespace to the new lowercase `tailordb` namespace. The capital-cased
|
|
11
|
+
* namespace was inherited from `@tailor-platform/function-types`; the SDK
|
|
12
|
+
* keeps it as a `@deprecated` alias in v1 and removes it in v2.
|
|
13
|
+
*
|
|
14
|
+
* Only the known type-only members (`QueryResult`, `CommandType`, `Client`)
|
|
15
|
+
* are rewritten so that unrelated user-defined symbols sharing the
|
|
16
|
+
* `Tailordb.` prefix remain untouched. Both type-position references
|
|
17
|
+
* (`Tailordb.QueryResult<T>`, `typeof Tailordb.Client`) and value-position
|
|
18
|
+
* references (`new Tailordb.Client(...)`) are handled by the same rule.
|
|
19
|
+
* @param source - File contents
|
|
20
|
+
* @param _filePath - Absolute path to the file (kept for the runner signature)
|
|
21
|
+
* @returns Transformed source or null when nothing matched.
|
|
22
|
+
*/
|
|
23
|
+
function transform(source, _filePath) {
|
|
24
|
+
if (!source.includes("Tailordb.")) return null;
|
|
25
|
+
PATTERN.lastIndex = 0;
|
|
26
|
+
const updated = source.replace(PATTERN, (_match, member) => `tailordb.${member}`);
|
|
27
|
+
return updated === source ? null : updated;
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { transform as default };
|
package/dist/index.js
CHANGED
|
@@ -98,6 +98,15 @@ const allCodemods = [
|
|
|
98
98
|
until: "2.0.0",
|
|
99
99
|
scriptPath: "v2/auth-invoker-unwrap/scripts/transform.js",
|
|
100
100
|
legacyPatterns: ["auth.invoker"]
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
id: "v2/tailordb-namespace",
|
|
104
|
+
name: "Tailordb → tailordb (lowercase ambient namespace)",
|
|
105
|
+
description: "Rewrite references to the deprecated capital-cased `Tailordb` ambient namespace (`Tailordb.QueryResult`, `Tailordb.CommandType`, `Tailordb.Client`, `typeof Tailordb.Client`) to the new lowercase `tailordb.*` namespace re-published by the SDK in place of `@tailor-platform/function-types`.",
|
|
106
|
+
since: "1.0.0",
|
|
107
|
+
until: "2.0.0",
|
|
108
|
+
scriptPath: "v2/tailordb-namespace/scripts/transform.js",
|
|
109
|
+
legacyPatterns: ["Tailordb."]
|
|
101
110
|
}
|
|
102
111
|
];
|
|
103
112
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailor-platform/sdk-codemod",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Codemod runner for Tailor Platform SDK upgrades",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -16,24 +16,24 @@
|
|
|
16
16
|
],
|
|
17
17
|
"type": "module",
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@ast-grep/napi": "0.42.
|
|
19
|
+
"@ast-grep/napi": "0.42.3",
|
|
20
20
|
"chalk": "5.6.2",
|
|
21
21
|
"diff": "9.0.0",
|
|
22
22
|
"pathe": "2.0.3",
|
|
23
23
|
"picomatch": "4.0.4",
|
|
24
24
|
"pkg-types": "2.3.1",
|
|
25
25
|
"politty": "0.4.15",
|
|
26
|
-
"semver": "7.
|
|
27
|
-
"zod": "4.3
|
|
26
|
+
"semver": "7.8.1",
|
|
27
|
+
"zod": "4.4.3"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@types/node": "24.12.
|
|
30
|
+
"@types/node": "24.12.4",
|
|
31
31
|
"@types/picomatch": "4.0.3",
|
|
32
32
|
"@types/semver": "7.7.1",
|
|
33
33
|
"oxlint": "1.61.0",
|
|
34
34
|
"tsdown": "0.22.0",
|
|
35
35
|
"typescript": "5.9.3",
|
|
36
|
-
"vitest": "4.1.
|
|
36
|
+
"vitest": "4.1.7"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "tsdown",
|