mirror of
				https://github.com/wled/WLED.git
				synced 2025-11-02 23:58:53 +00:00 
			
		
		
		
	Merge pull request #4556 from spiro-c/npm-check
Fix for: Build should stop if npm fails #4513
This commit is contained in:
		@@ -1,3 +1,21 @@
 | 
			
		||||
Import('env')
 | 
			
		||||
Import("env")
 | 
			
		||||
import shutil
 | 
			
		||||
 | 
			
		||||
env.Execute("npm run build")
 | 
			
		||||
node_ex = shutil.which("node")
 | 
			
		||||
# Check if Node.js is installed and present in PATH if it failed, abort the build
 | 
			
		||||
if node_ex is None:
 | 
			
		||||
    print('\x1b[0;31;43m' + 'Node.js is not installed or missing from PATH html css js will not be processed check https://kno.wled.ge/advanced/compiling-wled/' + '\x1b[0m')
 | 
			
		||||
    exitCode = env.Execute("null")
 | 
			
		||||
    exit(exitCode)
 | 
			
		||||
else:
 | 
			
		||||
    # Install the necessary node packages for the pre-build asset bundling script
 | 
			
		||||
    print('\x1b[6;33;42m' + 'Installing node packages' + '\x1b[0m')
 | 
			
		||||
    env.Execute("npm install")
 | 
			
		||||
 | 
			
		||||
    # Call the bundling script
 | 
			
		||||
    exitCode = env.Execute("npm run build")
 | 
			
		||||
 | 
			
		||||
    # If it failed, abort the build
 | 
			
		||||
    if (exitCode):
 | 
			
		||||
      print('\x1b[0;31;43m' + 'npm run build fails check https://kno.wled.ge/advanced/compiling-wled/' + '\x1b[0m')
 | 
			
		||||
      exit(exitCode)
 | 
			
		||||
		Reference in New Issue
	
	Block a user