Skip to content

Commit

Permalink
build: fix postinstall error on windows (#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
himself65 authored Nov 23, 2023
1 parent 4be0dee commit 2f6a316
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
13 changes: 13 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,19 @@ jobs:
- run: pnpm install --frozen-lockfile
- run: pnpm test

windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'pnpm'
cache-dependency-path: '**/pnpm-lock.yaml'
# only try to install on windows for now, e2e will fail on windows
- run: pnpm install --frozen-lockfile

e2e:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"dev": "pnpm -r --filter='./packages/*' run dev",
"compile": "pnpm -r --filter='./packages/*' run compile",
"csb-install-FIXME": "pnpm install --no-frozen-lockfile",
"postinstall": "test -d ./packages/waku/dist || (pnpm -r --filter='./packages/waku' run compile && pnpm install)",
"postinstall": "node ./scripts/postinstall.js",
"test": "prettier -c . && eslint . && tsc -b",
"e2e": "playwright test",
"examples:dev": "(cd ./examples/${NAME} && pnpm run dev)",
Expand Down
22 changes: 22 additions & 0 deletions scripts/postinstall.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env node
import fs from 'node:fs';
import { execSync } from 'node:child_process';
import process from 'node:process';
import console from 'node:console';

const directory = './packages/waku/dist';

if (!fs.existsSync(directory)) {
try {
execSync('pnpm -r --filter="./packages/waku" run compile', {
stdio: 'inherit',
});
execSync('pnpm install', { stdio: 'inherit' });
} catch (error) {
console.error(
'An error occurred while running postinstall scripts:',
error,
);
process.exit(1);
}
}

1 comment on commit 2f6a316

@vercel
Copy link

@vercel vercel bot commented on 2f6a316 Nov 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

waku – ./

waku-git-main-daishi.vercel.app
waku-daishi.vercel.app
waku.vercel.app
www.waku.gg
waku.gg

Please sign in to comment.