diff --git a/Makefile b/Makefile index d1c7d62895..8866684374 100644 --- a/Makefile +++ b/Makefile @@ -146,45 +146,45 @@ client/build/index.html: $(shell find client/app -type f) $(SCOPE_UI_BUILD_UPTOD mkdir -p client/build $(SUDO) docker run $(RM) $(RUN_FLAGS) -v $(shell pwd)/client/app:/home/weave/app \ -v $(shell pwd)/client/build:/home/weave/build \ - $(SCOPE_UI_BUILD_IMAGE) npm run build + $(SCOPE_UI_BUILD_IMAGE) yarn run build client/build-external/index.html: $(shell find client/app -type f) $(SCOPE_UI_BUILD_UPTODATE) mkdir -p client/build $(SUDO) docker run $(RM) $(RUN_FLAGS) -v $(shell pwd)/client/app:/home/weave/app \ -v $(shell pwd)/client/build-external:/home/weave/build-external \ - $(SCOPE_UI_BUILD_IMAGE) npm run build-external + $(SCOPE_UI_BUILD_IMAGE) yarn run build-external client-test: $(shell find client/app/scripts -type f) $(SCOPE_UI_BUILD_UPTODATE) $(SUDO) docker run $(RM) $(RUN_FLAGS) -v $(shell pwd)/client/app:/home/weave/app \ -v $(shell pwd)/client/test:/home/weave/test \ - $(SCOPE_UI_BUILD_IMAGE) npm test + $(SCOPE_UI_BUILD_IMAGE) yarn test client-lint: $(SCOPE_UI_BUILD_UPTODATE) $(SUDO) docker run $(RM) $(RUN_FLAGS) -v $(shell pwd)/client/app:/home/weave/app \ -v $(shell pwd)/client/test:/home/weave/test \ - $(SCOPE_UI_BUILD_IMAGE) npm run lint + $(SCOPE_UI_BUILD_IMAGE) yarn run lint client-start: $(SCOPE_UI_BUILD_UPTODATE) $(SUDO) docker run $(RM) $(RUN_FLAGS) --net=host -v $(shell pwd)/client/app:/home/weave/app \ -v $(shell pwd)/client/build:/home/weave/build -e WEBPACK_SERVER_HOST \ - $(SCOPE_UI_BUILD_IMAGE) npm start + $(SCOPE_UI_BUILD_IMAGE) yarn start tmp/weave-scope.tgz: $(shell find client/app -type f) $(SCOPE_UI_BUILD_UPTODATE) $(sudo) docker run $(RUN_FLAGS) \ -v $(shell pwd)/client/app:/home/weave/app \ -v $(shell pwd)/tmp:/home/weave/tmp \ $(SCOPE_UI_BUILD_IMAGE) \ - npm run bundle + yarn run bundle else client/build/index.html: test "true" = "$(SCOPE_SKIP_UI_ASSETS)" && mkdir -p client/build || \ - { cd client && npm run build; } + { cd client && yarn run build; } client/build-external/index.html: test "true" = "$(SCOPE_SKIP_UI_ASSETS)" && mkdir -p client/build-external || \ - { cd client && npm run build-external; } + { cd client && yarn run build-external; } endif diff --git a/client/README.md b/client/README.md index 6e84f1043a..38dc563d1a 100644 --- a/client/README.md +++ b/client/README.md @@ -3,8 +3,9 @@ ## Getting Started (using local node) - You need at least Node.js 6.9.0 and a running `weavescope` container -- Setup: `npm install` -- Develop: `BACKEND_HOST= npm start` and then open `http://localhost:4042/` +- Get Yarn: `npm install -g yarn` +- Setup: `yarn install` +- Develop: `BACKEND_HOST= yarn start` and then open `http://localhost:4042/` This will start a webpack-dev-server that serves the UI and proxies API requests to the container. @@ -17,13 +18,13 @@ This will start a webpack-dev-server that serves the UI from the UI build contai ## Test Production Bundles Locally -- Build: `npm run build`, output will be in `build/` -- Serve files from `build/`: `BACKEND_HOST= npm run start-production` and then open `http://localhost:4042/` +- Build: `yarn run build`, output will be in `build/` +- Serve files from `build/`: `BACKEND_HOST= yarn run start-production` and then open `http://localhost:4042/` ## Coding This directory has a `.eslintrc`, make sure your editor supports linter hints. -To run a linter, you also run `npm run lint`. +To run a linter, you also run `yarn run lint`. ## Logging @@ -45,5 +46,5 @@ debug('Store log message'); Got a blank screen when loading `http://localhost:4042`? Make sure you are accessing the right machine: -If you're running `npm start` on a virtual machine with IP 10.0.0.8, you need to point your browser to `http://10.0.0.8:4042`. +If you're running `yarn start` on a virtual machine with IP 10.0.0.8, you need to point your browser to `http://10.0.0.8:4042`. Also, you may need to manually configure the virtual machine to expose ports 4041 (webpack-dev-server) and 4042 (express proxy). diff --git a/client/package.json b/client/package.json index 0d839e1d8e..ffacad601b 100644 --- a/client/package.json +++ b/client/package.json @@ -100,8 +100,8 @@ "build": "webpack --config webpack.production.config.js", "build-external": "EXTERNAL=true webpack --config webpack.production.config.js", "copy-pkg-files": "cp package.json build-pkg/ && cp -R app/styles build-pkg/", - "build-pkg": "mkdir -p build-pkg && node node_modules/.bin/babel app/scripts --ignore __tests__ --out-dir build-pkg && npm run copy-pkg-files", - "bundle": "npm run build-pkg && npm pack ./build-pkg && mv weave-scope-$npm_package_version.tgz ./tmp/weave-scope.tgz", + "build-pkg": "mkdir -p build-pkg && node node_modules/.bin/babel app/scripts --ignore __tests__ --out-dir build-pkg && yarn run copy-pkg-files", + "bundle": "yarn run build-pkg && yarn pack ./build-pkg && mv weave-scope-$npm_package_version.tgz ./tmp/weave-scope.tgz", "start": "node server.js", "start-production": "NODE_ENV=production node server.js", "test": "jest", @@ -109,7 +109,7 @@ "lint": "eslint app server.js", "clean": "rm build/app.js", "noprobe": "../scope stop && ../scope launch --no-probe --app.window 8760h", - "loadreport": "npm run noprobe && sleep 1 && curl -X POST -H \"Content-Type: application/json\" http://$BACKEND_HOST/api/report -d" + "loadreport": "yarn run noprobe && sleep 1 && curl -X POST -H \"Content-Type: application/json\" http://$BACKEND_HOST/api/report -d" }, "jest": { "transform": {