@ryusenkei/conventions 0.10.0 → 0.10.1

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,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.10.1
4
+
5
+ - `runAffectedCheck` failed every step on Windows when `npm_execpath` pointed at a standalone `pnpm.exe` (it was started with `node`). It now starts `.js`, `.cjs`, and `.mjs` with `node`, and `.exe` directly.
6
+
3
7
  ## 0.10.0
4
8
 
5
9
  - `runAffectedCheck`: the pre-push `pnpm check` from `scripts/check.ts`. It type checks the changed packages and their dependents and runs the tests that import a changed file, against the nearest of `origin/main` and `origin/dev/*`; `--all` checks everything. The type check and the tests run one after the other to keep the peak memory low. See [Pre-push check](README.md#pre-push-check).
package/README.md CHANGED
@@ -166,7 +166,7 @@ process.exitCode = results.every((r) => r.ok) ? 0 : 1;
166
166
 
167
167
  - The type check and the tests run one after the other, and `steps` run beside them. This keeps the peak memory to one heavy process tree, so parallel pushes from other worktrees fit (`concurrency` sets how many packages `tsc` checks at once, default 2).
168
168
  - `--base <ref>` sets the base. `globalFiles` adds files that mean everything, and `testArgs` adds Vitest arguments such as reporters.
169
- - Run it through `pnpm` (`pnpm check`). It starts `pnpm` from `npm_execpath`.
169
+ - Run it through `pnpm` (`pnpm check`). It starts `pnpm` from `npm_execpath` (`.js` with `node`, `.exe` directly).
170
170
 
171
171
  The whole repository is checked with `pnpm check --all` locally before deploying.
172
172
 
@@ -23,6 +23,15 @@ export type AffectedCheckOptions = {
23
23
  /** 型検査で同時に動かすパッケージの数(`pnpm -r --workspace-concurrency`) */
24
24
  concurrency?: number;
25
25
  };
26
+ /**
27
+ * 起動するファイルと引数(pnpm は実行中の pnpm の npm_execpath から)
28
+ * - .js・.cjs・.mjs は node で起動、.exe は直接、.cmd・.bat はシェル経由(単体の pnpm.exe を指す場合があるため)
29
+ */
30
+ export declare function spawnTarget(command: string, args: string[], execpath?: string | undefined): {
31
+ file: string;
32
+ argv: string[];
33
+ shell: boolean;
34
+ };
26
35
  /**
27
36
  * リポのルートで push の前の検査を実行し、結果を返す(終了コードは呼ぶ側が設定)
28
37
  * - 引数: `--all` ですべて、`--base <ref>` で基準を指定(省略時は origin/main と origin/dev/* のうち最も近いもの)
@@ -68,12 +68,21 @@ function planOf(options, argv) {
68
68
  return { plan, heavy, ctx, covered: base.ref };
69
69
  }
70
70
  const seconds = (from) => `${((Date.now() - from) / 1000).toFixed(1)}s`;
71
- // pnpm は実行中の pnpm(npm_execpath)を node で起動(Windows の pnpm.cmd をシェルなしで起動できないため)
71
+ /**
72
+ * 起動するファイルと引数(pnpm は実行中の pnpm の npm_execpath から)
73
+ * - .js・.cjs・.mjs は node で起動、.exe は直接、.cmd・.bat はシェル経由(単体の pnpm.exe を指す場合があるため)
74
+ */
75
+ export function spawnTarget(command, args, execpath = process.env.npm_execpath) {
76
+ if (command !== 'pnpm' || !execpath)
77
+ return { file: command, argv: args, shell: false };
78
+ if (/\.[cm]?js$/i.test(execpath))
79
+ return { file: process.execPath, argv: [execpath, ...args], shell: false };
80
+ return { file: execpath, argv: args, shell: /\.(cmd|bat)$/i.test(execpath) };
81
+ }
72
82
  function capture(command, args) {
73
- const pnpm = command === 'pnpm' ? process.env.npm_execpath : undefined;
74
- const [file, argv] = pnpm ? [process.execPath, [pnpm, ...args]] : [command, args];
83
+ const { file, argv, shell } = spawnTarget(command, args);
75
84
  return new Promise((resolve) => {
76
- const child = spawn(file, argv, { stdio: ['ignore', 'pipe', 'pipe'] });
85
+ const child = spawn(file, argv, { stdio: ['ignore', 'pipe', 'pipe'], shell });
77
86
  let output = '';
78
87
  child.stdout.on('data', (chunk) => (output += chunk.toString()));
79
88
  child.stderr.on('data', (chunk) => (output += chunk.toString()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryusenkei/conventions",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "RYUSENKEI のモノリポの共通の規約(Claude Code の規約・hook、共通ファイルの同期)",
5
5
  "license": "MIT",
6
6
  "author": "RYUSENKEI",