@ryusenkei/conventions 0.2.1 → 0.3.0

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/README.md CHANGED
@@ -82,6 +82,7 @@ Opt in per repository in the root `package.json`:
82
82
  `sync` writes these files and `check` compares them, ignoring line endings:
83
83
 
84
84
  - `.editorconfig`, `.gitattributes`, `.gitignore`, `.gitleaks.toml`, `mise.toml`, `.github/dependabot.yaml`, `.githooks/commit-msg`, `.githooks/pre-push`
85
+ - `.github/dependabot.yaml` updates npm and GitHub Actions. When the repository has a `go.mod` at the root, a `gomod` entry is appended (same schedule, rebase strategy and cooldown, minor and patch grouped). Without one it is left out, because Dependabot fails on a missing `go.mod`
85
86
  - `.claude/settings.json`: only the hooks, `attribution`, and `permissions.deny` are managed. Other settings and hooks are kept
86
87
  - `pnpm-workspace.yaml`: `minimumReleaseAge` and `minimumReleaseAgeExclude`, matching the Dependabot `cooldown`
87
88
 
package/dist/files.js CHANGED
@@ -1,6 +1,7 @@
1
1
  // 利用側のリポにある共通ファイルの同期・検査
2
2
  // - マスタ: パッケージの `files/`(npm は `.gitignore` を同梱しない → 先頭の `.` を除いた名前で格納)
3
3
  // - 比較は改行コードを LF に正規化(Windows の作業ツリーは CRLF になりうる)
4
+ // - `append`: 条件のファイルがあるリポのみ末尾に追加(例: go.mod のないリポで gomod の更新はエラー)
4
5
  import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
5
6
  import { dirname, join } from 'node:path';
6
7
  import { hasStop, managedSettings } from "./settings.js";
@@ -10,7 +11,7 @@ const FILES = [
10
11
  { from: 'gitignore', to: '.gitignore' },
11
12
  { from: 'gitleaks.toml', to: '.gitleaks.toml' },
12
13
  { from: 'mise.toml', to: 'mise.toml' },
13
- { from: 'dependabot.yaml', to: '.github/dependabot.yaml' },
14
+ { from: 'dependabot.yaml', to: '.github/dependabot.yaml', append: { from: 'dependabot-gomod.yaml', if: 'go.mod' } },
14
15
  { from: 'commit-msg', to: '.githooks/commit-msg', mode: 0o755 },
15
16
  { from: 'pre-push', to: '.githooks/pre-push', mode: 0o755 },
16
17
  ];
@@ -27,11 +28,12 @@ const RELEASE_AGE = [
27
28
  ];
28
29
  const lf = (s) => s.replaceAll('\r\n', '\n');
29
30
  const read = (path) => (existsSync(path) ? lf(readFileSync(path, 'utf8')) : undefined);
31
+ const master = (name) => lf(readFileSync(new URL(`../files/${name}`, import.meta.url), 'utf8'));
30
32
  /** マスタとの差分 */
31
33
  export function drifts(root, options = {}) {
32
34
  const out = [];
33
35
  for (const f of FILES) {
34
- const expected = lf(readFileSync(new URL(`../files/${f.from}`, import.meta.url), 'utf8'));
36
+ const expected = master(f.from) + (f.append && existsSync(join(root, f.append.if)) ? master(f.append.from) : '');
35
37
  if (read(join(root, f.to)) !== expected)
36
38
  out.push({ path: f.to, expected, message: 'マスタと不一致' });
37
39
  }
@@ -0,0 +1,19 @@
1
+
2
+ # Go のモジュール(ルートに go.mod があるリポのみ `sync` が追加)
3
+ - package-ecosystem: gomod
4
+ directory: "/"
5
+ # 頻度・rebase・公開直後のバージョンの回避は npm と同じ
6
+ schedule:
7
+ interval: monthly
8
+ rebase-strategy: disabled
9
+ cooldown:
10
+ default-days: 2
11
+ commit-message:
12
+ prefix: build
13
+ include: scope
14
+ groups:
15
+ # minor・patch は1つの PR にまとめる(Go の major はモジュールのパスが変わるため Dependabot の対象外)
16
+ minor-and-patch:
17
+ update-types:
18
+ - minor
19
+ - patch
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryusenkei/conventions",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "RYUSENKEI のモノリポの共通の規約(Claude Code の規約・hook、共通ファイルの同期)",
5
5
  "license": "MIT",
6
6
  "author": "RYUSENKEI",