geowarin / boot-react

A starter application with spring boot and react
MIT License
591 stars 155 forks source link

Provide a way to run the frontend without npm installed on windows #10

Closed geowarin closed 7 years ago

geowarin commented 8 years ago

The gradle node plugin will automatically install the correct version of npm to build the project. However, we still require users to install their own version of node/npm to run the frontend in dev mode.

I will keep an eye of the node wrapper discussed here, looks promising.

geowarin commented 8 years ago

I added a wrapper script for npm (UNIX only). Tell me if it helps.

I'm looking for a volunteer for a windows version :smile:

kucharzyk commented 7 years ago

My wrapper scripts looks like that:

nodew.cmd (windows)

@echo off
setlocal
set NODE_EXE=""
for /r %%x in (*node.exe) do set NODE_EXE=%%x
set NODE_HOME=%NODE_EXE:node.exe=%
set PATH=%NODE_HOME%;%PATH%
if not exist %NODE_EXE% (
  echo Node not found! Run gradle build first!
) else (
  %NODE_EXE% %*
)
@echo on

yarn.cmd (windows)

@echo off
setlocal
set YARN_SCRIPT=%~dp0build\yarn\node_modules\yarn\bin\yarn.js
if not exist %YARN_SCRIPT% (
  echo Node not found! Run gradle build first!
) else (
  nodew.cmd %YARN_SCRIPT% %*
)
@echo on

nodew (linux)

@echo off
setlocal
set YARN_SCRIPT=%~dp0build\yarn\node_modules\yarn\bin\yarn.js
if not exist %YARN_SCRIPT% (
  echo Node not found! Run gradle build first!
) else (
  nodew.cmd %YARN_SCRIPT% %*
)
@echo on

yarnw (linux)

#!/usr/bin/env bash

YARN_SCRIPT="./build/yarn/node_modules/yarn/bin/yarn.js"

if [ ! -f $YARN_SCRIPT ]; then
    echo "Yarn not found! Run gradle build first!"
else
    ./nodew $YARN_SCRIPT "$@"
fi
geowarin commented 7 years ago

Fixed by automatically running yarn in development