Skip to content

Commit

Permalink
Merge pull request #2676 from weaveworks/2606-update-readme-to-use-yarn
Browse files Browse the repository at this point in the history
Update README/Makefile/package.json to use yarn
  • Loading branch information
rndstr authored Jul 6, 2017
2 parents 13fa738 + 718e817 commit 0dbea45
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
13 changes: 7 additions & 6 deletions client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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=<dockerhost-ip> npm start` and then open `http://localhost:4042/`
- Get Yarn: `npm install -g yarn`
- Setup: `yarn install`
- Develop: `BACKEND_HOST=<dockerhost-ip> 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.

Expand All @@ -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=<dockerhost-ip> 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=<dockerhost-ip> 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

Expand All @@ -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).
6 changes: 3 additions & 3 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,16 @@
"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",
"coveralls": "cat coverage/lcov.info | coveralls",
"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": {
Expand Down

0 comments on commit 0dbea45

Please sign in to comment.