File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
resources/views/docs/desktop/2/digging-deeper Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -147,6 +147,24 @@ NativePHP provides a similar method convenience for Artisan commands:
147147ChildProcess::artisan('smtp:serve', alias: 'smtp-server');
148148```
149149
150+ ### Node scripts
151+
152+ NativePHP provides a convenient method to execute JavaScript files using the bundled Node.js runtime:
153+
154+ ``` php
155+ ChildProcess::node(
156+ cmd: 'resources/js/websocket-server.js',
157+ alias: 'websocket-server'
158+ );
159+ ```
160+
161+ This method automatically uses the Node.js runtime that ships with your NativePHP application, ensuring consistency across different environments.
162+
163+ ** Key benefits:**
164+ - No need to compile JavaScript files beforehand
165+ - Dependencies can be used directly without bundling for browser compatibility
166+ - Leverages the same Node.js version across all platforms
167+
150168## Getting running processes
151169
152170### Getting a single process
You can’t perform that action at this time.
0 commit comments