@tailor-platform/sdk-codemod 0.8.10 → 0.8.12
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,21 @@
|
|
|
1
1
|
# @tailor-platform/sdk-codemod
|
|
2
2
|
|
|
3
|
+
## 0.8.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#2365](https://github.com/tailor-platform/sdk/pull/2365) [`094bf55`](https://github.com/tailor-platform/sdk/commit/094bf55be5fb771ec5116a4317537799d987fe83) Thanks [@toiroakr](https://github.com/toiroakr)! - Remove the `v3/setup-branch-flag-rename` codemod. It rewrote `tailor setup branch --branch` to `--target`, but `@tailor-platform/sdk-plugin-setup` now removes the `--branch` alias outright instead of deprecating it until v3, so the rewrite no longer applies.
|
|
8
|
+
|
|
9
|
+
- [#2332](https://github.com/tailor-platform/sdk/pull/2332) [`766a3f9`](https://github.com/tailor-platform/sdk/commit/766a3f91acaf7fa9cd643f7c2bf9fe6055d578c5) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency @clack/prompts to v1.8.0
|
|
10
|
+
|
|
11
|
+
- [#2378](https://github.com/tailor-platform/sdk/pull/2378) [`867d586`](https://github.com/tailor-platform/sdk/commit/867d586a8b08a27f0b1a26dec2f18efa7963e375) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency zod to v4.6.5
|
|
12
|
+
|
|
13
|
+
## 0.8.11
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#2362](https://github.com/tailor-platform/sdk/pull/2362) [`08ff50b`](https://github.com/tailor-platform/sdk/commit/08ff50b50a31c6a27ccb8f6ca409365032d13e0d) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency zod to v4.6.4
|
|
18
|
+
|
|
3
19
|
## 0.8.10
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -123,7 +123,6 @@ const V2_NEXT_6 = "2.0.0-next.6";
|
|
|
123
123
|
const V2_NEXT_7 = "2.0.0-next.7";
|
|
124
124
|
const V2_NEXT_9 = "2.0.0-next.9";
|
|
125
125
|
const V2_NEXT_11 = "2.0.0-next.11";
|
|
126
|
-
const SETUP_BRANCH_RESIDUAL_FLAG = /(?:(?<![\w.-])tailor(?:-sdk)?(?:\.(?:cmd|ps1|exe))?|@tailor-platform\/sdk(?:@\S{1,32})?)[\s\\^`]{1,16}setup[\s\\^`]{1,16}branch\b(?:'[^'\n]*'|"[^"\n]*"|[^\n;&|'"#]|[\\^`]\r?\n)*(?:[ \t]|[\\^`]\r?\n)--branch(?![\w-])/;
|
|
127
126
|
/** All registered codemods, in registration order. */
|
|
128
127
|
const allCodemods = [
|
|
129
128
|
{
|
|
@@ -1586,36 +1585,6 @@ const allCodemods = [
|
|
|
1586
1585
|
"unchanged unless it documents a command to type."
|
|
1587
1586
|
].join("\n")
|
|
1588
1587
|
},
|
|
1589
|
-
{
|
|
1590
|
-
id: "v3/setup-branch-flag-rename",
|
|
1591
|
-
name: "setup branch --branch → --target",
|
|
1592
|
-
description: "Rename the `--branch` option of `tailor setup branch` invocations to `--target`. `--branch` remains as a deprecated alias until it is removed in v3. The `--branch` option of `setup tag`, `setup preview`, and `setup coordinate` is unchanged.",
|
|
1593
|
-
since: "1.72.0",
|
|
1594
|
-
until: "3.0.0",
|
|
1595
|
-
scriptPath: "v3/setup-branch-flag-rename/scripts/transform.js",
|
|
1596
|
-
filePatterns: [
|
|
1597
|
-
"**/package.json",
|
|
1598
|
-
"**/*.{sh,bash,zsh,ps1,cmd,bat,yml,yaml}",
|
|
1599
|
-
"**/*.md",
|
|
1600
|
-
"**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}"
|
|
1601
|
-
],
|
|
1602
|
-
legacyPatterns: [SETUP_BRANCH_RESIDUAL_FLAG],
|
|
1603
|
-
sourceStringLegacyPatterns: [SETUP_BRANCH_RESIDUAL_FLAG],
|
|
1604
|
-
examples: [{
|
|
1605
|
-
lang: "sh",
|
|
1606
|
-
before: "tailor setup branch --name my-app-stg --branch main",
|
|
1607
|
-
after: "tailor setup branch --name my-app-stg --target main"
|
|
1608
|
-
}],
|
|
1609
|
-
prompt: [
|
|
1610
|
-
"The `--branch` option of `tailor setup branch` is renamed to `--target`;",
|
|
1611
|
-
"the old spelling is removed in v3. Replace any remaining `--branch` options of",
|
|
1612
|
-
"`setup branch` invocations the codemod did not rewrite (e.g. wrapped across",
|
|
1613
|
-
"lines or invoked through a package runner such as `npx @tailor-platform/sdk`)",
|
|
1614
|
-
"with `--target`. Do not touch the `--branch` option of `setup tag`,",
|
|
1615
|
-
"`setup preview`, or `setup coordinate`, which keeps its name, and leave prose",
|
|
1616
|
-
"that merely mentions the option unchanged unless it documents a command to type."
|
|
1617
|
-
].join("\n")
|
|
1618
|
-
},
|
|
1619
1588
|
{
|
|
1620
1589
|
id: "v3/relation-toward-table",
|
|
1621
1590
|
name: "relation() toward.type → toward.table",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailor-platform/sdk-codemod",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.12",
|
|
4
4
|
"description": "Codemod runner for Tailor Platform SDK upgrades",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"picomatch": "4.0.7",
|
|
27
27
|
"pkg-types": "2.3.3",
|
|
28
28
|
"semver": "7.8.5",
|
|
29
|
-
"zod": "4.5
|
|
29
|
+
"zod": "4.6.5"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@tailor-platform/shared": "^0.0.0",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@types/picomatch": "4.0.3",
|
|
35
35
|
"@types/semver": "7.8.0",
|
|
36
36
|
"eslint-plugin-zod": "4.12.1",
|
|
37
|
-
"oxlint": "1.
|
|
37
|
+
"oxlint": "1.82.0",
|
|
38
38
|
"oxlint-tsgolint": "7.0.2001",
|
|
39
39
|
"tsdown": "0.23.0",
|
|
40
40
|
"typescript": "6.0.3",
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { t as transformPackageScripts } from "../../../package-json-scripts-DVHZc1mk.js";
|
|
2
|
-
import * as path from "pathe";
|
|
3
|
-
//#region codemods/v3/setup-branch-flag-rename/scripts/transform.ts
|
|
4
|
-
const TOKEN_SEPARATOR = "(?:[ \\t]|\\\\\\r?\\n)+";
|
|
5
|
-
const COMMAND_START = new RegExp(`(?<![\\w.-])tailor(?:-sdk)?(?:\\.(?:cmd|ps1|exe))?${TOKEN_SEPARATOR}setup${TOKEN_SEPARATOR}branch(?![\\w.-])`, "g");
|
|
6
|
-
const NEXT_TOKEN = new RegExp(`${TOKEN_SEPARATOR}("[^"\\n]*"|'[^'\\n]*'|[^\\s;&|]+)`, "y");
|
|
7
|
-
function replaceCommand(value) {
|
|
8
|
-
let result = "";
|
|
9
|
-
let cursor = 0;
|
|
10
|
-
COMMAND_START.lastIndex = 0;
|
|
11
|
-
for (let match = COMMAND_START.exec(value); match; match = COMMAND_START.exec(value)) {
|
|
12
|
-
let pos = COMMAND_START.lastIndex;
|
|
13
|
-
result += value.slice(cursor, pos);
|
|
14
|
-
NEXT_TOKEN.lastIndex = pos;
|
|
15
|
-
for (let token = NEXT_TOKEN.exec(value); token; token = NEXT_TOKEN.exec(value)) {
|
|
16
|
-
const chunk = token[0];
|
|
17
|
-
const word = token[1];
|
|
18
|
-
if (word.startsWith("#")) break;
|
|
19
|
-
const quoted = /^(['"])(--branch(?:=.*)?)\1$/.exec(word);
|
|
20
|
-
const quote = quoted ? quoted[1] : "";
|
|
21
|
-
const bare = quoted ? quoted[2] : word;
|
|
22
|
-
if (bare === "--branch" || bare.startsWith("--branch=")) {
|
|
23
|
-
const separator = chunk.slice(0, chunk.length - word.length);
|
|
24
|
-
result += `${separator}${quote}--target${bare.slice(8)}${quote}`;
|
|
25
|
-
} else result += chunk;
|
|
26
|
-
pos = NEXT_TOKEN.lastIndex;
|
|
27
|
-
if (/\$\(|`|<\(|>\(/.test(word)) break;
|
|
28
|
-
}
|
|
29
|
-
cursor = pos;
|
|
30
|
-
COMMAND_START.lastIndex = pos;
|
|
31
|
-
}
|
|
32
|
-
result += value.slice(cursor);
|
|
33
|
-
return result;
|
|
34
|
-
}
|
|
35
|
-
function transformText(source) {
|
|
36
|
-
const updated = replaceCommand(source);
|
|
37
|
-
return updated === source ? null : updated;
|
|
38
|
-
}
|
|
39
|
-
function transformPackageJson(source) {
|
|
40
|
-
return transformPackageScripts(source, replaceCommand);
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Rename the `--branch` option of `tailor setup branch` invocations to
|
|
44
|
-
* `--target`.
|
|
45
|
-
*
|
|
46
|
-
* `--branch` remains as a deprecated alias until v3, where only
|
|
47
|
-
* `--target` is recognized. `setup tag`, `setup preview`, and
|
|
48
|
-
* `setup coordinate` keep their own `--branch` option unchanged.
|
|
49
|
-
* @param source - File contents
|
|
50
|
-
* @param filePath - Absolute path to the file (used to dispatch package.json vs text)
|
|
51
|
-
* @returns Transformed source or null when nothing matched.
|
|
52
|
-
*/
|
|
53
|
-
function transform(source, filePath) {
|
|
54
|
-
if (!source.includes("--branch")) return null;
|
|
55
|
-
if (path.extname(filePath).toLowerCase() === ".json") return transformPackageJson(source);
|
|
56
|
-
return transformText(source);
|
|
57
|
-
}
|
|
58
|
-
//#endregion
|
|
59
|
-
export { transform as default };
|