@tama-create/sf-tools 1.4.0-dev.1 → 1.4.0-dev.11
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/config/changeset-types.txt +350 -0
- package/config/install/gitmessage +6 -0
- package/config/install/release/README.md +26 -0
- package/config/install/release/deploy-target.txt +368 -0
- package/config/install/release/remove-target.txt +279 -0
- package/config/metadata-capability.txt +118 -0
- package/config/metadata-dirs.txt +79 -0
- package/config/metasync-detect.txt +52 -0
- package/config/metasync-extra.txt +30 -0
- package/config/metasync-fingerprint.txt +90 -0
- package/dist/commands/index.js +7 -6
- package/dist/commands/launcher.js +21 -4
- package/dist/commands/pr.js +1 -1
- package/dist/commands/project.js +15 -6
- package/dist/commands/push.js +1 -1
- package/dist/commands/start.js +50 -2
- package/dist/commands/switch-org.js +1 -1
- package/dist/core/ci-sequence-steps.js +2 -2
- package/dist/core/ci-validate-steps.js +1 -1
- package/dist/core/cli-update-notice.js +47 -0
- package/dist/core/create-setup.js +47 -3
- package/dist/core/diag.js +9 -9
- package/dist/core/launcher-status.js +33 -2
- package/dist/core/log-auto.js +1 -1
- package/dist/core/log-box.js +32 -8
- package/dist/core/log-pull.js +2 -2
- package/dist/core/log-select.js +1 -1
- package/dist/core/log-start.js +2 -2
- package/dist/core/log-status.js +2 -2
- package/dist/core/metasync.js +2 -2
- package/dist/core/new-version.js +93 -0
- package/dist/core/pr.js +24 -6
- package/dist/core/project-status.js +20 -9
- package/dist/core/project-tier.js +1 -1
- package/dist/core/project-upgrade.js +138 -0
- package/dist/core/promote-check.js +46 -13
- package/dist/core/push.js +16 -5
- package/dist/core/release.js +1 -1
- package/dist/core/start.js +2 -2
- package/dist/core/update-cli.js +1 -1
- package/dist/io/create-deps.js +1 -0
- package/dist/io/job-deps.js +21 -13
- package/dist/io/keys.js +22 -6
- package/dist/io/log-deps.js +2 -1
- package/dist/io/metasync-deps.js +3 -2
- package/dist/io/promote-deps.js +4 -3
- package/dist/io/temp-dir.js +15 -1
- package/dist/io/toolbox.js +1 -1
- package/dist/ui/launcher.js +47 -14
- package/lib/apexlog.js +819 -0
- package/lib/metasync.js +1364 -0
- package/lib/package.json +4 -0
- package/lib/typecheck.js +547 -0
- package/package.json +9 -2
- package/templates/.forceignore +12 -0
- package/templates/.gitattributes +58 -0
- package/templates/.github/workflows/wf-metasync.yml +177 -0
- package/templates/.github/workflows/wf-release.yml +454 -0
- package/templates/.github/workflows/wf-sequence.yml +292 -0
- package/templates/.github/workflows/wf-validate.yml +389 -0
- package/templates/.prettierignore +11 -0
- package/templates/.prettierrc +17 -0
- package/templates/.vscode/extensions.json +9 -0
- package/templates/.vscode/launch.json +16 -0
- package/templates/.vscode/settings.json +39 -0
- package/templates/AGENTS.md +3 -0
- package/templates/CLAUDE.md +4 -0
- package/templates/README.md +11 -0
- package/templates/config/project-scratch-def.json +13 -0
- package/templates/eslint.config.js +55 -0
- package/templates/force-app/main/default/.gitkeep +0 -0
- package/templates/gitignore.template +62 -0
- package/templates/jest.config.js +6 -0
- package/templates/package.json +29 -0
- package/templates/scripts/apex/hello.apex +10 -0
- package/templates/scripts/soql/account.soql +6 -0
- package/templates/sf-tools/config/branches.txt +24 -0
- package/templates/sf-tools/config/metadata.txt +576 -0
- package/templates/sfdx-project.json +12 -0
- package/templates-ts/.github/workflows/wf-metasync.yml +109 -0
- package/templates-ts/.github/workflows/wf-release.yml +263 -0
- package/templates-ts/.github/workflows/wf-sequence.yml +153 -0
- package/templates-ts/.github/workflows/wf-validate.yml +185 -0
package/dist/io/temp-dir.js
CHANGED
|
@@ -2,9 +2,23 @@
|
|
|
2
2
|
import { mkdtempSync, rmSync } from "node:fs";
|
|
3
3
|
import { tmpdir } from "node:os";
|
|
4
4
|
import { join } from "node:path";
|
|
5
|
+
/**
|
|
6
|
+
* フォルダを消す。Windows では、ウイルス対策・インデクサー・終わったばかりの子プロセスが、フォルダをつかんでいて、EPERM・EBUSY で
|
|
7
|
+
* 消せないことがある(ときどき起きる)ため、再試行する(maxRetries・retryDelay)。それでも消せなければ、止めずに、消せなかった場所を
|
|
8
|
+
* 警告に出す(中に、アクセストークンなどが残ることがある。手で消してもらう)。呼ぶ側の処理を、後始末の失敗で、失敗にしない
|
|
9
|
+
*/
|
|
10
|
+
export function removeTree(path) {
|
|
11
|
+
try {
|
|
12
|
+
rmSync(path, { recursive: true, force: true, maxRetries: 5, retryDelay: 200 });
|
|
13
|
+
}
|
|
14
|
+
catch (e) {
|
|
15
|
+
const code = e.code ?? "";
|
|
16
|
+
process.stderr.write(`[WARNING] 一時フォルダを消せませんでした(${code})。中に、秘密の値が残っているかもしれません。手で消してください: ${path}\n`);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
5
19
|
export function realTempDeps(prefix) {
|
|
6
20
|
return {
|
|
7
21
|
makeTempDir: () => mkdtempSync(join(process.env.TMPDIR || tmpdir(), prefix)),
|
|
8
|
-
removeDir:
|
|
22
|
+
removeDir: removeTree,
|
|
9
23
|
};
|
|
10
24
|
}
|
package/dist/io/toolbox.js
CHANGED
package/dist/ui/launcher.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
// ランチャー(sft を引数なしで、force-* の中で打ったときのメニュー)。phases/start/launcher.sh の移し先(doc/rebuild-design.md 6.1)。
|
|
2
2
|
// 項目は、サブコマンドの表(menu を持つもの)から作る。番号のキーを押すとすぐ動き(Enter は要らない)、終わるとメニューに戻る。
|
|
3
|
-
// q と入力の終わりで終了(0
|
|
3
|
+
// q と入力の終わりで終了(0)。範囲外の文字は聞き直す。矢印・端末からの通知・Ctrl+C など文字でないものは、黙って読み捨てる(プロンプトを重ねない。Ctrl+C は、メニューの中では無効: 誤って閉じない: 6.3)。
|
|
4
|
+
// 何も打たずに Enter: メニューを描き直し、裏の判定をやり直す(PR のマージは先端のコミットを変えないため、保存した結果では次の段階に変わらない)。
|
|
5
|
+
// 判定が動いているあいだの Enter は、描き直すだけ(2 つ同時には動かさない)。
|
|
4
6
|
// 見出し(core/launcher-status.ts)は、メニューを描くたびに作る。入力を 5 秒ずつ待ち、デバッグログの状態(準備中・取得中)が
|
|
5
7
|
// 変わった・裏の判定(sft pr --status)が終わったら、コマンドを動かさずに描き直す(待っている入力は、そのまま続ける)。
|
|
6
8
|
// 結果は 1 行: 0 →「✓ <名前>: 終わりました(成功)」/ それ以外 →「✗ <名前>: 失敗、または中断しました(終了コード N)」。
|
|
7
9
|
// なくしたもの: 自分のファイルの書き換わりを見て読み込み直す動き(版を固定するため: 設計 2.4.2)。
|
|
8
|
-
// 組織への接続・doctor・デバッグログの取得は、開く前に src/core/start.ts
|
|
9
|
-
import { apexlogState, makePaint, parseGitStatus, statusLines, targetOrg } from "../core/launcher-status.js";
|
|
10
|
+
// 組織への接続・doctor・デバッグログの取得は、開く前に src/core/start.ts が行う。項目 Start は、組織の接続・VS Code・doctor をやり直す(src/commands/start.ts。ランチャーは開き直さない)
|
|
11
|
+
import { apexlogState, makePaint, parseGitStatus, statusLines, targetOrg, uncommittedTargets } from "../core/launcher-status.js";
|
|
12
|
+
import { countTargets } from "../core/promote-check.js";
|
|
10
13
|
const LINE = "──────────────────────────────────────────────────";
|
|
11
14
|
const readOrNull = (box, path) => {
|
|
12
15
|
try {
|
|
@@ -29,11 +32,23 @@ export async function runLauncher(args, box, deps) {
|
|
|
29
32
|
}
|
|
30
33
|
const { items } = deps;
|
|
31
34
|
const prNumber = items.findIndex((i) => i.name === "pr") + 1;
|
|
32
|
-
const prompt = ` 番号を入力 (1-${items.length} / q で終了): `;
|
|
33
|
-
|
|
35
|
+
const prompt = ` 番号を入力 (1-${items.length} / Enter で再表示 / q で終了): `;
|
|
36
|
+
/** 裏の判定を最後に頼んだときの、先端のコミットと対象のファイルの空・空でない */
|
|
37
|
+
let checkedKey = "";
|
|
34
38
|
let checking = false;
|
|
35
39
|
let checkDone = false;
|
|
36
|
-
|
|
40
|
+
/** Enter で頼まれた判定のやり直し(次に描くとき、保存した結果を使わずに判定する) */
|
|
41
|
+
let recheck = false;
|
|
42
|
+
const wantCheckFor = (head, key) => head !== "" && key !== checkedKey;
|
|
43
|
+
const targetsEmpty = (branch) => {
|
|
44
|
+
try {
|
|
45
|
+
const counts = ["deploy-target.txt", "remove-target.txt"].map((f) => countTargets(box, `sf-tools/release/${branch}/${f}`));
|
|
46
|
+
return counts.every((n) => n === null) ? null : counts.every((n) => !n);
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
37
52
|
const envBranches = () => {
|
|
38
53
|
const text = readOrNull(box, "sf-tools/config/branches.txt") ?? "";
|
|
39
54
|
return text
|
|
@@ -43,19 +58,29 @@ export async function runLauncher(args, box, deps) {
|
|
|
43
58
|
};
|
|
44
59
|
const draw = async () => {
|
|
45
60
|
const st = await box.run("git", ["status", "--porcelain=v2", "--branch"]).catch(() => null);
|
|
46
|
-
const
|
|
61
|
+
const statusText = st !== null && st.code === 0 ? st.stdout : "";
|
|
62
|
+
const git = parseGitStatus(statusText);
|
|
63
|
+
const empty = targetsEmpty(git.branch);
|
|
64
|
+
const key = `${git.head} ${empty}`;
|
|
65
|
+
const fresh = recheck && !checking && deps.startPrStatus !== null;
|
|
66
|
+
if (fresh)
|
|
67
|
+
checkedKey = "";
|
|
68
|
+
recheck = false;
|
|
47
69
|
const { lines, wantCheck } = statusLines({
|
|
48
70
|
git,
|
|
49
71
|
org: targetOrg(readOrNull(box, ".sf/config.json")),
|
|
50
72
|
apexlog: readOrNull(box, "logs/apex/.status"),
|
|
51
|
-
nextStatus: readOrNull(box, "sf-tools/logs/next-status.txt"),
|
|
73
|
+
nextStatus: readOrNull(box, "sf-tools/logs/next-status.txt"), // 判定し直すあいだも、前回の結果を出す(「更新中」を添える)
|
|
74
|
+
targetsEmpty: empty,
|
|
75
|
+
uncommitted: uncommittedTargets(statusText, git.branch),
|
|
52
76
|
envBranches: envBranches(),
|
|
53
|
-
checking: checking || (wantCheckFor(git.head) && deps.startPrStatus !== null), // これから始める分も「確かめています」
|
|
77
|
+
checking: checking || (wantCheckFor(git.head, key) && deps.startPrStatus !== null), // これから始める分も「確かめています」
|
|
78
|
+
refresh: fresh,
|
|
54
79
|
prNumber,
|
|
55
80
|
}, paint);
|
|
56
|
-
// 使える結果がない →
|
|
57
|
-
if (wantCheck && wantCheckFor(git.head) && deps.startPrStatus !== null) {
|
|
58
|
-
|
|
81
|
+
// 使える結果がない → 裏で判定する(先端のコミットと対象の空・空でないの組ごとに 1 回。失敗しても繰り返さない)
|
|
82
|
+
if (wantCheck && wantCheckFor(git.head, key) && deps.startPrStatus !== null) {
|
|
83
|
+
checkedKey = key;
|
|
59
84
|
checking = true;
|
|
60
85
|
deps
|
|
61
86
|
.startPrStatus()
|
|
@@ -82,7 +107,7 @@ export async function runLauncher(args, box, deps) {
|
|
|
82
107
|
let shown = apexlogState(readOrNull(box, "logs/apex/.status"));
|
|
83
108
|
let pending = box.input.readKey(prompt);
|
|
84
109
|
let chosen = null;
|
|
85
|
-
while (chosen === null) {
|
|
110
|
+
while (chosen === null && !recheck) {
|
|
86
111
|
const got = await Promise.race([pending.then((key) => ({ key })), deps.tick().then(() => null)]);
|
|
87
112
|
if (got === null) {
|
|
88
113
|
// 待ち切れ: 準備中・取得中の状態が変わった・裏の判定が終わったら、描き直す(本数・期限の更新では描き直さない)
|
|
@@ -106,13 +131,21 @@ export async function runLauncher(args, box, deps) {
|
|
|
106
131
|
err("");
|
|
107
132
|
return 0;
|
|
108
133
|
}
|
|
134
|
+
if (key === "" || key === "\r" || key === "\n") {
|
|
135
|
+
recheck = true;
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
109
138
|
const n = /^[1-9]$/.test(key) ? Number(key) : 0;
|
|
110
139
|
const item = n >= 1 && n <= items.length ? items[n - 1] : undefined;
|
|
111
140
|
if (item)
|
|
112
141
|
chosen = item;
|
|
142
|
+
else if (/^[ -~]$/.test(key))
|
|
143
|
+
pending = box.input.readKey(prompt); // 範囲外の文字は、打った文字を出して、聞き直す
|
|
113
144
|
else
|
|
114
|
-
pending = box.input.readKey(
|
|
145
|
+
pending = box.input.readKey(""); // 矢印・端末からの通知・Ctrl+C など、文字でないものは、黙って読み捨てる(プロンプトを重ねない)
|
|
115
146
|
}
|
|
147
|
+
if (chosen === null)
|
|
148
|
+
continue; // Enter: 描き直す
|
|
116
149
|
err("");
|
|
117
150
|
err(paint.green(` ▶ sft ${chosen.name}`));
|
|
118
151
|
err("");
|