Skip to content

Commit 4ac87c9

Browse files
authored
fix(cli): remove Windows-breaking postinstall chmod (#669)
## Summary - The `pgflow` package's `postinstall` ran `chmod +x dist/index.js || true`. `chmod` and `true` do not exist in Windows cmd.exe, so `npm install pgflow` and `npx pgflow@latest install` failed with `'chmod' is not recognized as an internal or external command`. - npm sets the executable bit on files declared in the `bin` field during install, so the script was redundant even on Unix. Removal is the whole fix. - Adds a permanent `windows-latest` smoke workflow as the regression test: build the CLI, `pnpm pack`, install the tarball into a clean directory with lifecycle scripts enabled, run the npm-created `pgflow.cmd --version` shim. The rest of CI runs on Ubuntu and invokes `node dist/index.js` directly, so npm installation and Windows shims were never exercised. - One `pgflow` patch changeset for the 0.15.1 release group (#666). - Recreates the minimal removal from #612 against current `main` (#612 was based on v0.13.3). ## Checks - `pnpm nx build cli` — pass - `pnpm pack` in `pkgs/cli` — tarball contains `dist/`, no `postinstall` in its `package.json` - CLI unit tests — 43/43 pass - `prettier --check` on all three touched files — pass - Windows smoke job runs in this PR's CI Closes #610
1 parent 078aa1e commit 4ac87c9

3 files changed

Lines changed: 61 additions & 4 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"pgflow": patch
3+
---
4+
5+
Remove the postinstall `chmod` script that broke `npm install pgflow` on Windows; npm sets the executable bit for `bin` files automatically.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Windows Smoke
2+
3+
# Regression test for https://github.com/pgflow-dev/pgflow/issues/610:
4+
# `npm install pgflow` must succeed on Windows with lifecycle scripts enabled,
5+
# and the npm-created pgflow.cmd shim must run. The rest of CI runs on Ubuntu
6+
# and invokes `node dist/index.js` directly, so it never exercises this.
7+
on:
8+
workflow_dispatch:
9+
pull_request:
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
windows-package-smoke:
16+
runs-on: windows-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- uses: pnpm/action-setup@v4
21+
with:
22+
version: '10.20.0'
23+
run_install: false
24+
25+
- uses: actions/setup-node@v4
26+
with:
27+
node-version: 24
28+
cache: 'pnpm'
29+
cache-dependency-path: |
30+
**/pnpm-lock.yaml
31+
32+
- name: Install dependencies
33+
run: pnpm install --frozen-lockfile --prefer-offline
34+
35+
- name: Build CLI
36+
run: pnpm nx build cli
37+
38+
- name: Pack CLI tarball
39+
shell: bash
40+
working-directory: pkgs/cli
41+
run: pnpm pack
42+
43+
# Install the tarball into a clean directory with lifecycle scripts
44+
# enabled (no --ignore-scripts): this is the step that failed in #610.
45+
- name: Install tarball into a clean directory
46+
shell: bash
47+
run: |
48+
SMOKE_DIR="$RUNNER_TEMP/pgflow-smoke"
49+
mkdir -p "$SMOKE_DIR"
50+
cd "$SMOKE_DIR"
51+
npm install "$GITHUB_WORKSPACE/pkgs/cli"/pgflow-*.tgz
52+
53+
- name: Run npm-created pgflow.cmd shim
54+
shell: bash
55+
run: $RUNNER_TEMP/pgflow-smoke/node_modules/.bin/pgflow.cmd --version

‎pkgs/cli/package.json‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,5 @@
3737
},
3838
"files": [
3939
"dist"
40-
],
41-
"scripts": {
42-
"postinstall": "chmod +x dist/index.js || true"
43-
}
40+
]
4441
}

0 commit comments

Comments
 (0)