Skip to content

Commit

Permalink
feat(create-waku): install dependencies automatically when creating a…
Browse files Browse the repository at this point in the history
… new waku project (#808)

follow up #728

- [x] implement a new feature

---------

Co-authored-by: Joel Mathew Koshy <[email protected]>
Co-authored-by: Daishi Kato <[email protected]>
  • Loading branch information
3 people authored Oct 1, 2024
1 parent 8b38ceb commit 901594c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 9 deletions.
7 changes: 4 additions & 3 deletions e2e/create-waku.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { spawn } from 'node:child_process';
import { exec, spawn } from 'node:child_process';

Check failure on line 1 in e2e/create-waku.spec.ts

View workflow job for this annotation

GitHub Actions / E2E on macos-latest (Node 18.17.0) - (3/4)

Child Process Error

stderr: Could not execute pnpm install. Please run

Check failure on line 1 in e2e/create-waku.spec.ts

View workflow job for this annotation

GitHub Actions / E2E on macos-latest (Node 20.8.0) - (3/4)

Child Process Error

stderr: Could not execute pnpm install. Please run

Check failure on line 1 in e2e/create-waku.spec.ts

View workflow job for this annotation

GitHub Actions / E2E on ubuntu-latest (Node 20.8.0) - (3/4)

Child Process Error

stderr: node:internal/bootstrap/switches/does_own_process_state:138 cachedCwd = rawMethods.cwd(); ^ Error: ENOENT: no such file or directory, uv_cwd at process.wrappedCwd (node:internal/bootstrap/switches/does_own_process_state:138:28) at process.cwd (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:45:23) at process.cwd (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:7749:23) at ../node_modules/.pnpm/[email protected]/node_modules/get-source/impl/path.js (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:38842:58) at __require (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:12:50) at ../node_modules/.pnpm/[email protected]/node_modules/get-source/get-source.js (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:38933:17) at __require (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:12:50) at ../node_modules/.pnpm/[email protected]/node_modules/stacktracey/stacktracey.js (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:39240:21) at __require (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:12:50) at ../cli/default-reporter/lib/reportError.js (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:39481:42) { errno: -2, code: 'ENOENT', syscall: 'uv_cwd' } Node.js v20.8.0

Check failure on line 1 in e2e/create-waku.spec.ts

View workflow job for this annotation

GitHub Actions / E2E on ubuntu-latest (Node 20.8.0) - (3/4)

Child Process Error

stderr: Could not execute pnpm install. Please run

Check failure on line 1 in e2e/create-waku.spec.ts

View workflow job for this annotation

GitHub Actions / E2E on windows-latest (Node 20.8.0) - (3/4)

Child Process Error

stderr: node:events:492 throw er; // Unhandled 'error' event ^ Error: EPIPE: broken pipe, write at Socket._write (node:internal/net:61:25) at writeOrBuffer (node:internal/streams/writable:447:12) at _write (node:internal/streams/writable:389:10) at Writable.write (node:internal/streams/writable:393:10) at console.value (node:internal/console/constructor:304:16) at console.log (node:internal/console/constructor:379:26) at ConsumerObserver2.next (C:\Users\runneradmin\setup-pnpm\node_modules\.pnpm\[email protected]\node_modules\pnpm\dist\pnpm.cjs:23275:29) at Subscriber2._next (C:\Users\runneradmin\setup-pnpm\node_modules\.pnpm\[email protected]\node_modules\pnpm\dist\pnpm.cjs:23244:26) at Subscriber2.next (C:\Users\runneradmin\setup-pnpm\node_modules\.pnpm\[email protected]\node_modules\pnpm\dist\pnpm.cjs:23217:16) at C:\Users\runneradmin\setup-pnpm\node_modules\.pnpm\[email protected]\node_modules\pnpm\dist\pnpm.cjs:26952:24 Emitted 'error' event on Socket instance at: at emitErrorNT (node:internal/streams/destroy:151:8) at emitErrorCloseNT (node:internal/streams/destroy:116:3) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { errno: -4047, syscall: 'write', code: 'EPIPE' } Node.js v20.8.0

Check failure on line 1 in e2e/create-waku.spec.ts

View workflow job for this annotation

GitHub Actions / E2E on windows-latest (Node 20.8.0) - (3/4)

Child Process Error

stderr: Could not execute pnpm install. Please run

Check failure on line 1 in e2e/create-waku.spec.ts

View workflow job for this annotation

GitHub Actions / E2E on windows-latest (Node 18.17.0) - (3/4)

Child Process Error

stderr: node:events:492 throw er; // Unhandled 'error' event ^ Error: EPIPE: broken pipe, write at Socket._write (node:internal/net:61:25) at writeOrBuffer (node:internal/streams/writable:392:12) at _write (node:internal/streams/writable:333:10) at Writable.write (node:internal/streams/writable:337:10) at console.value (node:internal/console/constructor:305:16) at console.log (node:internal/console/constructor:380:26) at ConsumerObserver2.next (C:\Users\runneradmin\setup-pnpm\node_modules\.pnpm\[email protected]\node_modules\pnpm\dist\pnpm.cjs:23275:29) at Subscriber2._next (C:\Users\runneradmin\setup-pnpm\node_modules\.pnpm\[email protected]\node_modules\pnpm\dist\pnpm.cjs:23244:26) at Subscriber2.next (C:\Users\runneradmin\setup-pnpm\node_modules\.pnpm\[email protected]\node_modules\pnpm\dist\pnpm.cjs:23217:16) at C:\Users\runneradmin\setup-pnpm\node_modules\.pnpm\[email protected]\node_modules\pnpm\dist\pnpm.cjs:26952:24 Emitted 'error' event on Socket instance at: at emitErrorNT (node:internal/streams/destroy:151:8) at emitErrorCloseNT (node:internal/streams/destroy:116:3) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { errno: -4047, syscall: 'write', code: 'EPIPE' } Node.js v18.17.0

Check failure on line 1 in e2e/create-waku.spec.ts

View workflow job for this annotation

GitHub Actions / E2E on windows-latest (Node 18.17.0) - (3/4)

Child Process Error

stderr: Could not execute pnpm install. Please run

Check failure on line 1 in e2e/create-waku.spec.ts

View workflow job for this annotation

GitHub Actions / E2E on ubuntu-latest (Node 18.17.0) - (3/4)

Child Process Error

stderr: node:internal/bootstrap/switches/does_own_process_state:126 cachedCwd = rawMethods.cwd(); ^ Error: ENOENT: no such file or directory, uv_cwd at process.wrappedCwd (node:internal/bootstrap/switches/does_own_process_state:126:28) at process.cwd (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:45:23) at process.cwd (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:7749:23) at ../node_modules/.pnpm/[email protected]/node_modules/get-source/impl/path.js (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:38842:58) at __require (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:12:50) at ../node_modules/.pnpm/[email protected]/node_modules/get-source/get-source.js (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:38933:17) at __require (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:12:50) at ../node_modules/.pnpm/[email protected]/node_modules/stacktracey/stacktracey.js (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:39240:21) at __require (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:12:50) at ../cli/default-reporter/lib/reportError.js (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:39481:42) { errno: -2, code: 'ENOENT', syscall: 'uv_cwd' } Node.js v18.17.0

Check failure on line 1 in e2e/create-waku.spec.ts

View workflow job for this annotation

GitHub Actions / E2E on ubuntu-latest (Node 18.17.0) - (3/4)

Child Process Error

stderr: Could not execute pnpm install. Please run

Check failure on line 1 in e2e/create-waku.spec.ts

View workflow job for this annotation

GitHub Actions / E2E on windows-latest (Node 18.17.0) - (2/4)

Child Process Error

stderr: node:events:492 throw er; // Unhandled 'error' event ^ Error: EPIPE: broken pipe, write at Socket._write (node:internal/net:61:25) at writeOrBuffer (node:internal/streams/writable:392:12) at _write (node:internal/streams/writable:333:10) at Writable.write (node:internal/streams/writable:337:10) at console.value (node:internal/console/constructor:305:16) at console.log (node:internal/console/constructor:380:26) at ConsumerObserver2.next (C:\Users\runneradmin\setup-pnpm\node_modules\.pnpm\[email protected]\node_modules\pnpm\dist\pnpm.cjs:23275:29) at Subscriber2._next (C:\Users\runneradmin\setup-pnpm\node_modules\.pnpm\[email protected]\node_modules\pnpm\dist\pnpm.cjs:23244:26) at Subscriber2.next (C:\Users\runneradmin\setup-pnpm\node_modules\.pnpm\[email protected]\node_modules\pnpm\dist\pnpm.cjs:23217:16) at C:\Users\runneradmin\setup-pnpm\node_modules\.pnpm\[email protected]\node_modules\pnpm\dist\pnpm.cjs:26952:24 Emitted 'error' event on Socket instance at: at emitErrorNT (node:internal/streams/destroy:151:8) at emitErrorCloseNT (node:internal/streams/destroy:116:3) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { errno: -4047, syscall: 'write', code: 'EPIPE' } Node.js v18.17.0

Check failure on line 1 in e2e/create-waku.spec.ts

View workflow job for this annotation

GitHub Actions / E2E on windows-latest (Node 18.17.0) - (2/4)

Child Process Error

stderr: Could not execute pnpm install. Please run

Check failure on line 1 in e2e/create-waku.spec.ts

View workflow job for this annotation

GitHub Actions / E2E on windows-latest (Node 20.8.0) - (2/4)

Child Process Error

stderr: node:events:492 throw er; // Unhandled 'error' event ^ Error: EPIPE: broken pipe, write at Socket._write (node:internal/net:61:25) at writeOrBuffer (node:internal/streams/writable:447:12) at _write (node:internal/streams/writable:389:10) at Writable.write (node:internal/streams/writable:393:10) at console.value (node:internal/console/constructor:304:16) at console.log (node:internal/console/constructor:379:26) at ConsumerObserver2.next (C:\Users\runneradmin\setup-pnpm\node_modules\.pnpm\[email protected]\node_modules\pnpm\dist\pnpm.cjs:23275:29) at Subscriber2._next (C:\Users\runneradmin\setup-pnpm\node_modules\.pnpm\[email protected]\node_modules\pnpm\dist\pnpm.cjs:23244:26) at Subscriber2.next (C:\Users\runneradmin\setup-pnpm\node_modules\.pnpm\[email protected]\node_modules\pnpm\dist\pnpm.cjs:23217:16) at C:\Users\runneradmin\setup-pnpm\node_modules\.pnpm\[email protected]\node_modules\pnpm\dist\pnpm.cjs:26952:24 Emitted 'error' event on Socket instance at: at emitErrorNT (node:internal/streams/destroy:151:8) at emitErrorCloseNT (node:internal/streams/destroy:116:3) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { errno: -4047, syscall: 'write', code: 'EPIPE' } Node.js v20.8.0

Check failure on line 1 in e2e/create-waku.spec.ts

View workflow job for this annotation

GitHub Actions / E2E on windows-latest (Node 20.8.0) - (2/4)

Child Process Error

stderr: Could not execute pnpm install. Please run

Check failure on line 1 in e2e/create-waku.spec.ts

View workflow job for this annotation

GitHub Actions / E2E on macos-latest (Node 20.8.0) - (2/4)

Child Process Error

stderr: Could not execute pnpm install. Please run

Check failure on line 1 in e2e/create-waku.spec.ts

View workflow job for this annotation

GitHub Actions / E2E on ubuntu-latest (Node 18.17.0) - (2/4)

Child Process Error

stderr: node:internal/bootstrap/switches/does_own_process_state:126 cachedCwd = rawMethods.cwd(); ^ Error: ENOENT: no such file or directory, uv_cwd at process.wrappedCwd (node:internal/bootstrap/switches/does_own_process_state:126:28) at process.cwd (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:45:23) at process.cwd (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:7749:23) at ../node_modules/.pnpm/[email protected]/node_modules/get-source/impl/path.js (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:38842:58) at __require (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:12:50) at ../node_modules/.pnpm/[email protected]/node_modules/get-source/get-source.js (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:38933:17) at __require (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:12:50) at ../node_modules/.pnpm/[email protected]/node_modules/stacktracey/stacktracey.js (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:39240:21) at __require (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:12:50) at ../cli/default-reporter/lib/reportError.js (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:39481:42) { errno: -2, code: 'ENOENT', syscall: 'uv_cwd' } Node.js v18.17.0

Check failure on line 1 in e2e/create-waku.spec.ts

View workflow job for this annotation

GitHub Actions / E2E on ubuntu-latest (Node 18.17.0) - (2/4)

Child Process Error

stderr: Could not execute pnpm install. Please run

Check failure on line 1 in e2e/create-waku.spec.ts

View workflow job for this annotation

GitHub Actions / E2E on ubuntu-latest (Node 20.8.0) - (2/4)

Child Process Error

stderr: node:internal/bootstrap/switches/does_own_process_state:138 cachedCwd = rawMethods.cwd(); ^ Error: ENOENT: no such file or directory, uv_cwd at process.wrappedCwd (node:internal/bootstrap/switches/does_own_process_state:138:28) at process.cwd (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:45:23) at process.cwd (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:7749:23) at ../node_modules/.pnpm/[email protected]/node_modules/get-source/impl/path.js (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:38842:58) at __require (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:12:50) at ../node_modules/.pnpm/[email protected]/node_modules/get-source/get-source.js (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:38933:17) at __require (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:12:50) at ../node_modules/.pnpm/[email protected]/node_modules/stacktracey/stacktracey.js (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:39240:21) at __require (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:12:50) at ../cli/default-reporter/lib/reportError.js (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:39481:42) { errno: -2, code: 'ENOENT', syscall: 'uv_cwd' } Node.js v20.8.0

Check failure on line 1 in e2e/create-waku.spec.ts

View workflow job for this annotation

GitHub Actions / E2E on ubuntu-latest (Node 20.8.0) - (2/4)

Child Process Error

stderr: Could not execute pnpm install. Please run

Check failure on line 1 in e2e/create-waku.spec.ts

View workflow job for this annotation

GitHub Actions / E2E on macos-latest (Node 18.17.0) - (2/4)

Child Process Error

stderr: Could not execute pnpm install. Please run

Check failure on line 1 in e2e/create-waku.spec.ts

View workflow job for this annotation

GitHub Actions / E2E on macos-latest (Node 18.17.0) - (1/4)

Child Process Error

stderr: Could not execute pnpm install. Please run

Check failure on line 1 in e2e/create-waku.spec.ts

View workflow job for this annotation

GitHub Actions / E2E on windows-latest (Node 20.8.0) - (1/4)

Child Process Error

stderr: node:events:492 throw er; // Unhandled 'error' event ^ Error: EPIPE: broken pipe, write at Socket._write (node:internal/net:61:25) at writeOrBuffer (node:internal/streams/writable:447:12) at _write (node:internal/streams/writable:389:10) at Writable.write (node:internal/streams/writable:393:10) at console.value (node:internal/console/constructor:304:16) at console.log (node:internal/console/constructor:379:26) at ConsumerObserver2.next (C:\Users\runneradmin\setup-pnpm\node_modules\.pnpm\[email protected]\node_modules\pnpm\dist\pnpm.cjs:23275:29) at Subscriber2._next (C:\Users\runneradmin\setup-pnpm\node_modules\.pnpm\[email protected]\node_modules\pnpm\dist\pnpm.cjs:23244:26) at Subscriber2.next (C:\Users\runneradmin\setup-pnpm\node_modules\.pnpm\[email protected]\node_modules\pnpm\dist\pnpm.cjs:23217:16) at C:\Users\runneradmin\setup-pnpm\node_modules\.pnpm\[email protected]\node_modules\pnpm\dist\pnpm.cjs:26952:24 Emitted 'error' event on Socket instance at: at emitErrorNT (node:internal/streams/destroy:151:8) at emitErrorCloseNT (node:internal/streams/destroy:116:3) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { errno: -4047, syscall: 'write', code: 'EPIPE' } Node.js v20.8.0

Check failure on line 1 in e2e/create-waku.spec.ts

View workflow job for this annotation

GitHub Actions / E2E on macos-latest (Node 20.8.0) - (1/4)

Child Process Error

stderr: Could not execute pnpm install. Please run

Check failure on line 1 in e2e/create-waku.spec.ts

View workflow job for this annotation

GitHub Actions / E2E on windows-latest (Node 20.8.0) - (1/4)

Child Process Error

stderr: Could not execute pnpm install. Please run

Check failure on line 1 in e2e/create-waku.spec.ts

View workflow job for this annotation

GitHub Actions / E2E on ubuntu-latest (Node 18.17.0) - (1/4)

Child Process Error

stderr: node:internal/bootstrap/switches/does_own_process_state:126 cachedCwd = rawMethods.cwd(); ^ Error: ENOENT: no such file or directory, uv_cwd at process.wrappedCwd (node:internal/bootstrap/switches/does_own_process_state:126:28) at process.cwd (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:45:23) at process.cwd (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:7749:23) at ../node_modules/.pnpm/[email protected]/node_modules/get-source/impl/path.js (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:38842:58) at __require (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:12:50) at ../node_modules/.pnpm/[email protected]/node_modules/get-source/get-source.js (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:38933:17) at __require (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:12:50) at ../node_modules/.pnpm/[email protected]/node_modules/stacktracey/stacktracey.js (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:39240:21) at __require (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:12:50) at ../cli/default-reporter/lib/reportError.js (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:39481:42) { errno: -2, code: 'ENOENT', syscall: 'uv_cwd' } Node.js v18.17.0

Check failure on line 1 in e2e/create-waku.spec.ts

View workflow job for this annotation

GitHub Actions / E2E on ubuntu-latest (Node 18.17.0) - (1/4)

Child Process Error

stderr: Could not execute pnpm install. Please run

Check failure on line 1 in e2e/create-waku.spec.ts

View workflow job for this annotation

GitHub Actions / E2E on ubuntu-latest (Node 20.8.0) - (1/4)

Child Process Error

stderr: node:internal/bootstrap/switches/does_own_process_state:138 cachedCwd = rawMethods.cwd(); ^ Error: ENOENT: no such file or directory, uv_cwd at process.wrappedCwd (node:internal/bootstrap/switches/does_own_process_state:138:28) at process.cwd (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:45:23) at process.cwd (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:7749:23) at ../node_modules/.pnpm/[email protected]/node_modules/get-source/impl/path.js (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:38842:58) at __require (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:12:50) at ../node_modules/.pnpm/[email protected]/node_modules/get-source/get-source.js (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:38933:17) at __require (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:12:50) at ../node_modules/.pnpm/[email protected]/node_modules/stacktracey/stacktracey.js (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:39240:21) at __require (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:12:50) at ../cli/default-reporter/lib/reportError.js (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs:39481:42) { errno: -2, code: 'ENOENT', syscall: 'uv_cwd' } Node.js v20.8.0

Check failure on line 1 in e2e/create-waku.spec.ts

View workflow job for this annotation

GitHub Actions / E2E on ubuntu-latest (Node 20.8.0) - (1/4)

Child Process Error

stderr: Could not execute pnpm install. Please run

Check failure on line 1 in e2e/create-waku.spec.ts

View workflow job for this annotation

GitHub Actions / E2E on windows-latest (Node 18.17.0) - (1/4)

Child Process Error

stderr: node:events:492 throw er; // Unhandled 'error' event ^ Error: EPIPE: broken pipe, write at Socket._write (node:internal/net:61:25) at writeOrBuffer (node:internal/streams/writable:392:12) at _write (node:internal/streams/writable:333:10) at Writable.write (node:internal/streams/writable:337:10) at console.value (node:internal/console/constructor:305:16) at console.log (node:internal/console/constructor:380:26) at ConsumerObserver2.next (C:\Users\runneradmin\setup-pnpm\node_modules\.pnpm\[email protected]\node_modules\pnpm\dist\pnpm.cjs:23275:29) at Subscriber2._next (C:\Users\runneradmin\setup-pnpm\node_modules\.pnpm\[email protected]\node_modules\pnpm\dist\pnpm.cjs:23244:26) at Subscriber2.next (C:\Users\runneradmin\setup-pnpm\node_modules\.pnpm\[email protected]\node_modules\pnpm\dist\pnpm.cjs:23217:16) at C:\Users\runneradmin\setup-pnpm\node_modules\.pnpm\[email protected]\node_modules\pnpm\dist\pnpm.cjs:26952:24 Emitted 'error' event on Socket instance at: at emitErrorNT (node:internal/streams/destroy:151:8) at emitErrorCloseNT (node:internal/streams/destroy:116:3) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { errno: -4047, syscall: 'write', code: 'EPIPE' } Node.js v18.17.0

Check failure on line 1 in e2e/create-waku.spec.ts

View workflow job for this annotation

GitHub Actions / E2E on windows-latest (Node 18.17.0) - (1/4)

Child Process Error

stderr: Could not execute pnpm install. Please run
import { fileURLToPath } from 'node:url';
import crypto from 'node:crypto';
import { mkdir, readdir, cp, readFile, writeFile } from 'node:fs/promises';
import { test, debugChildProcess, terminate } from './utils.js';
import { test, debugChildProcess } from './utils.js';
import { expect } from '@playwright/test';

test('should create waku with default setup work', async () => {
Expand Down Expand Up @@ -43,7 +43,7 @@ test('should create waku with default setup work', async () => {
expect(files).toContain('package.json');
expect(files).toContain('src');
expect(files).toContain('tsconfig.json');
await terminate(childProcess.pid!);
exec(`rm -rf ${cwd}`);
});

test('should create waku with update notify work', async () => {
Expand Down Expand Up @@ -87,5 +87,6 @@ test('should create waku with update notify work', async () => {
break;
}
}
exec(`rm -rf ${cwd}`);
// no need to kill the process, it will exit by itself
});
30 changes: 24 additions & 6 deletions packages/create-waku/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
parseExampleOption,
downloadAndExtract,
} from './helpers/example-option.js';
import { spawn } from 'node:child_process';

const userAgent = process.env.npm_config_user_agent || '';
const packageManager = /pnpm/.test(userAgent)
Expand Down Expand Up @@ -202,15 +203,32 @@ async function init() {
await installTemplate(root, packageName, templateRoot, templateName);
}

// TODO automatically installing dependencies
// 1. check packageManager
// 2. and then install dependencies

console.log(`\nDone. Now run:\n`);
console.log(`${bold(green(`cd ${targetDir}`))}`);
console.log(`${bold(green(commands.install))}`);
console.log(`${bold(green(commands.dev))}`);
console.log();
console.log(`Installing dependencies by running ${commands.install}...`);

const installProcess = spawn(packageManager, ['install'], {
stdio: 'inherit',
shell: process.platform === 'win32',
cwd: targetDir,
});

installProcess.on('close', (code) => {
// process exit code
if (code !== 0) {
console.error(`Could not execute ${commands.install}. Please run`);
console.log(`${bold(green(`cd ${targetDir}`))}`);
console.log(`${bold(green(commands.install))}`);
console.log(`${bold(green(commands.dev))}`);
console.log();
} else {
console.log(`\nDone. Now run:\n`);
console.log(`${bold(green(`cd ${targetDir}`))}`);
console.log(`${bold(green(commands.dev))}`);
console.log();
}
});
}

init()
Expand Down

0 comments on commit 901594c

Please sign in to comment.